[Esbox-commits] r767 - in trunk: . common common/com.nokia.cpp.utils.core common/com.nokia.cpp.utils.core/.settings common/com.nokia.cpp.utils.core/META-INF common/com.nokia.cpp.utils.core/src common/com.nokia.cpp.utils.core/src/com common/com.nokia.cpp.utils.core/src/com/nokia common/com.nokia.cpp.utils.core/src/com/nokia/cpp common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport common/com.nokia.cpp.utils.ui common/com.nokia.cpp.utils.ui/.settings common/com.nokia.cpp.utils.ui/META-INF common/com.nokia.cpp.utils.ui/src common/com.nokia.cpp.utils.ui/src/com common/com.nokia.cpp.utils.ui/src/com/nokia common/com.nokia.cpp.utils.ui/src/com/nokia/cpp common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport common/org.indt.esbox.core.compatibility common/org.indt.esbox.core.compatibility/.settings common/org.indt.esbox.core.compatibility/META-INF common/org.indt.esbox.core.compatibility/src common/org.indt.esbox.core.compatibility/src/org common/org.indt.esbox.core.compatibility/src/org/indt common/org.indt.esbox.core.compatibility/src/org/indt/esbox common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility/core common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/core common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/core/compatibility common/org.maemo.esbox.analysis common/org.maemo.esbox.analysis/.settings common/org.maemo.esbox.analysis/META-INF common/org.maemo.esbox.analysis/src common/org.maemo.esbox.analysis/src/org common/org.maemo.esbox.analysis/src/org/maemo common/org.maemo.esbox.analysis/src/org/maemo/esbox common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis/adapters common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/core common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/valgrind common/org.maemo.esbox.analysis.launch common/org.maemo.esbox.analysis.launch/.settings common/org.maemo.esbox.analysis.launch/META-INF common/org.maemo.esbox.analysis.launch/src common/org.maemo.esbox.analysis.launch/src/org common/org.maemo.esbox.analysis.launch/src/org/maemo common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis/launch common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/internal common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/internal/analysis common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/internal/analysis/launch common/org.maemo.esbox.analysis.ui common/org.maemo.esbox.analysis.ui/.settings common/org.maemo.esbox.analysis.ui/META-INF common/org.maemo.esbox.analysis.ui/icons common/org.maemo.esbox.analysis.ui/icons/full common/org.maemo.esbox.analysis.ui/icons/full/view16 common/org.maemo.esbox.analysis.ui/src common/org.maemo.esbox.analysis.ui/src/org common/org.maemo.esbox.analysis.ui/src/org/maemo common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/analysis common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/analysis/ui common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/ui common/org.maemo.esbox.core common/org.maemo.esbox.core/.settings common/org.maemo.esbox.core/META-INF common/org.maemo.esbox.core/about_files common/org.maemo.esbox.core/conf common/org.maemo.esbox.core/schema common/org.maemo.esbox.core/src common/org.maemo.esbox.core/src/org common/org.maemo.esbox.core/src/org/eclipse common/org.maemo.esbox.core/src/org/eclipse/cdt common/org.maemo.esbox.core/src/org/eclipse/cdt/core common/org.maemo.esbox.core/src/org/maemo common/org.maemo.esbox.core/src/org/maemo/esbox common/org.maemo.esbox.core/src/org/maemo/esbox/core common/org.maemo.esbox.core/src/org/maemo/esbox/core/adapters common/org.maemo.esbox.core/src/org/maemo/esbox/core/cpp common/org.maemo.esbox.core/src/org/maemo/esbox/core/env common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine common/org.maemo.esbox.core/src/org/maemo/esbox/core/model common/org.maemo.esbox.core/src/org/maemo/esbox/core/process common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml common/org.maemo.esbox.core/src/org/maemo/esbox/internal common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/cpp common/org.maemo.esbox.core-feature common/org.maemo.esbox.core-feature/licenses common/org.maemo.esbox.core.tests common/org.maemo.esbox.core.tests/.settings common/org.maemo.esbox.core.tests/META-INF common/org.maemo.esbox.core.tests/data common/org.maemo.esbox.core.tests/data/projects common/org.maemo.esbox.core.tests/data/projects/standalone-project common/org.maemo.esbox.core.tests/src common/org.maemo.esbox.core.tests/src/org common/org.maemo.esbox.core.tests/src/org/maemo common/org.maemo.esbox.core.tests/src/org/maemo/esbox common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/project common/org.maemo.esbox.core.tests/src/org/maemo/esbox/internal common/org.maemo.esbox.core.tests/src/org/maemo/esbox/internal/core common/org.maemo.esbox.core.tests/src/org/maemo/esbox/internal/core/tests common/org.maemo.esbox.help common/org.maemo.esbox.help/META-INF common/org.maemo.esbox.help/about_files common/org.maemo.esbox.help/html common/org.maemo.esbox.help/html/concepts common/org.maemo.esbox.help/html/gettingstarted common/org.maemo.esbox.help/html/images common/org.maemo.esbox.help/html/images/pref_images common/org.maemo.esbox.help/html/reference common/org.maemo.esbox.help/html/tasks common/org.maemo.esbox.launch common/org.maemo.esbox.launch/.settings common/org.maemo.esbox.launch/META-INF common/org.maemo.esbox.launch/about_files common/org.maemo.esbox.launch/icons common/org.maemo.esbox.launch/icons/full common/org.maemo.esbox.launch/icons/full/obj16 common/org.maemo.esbox.launch/schema common/org.maemo.esbox.launch/src common/org.maemo.esbox.launch/src/org common/org.maemo.esbox.launch/src/org/maemo common/org.maemo.esbox.launch/src/org/maemo/esbox common/org.maemo.esbox.launch/src/org/maemo/esbox/internal common/org.maemo.esbox.launch/src/org/maemo/esbox/internal/launch common/org.maemo.esbox.launch/src/org/maemo/esbox/launch common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/adapters common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui common/org.maemo.esbox.project.core common/org.maemo.esbox.project.core/.settings common/org.maemo.esbox.project.core/META-INF common/org.maemo.esbox.project.core/schema common/org.maemo.esbox.project.core/src common/org.maemo.esbox.project.core/src/org common/org.maemo.esbox.project.core/src/org/maemo common/org.maemo.esbox.project.core/src/org/maemo/esbox common/org.maemo.esbox.project.core/src/org/maemo/esbox/internal common/org.maemo.esbox.project.core/src/org/maemo/esbox/internal/project common/org.maemo.esbox.project.core/src/org/maemo/esbox/internal/project/core common/org.maemo.esbox.project.core/src/org/maemo/esbox/project common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core common/org.maemo.esbox.project.ui common/org.maemo.esbox.project.ui/.settings common/org.maemo.esbox.project.ui/META-INF common/org.maemo.esbox.project.ui/icons common/org.maemo.esbox.project.ui/icons/full common/org.maemo.esbox.project.ui/icons/full/obj16 common/org.maemo.esbox.project.ui/src common/org.maemo.esbox.project.ui/src/org common/org.maemo.esbox.project.ui/src/org/maemo common/org.maemo.esbox.project.ui/src/org/maemo/esbox common/org.maemo.esbox.project.ui/src/org/maemo/esbox/internal common/org.maemo.esbox.project.ui/src/org/maemo/esbox/internal/project common/org.maemo.esbox.project.ui/src/org/maemo/esbox/internal/project/ui common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/properties common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards common/org.maemo.esbox.ssh common/org.maemo.esbox.ssh/.settings common/org.maemo.esbox.ssh/META-INF common/org.maemo.esbox.ssh/conf common/org.maemo.esbox.ssh/src common/org.maemo.esbox.ssh/src/org common/org.maemo.esbox.ssh/src/org/maemo common/org.maemo.esbox.ssh/src/org/maemo/esbox common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ui common/org.maemo.esbox.ui common/org.maemo.esbox.ui/.settings common/org.maemo.esbox.ui/META-INF common/org.maemo.esbox.ui/icons common/org.maemo.esbox.ui/icons/full common/org.maemo.esbox.ui/icons/full/etool16 common/org.maemo.esbox.ui/icons/full/obj16 common/org.maemo.esbox.ui/src common/org.maemo.esbox.ui/src/org common/org.maemo.esbox.ui/src/org/maemo common/org.maemo.esbox.ui/src/org/maemo/esbox common/org.maemo.esbox.ui/src/org/maemo/esbox/internal common/org.maemo.esbox.ui/src/org/maemo/esbox/internal/ui common/org.maemo.esbox.ui/src/org/maemo/esbox/ui common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/actions common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences cpp cpp/org.maemo.esbox.cpp-feature cpp/org.maemo.esbox.cpp-feature/licenses cpp/org.maemo.esbox.cpp.launch cpp/org.maemo.esbox.cpp.launch/.settings cpp/org.maemo.esbox.cpp.launch/META-INF cpp/org.maemo.esbox.cpp.launch/src cpp/org.maemo.esbox.cpp.launch/src/org cpp/org.maemo.esbox.cpp.launch/src/org/maemo cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/internal cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/internal/cpp cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/internal/cpp/launch cpp/org.maemo.esbox.cpp.launch.analysis cpp/org.maemo.esbox.cpp.launch.analysis/.settings cpp/org.maemo.esbox.cpp.launch.analysis/META-INF cpp/org.maemo.esbox.cpp.launch.analysis/icons cpp/org.maemo.esbox.cpp.launch.analysis/icons/full cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16 cpp/org.maemo.esbox.cpp.launch.analysis/src cpp/org.maemo.esbox.cpp.launch.analysis/src/org cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/ui cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ui cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal/cpp cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal/cpp/launch cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal/cpp/launch/analysis cpp/org.maemo.esbox.cpp.launch.cdi.gdb cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.settings cpp/org.maemo.esbox.cpp.launch.cdi.gdb/META-INF cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons/full cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons/full/obj16 cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp/launch cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp/launch/cdi cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp/launch/cdi/gdb cpp/org.maemo.esbox.cpp.launch.dsf.gdb cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.settings cpp/org.maemo.esbox.cpp.launch.dsf.gdb/META-INF cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons/full cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons/full/obj16 cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/ui cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp/launch cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp/launch/dsf cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp/launch/dsf/gdb cpp/org.maemo.esbox.cpp.project.core cpp/org.maemo.esbox.cpp.project.core/.settings cpp/org.maemo.esbox.cpp.project.core/META-INF cpp/org.maemo.esbox.cpp.project.core/src cpp/org.maemo.esbox.cpp.project.core/src/org cpp/org.maemo.esbox.cpp.project.core/src/org/maemo cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal/cpp cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal/cpp/project cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal/cpp/project/core cpp/org.maemo.esbox.cpp.project.ui cpp/org.maemo.esbox.cpp.project.ui/.settings cpp/org.maemo.esbox.cpp.project.ui/META-INF cpp/org.maemo.esbox.cpp.project.ui/copied cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/classfmt cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core/util cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls cpp/org.maemo.esbox.cpp.project.ui/icons cpp/org.maemo.esbox.cpp.project.ui/icons/full cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16 cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16 cpp/org.maemo.esbox.cpp.project.ui/icons/full/view16 cpp/org.maemo.esbox.cpp.project.ui/icons/full/wizban cpp/org.maemo.esbox.cpp.project.ui/src cpp/org.maemo.esbox.cpp.project.ui/src/org cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/dialogs cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/properties cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal/cpp cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal/cpp/project cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal/cpp/project/ui cpp/org.maemo.esbox.cpp.tests cpp/org.maemo.esbox.cpp.tests/.settings cpp/org.maemo.esbox.cpp.tests/META-INF cpp/org.maemo.esbox.cpp.tests/data cpp/org.maemo.esbox.cpp.tests/data/convert cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/src cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/src cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/src cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/src cpp/org.maemo.esbox.cpp.tests/data/projects cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/src cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/src cpp/org.maemo.esbox.cpp.tests/src cpp/org.maemo.esbox.cpp.tests/src/org cpp/org.maemo.esbox.cpp.tests/src/org/maemo cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/internal cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/internal/cpp cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/internal/cpp/tests cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/ui device device/org.maemo.esbox.device-feature device/org.maemo.esbox.device-feature/licenses device/org.maemo.esbox.device.core device/org.maemo.esbox.device.core/.settings device/org.maemo.esbox.device.core/META-INF device/org.maemo.esbox.device.core/src device/org.maemo.esbox.device.core/src/org device/org.maemo.esbox.device.core/src/org/maemo device/org.maemo.esbox.device.core/src/org/maemo/esbox device/org.maemo.esbox.device.core/src/org/maemo/esbox/device device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/adapters device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh device/org.maemo.esbox.device.launch device/org.maemo.esbox.device.launch/.settings device/org.maemo.esbox.device.launch/META-INF device/org.maemo.esbox.device.launch/src device/org.maemo.esbox.device.launch/src/org device/org.maemo.esbox.device.launch/src/org/maemo device/org.maemo.esbox.device.launch/src/org/maemo/esbox device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui device/org.maemo.esbox.device.launch/src/org/maemo/esbox/internal device/org.maemo.esbox.device.launch/src/org/maemo/esbox/internal/device device/org.maemo.esbox.device.launch/src/org/maemo/esbox/internal/device/launch device/org.maemo.esbox.device.tests device/org.maemo.esbox.device.tests/.settings device/org.maemo.esbox.device.tests/META-INF device/org.maemo.esbox.device.tests/src device/org.maemo.esbox.device.tests/src/org device/org.maemo.esbox.device.tests/src/org/maemo device/org.maemo.esbox.device.tests/src/org/maemo/esbox device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh device/org.maemo.esbox.device.tests/src/org/maemo/esbox/internal device/org.maemo.esbox.device.tests/src/org/maemo/esbox/internal/device device/org.maemo.esbox.device.tests/src/org/maemo/esbox/internal/device/tests device/org.maemo.esbox.device.ui device/org.maemo.esbox.device.ui/.settings device/org.maemo.esbox.device.ui/META-INF device/org.maemo.esbox.device.ui/src device/org.maemo.esbox.device.ui/src/org device/org.maemo.esbox.device.ui/src/org/maemo device/org.maemo.esbox.device.ui/src/org/maemo/esbox device/org.maemo.esbox.device.ui/src/org/maemo/esbox/internal device/org.maemo.esbox.device.ui/src/org/maemo/esbox/internal/device device/org.maemo.esbox.device.ui/src/org/maemo/esbox/internal/device/ui linux linux/org.maemo.esbox.linux-feature linux/org.maemo.esbox.linux-feature/licenses linux/org.maemo.esbox.linux.autotools.core linux/org.maemo.esbox.linux.autotools.core/.settings linux/org.maemo.esbox.linux.autotools.core/META-INF linux/org.maemo.esbox.linux.autotools.core/src linux/org.maemo.esbox.linux.autotools.core/src/org linux/org.maemo.esbox.linux.autotools.core/src/org/maemo linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model linux/org.maemo.esbox.linux.autotools.ui linux/org.maemo.esbox.linux.autotools.ui/.settings linux/org.maemo.esbox.linux.autotools.ui/META-INF linux/org.maemo.esbox.linux.autotools.ui/src linux/org.maemo.esbox.linux.autotools.ui/src/org linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal/linux linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal/linux/autotools linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal/linux/autotools/ui linux/org.maemo.esbox.linux.packages.core linux/org.maemo.esbox.linux.packages.core/.settings linux/org.maemo.esbox.linux.packages.core/META-INF linux/org.maemo.esbox.linux.packages.core/schema linux/org.maemo.esbox.linux.packages.core/src linux/org.maemo.esbox.linux.packages.core/src/org linux/org.maemo.esbox.linux.packages.core/src/org/maemo linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/aptpkgconfig linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/debian linux/org.maemo.esbox.linux.packages.core/utils linux/org.maemo.esbox.linux.packages.ui linux/org.maemo.esbox.linux.packages.ui/.settings linux/org.maemo.esbox.linux.packages.ui/META-INF linux/org.maemo.esbox.linux.packages.ui/src linux/org.maemo.esbox.linux.packages.ui/src/org linux/org.maemo.esbox.linux.packages.ui/src/org/maemo linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal/linux linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal/linux/packages linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal/linux/packages/ui linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions linux/org.maemo.esbox.linux.tests linux/org.maemo.esbox.linux.tests/.settings linux/org.maemo.esbox.linux.tests/META-INF linux/org.maemo.esbox.linux.tests/data linux/org.maemo.esbox.linux.tests/data/autotools linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/data linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui linux/org.maemo.esbox.linux.tests/src linux/org.maemo.esbox.linux.tests/src/org linux/org.maemo.esbox.linux.tests/src/org/maemo linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal/linux linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal/linux/tests linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal/linux/tests/noexport linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests maemosdk maemosdk/org.maemo.esbox.maemosdk-feature maemosdk/org.maemo.esbox.maemosdk-feature/licenses maemosdk/org.maemo.esbox.maemosdk.analysis maemosdk/org.maemo.esbox.maemosdk.analysis/.settings maemosdk/org.maemo.esbox.maemosdk.analysis/META-INF maemosdk/org.maemo.esbox.maemosdk.analysis/src maemosdk/org.maemo.esbox.maemosdk.analysis/src/org maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters maemosdk/org.maemo.esbox.maemosdk.core maemosdk/org.maemo.esbox.maemosdk.core/.settings maemosdk/org.maemo.esbox.maemosdk.core/META-INF maemosdk/org.maemo.esbox.maemosdk.core/conf maemosdk/org.maemo.esbox.maemosdk.core/schema maemosdk/org.maemo.esbox.maemosdk.core/src maemosdk/org.maemo.esbox.maemosdk.core/src/org maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/platform maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/providers maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk maemosdk/org.maemo.esbox.maemosdk.cpp.templates maemosdk/org.maemo.esbox.maemosdk.cpp.templates/META-INF maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/26x26 maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/40x40 maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/scalable maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3 maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/help maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/help/en_GB maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/26x26 maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/40x40 maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/scalable maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src maemosdk/org.maemo.esbox.maemosdk.python.templates maemosdk/org.maemo.esbox.maemosdk.python.templates/META-INF maemosdk/org.maemo.esbox.maemosdk.python.templates/templates maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/EmptyProject maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/src maemosdk/org.maemo.esbox.maemosdk.tests maemosdk/org.maemo.esbox.maemosdk.tests/.settings maemosdk/org.maemo.esbox.maemosdk.tests/META-INF maemosdk/org.maemo.esbox.maemosdk.tests/src maemosdk/org.maemo.esbox.maemosdk.tests/src/org maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/maemosdk maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/maemosdk/tests maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands maemosdk/org.maemo.esbox.maemosdk.ui maemosdk/org.maemo.esbox.maemosdk.ui/.settings maemosdk/org.maemo.esbox.maemosdk.ui/META-INF maemosdk/org.maemo.esbox.maemosdk.ui/icons maemosdk/org.maemo.esbox.maemosdk.ui/icons/full maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16 maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/obj16 maemosdk/org.maemo.esbox.maemosdk.ui/src maemosdk/org.maemo.esbox.maemosdk.ui/src/org maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/sbrsh python python/org.maemo.esbox.python-feature python/org.maemo.esbox.python-feature/licenses python/org.maemo.esbox.python.launch python/org.maemo.esbox.python.launch/.settings python/org.maemo.esbox.python.launch/META-INF python/org.maemo.esbox.python.launch/about_files python/org.maemo.esbox.python.launch/icons python/org.maemo.esbox.python.launch/icons/full python/org.maemo.esbox.python.launch/icons/full/obj16 python/org.maemo.esbox.python.launch/src python/org.maemo.esbox.python.launch/src/org python/org.maemo.esbox.python.launch/src/org/maemo python/org.maemo.esbox.python.launch/src/org/maemo/esbox python/org.maemo.esbox.python.launch/src/org/maemo/esbox/internal python/org.maemo.esbox.python.launch/src/org/maemo/esbox/internal/python python/org.maemo.esbox.python.launch/src/org/maemo/esbox/internal/python/launch python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ui python/org.maemo.esbox.python.launch.analysis python/org.maemo.esbox.python.launch.analysis/.settings python/org.maemo.esbox.python.launch.analysis/META-INF python/org.maemo.esbox.python.launch.analysis/icons python/org.maemo.esbox.python.launch.analysis/icons/full python/org.maemo.esbox.python.launch.analysis/icons/full/obj16 python/org.maemo.esbox.python.launch.analysis/src python/org.maemo.esbox.python.launch.analysis/src/org python/org.maemo.esbox.python.launch.analysis/src/org/maemo python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal/python python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal/python/launch python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal/python/launch/analysis python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/ui python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind python/org.maemo.esbox.python.project.core python/org.maemo.esbox.python.project.core/.settings python/org.maemo.esbox.python.project.core/META-INF python/org.maemo.esbox.python.project.core/src python/org.maemo.esbox.python.project.core/src/org python/org.maemo.esbox.python.project.core/src/org/maemo python/org.maemo.esbox.python.project.core/src/org/maemo/esbox python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal/python python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal/python/project python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal/python/project/core python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core python/org.maemo.esbox.python.project.ui python/org.maemo.esbox.python.project.ui/.settings python/org.maemo.esbox.python.project.ui/META-INF python/org.maemo.esbox.python.project.ui/icons python/org.maemo.esbox.python.project.ui/icons/full python/org.maemo.esbox.python.project.ui/icons/full/obj16 python/org.maemo.esbox.python.project.ui/icons/full/wizban python/org.maemo.esbox.python.project.ui/src python/org.maemo.esbox.python.project.ui/src/org python/org.maemo.esbox.python.project.ui/src/org/maemo python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project/ui python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python/project python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python/project/ui python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python/project/ui/wizards python/org.maemo.esbox.python.tests python/org.maemo.esbox.python.tests/.settings python/org.maemo.esbox.python.tests/META-INF python/org.maemo.esbox.python.tests/data python/org.maemo.esbox.python.tests/data/convert python/org.maemo.esbox.python.tests/data/convert/esboxproj python/org.maemo.esbox.python.tests/data/convert/esboxproj/src python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/src python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/src python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/src python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4 python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/src python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5 python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/src python/org.maemo.esbox.python.tests/src python/org.maemo.esbox.python.tests/src/org python/org.maemo.esbox.python.tests/src/org/maemo python/org.maemo.esbox.python.tests/src/org/maemo/esbox python/org.maemo.esbox.python.tests/src/org/maemo/esbox/internal python/org.maemo.esbox.python.tests/src/org/maemo/esbox/internal/python python/org.maemo.esbox.python.tests/src/org/maemo/esbox/internal/python/tests python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests tmp_test
eswartz at garage.maemo.org
eswartz at garage.maemo.org
Fri Aug 29 22:17:09 EEST 2008
Author: eswartz
Date: 2008-08-29 22:17:02 +0300 (Fri, 29 Aug 2008)
New Revision: 767
Added:
trunk/common/
trunk/common/com.nokia.cpp.utils.core/
trunk/common/com.nokia.cpp.utils.core/.classpath
trunk/common/com.nokia.cpp.utils.core/.project
trunk/common/com.nokia.cpp.utils.core/.settings/
trunk/common/com.nokia.cpp.utils.core/.settings/org.eclipse.jdt.core.prefs
trunk/common/com.nokia.cpp.utils.core/META-INF/
trunk/common/com.nokia.cpp.utils.core/META-INF/MANIFEST.MF
trunk/common/com.nokia.cpp.utils.core/build.properties
trunk/common/com.nokia.cpp.utils.core/src/
trunk/common/com.nokia.cpp.utils.core/src/com/
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheMap.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ChainedIterator.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Check.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ClassUtils.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CommonPathFinder.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/FileUtils.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IDisposable.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IListener.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IListenerFiring.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IMessage.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IMessageListener.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ITimedTask.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IVariableLookupCallback.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ListenerList.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Logging.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Message.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/MessageLocation.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/MultiResourceChangeListenerDispatcher.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ObjectUtils.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Pair.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ProjectUtils.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/TextUtils.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/TrackedResource.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Triple.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Tuple.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/VariableSubstitutionEngine.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/Messages.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/UtilsCorePlugin.java
trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/messages.properties
trunk/common/com.nokia.cpp.utils.ui/
trunk/common/com.nokia.cpp.utils.ui/.classpath
trunk/common/com.nokia.cpp.utils.ui/.project
trunk/common/com.nokia.cpp.utils.ui/.settings/
trunk/common/com.nokia.cpp.utils.ui/.settings/org.eclipse.jdt.core.prefs
trunk/common/com.nokia.cpp.utils.ui/META-INF/
trunk/common/com.nokia.cpp.utils.ui/META-INF/MANIFEST.MF
trunk/common/com.nokia.cpp.utils.ui/build.properties
trunk/common/com.nokia.cpp.utils.ui/src/
trunk/common/com.nokia.cpp.utils.ui/src/com/
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ControlVisitor.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/DirectorySelectorWithHistory.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/FilesListDialog.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/IColorConverter.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/IToolTipLabelProvider.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ModelObjectComboBoxCellEditor.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/NotifyWithBooleanPrefDialog.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ProjectFolderSelectionDialog.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/QueryWithBooleanPrefDialog.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/QueryWithTristatePrefDialog.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/RadioButtonTableViewer.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/RunRunnableWhenWorkbenchVisibleJob.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ShowDialogWhenWorkbenchVisibleJob.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/UITaskUtils.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/WorkbenchUtils.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/ComposeableEditingContext.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/EditingContextOperation.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/ErrorPage.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/FormEditorEditingContext.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/IEditingContext.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/Messages.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/UtilsUIPlugin.java
trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/messages.properties
trunk/common/org.indt.esbox.core.compatibility/
trunk/common/org.indt.esbox.core.compatibility/.classpath
trunk/common/org.indt.esbox.core.compatibility/.project
trunk/common/org.indt.esbox.core.compatibility/.settings/
trunk/common/org.indt.esbox.core.compatibility/.settings/org.eclipse.jdt.core.prefs
trunk/common/org.indt.esbox.core.compatibility/META-INF/
trunk/common/org.indt.esbox.core.compatibility/META-INF/MANIFEST.MF
trunk/common/org.indt.esbox.core.compatibility/build.properties
trunk/common/org.indt.esbox.core.compatibility/plugin.xml
trunk/common/org.indt.esbox.core.compatibility/src/
trunk/common/org.indt.esbox.core.compatibility/src/org/
trunk/common/org.indt.esbox.core.compatibility/src/org/indt/
trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/
trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/
trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility/
trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility/core/
trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility/core/ESboxOldCppProjectBuilder.java
trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility/core/ESboxOldPythonProjectBuilder.java
trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/core/
trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/core/compatibility/
trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/core/compatibility/Activator.java
trunk/common/org.maemo.esbox.analysis.launch/
trunk/common/org.maemo.esbox.analysis.launch/.classpath
trunk/common/org.maemo.esbox.analysis.launch/.project
trunk/common/org.maemo.esbox.analysis.launch/.settings/
trunk/common/org.maemo.esbox.analysis.launch/.settings/org.eclipse.jdt.core.prefs
trunk/common/org.maemo.esbox.analysis.launch/META-INF/
trunk/common/org.maemo.esbox.analysis.launch/META-INF/MANIFEST.MF
trunk/common/org.maemo.esbox.analysis.launch/build.properties
trunk/common/org.maemo.esbox.analysis.launch/src/
trunk/common/org.maemo.esbox.analysis.launch/src/org/
trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/
trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/
trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis/
trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis/launch/
trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis/launch/OProfileRemoteLaunchProxy.java
trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis/launch/ValgrindLocalLaunchProxy.java
trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/internal/
trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/internal/analysis/
trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/internal/analysis/launch/
trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/internal/analysis/launch/Activator.java
trunk/common/org.maemo.esbox.analysis.ui/
trunk/common/org.maemo.esbox.analysis.ui/.classpath
trunk/common/org.maemo.esbox.analysis.ui/.project
trunk/common/org.maemo.esbox.analysis.ui/.settings/
trunk/common/org.maemo.esbox.analysis.ui/.settings/org.eclipse.jdt.core.prefs
trunk/common/org.maemo.esbox.analysis.ui/META-INF/
trunk/common/org.maemo.esbox.analysis.ui/META-INF/MANIFEST.MF
trunk/common/org.maemo.esbox.analysis.ui/build.properties
trunk/common/org.maemo.esbox.analysis.ui/icons/
trunk/common/org.maemo.esbox.analysis.ui/icons/full/
trunk/common/org.maemo.esbox.analysis.ui/icons/full/view16/
trunk/common/org.maemo.esbox.analysis.ui/icons/full/view16/oprofile_view.png
trunk/common/org.maemo.esbox.analysis.ui/icons/full/view16/valgrind_view.png
trunk/common/org.maemo.esbox.analysis.ui/plugin.xml
trunk/common/org.maemo.esbox.analysis.ui/src/
trunk/common/org.maemo.esbox.analysis.ui/src/org/
trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/
trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/
trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/analysis/
trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/analysis/ui/
trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/analysis/ui/IAnalysisViews.java
trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/
trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/
trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/Activator.java
trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/ui/
trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/ui/OProfileView.java
trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/ui/ValgrindView.java
trunk/common/org.maemo.esbox.analysis/
trunk/common/org.maemo.esbox.analysis/.classpath
trunk/common/org.maemo.esbox.analysis/.project
trunk/common/org.maemo.esbox.analysis/.settings/
trunk/common/org.maemo.esbox.analysis/.settings/org.eclipse.jdt.core.prefs
trunk/common/org.maemo.esbox.analysis/META-INF/
trunk/common/org.maemo.esbox.analysis/META-INF/MANIFEST.MF
trunk/common/org.maemo.esbox.analysis/build.properties
trunk/common/org.maemo.esbox.analysis/plugin.xml
trunk/common/org.maemo.esbox.analysis/src/
trunk/common/org.maemo.esbox.analysis/src/org/
trunk/common/org.maemo.esbox.analysis/src/org/maemo/
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis/
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis/adapters/
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis/adapters/IOProfileSupportAdapter.java
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis/adapters/IValgrindSupportAdapter.java
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/core/
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/core/Activator.java
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OPreportToolProvider.java
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OPreportToolRunner.java
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OProfileToolProvider.java
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OProfileToolRunner.java
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/valgrind/
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/valgrind/ValgrindToolProvider.java
trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/valgrind/ValgrindToolRunner.java
trunk/common/org.maemo.esbox.core-feature/
trunk/common/org.maemo.esbox.core-feature/.project
trunk/common/org.maemo.esbox.core-feature/TODO.txt
trunk/common/org.maemo.esbox.core-feature/build.properties
trunk/common/org.maemo.esbox.core-feature/feature.xml
trunk/common/org.maemo.esbox.core-feature/license.html
trunk/common/org.maemo.esbox.core-feature/licenses/
trunk/common/org.maemo.esbox.core-feature/licenses/COPYING
trunk/common/org.maemo.esbox.core-feature/licenses/COPYING.LESSER
trunk/common/org.maemo.esbox.core-feature/licenses/epl-v10.html
trunk/common/org.maemo.esbox.core.tests/
trunk/common/org.maemo.esbox.core.tests/.classpath
trunk/common/org.maemo.esbox.core.tests/.project
trunk/common/org.maemo.esbox.core.tests/.settings/
trunk/common/org.maemo.esbox.core.tests/.settings/org.eclipse.jdt.core.prefs
trunk/common/org.maemo.esbox.core.tests/META-INF/
trunk/common/org.maemo.esbox.core.tests/META-INF/MANIFEST.MF
trunk/common/org.maemo.esbox.core.tests/build.properties
trunk/common/org.maemo.esbox.core.tests/data/
trunk/common/org.maemo.esbox.core.tests/data/dumbData.dat
trunk/common/org.maemo.esbox.core.tests/data/projects/
trunk/common/org.maemo.esbox.core.tests/data/projects/standalone-project/
trunk/common/org.maemo.esbox.core.tests/data/projects/standalone-project/.esbox_settings
trunk/common/org.maemo.esbox.core.tests/data/projects/standalone-project/.project
trunk/common/org.maemo.esbox.core.tests/src/
trunk/common/org.maemo.esbox.core.tests/src/org/
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/MockSDK.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/MockSDKTarget.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/TestUtils.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/BaseTest.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestCommandLineArguments.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestEnvironmentProperties.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestEnvironmentVariables.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestFileSystemMapping.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestMountWalker.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSDKProviderFactory.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSSHFileSystem.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSSHProcess.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestShellTemplateSubstitutor.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestTemplateFilter.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestXMLStorage.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/project/
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/project/TestStandaloneProject.java
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/internal/
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/internal/core/
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/internal/core/tests/
trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/internal/core/tests/TestActivator.java
trunk/common/org.maemo.esbox.core/
trunk/common/org.maemo.esbox.core/.classpath
trunk/common/org.maemo.esbox.core/.project
trunk/common/org.maemo.esbox.core/.settings/
trunk/common/org.maemo.esbox.core/.settings/org.eclipse.jdt.core.prefs
trunk/common/org.maemo.esbox.core/CHANGES-1.5.html
trunk/common/org.maemo.esbox.core/ESboxRefactoringNotes.txt
trunk/common/org.maemo.esbox.core/KNOWN-ISSUES.html
trunk/common/org.maemo.esbox.core/META-INF/
trunk/common/org.maemo.esbox.core/META-INF/MANIFEST.MF
trunk/common/org.maemo.esbox.core/about.html
trunk/common/org.maemo.esbox.core/about_files/
trunk/common/org.maemo.esbox.core/about_files/epl-v10.html
trunk/common/org.maemo.esbox.core/build.properties
trunk/common/org.maemo.esbox.core/conf/
trunk/common/org.maemo.esbox.core/conf/esbox_common.xml
trunk/common/org.maemo.esbox.core/conf/sbox_version_1.0.xml
trunk/common/org.maemo.esbox.core/conf/sbox_version_2.0.xml
trunk/common/org.maemo.esbox.core/plugin.xml
trunk/common/org.maemo.esbox.core/schema/
trunk/common/org.maemo.esbox.core/schema/build_machine_factory.exsd
trunk/common/org.maemo.esbox.core/schema/execution_environment.exsd
trunk/common/org.maemo.esbox.core/schema/sdk_provider.exsd
trunk/common/org.maemo.esbox.core/schema/tool.exsd
trunk/common/org.maemo.esbox.core/src/
trunk/common/org.maemo.esbox.core/src/org/
trunk/common/org.maemo.esbox.core/src/org/eclipse/
trunk/common/org.maemo.esbox.core/src/org/eclipse/cdt/
trunk/common/org.maemo.esbox.core/src/org/eclipse/cdt/core/
trunk/common/org.maemo.esbox.core/src/org/eclipse/cdt/core/ProcessClosure.java
trunk/common/org.maemo.esbox.core/src/org/maemo/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/CorePlugin.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxException.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxMessageConsole.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxPreferenceConstants.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ErrorLogger.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/GeneralUtils.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/HostUtils.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/IPersistentPropertyAccess.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/IPluginErrorLogger.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/JobUtils.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/Policy.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/PreferenceProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/adapters/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/adapters/IDefaultExecutionEnvironmentAdapter.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/adapters/ISDKManageTargetAdapter.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/cpp/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/cpp/DefineFactory.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/cpp/IDefine.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/ESboxCommonVariables.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariable.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariableBlock.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariableManager.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentXMLStorage.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariable.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariableBlock.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariableManager.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IVariableProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/BaseExecutionEnvironment.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/ConsoleExecutionEnvironment.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/ExecutionEnvironmentFactory.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/IExecutionEnvironment.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/UnknownExecutionEnvironment.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/BuildMachineFactoryProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IBuildMachine.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IBuildMachineFactory.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IDeviceMachine.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemAccess.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemMapping.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemMappingListener.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ILocalMachine.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachine.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineBackend.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineController.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineControllerListener.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineManager.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineStatusListener.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineStatusReporter.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IPathCanonicalizer.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcess.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcessFilter.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcessLister.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ISharedFilesystemProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IVirtualMachine.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineException.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineManager.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineRegistry.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ProcessFilterCmdLineRegexp.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/UnixProcess.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/DefaultModelDocumentProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/DocumentFactory.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IIncludeFileLocator.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModel.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelDocumentProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelFactory.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelListenerBase.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelLoadResults.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IOwnedModel.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelBaseBase.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelDocument.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelProviderBase.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/WorkspaceModelProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/BaseProcessLauncher.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/CommandLineArguments.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/EnvironmentProperties.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/HostProcessLauncherFactory.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IProcessLauncher.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IProcessLauncherFactory.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IStreamLineMonitor.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherCreator.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherParameters.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherUtils.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessRunnerCreator.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessRunnerParameters.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ShellTemplateSubstitutor.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/StreamMonitor.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/IPreferenceProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDK.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKPlatform.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKTarget.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/SDKFactory.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ESboxToolEngine.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ITool.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolListener.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolParam.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolRunner.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/Tool.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ToolEvent.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ToolParam.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/EFSXMLFileStorage.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/ResourceXMLFileStorage.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/XMLStorageBase.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/XMLUtils.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/BaseProcessLauncherFactory.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/HostProcessLauncher.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/AlwaysOnMachineController.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/BaseMachineController.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/FileSystemMapping.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostFileSystemAccess.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostMachineBackend.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostUnixMachine.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostWindowsMachine.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IBuildMachineImpl.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IFileSystemAccessImpl.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IFileSystemMappingImpl.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IMachineImpl.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IStreamWrapper.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IStreamWrapperFactory.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/Machine.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MachineControllerProbingJob.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MachineProbingJob.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MappingException.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/StockSharedFilesystemProvider.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/UnixProcessLister.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/Win32ProcessLister.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDK.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDKPlatform.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDKTarget.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/HostSDK.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/HostSDKTarget.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKFactoryRefreshJob.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKTargetConvertingFileSystemAccess.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKTargetConvertingFileSystemMapping.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/Activator.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/ESboxPreferenceInitializer.java
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/cpp/
trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/cpp/Define.java
trunk/common/org.maemo.esbox.help/
trunk/common/org.maemo.esbox.help/.project
trunk/common/org.maemo.esbox.help/META-INF/
trunk/common/org.maemo.esbox.help/META-INF/MANIFEST.MF
trunk/common/org.maemo.esbox.help/about.html
trunk/common/org.maemo.esbox.help/about_files/
trunk/common/org.maemo.esbox.help/about_files/epl-v10.html
trunk/common/org.maemo.esbox.help/build.properties
trunk/common/org.maemo.esbox.help/html/
trunk/common/org.maemo.esbox.help/html/concepts/
trunk/common/org.maemo.esbox.help/html/concepts/DebianPackage.html
trunk/common/org.maemo.esbox.help/html/concepts/LocalDebugging.html
trunk/common/org.maemo.esbox.help/html/concepts/LocalLaunching.html
trunk/common/org.maemo.esbox.help/html/concepts/MaemoBuilder.html
trunk/common/org.maemo.esbox.help/html/concepts/MaemoProjects.html
trunk/common/org.maemo.esbox.help/html/concepts/ProfilingApplications.html
trunk/common/org.maemo.esbox.help/html/concepts/RemoteDebugging.html
trunk/common/org.maemo.esbox.help/html/concepts/RemoteLaunching.html
trunk/common/org.maemo.esbox.help/html/concepts/Sbrsh.html
trunk/common/org.maemo.esbox.help/html/concepts/ScratchboxTarget.html
trunk/common/org.maemo.esbox.help/html/concepts/StringExternalization.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/
trunk/common/org.maemo.esbox.help/html/gettingstarted/BasicTutorial.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/CompilingCMaemoProject.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/ConfigurationTutorial.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingAMaemoProject.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingProjectTemplates.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingPythonProject.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/DebuggingCMaemoApplications.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/DebuggingPythonMaemoApplications.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/ExternalizeString.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/Introduction.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/ProfilingMaemoApplications.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/RunningCProject.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/RunningPythonProject.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/SettingPreferences.html
trunk/common/org.maemo.esbox.help/html/gettingstarted/SettingsSbrshConfiguration.html
trunk/common/org.maemo.esbox.help/html/help.css
trunk/common/org.maemo.esbox.help/html/images/
trunk/common/org.maemo.esbox.help/html/images/build.jpg
trunk/common/org.maemo.esbox.help/html/images/build1.jpg
trunk/common/org.maemo.esbox.help/html/images/debian.jpg
trunk/common/org.maemo.esbox.help/html/images/debian1.jpg
trunk/common/org.maemo.esbox.help/html/images/debian2.jpg
trunk/common/org.maemo.esbox.help/html/images/debug.jpg
trunk/common/org.maemo.esbox.help/html/images/debug1.jpg
trunk/common/org.maemo.esbox.help/html/images/debug10.jpg
trunk/common/org.maemo.esbox.help/html/images/debug2.jpg
trunk/common/org.maemo.esbox.help/html/images/debug3.jpg
trunk/common/org.maemo.esbox.help/html/images/debug4.jpg
trunk/common/org.maemo.esbox.help/html/images/debug5.jpg
trunk/common/org.maemo.esbox.help/html/images/debug6.jpg
trunk/common/org.maemo.esbox.help/html/images/debug7.jpg
trunk/common/org.maemo.esbox.help/html/images/debug8.jpg
trunk/common/org.maemo.esbox.help/html/images/debug9.jpg
trunk/common/org.maemo.esbox.help/html/images/esbox0.jpg
trunk/common/org.maemo.esbox.help/html/images/esbox1.jpg
trunk/common/org.maemo.esbox.help/html/images/esbox2.jpg
trunk/common/org.maemo.esbox.help/html/images/esbox3.jpg
trunk/common/org.maemo.esbox.help/html/images/esbox4.jpg
trunk/common/org.maemo.esbox.help/html/images/esbox5.jpg
trunk/common/org.maemo.esbox.help/html/images/externalize01.jpg
trunk/common/org.maemo.esbox.help/html/images/externalize02.jpg
trunk/common/org.maemo.esbox.help/html/images/externalize03.jpg
trunk/common/org.maemo.esbox.help/html/images/green_fade_left_68_165_28.png
trunk/common/org.maemo.esbox.help/html/images/maketarget.jpg
trunk/common/org.maemo.esbox.help/html/images/maketarget0.png
trunk/common/org.maemo.esbox.help/html/images/maketarget1.jpg
trunk/common/org.maemo.esbox.help/html/images/newproject.png
trunk/common/org.maemo.esbox.help/html/images/newproject1.png
trunk/common/org.maemo.esbox.help/html/images/newproject2.png
trunk/common/org.maemo.esbox.help/html/images/newproject3.png
trunk/common/org.maemo.esbox.help/html/images/newproject4.png
trunk/common/org.maemo.esbox.help/html/images/newpythonproject.png
trunk/common/org.maemo.esbox.help/html/images/newpythonproject1.png
trunk/common/org.maemo.esbox.help/html/images/newpythonproject2.png
trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus.png
trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus_arg.png
trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus_dwnld.png
trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus_env.png
trunk/common/org.maemo.esbox.help/html/images/oprofile_python_arg.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/
trunk/common/org.maemo.esbox.help/html/images/pref_images/debug_config.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_connectionserial.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_connectiontcp.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_debuggerlist.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_maintab.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_shlibtab.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/env.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/gazpacho.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/installed_targets.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/localapp.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_1.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_2.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_3.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_4.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_5.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_6.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_1.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_2.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_3.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_4.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/remoteapp.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/sbox1.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/sbox2.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_download.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_download_custom.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_edit.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_viewer.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/ssh.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/targets.png
trunk/common/org.maemo.esbox.help/html/images/pref_images/xserver.png
trunk/common/org.maemo.esbox.help/html/images/preferences.jpg
trunk/common/org.maemo.esbox.help/html/images/preferences1.jpg
trunk/common/org.maemo.esbox.help/html/images/preferences2.jpg
trunk/common/org.maemo.esbox.help/html/images/profiling0.jpg
trunk/common/org.maemo.esbox.help/html/images/profiling1.jpg
trunk/common/org.maemo.esbox.help/html/images/profiling2.jpg
trunk/common/org.maemo.esbox.help/html/images/profiling3.jpg
trunk/common/org.maemo.esbox.help/html/images/profiling4.jpg
trunk/common/org.maemo.esbox.help/html/images/profiling5.jpg
trunk/common/org.maemo.esbox.help/html/images/profiling6.jpg
trunk/common/org.maemo.esbox.help/html/images/python.jpg
trunk/common/org.maemo.esbox.help/html/images/python1.jpg
trunk/common/org.maemo.esbox.help/html/images/python3.jpg
trunk/common/org.maemo.esbox.help/html/images/python9.jpg
trunk/common/org.maemo.esbox.help/html/images/run.jpg
trunk/common/org.maemo.esbox.help/html/images/run1.jpg
trunk/common/org.maemo.esbox.help/html/images/run2.jpg
trunk/common/org.maemo.esbox.help/html/images/run_args.png
trunk/common/org.maemo.esbox.help/html/images/run_common.png
trunk/common/org.maemo.esbox.help/html/images/run_debug.png
trunk/common/org.maemo.esbox.help/html/images/run_env.png
trunk/common/org.maemo.esbox.help/html/images/run_main.png
trunk/common/org.maemo.esbox.help/html/images/run_source.png
trunk/common/org.maemo.esbox.help/html/images/sbrsh0.jpg
trunk/common/org.maemo.esbox.help/html/images/sbrsh1.jpg
trunk/common/org.maemo.esbox.help/html/images/sbrsh2.jpg
trunk/common/org.maemo.esbox.help/html/images/sbrsh3.jpg
trunk/common/org.maemo.esbox.help/html/images/target.jpg
trunk/common/org.maemo.esbox.help/html/images/target0.1.jpg
trunk/common/org.maemo.esbox.help/html/images/target0.jpg
trunk/common/org.maemo.esbox.help/html/images/target1.jpg
trunk/common/org.maemo.esbox.help/html/images/target1a.png
trunk/common/org.maemo.esbox.help/html/images/target2.jpg
trunk/common/org.maemo.esbox.help/html/images/target3.jpg
trunk/common/org.maemo.esbox.help/html/images/target4.jpg
trunk/common/org.maemo.esbox.help/html/images/target5.jpg
trunk/common/org.maemo.esbox.help/html/images/target6.jpg
trunk/common/org.maemo.esbox.help/html/images/target7.jpg
trunk/common/org.maemo.esbox.help/html/images/template.jpg
trunk/common/org.maemo.esbox.help/html/images/template1.jpg
trunk/common/org.maemo.esbox.help/html/images/variables.png
trunk/common/org.maemo.esbox.help/html/legal.html
trunk/common/org.maemo.esbox.help/html/reference/
trunk/common/org.maemo.esbox.help/html/reference/FAQ.html
trunk/common/org.maemo.esbox.help/html/reference/Glossary.html
trunk/common/org.maemo.esbox.help/html/tasks/
trunk/common/org.maemo.esbox.help/html/tasks/CreateMakeTarget.html
trunk/common/org.maemo.esbox.help/html/tasks/CreateNewTarget.html
trunk/common/org.maemo.esbox.help/html/tasks/CreateOprofileconfig.html
trunk/common/org.maemo.esbox.help/html/tasks/DebianPackage.html
trunk/common/org.maemo.esbox.help/html/tips.html
trunk/common/org.maemo.esbox.help/html/toc.html
trunk/common/org.maemo.esbox.help/plugin.xml
trunk/common/org.maemo.esbox.help/toc.xml
trunk/common/org.maemo.esbox.help/tocconcepts.xml
trunk/common/org.maemo.esbox.help/tocgettingstarted.xml
trunk/common/org.maemo.esbox.help/tocreference.xml
trunk/common/org.maemo.esbox.help/toctasks.xml
trunk/common/org.maemo.esbox.launch/
trunk/common/org.maemo.esbox.launch/.classpath
trunk/common/org.maemo.esbox.launch/.project
trunk/common/org.maemo.esbox.launch/.settings/
trunk/common/org.maemo.esbox.launch/.settings/org.eclipse.jdt.core.prefs
trunk/common/org.maemo.esbox.launch/META-INF/
trunk/common/org.maemo.esbox.launch/META-INF/MANIFEST.MF
trunk/common/org.maemo.esbox.launch/about.html
trunk/common/org.maemo.esbox.launch/about_files/
trunk/common/org.maemo.esbox.launch/about_files/epl-v10.html
trunk/common/org.maemo.esbox.launch/build.properties
trunk/common/org.maemo.esbox.launch/icons/
trunk/common/org.maemo.esbox.launch/icons/download.gif
trunk/common/org.maemo.esbox.launch/icons/full/
trunk/common/org.maemo.esbox.launch/icons/full/obj16/
trunk/common/org.maemo.esbox.launch/icons/full/obj16/local_obj.png
trunk/common/org.maemo.esbox.launch/icons/full/obj16/oprofile_obj.png
trunk/common/org.maemo.esbox.launch/icons/full/obj16/remote_obj.png
trunk/common/org.maemo.esbox.launch/icons/full/obj16/valgrind_obj.png
trunk/common/org.maemo.esbox.launch/plugin.xml
trunk/common/org.maemo.esbox.launch/schema/
trunk/common/org.maemo.esbox.launch/schema/LaunchProtocolPage.exsd
trunk/common/org.maemo.esbox.launch/schema/LaunchProtocolType.exsd
trunk/common/org.maemo.esbox.launch/src/
trunk/common/org.maemo.esbox.launch/src/org/
trunk/common/org.maemo.esbox.launch/src/org/maemo/
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/internal/
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/internal/launch/
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/internal/launch/Activator.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocol.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocolType.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ESboxDebuggerStatus.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ESboxLaunchUtils.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxCDTLaunchConfigurationConstants.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxLaunchConfigurationConstants.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxLaunchHelpContextID.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocol.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocolType.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchConfigurationData.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchProtocolFactory.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/adapters/
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/adapters/IGdbServerSupportAdapter.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/adapters/IRunStandaloneAdapter.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLaunchParameterAccessor.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLaunchProxy.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLocalLaunchProxy.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractRemoteLaunchProxy.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IESboxLaunchParameterAccessor.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IGDBParameterAccessor.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/ILaunchParameterAccessor.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/ILaunchProxy.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IRemoteLaunchParameterAccessor.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/AbstractLaunchProtocolPage.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/DownloadMethodSelectionDialog.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ESboxDownloadTab.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ILaunchProtocolPage.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/LaunchProtocolPageFactory.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/StatusInfo.java
trunk/common/org.maemo.esbox.project.core/
trunk/common/org.maemo.esbox.project.core/.classpath
trunk/common/org.maemo.esbox.project.core/.project
trunk/common/org.maemo.esbox.project.core/.settings/
trunk/common/org.maemo.esbox.project.core/.settings/org.eclipse.jdt.core.prefs
trunk/common/org.maemo.esbox.project.core/META-INF/
trunk/common/org.maemo.esbox.project.core/META-INF/MANIFEST.MF
trunk/common/org.maemo.esbox.project.core/build.properties
trunk/common/org.maemo.esbox.project.core/plugin.xml
trunk/common/org.maemo.esbox.project.core/schema/
trunk/common/org.maemo.esbox.project.core/schema/esboxLanguageTemplateProvider.exsd
trunk/common/org.maemo.esbox.project.core/schema/esbox_templates.exsd
trunk/common/org.maemo.esbox.project.core/schema/esbox_templates.properties
trunk/common/org.maemo.esbox.project.core/schema/esbox_templatesAssociations.exsd
trunk/common/org.maemo.esbox.project.core/schema/oldStyleProjectPropertiesProvider.exsd
trunk/common/org.maemo.esbox.project.core/schema/projectType.exsd
trunk/common/org.maemo.esbox.project.core/src/
trunk/common/org.maemo.esbox.project.core/src/org/
trunk/common/org.maemo.esbox.project.core/src/org/maemo/
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/internal/
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/internal/project/
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/internal/project/core/
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/internal/project/core/Activator.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxBuildConfigurationBase.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxBuildConfigurationParameters.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxConfigHandler.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectCreatorConverter.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectHandleBase.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectPropertiesWrapper.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxPropertyTester.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxStandaloneProjectHandleBase.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateEngine.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateFilter.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateProcessInfo.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxBuildConfiguration.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxProjectHandle.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxProjectType.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IIndexerConfigurationSettings.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ILanguageTemplateProvider.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IOldESboxProjectBuilder.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IOldStyleProjectPropertiesProvider.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IProjectProperties.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ITemplate.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ProjectManager.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ProjectScriptLauncher.java
trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/XMLPersistentPropertyAccess.java
trunk/common/org.maemo.esbox.project.ui/
trunk/common/org.maemo.esbox.project.ui/.classpath
trunk/common/org.maemo.esbox.project.ui/.project
trunk/common/org.maemo.esbox.project.ui/.settings/
trunk/common/org.maemo.esbox.project.ui/.settings/org.eclipse.jdt.core.prefs
trunk/common/org.maemo.esbox.project.ui/META-INF/
trunk/common/org.maemo.esbox.project.ui/META-INF/MANIFEST.MF
trunk/common/org.maemo.esbox.project.ui/build.properties
trunk/common/org.maemo.esbox.project.ui/icons/
trunk/common/org.maemo.esbox.project.ui/icons/full/
trunk/common/org.maemo.esbox.project.ui/icons/full/obj16/
trunk/common/org.maemo.esbox.project.ui/icons/full/obj16/fldr_obj.gif
trunk/common/org.maemo.esbox.project.ui/icons/full/obj16/variable_obj.gif
trunk/common/org.maemo.esbox.project.ui/src/
trunk/common/org.maemo.esbox.project.ui/src/org/
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/internal/
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/internal/project/
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/internal/project/ui/
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/internal/project/ui/UIActivator.java
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/ESboxBuildConfigurationsPage.java
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/ESboxProjectContentsArea.java
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/properties/
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/properties/BaseESBoxBuildTargetPropertyPage.java
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/properties/ESboxProjectPropertyPage.java
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxBaseProjectTargetSelectionPage.java
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxCommonNewProjectWizard.java
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxProjectMultiTargetSelectionPage.java
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxProjectSingleTargetSelectionPage.java
trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxTemplateSelectionPage.java
trunk/common/org.maemo.esbox.ssh/
trunk/common/org.maemo.esbox.ssh/.classpath
trunk/common/org.maemo.esbox.ssh/.project
trunk/common/org.maemo.esbox.ssh/.settings/
trunk/common/org.maemo.esbox.ssh/.settings/org.eclipse.jdt.core.prefs
trunk/common/org.maemo.esbox.ssh/META-INF/
trunk/common/org.maemo.esbox.ssh/META-INF/MANIFEST.MF
trunk/common/org.maemo.esbox.ssh/build.properties
trunk/common/org.maemo.esbox.ssh/conf/
trunk/common/org.maemo.esbox.ssh/conf/run_linux_wait.bat
trunk/common/org.maemo.esbox.ssh/plugin.xml
trunk/common/org.maemo.esbox.ssh/src/
trunk/common/org.maemo.esbox.ssh/src/org/
trunk/common/org.maemo.esbox.ssh/src/org/maemo/
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/DeviceSSHLinuxMachine.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/SSHDeviceMachineController.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/SSHMachineControllerBase.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/Activator.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/BuggySB2QEMUStreamWrapperFactory.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/JSchSessionFactory.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/MountWalker.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/NonInteractiveUserInfo.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuBuildMachineFactory.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuMachine.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuMachineController.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteMachineController.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteSSHLinuxBuildMachineFactory.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteSSHLinuxMachine.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileInfo.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileStore.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileSystem.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHMachineBackend.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHMachineSetupDialog.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcess.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcessLauncher.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcessLauncherFactory.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHSftpProgressMonitor.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/StockQemuConfiguration.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/UnixUserInformation.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/IMountVisitor.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/IQemuConfiguration.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ISSHMachine.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/SSHConfiguration.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ui/
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ui/ESboxSSHPreferencePage.java
trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ui/SSHPreferenceUtils.java
trunk/common/org.maemo.esbox.ui/
trunk/common/org.maemo.esbox.ui/.classpath
trunk/common/org.maemo.esbox.ui/.project
trunk/common/org.maemo.esbox.ui/.settings/
trunk/common/org.maemo.esbox.ui/.settings/org.eclipse.jdt.core.prefs
trunk/common/org.maemo.esbox.ui/META-INF/
trunk/common/org.maemo.esbox.ui/META-INF/MANIFEST.MF
trunk/common/org.maemo.esbox.ui/build.properties
trunk/common/org.maemo.esbox.ui/icons/
trunk/common/org.maemo.esbox.ui/icons/full/
trunk/common/org.maemo.esbox.ui/icons/full/etool16/
trunk/common/org.maemo.esbox.ui/icons/full/etool16/execenv.png
trunk/common/org.maemo.esbox.ui/icons/full/obj16/
trunk/common/org.maemo.esbox.ui/icons/full/obj16/buildconsole.gif
trunk/common/org.maemo.esbox.ui/icons/full/obj16/keylock_misc.gif
trunk/common/org.maemo.esbox.ui/icons/full/obj16/lib_obj.gif
trunk/common/org.maemo.esbox.ui/plugin.xml
trunk/common/org.maemo.esbox.ui/src/
trunk/common/org.maemo.esbox.ui/src/org/
trunk/common/org.maemo.esbox.ui/src/org/maemo/
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/internal/
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/internal/ui/
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/internal/ui/UIActivator.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxBuildTargetProvider.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxBuildTargetUI.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxExecutionEnvironmentProvider.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxExecutionEnvironmentUI.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/IPreferenceConstants.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/actions/
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/actions/ESboxAction.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/ComboDialogField.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/DialogField.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/IDialogFieldListener.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/LayoutUtil.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/PixelConverter.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/SWTUtil.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/StatusInfo.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/StringDialogField.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/DialogUtils.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/PasswordInputDialog.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/SelectSDKTargetDialog.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/TimeTriggeredProgressMonitorDialog.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/EnvironmentTab.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/PixelConverter.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/VariableInputDialog.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxEnvPreferencePage.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxGazpachoPreferencePage.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxMachinePreferencesPage.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxPreferencesPage.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxTargetPreferencesPage.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxXServerPreferencePage.java
trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/SDKPreferencesPageUtils.java
trunk/cpp/
trunk/cpp/org.maemo.esbox.cpp-feature/
trunk/cpp/org.maemo.esbox.cpp-feature/.project
trunk/cpp/org.maemo.esbox.cpp-feature/build.properties
trunk/cpp/org.maemo.esbox.cpp-feature/feature.xml
trunk/cpp/org.maemo.esbox.cpp-feature/license.html
trunk/cpp/org.maemo.esbox.cpp-feature/licenses/
trunk/cpp/org.maemo.esbox.cpp-feature/licenses/COPYING
trunk/cpp/org.maemo.esbox.cpp-feature/licenses/COPYING.LESSER
trunk/cpp/org.maemo.esbox.cpp-feature/licenses/epl-v10.html
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.classpath
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.project
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.settings/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.settings/org.eclipse.jdt.core.prefs
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/META-INF/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/META-INF/MANIFEST.MF
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/build.properties
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/local_obj.png
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/oprofile_obj.png
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/remote_obj.png
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/valgrind_obj.png
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/plugin.xml
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchConfigurationTabGroup.java
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchDelegate.java
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchShortcut.java
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/ui/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/ui/OProfileMainTab.java
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchConfigurationTabGroup.java
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchDelegate.java
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchShortcut.java
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ui/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ui/ValgrindMainTab.java
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal/cpp/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal/cpp/launch/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal/cpp/launch/analysis/
trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal/cpp/launch/analysis/Activator.java
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.classpath
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.project
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.settings/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.settings/org.eclipse.jdt.core.prefs
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/META-INF/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/META-INF/MANIFEST.MF
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/build.properties
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons/full/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons/full/obj16/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons/full/obj16/local_obj.png
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons/full/obj16/remote_obj.png
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/plugin.xml
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESBoxGDBServerCDIDebugger2.java
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxGDBServerLocalDebugger.java
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxGDBServerRemoteDebugger.java
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxMICommandFactory.java
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp/launch/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp/launch/cdi/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp/launch/cdi/gdb/
trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp/launch/cdi/gdb/Activator.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.classpath
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.project
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.settings/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.settings/org.eclipse.jdt.core.prefs
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/META-INF/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/META-INF/MANIFEST.MF
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/build.properties
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons/full/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons/full/obj16/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons/full/obj16/local_obj.png
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons/full/obj16/remote_obj.png
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/plugin.xml
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/DsfLaunchConfigurationData.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/BaseDSFGDBParameterAccessor.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/ESboxGDBLauncher.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/LocalLaunchDelegate.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/LocalLaunchShortcut.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchDelegate.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchShortcut.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/ESboxFinalLaunchSequence.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/LocalServicesLaunchSequence.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/RemoteServicesLaunchSequence.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/ui/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/ui/LocalLaunchConfigurationTabGroup.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/ui/RemoteLaunchConfigurationTabGroup.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp/launch/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp/launch/dsf/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp/launch/dsf/gdb/
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp/launch/dsf/gdb/Activator.java
trunk/cpp/org.maemo.esbox.cpp.launch/
trunk/cpp/org.maemo.esbox.cpp.launch/.classpath
trunk/cpp/org.maemo.esbox.cpp.launch/.project
trunk/cpp/org.maemo.esbox.cpp.launch/.settings/
trunk/cpp/org.maemo.esbox.cpp.launch/.settings/org.eclipse.jdt.core.prefs
trunk/cpp/org.maemo.esbox.cpp.launch/META-INF/
trunk/cpp/org.maemo.esbox.cpp.launch/META-INF/MANIFEST.MF
trunk/cpp/org.maemo.esbox.cpp.launch/build.properties
trunk/cpp/org.maemo.esbox.cpp.launch/plugin.xml
trunk/cpp/org.maemo.esbox.cpp.launch/src/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/AbstractLaunchShortcut.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/BaseCDTGDBParameterAccessor.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPLocalGDBParameterAccessor.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPLocalLaunchProxy.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPRemoteGDBParameterAccessor.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPRemoteLaunchProxy.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CppLaunchConfigurationData.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ESboxAbstractLaunchDelegate.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ESboxCppLaunchUtils.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalLaunchShortcut.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalRunLaunchConfigurationTabGroup.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalRunLaunchDelegate.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteLaunchShortcut.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteRunLaunchConfigurationTabGroup.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteRunLaunchDelegate.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCDebuggerTab.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCMainTab.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCMainTabBase.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxGDBDebuggerPage.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxGDBServerDebuggerPage.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxRemoteCMainTab.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/internal/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/internal/cpp/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/internal/cpp/launch/
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/internal/cpp/launch/Activator.java
trunk/cpp/org.maemo.esbox.cpp.project.core/
trunk/cpp/org.maemo.esbox.cpp.project.core/.classpath
trunk/cpp/org.maemo.esbox.cpp.project.core/.project
trunk/cpp/org.maemo.esbox.cpp.project.core/.settings/
trunk/cpp/org.maemo.esbox.cpp.project.core/.settings/org.eclipse.jdt.core.prefs
trunk/cpp/org.maemo.esbox.cpp.project.core/META-INF/
trunk/cpp/org.maemo.esbox.cpp.project.core/META-INF/MANIFEST.MF
trunk/cpp/org.maemo.esbox.cpp.project.core/build.properties
trunk/cpp/org.maemo.esbox.cpp.project.core/plugin.xml
trunk/cpp/org.maemo.esbox.cpp.project.core/src/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/CdtConfigurationPropertyAccess.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ConfigurationPropertyCategories.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/CppScriptLauncher.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxAutotoolsBuilder.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxBuildConfigIndexerConfigurationSettings.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppBuildConfigProjectCreatorConverter.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppBuildConfiguration.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppConfigHandler.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectCreatorConverterBase.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectHandle.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectNature.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectType.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppPropertyTester.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppTemplateProcessInfo.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxDynamicVariableResolver.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxOldMakeBuilder.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/OldESboxProjectNature.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxBuildData.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxCConfigurationDataProvider.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxConfigurationData.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxDataFactory.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxLanguageData.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxRootFolderData.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxTargetPlatformData.java
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal/cpp/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal/cpp/project/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal/cpp/project/core/
trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal/cpp/project/core/Activator.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/
trunk/cpp/org.maemo.esbox.cpp.project.ui/.classpath
trunk/cpp/org.maemo.esbox.cpp.project.ui/.project
trunk/cpp/org.maemo.esbox.cpp.project.ui/.settings/
trunk/cpp/org.maemo.esbox.cpp.project.ui/.settings/org.eclipse.jdt.core.prefs
trunk/cpp/org.maemo.esbox.cpp.project.ui/META-INF/
trunk/cpp/org.maemo.esbox.cpp.project.ui/META-INF/MANIFEST.MF
trunk/cpp/org.maemo.esbox.cpp.project.ui/build.properties
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/ToolFactory.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/CharOperation.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/IScanner.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/InvalidInputException.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IBinding.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IMethodBinding.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IPackageBinding.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/ITypeBinding.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IVariableBinding.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/ASTNode.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/Literal.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/StringLiteral.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/classfmt/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/classfmt/ClassFileConstants.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/NLSLine.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/Scanner.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/ScannerHelper.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/TerminalTokens.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core/util/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core/util/MementoTokenizer.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core/util/PublicScanner.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/KeyValuePair.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSElement.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSLine.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSScanner.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSSubstitution.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/CopiedFromJDTPluginImages.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/MultiStateCellEditor.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/NLSUIMessages.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/NLSUIMessages.properties
trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/RenameKeysDialog.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/maemomenu_misc.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/restart_co.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/scratchbox_terminal.png
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/start_co.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/stop_co.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/xservermenu_misc.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/define_obj.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/fldr_obj.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/hfolder_obj.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/keylock_misc.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/maemoprj_cnv.png
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/maemoprj_obj.png
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/mountpoint_tsk.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/never_translate.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/output_folder_obj.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/skip.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/translate.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/variable_obj.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/view16/
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/view16/oprofile_view.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/view16/oprofile_view.png
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/view16/valgrind_view.png
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/wizban/
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/wizban/newmaemoprj_wiz.png
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/wizban/newtarget_wiz.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/wizban/sbrsh_wiz.gif
trunk/cpp/org.maemo.esbox.cpp.project.ui/plugin.xml
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/CScratchboxConsole.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ConvertCppProjectMarkerResolutionGenerator.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ESboxBuildConfigManager.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ESboxCppTemplateWrapper.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/BuildAllAction.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ConfigureAction.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ExternalizeAction.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/GenerateConfigureAction.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ProjectConverter.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/dialogs/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/dialogs/ExternalizeDialog.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddIndexerIncludePaths.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddIndexerMacroDefinitions.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddPkgConfigIndexerInfo.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddProjectSourceFolders.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/RunScript.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/ValidateAndInstallPackages.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/properties/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/properties/ESBoxOldCppTargetPropertyPage.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/properties/PathAndSymbolPage.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/CppTemplateProvider.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/ESboxCppTemplateEngine.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/ESboxTemplateInfo.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ConvertToESboxCppBuildConfigWizard.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ConvertToESboxCppBuildConfigWizardPage.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/CppProjectWizard.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ExternalizeWizard.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ExternalizeWizardPage.java
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal/cpp/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal/cpp/project/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal/cpp/project/ui/
trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal/cpp/project/ui/UIActivator.java
trunk/cpp/org.maemo.esbox.cpp.tests/
trunk/cpp/org.maemo.esbox.cpp.tests/.classpath
trunk/cpp/org.maemo.esbox.cpp.tests/.project
trunk/cpp/org.maemo.esbox.cpp.tests/.settings/
trunk/cpp/org.maemo.esbox.cpp.tests/.settings/org.eclipse.jdt.core.prefs
trunk/cpp/org.maemo.esbox.cpp.tests/META-INF/
trunk/cpp/org.maemo.esbox.cpp.tests/META-INF/MANIFEST.MF
trunk/cpp/org.maemo.esbox.cpp.tests/build.properties
trunk/cpp/org.maemo.esbox.cpp.tests/data/
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/.cproject
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/.project
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/COPYING
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/COPYING.LESSER
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/Makefile
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/src/
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/src/helloworld.c
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/.cproject
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/.project
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/COPYING
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/COPYING.LESSER
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/Makefile
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/src/
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/src/helloworld.c
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/.project
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/Makefile
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/src/
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/src/helloworld.c
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/.cproject
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/.project
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/COPYING
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/COPYING.LESSER
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/Makefile
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/src/
trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/src/helloworld.c
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/.cproject
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/.project
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/COPYING
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/COPYING.LESSER
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/Makefile
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/src/
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/src/helloworld.c
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/.cproject
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/.project
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/COPYING
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/COPYING.LESSER
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/Makefile
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/src/
trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/src/helloworld.c
trunk/cpp/org.maemo.esbox.cpp.tests/src/
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/internal/
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/internal/cpp/
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/internal/cpp/tests/
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/internal/cpp/tests/TestActivator.java
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/TestESboxProjectInfo.java
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/ui/
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/ui/TestBuildConfigProjectConverter.java
trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/ui/TestBuildConfigProjectCreator.java
trunk/device/
trunk/device/org.maemo.esbox.device-feature/
trunk/device/org.maemo.esbox.device-feature/.project
trunk/device/org.maemo.esbox.device-feature/build.properties
trunk/device/org.maemo.esbox.device-feature/feature.xml
trunk/device/org.maemo.esbox.device-feature/license.html
trunk/device/org.maemo.esbox.device-feature/licenses/
trunk/device/org.maemo.esbox.device-feature/licenses/COPYING
trunk/device/org.maemo.esbox.device-feature/licenses/COPYING.LESSER
trunk/device/org.maemo.esbox.device-feature/licenses/epl-v10.html
trunk/device/org.maemo.esbox.device.core/
trunk/device/org.maemo.esbox.device.core/.classpath
trunk/device/org.maemo.esbox.device.core/.project
trunk/device/org.maemo.esbox.device.core/.settings/
trunk/device/org.maemo.esbox.device.core/.settings/org.eclipse.jdt.core.prefs
trunk/device/org.maemo.esbox.device.core/META-INF/
trunk/device/org.maemo.esbox.device.core/META-INF/MANIFEST.MF
trunk/device/org.maemo.esbox.device.core/build.properties
trunk/device/org.maemo.esbox.device.core/src/
trunk/device/org.maemo.esbox.device.core/src/org/
trunk/device/org.maemo.esbox.device.core/src/org/maemo/
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/DeviceMachineFactory.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/adapters/
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/adapters/ISbrshAutoconfigurationAdapter.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/ISBRSHMachine.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHCommandConfiguration.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHConfigurationFile.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHConfigurationFileFactory.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHDeviceMachineController.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHMount.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHTarget.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/Activator.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHFileSystemAccess.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHFileSystemMapping.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHMachine.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHProcessLauncher.java
trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHProcessLauncherFactory.java
trunk/device/org.maemo.esbox.device.launch/
trunk/device/org.maemo.esbox.device.launch/.classpath
trunk/device/org.maemo.esbox.device.launch/.project
trunk/device/org.maemo.esbox.device.launch/.settings/
trunk/device/org.maemo.esbox.device.launch/.settings/org.eclipse.jdt.core.prefs
trunk/device/org.maemo.esbox.device.launch/META-INF/
trunk/device/org.maemo.esbox.device.launch/META-INF/MANIFEST.MF
trunk/device/org.maemo.esbox.device.launch/build.properties
trunk/device/org.maemo.esbox.device.launch/plugin.xml
trunk/device/org.maemo.esbox.device.launch/src/
trunk/device/org.maemo.esbox.device.launch/src/org/
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/FileToTransfer.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/IESboxDeviceLaunchHelpContextID.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocol.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocolType.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocol.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocolType.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/AddEditFileToDownloadDialog.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/AddFilesToDownloadDialog.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/FilesBlock.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/LaunchUIMessages.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/LaunchUIMessages.properties
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHFileGUIEditorDialog.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHFileTextEditorDialog.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHLaunchProtocolPage.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHMountEditorDialog.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SSHLaunchProtocolPage.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/internal/
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/internal/device/
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/internal/device/launch/
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/internal/device/launch/Activator.java
trunk/device/org.maemo.esbox.device.tests/
trunk/device/org.maemo.esbox.device.tests/.classpath
trunk/device/org.maemo.esbox.device.tests/.project
trunk/device/org.maemo.esbox.device.tests/.settings/
trunk/device/org.maemo.esbox.device.tests/.settings/org.eclipse.jdt.core.prefs
trunk/device/org.maemo.esbox.device.tests/META-INF/
trunk/device/org.maemo.esbox.device.tests/META-INF/MANIFEST.MF
trunk/device/org.maemo.esbox.device.tests/build.properties
trunk/device/org.maemo.esbox.device.tests/src/
trunk/device/org.maemo.esbox.device.tests/src/org/
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/TestSSHFileSystemOnMaemoDevice.java
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHConfigurationFile.java
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHFileSystemMapping.java
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHMachine.java
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHProcessLauncherFactory.java
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/internal/
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/internal/device/
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/internal/device/tests/
trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/internal/device/tests/TestActivator.java
trunk/device/org.maemo.esbox.device.ui/
trunk/device/org.maemo.esbox.device.ui/.classpath
trunk/device/org.maemo.esbox.device.ui/.project
trunk/device/org.maemo.esbox.device.ui/.settings/
trunk/device/org.maemo.esbox.device.ui/.settings/org.eclipse.jdt.core.prefs
trunk/device/org.maemo.esbox.device.ui/META-INF/
trunk/device/org.maemo.esbox.device.ui/META-INF/MANIFEST.MF
trunk/device/org.maemo.esbox.device.ui/build.properties
trunk/device/org.maemo.esbox.device.ui/src/
trunk/device/org.maemo.esbox.device.ui/src/org/
trunk/device/org.maemo.esbox.device.ui/src/org/maemo/
trunk/device/org.maemo.esbox.device.ui/src/org/maemo/esbox/
trunk/device/org.maemo.esbox.device.ui/src/org/maemo/esbox/internal/
trunk/device/org.maemo.esbox.device.ui/src/org/maemo/esbox/internal/device/
trunk/device/org.maemo.esbox.device.ui/src/org/maemo/esbox/internal/device/ui/
trunk/device/org.maemo.esbox.device.ui/src/org/maemo/esbox/internal/device/ui/UIActivator.java
trunk/linux/
trunk/linux/org.maemo.esbox.linux-feature/
trunk/linux/org.maemo.esbox.linux-feature/.project
trunk/linux/org.maemo.esbox.linux-feature/build.properties
trunk/linux/org.maemo.esbox.linux-feature/feature.xml
trunk/linux/org.maemo.esbox.linux-feature/license.html
trunk/linux/org.maemo.esbox.linux-feature/licenses/
trunk/linux/org.maemo.esbox.linux-feature/licenses/COPYING
trunk/linux/org.maemo.esbox.linux-feature/licenses/COPYING.LESSER
trunk/linux/org.maemo.esbox.linux-feature/licenses/epl-v10.html
trunk/linux/org.maemo.esbox.linux.autotools.core/
trunk/linux/org.maemo.esbox.linux.autotools.core/.classpath
trunk/linux/org.maemo.esbox.linux.autotools.core/.project
trunk/linux/org.maemo.esbox.linux.autotools.core/.settings/
trunk/linux/org.maemo.esbox.linux.autotools.core/.settings/org.eclipse.jdt.core.prefs
trunk/linux/org.maemo.esbox.linux.autotools.core/META-INF/
trunk/linux/org.maemo.esbox.linux.autotools.core/META-INF/MANIFEST.MF
trunk/linux/org.maemo.esbox.linux.autotools.core/build.properties
trunk/linux/org.maemo.esbox.linux.autotools.core/src/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/Activator.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfConfigurationFile.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfMacroCallVisitor.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfMacroUtils.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModel.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModelMacroCall.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModelObject.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfPackageCheck.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfPackageCheckModule.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/IAutoconfElementAccess.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/AutoconfModelProvider.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfAutomakeBridge.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfModelFactory.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfWorkspaceModelProvider.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutotoolsPackageManagerBridge.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/EAutoconfPackageCheckOperator.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfConfigurationFile.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfModel.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfModelMacroCall.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfOwnedModel.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfPackageCheck.java
trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfPackageCheckModule.java
trunk/linux/org.maemo.esbox.linux.autotools.ui/
trunk/linux/org.maemo.esbox.linux.autotools.ui/.classpath
trunk/linux/org.maemo.esbox.linux.autotools.ui/.project
trunk/linux/org.maemo.esbox.linux.autotools.ui/.settings/
trunk/linux/org.maemo.esbox.linux.autotools.ui/.settings/org.eclipse.jdt.core.prefs
trunk/linux/org.maemo.esbox.linux.autotools.ui/META-INF/
trunk/linux/org.maemo.esbox.linux.autotools.ui/META-INF/MANIFEST.MF
trunk/linux/org.maemo.esbox.linux.autotools.ui/build.properties
trunk/linux/org.maemo.esbox.linux.autotools.ui/src/
trunk/linux/org.maemo.esbox.linux.autotools.ui/src/org/
trunk/linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/
trunk/linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/
trunk/linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal/
trunk/linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal/linux/
trunk/linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal/linux/autotools/
trunk/linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal/linux/autotools/ui/
trunk/linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal/linux/autotools/ui/UIActivator.java
trunk/linux/org.maemo.esbox.linux.packages.core/
trunk/linux/org.maemo.esbox.linux.packages.core/.classpath
trunk/linux/org.maemo.esbox.linux.packages.core/.project
trunk/linux/org.maemo.esbox.linux.packages.core/.settings/
trunk/linux/org.maemo.esbox.linux.packages.core/.settings/org.eclipse.jdt.core.prefs
trunk/linux/org.maemo.esbox.linux.packages.core/META-INF/
trunk/linux/org.maemo.esbox.linux.packages.core/META-INF/MANIFEST.MF
trunk/linux/org.maemo.esbox.linux.packages.core/build.properties
trunk/linux/org.maemo.esbox.linux.packages.core/plugin.xml
trunk/linux/org.maemo.esbox.linux.packages.core/schema/
trunk/linux/org.maemo.esbox.linux.packages.core/schema/packageManagerProvider.exsd
trunk/linux/org.maemo.esbox.linux.packages.core/schema/packageMapping.exsd
trunk/linux/org.maemo.esbox.linux.packages.core/src/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/Activator.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/AptSystemPackage.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/BasePackage.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/BuildPackageMapping.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PackageManagerBase.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PackageMapper.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PkgConfigBuildPackage.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PkgConfigScannerEngine.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/EPackageCategory.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IAptRepository.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IBuildPackage.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IBuildPackageMapping.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IImplicitBuildPackage.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackage.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackageManager.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackageManagerProvider.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPkgConfigBuildPackage.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPkgConfigScanner.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IRepository.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/ISystemPackage.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/PackageManagerProvider.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/aptpkgconfig/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/aptpkgconfig/AptPackageManager.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/debian/
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/debian/DebianPackageInstaller.java
trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/debian/DebianScriptLauncher.java
trunk/linux/org.maemo.esbox.linux.packages.core/utils/
trunk/linux/org.maemo.esbox.linux.packages.core/utils/scan-pkgconfig.sh
trunk/linux/org.maemo.esbox.linux.packages.ui/
trunk/linux/org.maemo.esbox.linux.packages.ui/.classpath
trunk/linux/org.maemo.esbox.linux.packages.ui/.project
trunk/linux/org.maemo.esbox.linux.packages.ui/.settings/
trunk/linux/org.maemo.esbox.linux.packages.ui/.settings/org.eclipse.jdt.core.prefs
trunk/linux/org.maemo.esbox.linux.packages.ui/META-INF/
trunk/linux/org.maemo.esbox.linux.packages.ui/META-INF/MANIFEST.MF
trunk/linux/org.maemo.esbox.linux.packages.ui/build.properties
trunk/linux/org.maemo.esbox.linux.packages.ui/plugin.xml
trunk/linux/org.maemo.esbox.linux.packages.ui/src/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal/linux/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal/linux/packages/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal/linux/packages/ui/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal/linux/packages/ui/UIActivator.java
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/DeployDebianPackageWizard.java
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/DeployDebianPackageWizardPage.java
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/ProjectPackageInstaller.java
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/CreateDebianPackageAction.java
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/DeployDebianPackageAction.java
trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/ValidatePackagesCommand.java
trunk/linux/org.maemo.esbox.linux.tests/
trunk/linux/org.maemo.esbox.linux.tests/.classpath
trunk/linux/org.maemo.esbox.linux.tests/.project
trunk/linux/org.maemo.esbox.linux.tests/.settings/
trunk/linux/org.maemo.esbox.linux.tests/.settings/org.eclipse.jdt.core.prefs
trunk/linux/org.maemo.esbox.linux.tests/META-INF/
trunk/linux/org.maemo.esbox.linux.tests/META-INF/MANIFEST.MF
trunk/linux/org.maemo.esbox.linux.tests/build.properties
trunk/linux/org.maemo.esbox.linux.tests/data/
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/.cproject
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/.project
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/Makefile.am
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/aclocal.m4
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/autogen.sh
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.badpkgmacros
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.check
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.newstyle
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.noautomake
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/data/
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/data/Makefile.am
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/Makefile.am
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/appdata.h
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/main.c
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/callbacks.c
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/callbacks.h
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/interface.c
trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/interface.h
trunk/linux/org.maemo.esbox.linux.tests/src/
trunk/linux/org.maemo.esbox.linux.tests/src/org/
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal/
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal/linux/
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal/linux/tests/
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal/linux/tests/noexport/
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal/linux/tests/noexport/TestActivator.java
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/ManualTestPackageManager.java
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestAutoconfModel.java
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestBuildPackageMapper.java
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestBuildPackageMapping.java
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestPkgConfigScanner.java
trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestScratchboxPackageProvider.java
trunk/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk-feature/
trunk/maemosdk/org.maemo.esbox.maemosdk-feature/.project
trunk/maemosdk/org.maemo.esbox.maemosdk-feature/build.properties
trunk/maemosdk/org.maemo.esbox.maemosdk-feature/feature.xml
trunk/maemosdk/org.maemo.esbox.maemosdk-feature/license.html
trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/
trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/COPYING.LESSER
trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/epl-v10.html
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.classpath
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.project
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.settings/
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.settings/org.eclipse.jdt.core.prefs
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/META-INF/
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/META-INF/MANIFEST.MF
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/build.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/plugin.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/Activator.java
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/AnalysisAdapterFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/OProfileSupportAdapter.java
trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/ValgrindSupportAdapter.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/.classpath
trunk/maemosdk/org.maemo.esbox.maemosdk.core/.project
trunk/maemosdk/org.maemo.esbox.maemosdk.core/.settings/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/.settings/org.eclipse.jdt.core.prefs
trunk/maemosdk/org.maemo.esbox.maemosdk.core/META-INF/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/META-INF/MANIFEST.MF
trunk/maemosdk/org.maemo.esbox.maemosdk.core/build.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.core/conf/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/conf/run.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.core/plugin.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.core/schema/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/schema/maemo_sdk.exsd
trunk/maemosdk/org.maemo.esbox.maemosdk.core/schema/platform.exsd
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/MaemoSDKEngine.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/MaemoSDKInfo.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/platform/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/platform/PlatformEngine.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/platform/PlatformInfo.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/Activator.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoDefaultExecutionEnvironmentAdapter.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoDefaultExecutionEnvironmentFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoGdbServerSupportAdapter.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoGdbServerSupportAdapterFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoRunStandaloneAdapter.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoRunStandaloneSupportAdapterFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoSbrshAutoconfigurationAdapter.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoSbrshAutoconfigurationAdapterFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommandAbstractor.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateMaemoRootstrapSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetGdbQemuCommandPatternCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetMaemoRootstrapLocationCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetVesionScratchboxCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/KillallCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListAvailableMaemoRootstrapsSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListDevkitsCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListInstalledMaemoRootstrapsSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListSessionsCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListTargetsCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoRootstrapSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveMaemoRootstrapSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ResetTargetCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RootstrapCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidOperationException.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidParameterException.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SelectTargetCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowPathMappingSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowTargetCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SimpleCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/AddSbrshCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/ConfigureSbrshCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/MountTargetSbrshCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/UnmountTargetSbrshCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/BaseScratchboxSDKTarget.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/IScratchboxSDKPlatformArchitectureProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1FileSystemMapping.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1ProcessLauncher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1ProcessLauncherFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1SDK.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1SDKTarget.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2FileSystemMapping.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2ProcessLauncher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2ProcessLauncherFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2SDK.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2SDKTarget.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/ScratchboxSDK.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/providers/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/providers/Scratchbox1SDKProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/providers/Scratchbox2SDKProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/OldStyleProjectProperties.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/OldStyleWorkspaceProjectPropertiesProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/ScratchboxPackageManagerProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/ScratchboxPropertyTester.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/BaseScratchboxExecutionEnvironment.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/GTKExecutionEnvironment.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/MaemoExecutionEnvironment.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/X11ExecutionEnvironment.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ESboxScriptLauncher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoLauncher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoRootstrap.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/PersistentCache.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxException.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxFacade.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxTarget.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxTargetSwitcher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/XLauncher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox1SDK.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox1SDKTarget.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox2SDK.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox2SDKTarget.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDK.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDKTarget.java
trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKFacade.java
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/.project
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/META-INF/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/META-INF/MANIFEST.MF
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/build.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/plugin.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/plugin.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/COPYING.LESSER
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/autogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/configure.ac
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/main.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/mywindow.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/mywindow.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/COPYING.LESSER
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/autogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/configure.ac
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/main.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/mywindow.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/mywindow.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/COPYING.LESSER
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/autogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/configure.ac
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/main.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/mywindow.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/mywindow.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/COPYING.LESSER
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/autogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/configure.ac
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/LINGUAS.htm
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/POTFILES.in
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/en_GB.po
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/pt_BR.po
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/helloworld.htm
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/main.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/mywindow.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/mywindow.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/COPYING.LESSER
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/autogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/configure.ac
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/main.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/mywindow.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/mywindow.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/autogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/configure.ac
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/src/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/COPYING.LESSER
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/Makefile
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/src/helloworld.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/autogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/configure.ac
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/com.nokia.hello-world-applet.service.in
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/hello-world-applet.desktop.in
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/26x26/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/26x26/hello-world.26.png
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/40x40/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/40x40/hello-world.40.png
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/scalable/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/scalable/hello-world.64.png
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/changelog
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/control
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/copyright
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/maemo-hello-world-applet.install
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/postinst
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/rules
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/hello-world-home.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/hello-world-home.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/libhelloworld.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/libhelloworld.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/autogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/configure.ac
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/Makefile.in
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/PACKAGE.desktop.in
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/com.nokia.PACKAGE.service.in
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/changelog
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/control
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/copyright
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/postinst
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/rules.in
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/ChangeLog
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/POTFILES.in
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/localisation.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/main.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/COPYING.LESSER
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/Makefile
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/src/main.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/COPYING.LESSER
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/Makefile
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/src/main.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/autogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/configure.ac
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/com.nokia.maemopad.service
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/help/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/help/en_GB/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/help/en_GB/MaemoPad.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/26x26/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/26x26/maemopad.png
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/40x40/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/40x40/maemopad.png
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/scalable/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/scalable/maemopad.png
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/maemopad.desktop
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/changelog
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/control
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/copyright
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/maemopad.install
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/maemopad.links
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/rules
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po/POTFILES.in
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po/en_GB.po
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/appdata.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/main.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/callbacks.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/callbacks.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/interface.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/interface.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/AUTHORS
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/ChangeLog
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/NEWS
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/README
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/autogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/configure.ac
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project.desktop
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project.service
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project_help.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/changelog
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/control
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/rules
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/maemogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/ChangeLog
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/Makefile.in.in
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/POTFILES.in
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/callbacks.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/callbacks.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/interface.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.gob
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-project.glade
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/main.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/support.c
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/support.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/COPYING.LESSER
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/autogen.sh
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/configure.ac
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/Makefile.am
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/client.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/client.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/main-client.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/main-server.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-client.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-client.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-server.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-server.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/server.cpp
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/server.h
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/.project
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/META-INF/
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/META-INF/MANIFEST.MF
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/build.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/plugin.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/plugin.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/EmptyProject/
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/EmptyProject/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/COPYING
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/COPYING.LESSER
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/src/hello_world.py
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/template.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/template.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.classpath
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.project
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.settings/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.settings/org.eclipse.jdt.core.prefs
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/META-INF/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/build.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/maemosdk/tests/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/maemosdk/tests/Activator.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestOProfileValgrindSupport.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestProcessLauncher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestRunStandalone.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1ProcessLauncher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1SDKProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB2ProcessLauncher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB2SDKProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/BaseTest.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockCommandAbstractor.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncher.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncherFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGdbQemuCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGetCurrentTargetCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListCommands.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListSb2Commands.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestResetTargetCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRootstrapCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxFacade.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSelectTargetCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowPathMappingSb2Command.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowTargetCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSimpleCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.classpath
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.project
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.settings/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.settings/org.eclipse.jdt.core.prefs
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/META-INF/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/build.properties
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/maemomenu_misc.gif
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/restart_co.gif
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/scratchbox_terminal.png
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/start_co.gif
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/stop_co.gif
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/xservermenu_misc.gif
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/obj16/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/obj16/maemoprj_obj.png
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/plugin.xml
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/UIActivator.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/ESboxTargetRemover.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchbox1SDKManageTargetAdapter.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/MaemoRootstrapContentLabelProvider.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/LaunchShellAction.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/MaemoDropdownMenuAction.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/ValidateVirtualMachineCommand.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/XDropdownMenuAction.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox1PreferencesPage.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox2PreferencesPage.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/BadInstallationPage.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/IValidatePage.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/NewScratchbox1TargetWizard.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/NewScratchbox2TargetWizard.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetListener.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardCPUMethod.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardCompilerPage.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardDevkitsPage.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardNamePage.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardPageFactory.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardRootstrapSb2Page.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/sbrsh/
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/sbrsh/SbrshConfigurationNFSServer.java
trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/sbrsh/SbrshConfigurationTargetDevice.java
trunk/python/
trunk/python/org.maemo.esbox.python-feature/
trunk/python/org.maemo.esbox.python-feature/.project
trunk/python/org.maemo.esbox.python-feature/TODO.txt
trunk/python/org.maemo.esbox.python-feature/build.properties
trunk/python/org.maemo.esbox.python-feature/feature.xml
trunk/python/org.maemo.esbox.python-feature/license.html
trunk/python/org.maemo.esbox.python-feature/licenses/
trunk/python/org.maemo.esbox.python-feature/licenses/COPYING
trunk/python/org.maemo.esbox.python-feature/licenses/COPYING.LESSER
trunk/python/org.maemo.esbox.python-feature/licenses/epl-v10.html
trunk/python/org.maemo.esbox.python.launch.analysis/
trunk/python/org.maemo.esbox.python.launch.analysis/.classpath
trunk/python/org.maemo.esbox.python.launch.analysis/.project
trunk/python/org.maemo.esbox.python.launch.analysis/.settings/
trunk/python/org.maemo.esbox.python.launch.analysis/.settings/org.eclipse.jdt.core.prefs
trunk/python/org.maemo.esbox.python.launch.analysis/META-INF/
trunk/python/org.maemo.esbox.python.launch.analysis/META-INF/MANIFEST.MF
trunk/python/org.maemo.esbox.python.launch.analysis/build.properties
trunk/python/org.maemo.esbox.python.launch.analysis/icons/
trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/
trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/
trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/local_obj.png
trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/oprofile_obj.png
trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/remote_obj.png
trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/valgrind_obj.png
trunk/python/org.maemo.esbox.python.launch.analysis/plugin.xml
trunk/python/org.maemo.esbox.python.launch.analysis/src/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal/python/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal/python/launch/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal/python/launch/analysis/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal/python/launch/analysis/Activator.java
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchConfigurationTabGroup.java
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchDelegate.java
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchShortcut.java
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/ui/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/ui/OProfileMainTab.java
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchConfigurationTabGroup.java
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchDelegate.java
trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchShortcut.java
trunk/python/org.maemo.esbox.python.launch/
trunk/python/org.maemo.esbox.python.launch/.classpath
trunk/python/org.maemo.esbox.python.launch/.project
trunk/python/org.maemo.esbox.python.launch/.settings/
trunk/python/org.maemo.esbox.python.launch/.settings/org.eclipse.jdt.core.prefs
trunk/python/org.maemo.esbox.python.launch/META-INF/
trunk/python/org.maemo.esbox.python.launch/META-INF/MANIFEST.MF
trunk/python/org.maemo.esbox.python.launch/about.html
trunk/python/org.maemo.esbox.python.launch/about_files/
trunk/python/org.maemo.esbox.python.launch/about_files/epl-v10.html
trunk/python/org.maemo.esbox.python.launch/build.properties
trunk/python/org.maemo.esbox.python.launch/icons/
trunk/python/org.maemo.esbox.python.launch/icons/full/
trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/
trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/local_obj.png
trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/oprofile_obj.png
trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/remote_obj.png
trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/valgrind_obj.png
trunk/python/org.maemo.esbox.python.launch/plugin.xml
trunk/python/org.maemo.esbox.python.launch/src/
trunk/python/org.maemo.esbox.python.launch/src/org/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/internal/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/internal/python/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/internal/python/launch/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/internal/python/launch/Activator.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/AbstractLaunchShortcut.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/AbstractPythonLaunchDelegate.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/BasePythonLaunchParameterAccessor.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ESboxAbstractPythonConfigurationTabGroup.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ESboxPythonAbstractLaunchDelegate.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/IESboxPythonLaunchConstants.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PydevDebugScriptCopier.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLaunchConfigurationData.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLaunchUtils.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLocalLaunchParameterAccessor.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLocalLaunchProxy.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonRemoteLaunchParameterAccessor.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonRemoteLaunchProxy.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonDebugger.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonRemoteDebugger.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonSourceLocator.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonSourceLookupParticipant.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/PythonDebugger.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalLaunchShortcut.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalRunConfigurationTabGroup.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalRunLaunchDelegate.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/ESboxPythonRemoteLaunchDelegate.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/ESboxPythonRemoteRunLaunchShortcut.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/EsboxPythonRemoteRunConfigurationTabGroup.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ui/
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ui/ArgumentsTab.java
trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ui/MainModuleTab.java
trunk/python/org.maemo.esbox.python.project.core/
trunk/python/org.maemo.esbox.python.project.core/.classpath
trunk/python/org.maemo.esbox.python.project.core/.project
trunk/python/org.maemo.esbox.python.project.core/.settings/
trunk/python/org.maemo.esbox.python.project.core/.settings/org.eclipse.jdt.core.prefs
trunk/python/org.maemo.esbox.python.project.core/META-INF/
trunk/python/org.maemo.esbox.python.project.core/META-INF/MANIFEST.MF
trunk/python/org.maemo.esbox.python.project.core/build.properties
trunk/python/org.maemo.esbox.python.project.core/plugin.xml
trunk/python/org.maemo.esbox.python.project.core/src/
trunk/python/org.maemo.esbox.python.project.core/src/org/
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal/
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal/python/
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal/python/project/
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal/python/project/core/
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal/python/project/core/Activator.java
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonBuildConfiguration.java
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonConfigHandler.java
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectCreatorConverter.java
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectHandle.java
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectNature.java
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectType.java
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/OldESboxPythonProjectNature.java
trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/PythonPropertyTester.java
trunk/python/org.maemo.esbox.python.project.ui/
trunk/python/org.maemo.esbox.python.project.ui/.classpath
trunk/python/org.maemo.esbox.python.project.ui/.project
trunk/python/org.maemo.esbox.python.project.ui/.settings/
trunk/python/org.maemo.esbox.python.project.ui/.settings/org.eclipse.jdt.core.prefs
trunk/python/org.maemo.esbox.python.project.ui/META-INF/
trunk/python/org.maemo.esbox.python.project.ui/META-INF/MANIFEST.MF
trunk/python/org.maemo.esbox.python.project.ui/build.properties
trunk/python/org.maemo.esbox.python.project.ui/icons/
trunk/python/org.maemo.esbox.python.project.ui/icons/full/
trunk/python/org.maemo.esbox.python.project.ui/icons/full/obj16/
trunk/python/org.maemo.esbox.python.project.ui/icons/full/obj16/maemopythonprj_obj.png
trunk/python/org.maemo.esbox.python.project.ui/icons/full/wizban/
trunk/python/org.maemo.esbox.python.project.ui/icons/full/wizban/newmaemoprj_wiz.png
trunk/python/org.maemo.esbox.python.project.ui/plugin.xml
trunk/python/org.maemo.esbox.python.project.ui/src/
trunk/python/org.maemo.esbox.python.project.ui/src/org/
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project/
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project/ui/
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project/ui/ESboxOldPythonBuildTargetPropertyPage.java
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project/ui/UIActivator.java
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python/
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python/project/
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python/project/ui/
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python/project/ui/wizards/
trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python/project/ui/wizards/PythonProjectWizard.java
trunk/python/org.maemo.esbox.python.tests/
trunk/python/org.maemo.esbox.python.tests/.classpath
trunk/python/org.maemo.esbox.python.tests/.project
trunk/python/org.maemo.esbox.python.tests/.settings/
trunk/python/org.maemo.esbox.python.tests/.settings/org.eclipse.jdt.core.prefs
trunk/python/org.maemo.esbox.python.tests/META-INF/
trunk/python/org.maemo.esbox.python.tests/META-INF/MANIFEST.MF
trunk/python/org.maemo.esbox.python.tests/build.properties
trunk/python/org.maemo.esbox.python.tests/data/
trunk/python/org.maemo.esbox.python.tests/data/convert/
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/.cproject
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/.project
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/Makefile
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/src/
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/src/helloworld.c
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/.cproject
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/.project
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/Makefile
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/src/
trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/src/helloworld.c
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/.project
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/Makefile
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/src/
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/src/helloworld.c
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/.cproject
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/.project
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/COPYING
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/COPYING.LESSER
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/Makefile
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/src/
trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/src/helloworld.c
trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/
trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/.project
trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/.pydevproject
trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/src/
trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/src/hello_world.py
trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/
trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.esbox_settings
trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.project
trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.pydevproject
trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/src/
trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/src/hello_world.py
trunk/python/org.maemo.esbox.python.tests/src/
trunk/python/org.maemo.esbox.python.tests/src/org/
trunk/python/org.maemo.esbox.python.tests/src/org/maemo/
trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/
trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/internal/
trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/internal/python/
trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/internal/python/tests/
trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/internal/python/tests/TestActivator.java
trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/
trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/
trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectConverter.java
trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectProperties.java
trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectType.java
Removed:
trunk/org.indt.esbox.core/
trunk/org.indt.esbox.debug/
trunk/org.indt.esbox.feature/
trunk/org.indt.esbox.help/
trunk/org.indt.esbox.launch/
trunk/org.indt.esbox.python.debug/
trunk/org.indt.esbox.python.launch/
trunk/org.indt.esbox.python.ui/
trunk/org.indt.esbox.tests/
trunk/org.indt.esbox.ui/
trunk/tmp_test/esbox_1.5_inprogress_20080814.zip
Log:
A lot of ESbox 1.5 development plus refactoring.
New features, by sprint:
* Windows hosting support
ESbox was ported to run on a non-Linux host, using a virtual Linux
machine. Currently this VM image is hosted inside Nokia; more specific
instructions for configuring your own image will be provided in the
future.
----
* Project conversion
You can convert existing projects to build with ESbox using File > New >
Convert to C/C++ Maemo Project
* apt package installation
The New C/C++ and Python project wizards will automatically install
missing build/runtime dependencies in scratchbox.
* DSF debugger integration
Programs can be run or debugged using the new DSF debugger framework,
which provides markedly faster performance for remote debugging.
Launch configurations and shortcut menus are tagged with "(DSF)". This
is experimental at the moment and there are known issues, e.g., with
terminating programs.
-----
* Build configurations
ESbox C/C++ and Python projects use build configurations instead of
using a single target per project. The <project> > ESbox Build
Configurations property page allows you to select one or more build
configurations and change the active target. In C/C++, CDT provides
additional UI to switch and build targets.
A checkbox list is used to select the build configurations. They cannot
be edited or customized individually; there is a one-to-one mapping from
build target to build configuration. This will probably be extended in
the future.
This prototype provides fully editable CDT indexer and source path
settings.
* Autotools
The Autotools for Eclipse project is integrated. You can edit *.ac,
*.m4, and *.am files with the editor provided by the project.
* Windows VM setup
ESbox will ask you for the password so you can mount the shared
directory used by the VM Linux image.
* Debugger improvements
o The warnings about invalid paths are fixed in Windows-hosted
launches (bug 7291)
o The "Invalid launch configurations" message no longer
appears (bug 7250)
o Python source mapping works with the latest version of Pydev
-----
* Build configurations
The C/C++ project model is officially migrated to use build
configurations. Any older projects must be converted first, which
changes the project irrevocably to the new format. You will see notice
of this if you look at {project} > Properties > ESbox Build
Configurations or try to build the project.
* More intelligent package installation
A new command, Project > Validate Installed Packages, will ensure that
the build packages needed by configure.ac have their corresponding
system packages installed. In this release, all the known packages
installed by the maemo-cplusplus-env metapackage and those otherwise
shipped with the Diablo and Chinook rootstraps are recognized. Any other
unrecognized build packages are ignored.
* Internal refactoring
The remote launching protocols (SSH, SBRSH) have been moved into
extension points to allow better flexibility in the future.
The ESbox > Environment pane was rewritten to be independent of CDT.
------
* Refactor plugins into separate features
Plugins have been split to ensure that dependencies are as thin as
possible between functionally distinct parts of the architecture. The
maemo and scratchbox specific features are provided as extension points
or adapters to the core.
The "common" plugins constitute the interfaces, helper classes, and
extension points which allows you to launch processes, build,
run/debug/profile, and navigate files on any host with a filesystem and
process model (host, scratchbox, device, remote machine, etc).
The "linux" plugins constitute the new autotools and package management
features mentioned above.
The "cpp" plugins constitute the project model, build system, and
run/debug model for C/C++ programs.
The "python" plugins constitute the project model, build system, and
run/debug model for Python programs.
The "device" plugins constitute the SSH and SBRSH support for running
and debugging.
The "maemosdk" plugins constitute the scratchbox and maemo-specific
support in ESbox (including project templates).
Property changes on: trunk/common/com.nokia.cpp.utils.core
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/com.nokia.cpp.utils.core/.classpath
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/.classpath (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/com.nokia.cpp.utils.core/.project
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/.project (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.nokia.cpp.utils.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/com.nokia.cpp.utils.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Fri Jul 25 18:31:21 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/com.nokia.cpp.utils.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-Name: Carbide.c++ Core Utilities
+Bundle-SymbolicName: com.nokia.cpp.utils.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: com.nokia.cpp.utils.core.noexport.UtilsCorePlugin
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;visibility:=reexport,
+ org.eclipse.core.filebuffers,
+ org.eclipse.jface,
+ org.eclipse.core.filesystem;bundle-version="1.2.0"
+Bundle-ActivationPolicy: lazy
+Export-Package: com.nokia.cpp.internal.api.utils.core
+Bundle-ManifestVersion: 2
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
Added: trunk/common/com.nokia.cpp.utils.core/build.properties
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/build.properties (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = .,\
+ META-INF/
+src.includes = src/,\
+ META-INF/
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheMap.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheMap.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheMap.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import org.eclipse.swt.graphics.Resource;
+
+import java.util.*;
+
+/**
+ * Map-like class for managing disposable objects.
+ * <p>
+ * Entries are accessed via keys. When the map is
+ * released, all entries are released. If entries
+ * implement IDisposable or like interfaces, we call
+ * their dispose() methods. Null values are not allowed.
+ */
+public class CacheMap implements IDisposable {
+
+ protected Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public Set<Object> keySet() {
+ return map.keySet();
+ }
+
+ public boolean containsKey(Object key) {
+ synchronized(map) {
+ return map.containsKey(key);
+ }
+ }
+
+ public void put(Object key, Object value) {
+ Check.checkArg(value);
+ synchronized(map) {
+ map.put(key, value);
+ }
+ }
+
+ public Object get(Object key) {
+ Object result;
+ synchronized(map) {
+ result = map.get(key);
+ }
+ return result;
+ }
+
+ public void remove(Object key) {
+ synchronized(map) {
+ map.remove(key);
+ }
+ }
+
+ public void dispose() {
+ if (map != null) {
+ // object should no longer be used after IDisposable.dispose
+ disposeAll();
+ map = null;
+ }
+ }
+
+ private void disposeObject(Object value) {
+ if (value instanceof IDisposable) {
+ IDisposable disposable = (IDisposable) value;
+ disposable.dispose();
+ }
+ else if (value instanceof Resource) {
+ Resource r = (Resource) value;
+ r.dispose();
+ }
+ }
+
+ public void disposeItem(Object key) {
+ Object item;
+ synchronized(map) {
+ item = map.remove(key);
+ }
+ if (item != null)
+ disposeObject(item);
+ }
+
+ public void disposeAll() {
+ synchronized(map) {
+ for (Iterator<Object> iter = map.values().iterator(); iter.hasNext();) {
+ Object element = iter.next();
+ disposeObject(element);
+ }
+ map.clear();
+ }
+ }
+
+ public int size() {
+ return map.size();
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ChainedIterator.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ChainedIterator.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ChainedIterator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * An iterator which manages two other iterators in sequence.
+ * @author eswartz
+ *
+ */
+public class ChainedIterator<Element> implements Iterator<Element> {
+
+ private Iterator<Element> first;
+ private Iterator<Element> second;
+
+ /**
+ *
+ */
+ public ChainedIterator(Iterator<Element> first, Iterator<Element> second) {
+ this.first = first;
+ this.second = second;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#hasNext()
+ */
+ public boolean hasNext() {
+ if (first != null) {
+ if (first.hasNext())
+ return true;
+ first = null;
+ }
+ if (second != null) {
+ if (second.hasNext())
+ return true;
+ second = null;
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#next()
+ */
+ public Element next() {
+ if (first != null)
+ return first.next();
+ else if (second != null)
+ return second.next();
+ throw new NoSuchElementException();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#remove()
+ */
+ public void remove() {
+ if (first != null)
+ first.remove();
+ else if (second != null)
+ second.remove();
+ else
+ throw new UnsupportedOperationException();
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Check.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Check.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Check.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+
+import com.nokia.cpp.utils.core.noexport.Messages;
+import com.nokia.cpp.utils.core.noexport.UtilsCorePlugin;
+
+
+/**
+ * Utilities for runtime checking of correctness.
+ *
+ * @author eswartz
+ *
+ */
+public class Check {
+ /**
+ * Report a failure. This logs the failure and reports a dialog in debug mode.
+ *
+ * @param message human-readable message
+ * @param thr the exception to report
+ */
+ public static void reportFailure(String message, Throwable thr) {
+ try {
+ IStatus status = Logging.newSimpleStatus(1 /* our caller */,
+ IStatus.ERROR,
+ message,
+ thr);
+ Logging.log(UtilsCorePlugin.getDefault(), status);
+ if (Platform.isRunning() && Platform.inDebugMode())
+ Logging.showErrorDialog(Messages.getString("Check.RuntimeError"), null, status); //$NON-NLS-1$
+ } catch (Throwable e) {
+ // ignore: don't recursively fail
+ }
+ }
+
+ /**
+ * Verify an argument is not null else throw a runtime exception
+ *
+ * It's not necessary to use this unless you're storing the object
+ * away for later use -- otherwise just deference it and let the runtime
+ * throw for you!
+ *
+ * @param obj
+ * @throws NullPointerException
+ */
+ static public void checkArg(Object obj) {
+ if (obj == null) {
+ RuntimeException thr = new NullPointerException();
+ reportFailure(Messages.getString("Check.ArgumentIsNull"), thr); //$NON-NLS-1$
+ throw thr;
+ }
+ }
+
+
+ /**
+ * Verify an argument satisfies a condition else throw a runtime exception
+ *
+ * @param condition test which must return true
+ * @throws IllegalArgumentException
+ */
+ static public void checkArg(boolean condition) {
+ if (!condition) {
+ RuntimeException thr = new IllegalArgumentException();
+ reportFailure(Messages.getString("Check.ArgumentIsInvalid"), thr); //$NON-NLS-1$
+ throw thr;
+ }
+ }
+
+ /**
+ * Verify an invariant of object state holds else throw a runtime exception.
+ * This is typically used to verify an object is internally consistent.
+ *
+ * @param condition test which must return true
+ * @throws IllegalStateException
+ */
+ static public void checkState(boolean condition) {
+ if (!condition) {
+ RuntimeException thr = new IllegalStateException();
+ reportFailure(Messages.getString("Check.ObjectIsInconsistent"), thr); //$NON-NLS-1$
+ throw thr;
+ }
+ }
+
+ /**
+ * Verify an invariant related to promised behavior holds else throw a runtime exception
+ * This is typically used to ensure a client API works as expected.
+ *
+ * @param condition test which must return true
+ * @throws AssertionError
+ */
+ static public void checkContract(boolean condition) {
+ if (!condition) {
+ AssertionError thr = new AssertionError();
+ reportFailure(Messages.getString("Check.ApiAssertionFailed"), thr); //$NON-NLS-1$
+ throw thr;
+ }
+ }
+
+ /**
+ * Throw a runtime exception to indicate a test on an argument
+ * failed due to another exception.
+ *
+ * @param thr the throwable that resulted from an argument test
+ * @throws IllegalArgumentException
+ */
+ public static void failedArg(Throwable thr) {
+ IllegalArgumentException exc = new IllegalArgumentException();
+ exc.initCause(thr);
+ throw exc;
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ClassUtils.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ClassUtils.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ClassUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import org.eclipse.core.runtime.*;
+import org.osgi.framework.Bundle;
+
+import com.nokia.cpp.utils.core.noexport.UtilsCorePlugin;
+
+import java.text.MessageFormat;
+
+/**
+ * Utilities for things involving dynamic instantation, reflection, etc.
+ *
+ */
+public abstract class ClassUtils {
+
+ /**
+ * Load a class by name.
+ * @param bundle The bundle providing the class loader context
+ * @param className the class to load, with a "<bundle-id/>" prefix to
+ * look in an alternate bundle
+ * @param expectedClass a class that the result must be assignment compatible with.
+ * @return the instantiated object, or null if loading or instantiation failed.
+ * @throws ClassNotFoundException if class is not found in bundle or in className bundle specifier
+ * @throws ClassCastException if class is not assignable to expectedClass
+ */
+ public static Class<?> loadClass(Bundle bundle, String className, Class expectedClass)
+ throws ClassNotFoundException, ClassCastException {
+ Check.checkArg(className);
+ Check.checkArg(expectedClass);
+
+ // check for class outside bundle
+ int idx = className.indexOf('/');
+ if (idx != -1) {
+ bundle = Platform.getBundle(className.substring(0, idx));
+ if (bundle != null)
+ className = className.substring(idx + 1);
+ }
+ if (bundle == null && UtilsCorePlugin.getDefault() != null)
+ bundle = UtilsCorePlugin.getDefault().getBundle();
+
+ Class<?> cls = null;
+ if (bundle != null) {
+ cls = bundle.loadClass(className);
+ cls = cls.asSubclass(expectedClass);
+ }
+ return cls;
+ }
+
+ /**
+ * Instantiate a class. Optionally logs
+ * an error if the class could not be instantiated.
+ * For logging to occur the logPlugin and logMessagePattern parameters
+ * must be provided.
+ * @param cls The loaded class.
+ * @param logPlugin The plugin to associate with the log message
+ * @param logMessagePattern The message text. This will be passed to
+ * MessageFormat.format along with the logMessageParams to dynamically
+ * create the message string.
+ * @param logMessageParams Optional parameters for the log message
+ * @return the instantiated object, or null if instantiation failed.
+ */
+ public static Object createInstanceFromClass(Class cls,
+ Plugin logPlugin, String logMessagePattern, Object logMessageParams[]) {
+ Object result = null;
+ Throwable thr = null;
+ if (cls == null) {
+ thr = new NullPointerException();
+ } else {
+ try {
+ result = cls.newInstance();
+ } catch (Throwable t) {
+ thr = t;
+ }
+ }
+ if (thr != null) {
+ // catch any throwables from user code
+ if (logPlugin != null && logMessagePattern != null) {
+ String msg = MessageFormat.format(logMessagePattern, logMessageParams);
+ Logging.log(logPlugin,
+ Logging.newStatus(logPlugin, IStatus.ERROR, msg, thr));
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Load and instantiate a class by name. Optionally logs
+ * an error if the class could not be loaded or instantiated.
+ * For logging to occur the logPlugin and logMessagePattern parameters
+ * must be provided.
+ * @param bundle The bundle providing the class loader context
+ * @param className the class to load, with a "<bundle-id/>" prefix to
+ * look in an alternate bundle
+ * @param expectedClass the expected type of the created object. Only objects
+ * compatible with this class are returned.
+ * @param logPlugin The plugin to associate with the log message
+ * @param logMessagePattern The message text. This will be passed to
+ * MessageFormat.format along with the logMessageParams to dynamically
+ * create the message string.
+ * @param logMessageParams Optional parameters for the log message
+ * @return the instantiated object, or null if loading or instantiation failed.
+ */
+ public static Object loadAndCreateInstance(Bundle bundle, String className, Class expectedClass,
+ Plugin logPlugin, String logMessagePattern, Object logMessageParams[]) {
+ Object result = null;
+ Throwable caughtThrowable = null;
+
+ try {
+ Class cls = loadClass(bundle, className, expectedClass);
+ result = cls.newInstance();
+ } catch (Throwable thr) {
+ // catch any throwables from user code
+ caughtThrowable = thr;
+ }
+
+ if (result == null && logPlugin != null && logMessagePattern != null) {
+ String msg = MessageFormat.format(logMessagePattern, logMessageParams);
+ Logging.log(logPlugin,
+ Logging.newStatus(logPlugin, IStatus.ERROR, msg, caughtThrowable));
+ }
+ return result;
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CommonPathFinder.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CommonPathFinder.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CommonPathFinder.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import java.util.List;
+
+/**
+ * Find the common base path for a list of paths.
+ * @author eswartz
+ *
+ */
+public class CommonPathFinder {
+
+ private IPath common = null;
+
+ /**
+ * Return the generated common path.
+ * @return common path, or null for empty set
+ */
+ public IPath getCommonPath() {
+ return common;
+ }
+
+ /**
+ * Reset the common path to the given directory.
+ * @param baseDir
+ */
+ public void reset(IPath baseDir) {
+ common = null;
+ addDirectory(baseDir);
+ }
+
+ /**
+ * Add a path representing a directory to the finder. The trailing
+ * slash, if any, will be removed.
+ * The common path becomes the common prefix of the current
+ * common path and the new path.
+ * @param dirPath a path with a known root (e.g. a project), or null
+ */
+ public void addDirectory(IPath dirPath) {
+ if (dirPath == null)
+ return;
+
+ IPath dir = dirPath.removeTrailingSeparator();
+ if (common == null)
+ common = dir;
+ else {
+ int matching = FileUtils.matchingFirstSegments(common, dir);
+ if (matching < common.segmentCount())
+ common = dir.uptoSegment(matching);
+ }
+ }
+
+ /**
+ * Add a path representing a file to the finder. The trailing
+ * component (assumed to be a file) will be removed.
+ * The common path becomes the common prefix of the current
+ * common path and the new path.
+ * @param filePath a path with a known root (e.g. a project), or null
+ */
+ public void addFile(IPath filePath) {
+ if (filePath == null)
+ return;
+ IPath dir = getDirectory(filePath);
+ addDirectory(dir);
+ }
+
+ /**
+ * Change a file path to a directory path. The empty path
+ * may be returned for a file without a directory.
+ * @param filePath
+ * @return
+ */
+ private IPath getDirectory(IPath filePath) {
+ filePath = filePath.removeTrailingSeparator();
+ if (filePath.segmentCount() >= 1)
+ return filePath.removeLastSegments(1);
+ return new Path("");
+ }
+
+ /**
+ * Add a list of paths representing files to the finder to
+ * determine a common base path.
+ * @param filePaths a list of paths each with a known root (e.g. a project)
+ */
+ public void addAllFiles(List<IPath> filePaths) {
+ for (IPath path : filePaths)
+ addFile(path);
+ }
+
+ /**
+ * Create a path relative to the common path.
+ * @param path one of the paths previously added to the finder
+ * @return common path relative path
+ */
+ public IPath makeRelativePath(IPath path) {
+ if (common == null)
+ return path;
+ return path.removeFirstSegments(common.segmentCount());
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/FileUtils.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/FileUtils.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/FileUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,900 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.swt.widgets.Shell;
+import org.osgi.framework.Bundle;
+
+import com.nokia.cpp.utils.core.noexport.UtilsCorePlugin;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public class FileUtils {
+
+ // special IStatus code for file modified during validateEdit
+ public static final int MODIFIED_FILES_STATUS = 1000;
+
+ /** Copy files or directories from 'from' to 'to'.
+ *
+ * Recursively descends if 'from' is a directory.
+ * Creates 'from' tail directory in 'to', e.g.:
+ * from = c:/foo/bar
+ * to = c:/temp
+ *
+ * -->
+ *
+ * c:/temp/bar
+ *
+ * @param from
+ * @param to
+ * @param filter the filename filter, or null
+ */
+ public static void copyTree(File from, File to, FileFilter filter) throws IOException {
+ File[] children;
+
+ if (!from.exists()) {
+ throw new IOException ("Source of copy \'" + from.getName() + "\' doesn't exist");
+ }
+
+ if (to.getCanonicalPath().equals(from.getCanonicalPath())) {
+ throw new IOException ("\'" + from.getName() + "\' cannot copy to itself");
+ }
+
+ if (from.isDirectory()) {
+ children = from.listFiles(filter);
+ // just like cp command, if target exist, make a new folder into
+ // the target, copy content into the target folder
+ if (to.exists()) {
+ if (to.isFile()) {
+ throw new IOException("Cannot overwrite non-directory \'" + to.getName() + "\' with directory " + from.getName());
+ }
+ // copy into new directory name grafted after the existing one
+ to = new File(to, from.getName());
+ copyTree(from, to, filter);
+ return;
+ } else {
+ // copy into new directory name
+ to.mkdir();
+ for (int i = 0; i < children.length; i++) {
+ File curto = new File(to, children[i].getName());
+
+ copyTree(children[i], curto, filter);
+ }
+ return;
+ }
+ }
+ else {
+ if (to.isDirectory()) {
+ to = new File (to, from.getName());
+ }
+ copyFile(from, to);
+ return;
+ }
+
+ }
+
+ /** Copy files or directories from 'from' to 'to'.
+ *
+ * Recursively descends if 'from' is a directory.
+ * Does not create 'from' tail directory in 'to', e.g.:
+ * from = c:/foo/bar contains a,b,c
+ * to = c:/temp
+ *
+ * -->
+ *
+ * c:/temp/a
+ * c:/temp/b
+ * c:/temp/c
+ *
+ * @param from
+ * @param to
+ * @param filter the filename filter, or null
+ */
+ public static void copyTreeNoParent(File from, File to, FileFilter filter) throws IOException {
+ File[] files;
+
+ Check.checkArg(from.isDirectory());
+
+ files = from.listFiles(filter);
+ to.mkdirs();
+
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory()) {
+ //File curto = new File(to, files[i].getName());
+ //curto.mkdirs();
+ copyTree(files[i], to, filter);
+ }
+ else {
+ File curto = new File(to, files[i].getName());
+ copyFile(files[i], curto);
+ }
+ }
+
+ }
+
+ /**
+ * Copy from an input stream to a file
+ *
+ * @param in
+ * @param to
+ * @throws IOException
+ */
+ public static void copyFile(InputStream in, File to) throws IOException {
+ FileOutputStream out = new FileOutputStream(to);
+ int len;
+ byte[] buffer = new byte[4096];
+ while ((len = in.read(buffer)) != -1) {
+ out.write(buffer, 0, len);
+ }
+ out.close();
+ in.close();
+ }
+
+ /** Copy a single file from 'from' to 'to'
+ *
+ * @param from
+ * @param to
+ * @throws IOException
+ */
+ public static void copyFile(File from, File to) throws IOException {
+ FileInputStream in = new FileInputStream(from);
+ copyFile(in, to);
+ }
+
+ /** Delete a directory tree recursively.
+ * <p>
+ * Does not delete file.
+ * @param file start point for deletion -- not itself deleted
+ */
+ public static void delTree(File file) {
+ File[] files = file.listFiles();
+ if (files != null) {
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory()) {
+ delTree(files[i]);
+ }
+ }
+ }
+ files = file.listFiles();
+ if (files != null) {
+ for (int i = 0; i < files.length; i++) {
+ files[i].delete();
+ }
+ }
+ }
+
+ /**
+ *
+ * Try our best to find the base directory of plugin among an Eclipse project,
+ * this enable us to use run JUnit without the slow JUnit Plugin test
+ *
+ * This would still fail for EMMA as the run in alternative locations that
+ * doesn't mirror our plugin.
+ *
+ * @param plugin plugin object
+ * @return URL or base of project
+ */
+ private static URL findPluginBaseWithoutLoadingPlugin(Plugin plugin) {
+ try {
+ URL url = plugin.getClass().getResource(".");
+ try {
+ // Plugin test with OSGi plugin need to resolve bundle resource
+ url = FileLocator.resolve(url);
+ } catch (NullPointerException e) {
+ // junit non plugin test, OSGi plugin is not loaded
+ } catch (IOException e) {
+ // junit non plugin test
+ }
+ java.io.File currentFile = new java.io.File(url.toURI()); //$NON-NLS-1$
+ do {
+ currentFile = currentFile.getParentFile();
+ if (currentFile.getName().equals("bin") || currentFile.getName().equals("src")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (new File(currentFile.getParentFile(), "plugin.xml").exists()) { //$NON-NLS-1$
+ // Eclipse project should have plugin.xml at root
+ try {
+ return currentFile.getParentFile().toURI().toURL();
+ } catch (MalformedURLException e) {
+ // give up and just bail out to null like before
+ return null;
+ }
+ }
+ }
+ } while (currentFile.getParentFile() != null);
+ } catch (URISyntaxException e) {
+ // give up and just bail out to null like before
+ return null;
+ }
+ return null;
+ }
+
+ public static File pluginRelativeFile(Plugin plugin, String file) throws IOException {
+ Check.checkArg(plugin);
+ Bundle bundle = plugin.getBundle();
+ if (bundle == null) {
+ // If we are a JUnit test, not a JUnit Plugin test
+ // the plugin will not be loaded(hence bundle is not there)
+ // instead the test will fake the plugin by declaring
+ // the plugin
+ URL url = findPluginBaseWithoutLoadingPlugin(plugin);
+ if (url == null)
+ return null;
+ return new File(url.getPath(), file);
+ } else {
+ URL url = FileLocator.find(bundle, new Path("."), null); //$NON-NLS-1$
+ if (url == null)
+ return null;
+ url = FileLocator.resolve(url);
+ return new File(url.getPath(), file);
+ }
+ }
+
+ /**
+ * Convert the path to a path relative to the base, if possible.
+ * @param rootPath full path to base
+ * @param cpath full path to resource
+ * @return new path (base-relative) or null if not resolvable to base
+ */
+ static public IPath removePrefixFromPath(IPath rootPath, IPath cpath) {
+ if (matchingFirstSegments(rootPath, cpath) == rootPath.segmentCount()) {
+ IPath suffix = cpath.removeFirstSegments(rootPath.segmentCount());
+ return suffix.setDevice(null);
+ }
+ return null;
+ }
+
+ /**
+ * Convert the path to a path in the workspace, if possible.
+ * Either the path comes in as a path pointing inside the
+ * workspace, or we can find a linked resource which aliases
+ * to the same location.
+ * @param cpath full filesystem path to resource
+ * @return new path (workspace-relative) or null if not resolvable to workspace
+ */
+ static public IPath convertToWorkspacePath(IPath cpath) {
+ return convertToWorkspacePath(cpath, false);
+ }
+
+ /**
+ * Convert the path to a path in the workspace, if possible.
+ * Either the path comes in as a path pointing inside the
+ * workspace, or we can find a linked resource which aliases
+ * to the same location.
+ * @param cpath full filesystem path to resource
+ * @param makeCanonical if true, work from the canonical path if possible
+ * (recommended)
+ * @return new path (workspace-relative) or null if not resolvable to workspace
+ */
+ static public IPath convertToWorkspacePath(IPath cpath, boolean makeCanonical) {
+ return convertToWorkspacePath(cpath, makeCanonical, true);
+ }
+ /**
+ * Convert the path to a path in the workspace, if possible.
+ * Either the path comes in as a path pointing inside the
+ * workspace, or we can find a linked resource which aliases
+ * to the same location.
+ * @param cpath full filesystem path to resource
+ * @param makeCanonical if true, work from the canonical path if possible
+ * (recommended)
+ * @param resolveLinks if true, look for project paths which reference files outside
+ * the workspace via links (very slow)
+ * @return new path (workspace-relative) or null if not resolvable to workspace
+ */
+ static public IPath convertToWorkspacePath(IPath cpath, boolean makeCanonical, boolean resolveLinks) {
+ if (!Platform.isRunning() || cpath == null)
+ return null;
+
+ if (makeCanonical) {
+ try {
+ // Since we have a filesystem path, try using the filesystem
+ // and Java's smarter APIs to fix the caps early.
+ // Watch out for the device being set incorrectly, though.
+ String device = cpath.getDevice();
+ cpath = new Path(cpath.toFile().getCanonicalPath()).setDevice(device);
+ } catch (IOException e) {
+ // Something's wrong with the path; just use it as-is
+ }
+ }
+
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IFile file = root.getFileForLocation(cpath);
+ if (file != null) {
+ return file.getFullPath().setDevice(null);
+ }
+
+ if (resolveLinks) {
+ // try to see if a linked resource points to this
+ IFile[] files = root.findFilesForLocation(cpath);
+ IPath newPath = null;
+ if (files.length > 0)
+ newPath = files[0].getFullPath().setDevice(null);
+ else {
+ IContainer[] folders = root.findContainersForLocation(cpath);
+ if (folders.length > 0)
+ newPath = folders[0].getFullPath().setDevice(null);
+ }
+ return newPath;
+ }
+
+ return null;
+ }
+
+ /**
+ * Convert the full path to a full path inside the workspace, if possible.
+ * (E.g. change a linked resource to the real full path.)
+ * <p>
+ * Either the path comes in as a path pointing inside the
+ * workspace, or we can find a linked resource which aliases
+ * to the same location.
+ * @param cpath full filesystem path
+ * @return same cpath, new path, or null if not resolvable to workspace
+ */
+ static public IPath convertToWorkspaceLocation(IPath cpath) {
+ if (!Platform.isRunning())
+ return null;
+
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IPath rootPath = root.getLocation();
+ IPath newPath = convertToWorkspacePath(cpath);
+ if (newPath == null)
+ return null;
+
+ // convert to full path
+ return rootPath.append(newPath);
+ }
+
+ /**
+ * Variant of routine that works with case-insensitive matching.
+ * @see IPath#matchingFirstSegments(IPath)
+ */
+ public static int matchingFirstSegments(IPath my, IPath anotherPath) {
+ if (my == null || anotherPath == null)
+ return 0;
+ int anotherPathLen = anotherPath.segmentCount();
+ int max = Math.min(my.segmentCount(), anotherPathLen);
+ int count = 0;
+ for (int i = 0; i < max; i++) {
+ if (!my.segment(i).equalsIgnoreCase(anotherPath.segment(i))) {
+ return count;
+ }
+ count++;
+ }
+ return count;
+ }
+
+ /**
+ * Map the given file to a path in the current workspace.
+ * @param file
+ * @return the IFile for the file
+ * @deprecated this function is broken since it doesn't resolve linked resources.
+ */
+ public static IFile convertFileToIFile(IContainer container, File file) {
+ IPath path = new Path(file.getAbsolutePath());
+ IPath rootPath = container.getLocation();
+
+ // this is BUGGY! Case sensitive for some dumb reason
+ //int match = path.matchingFirstSegments(rootPath);
+ int match = matchingFirstSegments(path, rootPath);
+ Check.checkState(match >= rootPath.segmentCount());
+
+ path = path.removeFirstSegments(match);
+ IFile wsFile = container.getFile(path);
+ return wsFile;
+ }
+
+ /**
+ * Map the given file to a path in the current workspace.
+ * @param file
+ * @return the IFile for the file, or null if the file is not in the workspace
+ */
+ public static IFile convertFileToIFile(File file) {
+ IPath path = new Path(file.getAbsolutePath());
+
+ IPath wsPath = convertToWorkspacePath(path, true);
+ if (wsPath != null)
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(wsPath);
+
+ return null;
+
+ /*
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IPath rootPath = root.getRawLocation();
+
+ // this is BUGGY! Case sensitive for some dumb reason
+ //int match = path.matchingFirstSegments(rootPath);
+ int match = matchingFirstSegments(path, rootPath);
+ if (match < rootPath.segmentCount())
+ return null;
+
+ path = path.removeFirstSegments(match);
+ IFile wsFile = root.getFile(path);
+
+ return wsFile;
+ */
+ }
+
+ /**
+ * Map the given file to a resource in the current workspace. This only handles
+ * files that map to known workspace resources.
+ * @param file
+ * @return the IResource for the file, or null if the file is not in the workspace or doesn't
+ * exist.
+ */
+ public static IResource convertFileToExistingResource(File file) {
+ IPath path = new Path(file.getAbsolutePath());
+
+ IPath wsPath = convertToWorkspacePath(path, true);
+ if (wsPath != null)
+ return ResourcesPlugin.getWorkspace().getRoot().findMember(wsPath);
+
+ return null;
+ }
+
+ /**
+ * Return the project for the given workspace-relative path.
+ */
+ public static IProject projectForPath(IPath path) {
+ IProject result = null;
+ if (path != null) {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ result = root.getProject(path.segment(0));
+ }
+ return result;
+ }
+
+ /**
+ * Read contents of a file into an array
+ * @param file
+ * @param encoding (null = system default)
+ * @return array of text
+ * @throws CoreException wrapping java.io.FileException
+ */
+ public static char[] readFileContents(File file, String encoding) throws CoreException {
+ Check.checkArg(file);
+ FileInputStream fis;
+ try {
+ fis = new FileInputStream(file);
+ return readInputStreamContents(fis, encoding);
+ } catch (IOException e) {
+ throw new CoreException(createErrorStatus(e));
+ }
+ }
+
+ /**
+ * Read contents of a file into an array
+ * @param is input stream
+ * @param encoding (null is system default)
+ * @return array of text
+ * @throws CoreException wrapping java.io.FileException
+ */
+ public static char[] readInputStreamContents(InputStream is, String encoding) throws CoreException {
+ Check.checkArg(is);
+
+ Reader reader;
+ try {
+ if (encoding != null)
+ reader = new InputStreamReader(is, encoding);
+ else
+ reader = new InputStreamReader(is);
+
+ return readReaderContents(reader);
+ } catch (UnsupportedEncodingException e) {
+ throw new CoreException(createErrorStatus(e));
+ }
+ }
+
+ /**
+ * Read contents of a file into an array
+ * @param file
+ * @param encoding (null = system default)
+ * @return array of text
+ * @throws CoreException wrapping java.io.FileException
+ */
+ public static char[] readReaderContents(Reader reader) throws CoreException {
+ Check.checkArg(reader);
+ try {
+ char[] buf = new char[1024];
+ StringBuffer sb = new StringBuffer();
+ int len;
+ while ((len = reader.read(buf)) > 0) {
+ sb.append(buf, 0, len);
+ }
+ reader.close();
+ return sb.toString().toCharArray();
+ } catch (UnsupportedEncodingException e) {
+ throw new CoreException(createErrorStatus(e));
+ } catch (IOException e) {
+ throw new CoreException(createErrorStatus(e));
+ }
+ }
+
+ /**
+ * Write contents of a file from an array
+ * @param file
+ * @param encoding (null = system default)
+ * @throws CoreException wrapping java.io.FileException
+ */
+ public static void writeFileContents(File file, char[] text, String encoding) throws CoreException {
+ Check.checkArg(file);
+ FileOutputStream fos;
+ try {
+ fos = new FileOutputStream(file);
+ writeOutputStreamContents(fos, text, encoding);
+ } catch (IOException e) {
+ throw new CoreException(createErrorStatus(e));
+ }
+ }
+
+ /**
+ * Write contents on array to an output stream
+ * @param os output stream
+ * @param encoding (null is system default)
+ * @return array of text
+ * @throws CoreException wrapping java.io.FileException
+ */
+ public static void writeOutputStreamContents(OutputStream os, char[] text, String encoding) throws CoreException {
+ Check.checkArg(os);
+
+ Writer writer;
+ try {
+ if (encoding != null)
+ writer = new OutputStreamWriter(os, encoding);
+ else
+ writer = new OutputStreamWriter(os);
+
+ writeWriterContents(writer, text);
+ } catch (UnsupportedEncodingException e) {
+ throw new CoreException(createErrorStatus(e));
+ }
+ }
+
+ /**
+ * Write contents of an array to a file
+ * @param file
+ * @param encoding (null = system default)
+ * @throws CoreException wrapping java.io.FileException
+ */
+ public static void writeWriterContents(Writer writer, char[] text) throws CoreException {
+ Check.checkArg(writer);
+ try {
+ try {
+ writer.write(text, 0, text.length);
+ } finally {
+ writer.close();
+ }
+ } catch (UnsupportedEncodingException e) {
+ throw new CoreException(createErrorStatus(e));
+ } catch (IOException e) {
+ throw new CoreException(createErrorStatus(e));
+ }
+ }
+
+
+ /**
+ * Returns whether pathSegment is a valid part of a path in a Carbide project.
+ * This checks for file name validity and
+ * name only contains alpha-numeric -or- hyphen -or- underscrore -or- dot characters
+ *
+ * @param pathSegment the segment (file or folder name)
+ * @return true if valid
+ */
+ public static boolean isValidCarbideProjectPathSegment(String pathSegment) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ int typeMask = IResource.FILE | IResource.FOLDER;
+ boolean valid = pathSegment.length() == 0 ||
+ workspace.validateName(pathSegment, typeMask).isOK();
+ if (valid) {
+ for (int i = 0; i < pathSegment.length(); i++) {
+ char c = pathSegment.charAt(i);
+ valid = Character.isLetterOrDigit(c) || (c == '-') || (c == '_');
+ if (!valid)
+ break;
+ }
+ }
+
+ return valid;
+ }
+
+ /**
+ * Resolve a workspace-relative path to correct any problems in
+ * capitalization.
+ * @param projectName
+ * @param wsPath workspace-relative path
+ * @return resolved path, as far as actual resources exist (the suffix
+ * may be unchanged if an intervening folder is missing)
+ */
+ public static IPath getCanonicalWorkspacePath(IPath wsPath) {
+ IPath resolvedPath = new Path(""); //$NON-NLS-1$
+ IContainer container = ResourcesPlugin.getWorkspace().getRoot();
+ // flag to consume the rest of the path without lookup
+ boolean failed = false;
+ for (String segment : wsPath.segments()) {
+ if (failed || container == null) {
+ resolvedPath = resolvedPath.append(segment);
+ continue;
+ }
+
+ IResource child = container.findMember(segment);
+ if (child != null) {
+ // found, so correct caps
+ resolvedPath = resolvedPath.append(segment);
+ if (child instanceof IContainer) {
+ container = (IContainer) child;
+ } else {
+ container = null;
+ }
+ } else {
+ // not found: manually search
+ boolean found = false;
+ try {
+ for (IResource member : container.members()) {
+ if (member.getName().equalsIgnoreCase(segment)) {
+ resolvedPath = resolvedPath.append(member.getName());
+ found = true;
+ if (member instanceof IContainer) {
+ container = (IContainer) member;
+ } else {
+ container = null;
+ }
+ break;
+ }
+ }
+ } catch (CoreException e) {
+ // just fail
+ }
+ if (!found) {
+ failed = true;
+ resolvedPath = resolvedPath.append(segment);
+ }
+ }
+ }
+ return resolvedPath;
+ }
+
+ /**
+ * This is an analogue to new Path(String) but avoids some bugs in
+ * the implementation when pathString is a relative path.
+ * @param pathString
+ * @return new Path
+ */
+ public static IPath createPossiblyRelativePath(String pathString) {
+ // canonicalize slashes
+ char[] pathChars = pathString.toCharArray();
+ int offset = 0;
+ for (int i = 0; i < pathChars.length; i++) {
+ if (pathChars[i] == '\\')
+ pathChars[i] = '/';
+ }
+
+ // The bug is, if "./" appears, then "../"'s after it are dropped,
+ // so get rid of "./" early. The result will still be relative.
+ while (offset + 2 <= pathChars.length) {
+ if (pathChars[offset] == '.' && pathChars[offset+1] == '/') {
+ offset += 2;
+ } else {
+ break;
+ }
+ }
+
+ return new Path(new String(pathChars, offset, pathChars.length - offset));
+ }
+
+ /**
+ * Tell if the given path refers to a parent directory (e.g.
+ * contains ".." entries)
+ * @param path
+ * @return true if resolved path contains ".."
+ */
+ public static boolean isPathInParent(IPath path) {
+ // first see if any segments are ".." at all
+ for (int i = 0; i < path.segmentCount(); i++) {
+ if (path.segment(i).equals("..")) { //$NON-NLS-1$
+ // comprehensive check, canonicalizing
+ path = new Path(path.toString());
+ if (path.segmentCount() > 0 && path.segment(0).equals("..")) { //$NON-NLS-1$
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Recurse the directory, returning files that match the given filter.
+ * The directories "." and ".." are filtered out before the filter sees them.
+ * The filter is passed files and directories, and a directory must
+ * pass the filter to be recursed.
+ * @param dir
+ * @param filter
+ * @param recordDirectories if true, accepted directories are added to the returned list;
+ * otherwise, directories are not added to the file list.
+ * @return array of matching files , never null
+ */
+ public static File[] listFilesInTree(File dir, FileFilter filter, boolean recordDirectories) {
+ List<File> files = new ArrayList<File>();
+ listFilesInTreeHelper(files, dir, filter, recordDirectories);
+ return (File[]) files.toArray(new File[files.size()]);
+ }
+
+ private static void listFilesInTreeHelper(List<File> files, File dir, FileFilter filter, boolean recordDirectories) {
+ if (recordDirectories)
+ files.add(dir);
+
+ File[] allEntries = dir.listFiles();
+ if (allEntries == null)
+ return;
+
+ for (File fileOrDir : allEntries) {
+ if (fileOrDir.getName().equals(".") || fileOrDir.getName().equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
+ // ignore
+ } else if (fileOrDir.isDirectory()) {
+ if (filter.accept(fileOrDir)) {
+ listFilesInTreeHelper(files, fileOrDir, filter, recordDirectories);
+ }
+ } else if (filter.accept(fileOrDir)) {
+ files.add(fileOrDir);
+ }
+ }
+ }
+
+ public static URL getParentPathURL(URL url) throws CoreException {
+ URL result;
+ try {
+ String string = url.toString();
+ int loc = string.lastIndexOf('/');
+ result = new URL(string.substring(0, loc + 1));
+ } catch (Exception e) {
+ throw new CoreException(createErrorStatus(e));
+ }
+
+ return result;
+ }
+
+ /**
+ * Wrapper around {@link FileUtils#validateEdit(IFile[], Shell)}
+ * taking a single file. If a modified files multistatus is generated
+ * the single entry for the single file is retrieved and returned.
+ */
+ public static IStatus validateEdit(IFile file, Shell context) {
+ IStatus status = validateEdit(new IFile[] {file}, context);
+ if (!status.isOK()) {
+ if (status.isMultiStatus()) {
+ IStatus[] children = status.getChildren();
+ if (children != null && children.length == 1 &&
+ children[0].getSeverity() == IStatus.WARNING &&
+ children[0].getCode() == MODIFIED_FILES_STATUS) {
+ status = children[0];
+ }
+ }
+ }
+ return status;
+ }
+
+ /**
+ * Wrapper around {@link IWorkspace#validateEdit(IFile[], Object)}
+ * Checks if any of the files have been modified by the validate
+ * operations. If so a MultiStatus is returned with WARNING severity.
+ * The code for the multistatus and each child is MODIFIED_FILES_STATUS
+ * and for each child the message fields is the full workspace
+ * path to the modified file.
+ * @param files
+ * @param context a Shell if UI interaction is allowed
+ * @return OK status, non-OK status from validateEdit, or a
+ * MultiStatus with one child for each modified file.
+ */
+ public static IStatus validateEdit(IFile[] files, Shell context) {
+ List<IFile> readOnly = new ArrayList<IFile>();
+ Map<IFile, Long> timeStamps = new HashMap<IFile, Long>();
+ for (IFile file : files) {
+ if (file.isReadOnly()) {
+ readOnly.add(file);
+ timeStamps.put(file, file.getModificationStamp());
+ }
+ }
+
+ if (readOnly.isEmpty()) {
+ return Status.OK_STATUS;
+ }
+
+ IStatus status = ResourcesPlugin.getWorkspace().validateEdit(
+ readOnly.toArray(new IFile[readOnly.size()]), context);
+ if (!status.isOK())
+ return status;
+
+ List<IFile> modified = new ArrayList<IFile>();
+ for (Map.Entry<IFile, Long> entry : timeStamps.entrySet()) {
+ Long newTimeStamp = entry.getKey().getModificationStamp();
+ if (!newTimeStamp.equals(entry.getValue())) {
+ modified.add(entry.getKey());
+ }
+ }
+
+ if (modified.size() > 0) {
+ String pluginID = UtilsCorePlugin.getDefault().getBundle().getSymbolicName();
+ MultiStatus ms = new MultiStatus(pluginID, MODIFIED_FILES_STATUS, "modified files", null);
+ for (IFile file : modified) {
+ String path = file.getFullPath().toString();
+ ms.add(new Status(IStatus.WARNING, pluginID, MODIFIED_FILES_STATUS, path, null));
+ }
+ status = ms;
+ }
+
+ return status;
+ }
+
+ /**
+ * Get the directory used for temporary files.
+ * @return absolute directory for temporary files, which may be the current directory
+ */
+ public static File getTemporaryDirectory() {
+ File dir = new File(System.getProperty("java.io.tmpdir", //$NON-NLS-1$
+ System.getProperty("user.dir", "."))); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ return dir.getCanonicalFile();
+ } catch (IOException e) {
+ return dir;
+ }
+ }
+
+ /**
+ * Get the path in a form amenable to comparing with another path.
+ * On Win32 hosts, this lowercases the path. On other hosts, the path is unmodified.
+ * @param path incoming path or <code>null</code>
+ * @return path converted to comparison-friendly format, or <code>null</code>
+ */
+ public static IPath getComparablePath(IPath path) {
+ if (path == null)
+ return null;
+
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ return new Path(path.toOSString().toLowerCase());
+ }
+
+ return path;
+ }
+
+ /**
+ * Get the file extension from path, guaranteed not to return null
+ * @param path IPath
+ * @return String non-null
+ */
+ public static String getSafeFileExtension(IPath path) {
+ String fileExtension = ""; //$NON-NLS-1$
+ if (path != null) {
+ String temp = path.getFileExtension();
+ if (temp != null)
+ fileExtension = temp;
+ }
+
+ return fileExtension;
+ }
+
+ /**
+ * Uses java.io semantics to test existence, because eclipse resources are always case-sensitive,
+ * regardless of the file system.
+ * @param resource {@link IResource}
+ * @return <code>boolean</code>
+ */
+ public static boolean exists(IResource resource) {
+ return resource.getLocation().toFile().exists();
+ }
+
+ private static IStatus createErrorStatus(Exception e) {
+ return new Status(IStatus.ERROR, UtilsCorePlugin.ID, null, e);
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IDisposable.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IDisposable.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IDisposable.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+ /**
+ * Generic interface for disposable objects
+ *
+ */
+public interface IDisposable {
+
+ /**
+ * Disposes of any resources held by the object.
+ * The object should not be used after dispose has been called.
+ */
+ void dispose();
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IListener.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IListener.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IListener.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+/**
+ * Generic listener interface
+ * @author eswartz
+ *
+ */
+public interface IListener<T> {
+ /** Add a listener. Duplicates are ignored. */
+ void add(T listener);
+ /** Remove a listener. Nonexistent entries are ignored. */
+ void remove(T listener);
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IListenerFiring.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IListenerFiring.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IListenerFiring.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+
+/**
+ * An implementor of listeners implements this for the {@link ListenerList#fireListeners(IListenerFiring)}
+ * method.
+ * @author eswartz
+ *
+ */
+public interface IListenerFiring<T> {
+ void fire(T listener);
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IMessage.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IMessage.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IMessage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * This encapsulates generic information about a message
+ * that can be reported to multiple sources (problems view,
+ * etc).
+ *
+ * @author eswartz
+ *
+ */
+public interface IMessage {
+ static public final int INFO = IStatus.INFO;
+ static public final int WARNING = IStatus.WARNING;
+ static public final int ERROR = IStatus.ERROR;
+
+ /** Get the severity
+ * @see #INFO
+ * @see #WARNING
+ * @see #ERROR
+ */
+ int getSeverity();
+
+ /** Get the message location */
+ MessageLocation getMessageLocation();
+
+ /** Get the offending file (full path) or null */
+ IPath getLocation();
+
+ /** Get the offending file (workspace path) or null */
+ IPath getPath();
+
+ /** Get the line number (1-based) */
+ int getLineNumber();
+
+ /** Get the column number (1-based) */
+ int getColumnNumber();
+
+ /** Get the message (localized) */
+ String getMessage();
+
+ /** Get the message key, i.e. the non-localized identifier for the message,
+ * for use in testing */
+ String getMessageKey();
+
+ /** Create (and attach) a problem marker */
+ IMarker createMarker(IResource resource, String modelMarkerType);
+
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IMessageListener.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IMessageListener.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IMessageListener.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+/**
+ * This interface listens to messages reported from various
+ * parts of Sedona (sourcegen, scripting, ...) which should
+ * be shown to the user.
+ *
+ * @author eswartz
+ *
+ */
+public interface IMessageListener {
+ /**
+ * Tell if the message should be emitted by this listener,
+ * usually true for a solitary listener. It would return false,
+ * e.g., if several listeners are attached and each has a particular
+ * resource scope for messages, and the given message doesn't match
+ * this listener's scope.
+ */
+ public boolean isHandlingMessage(IMessage msg);
+
+ /**
+ * Emit a message if #isHandlingMessage() returned true.
+ * @param msg
+ */
+ public void emitMessage(IMessage msg);
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ITimedTask.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ITimedTask.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ITimedTask.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+/**
+ * Interface for use with Logging.timeTask()
+ * @author eswartz
+ *
+ */
+public interface ITimedTask {
+ /** Get label for logging task */
+ public String getLabel();
+
+ /** Run the task */
+ public void run();
+
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IVariableLookupCallback.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IVariableLookupCallback.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/IVariableLookupCallback.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+public interface IVariableLookupCallback {
+ /** Get an unknown variable's value. */
+ public Object getValue(String var);
+}
\ No newline at end of file
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ListenerList.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ListenerList.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ListenerList.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import java.util.*;
+
+/**
+ * Utility class for listeners. Implemented with the assumption that
+ * iteration is much more common than adding or removing listeners.
+ * @param <E> a listener interface
+ */
+public class ListenerList<E> implements Iterable<E> {
+
+ private ArrayList<E> listeners;
+
+ public synchronized void add(E listener) {
+ if (listeners == null || !listeners.contains(listener)) {
+ ArrayList<E> newList = new ArrayList<E>();
+ if (listeners != null)
+ newList.addAll(listeners);
+ newList.add(listener);
+ listeners = newList;
+ }
+ }
+
+ public synchronized void remove(E listener) {
+ if (listeners == null)
+ return;
+ ArrayList<E> newList = new ArrayList<E>(listeners);
+ newList.remove(listener);
+ listeners = newList;
+ }
+
+ public synchronized Iterator<E> iterator() {
+ Iterator<E> result;
+ if (listeners != null) {
+ result = listeners.iterator();
+ }
+ else {
+ // would be nice if this could be a static, but it can't
+ result = new EmptyIterator<E>();
+ }
+ return result;
+ }
+
+ public synchronized int size() {
+ return listeners != null? listeners.size() : 0;
+ }
+
+ public void fireListeners(IListenerFiring<E> listenerFiring) {
+ Iterator<E> listenerIter = iterator();
+ while (listenerIter.hasNext()) {
+ listenerFiring.fire(listenerIter.next());
+ }
+ }
+
+ static class EmptyIterator<E> implements Iterator<E> {
+
+ public boolean hasNext() {
+ return false;
+ }
+
+ public E next() {
+ throw new NoSuchElementException();
+ }
+
+ public void remove() {
+ throw new IllegalStateException();
+ }
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Logging.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Logging.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Logging.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,447 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.osgi.framework.Bundle;
+
+import com.nokia.cpp.utils.core.noexport.Messages;
+import com.nokia.cpp.utils.core.noexport.UtilsCorePlugin;
+
+import java.io.PrintStream;
+import java.util.*;
+
+/**
+ * Utilities for plugins.
+ *
+ * All of these take a Plugin parameter, which usually requires a call in the
+ * form:
+ * <p>
+ * <code>
+ * Logging.<i>method</i>(MyPlugin.getDefault(), ...);
+ * </code>
+ * </p>
+ *
+ * If this becomes unwieldly, implement a wrapper method in your plugin class to
+ * access these methods natively:
+ * <p>
+ *
+ * <pre>
+ *
+ * class MyPlugin extends Plugin {
+ * ...
+ * void <i>method</i>(...) {
+ * Logging.<i>method</i>(getDefault(), ...);
+ * }
+ * ...
+ * }
+ *
+ * </pre>
+ *
+ * </p>
+ * <p>
+ * Then call as:
+ *
+ * <pre>
+ *
+ * MyPlugin.<i>method</i>(...);
+ *
+ * </pre>
+ *
+ * </p>
+ *
+ * @author eswartz
+ *
+ */
+public class Logging {
+
+ /** Tell whether Logging.timeStart() / Logging.timeEnd() / Logging.timeTask() show results
+ * Can't be final because it's modified from unit tests. */
+ static public boolean SHOW_TIMINGS = false;
+
+ /** List of ILogListener */
+ static private List<ILogListener> listeners = new ArrayList<ILogListener>(0);
+
+ /** Target for log messages when platform is not running
+ This can't be final, it's set from tests */
+ static public PrintStream consoleLog = System.err;
+ /** Always dump log messages to console? If false, only log when platform not running.
+ * Can't be final because it's modified from unit tests. */
+ static public boolean alwaysLogToConsole = false;
+
+ static public void addListener(ILogListener listener) {
+ listeners.add(listener);
+ }
+
+ static public void removeListener(ILogListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Create an IStatus instance eminating from the given plugin
+ * which includes detailed info about the plugin vendor, version, etc.
+ * Every IStatus generated by this class includes this information.
+ *
+ * Adapted from Java Developer's Guide to Eclipse, Ch. 28
+ *
+ * @param plugin
+ * the offending plugin
+ * @param severity
+ * the severity (IStatus.ERROR, IStatus.WARNING, IStatus.INFO)
+ * @param message
+ * the localized error string, or null to use
+ * thr.getLocalizedMessage()
+ * @param thr
+ * the throwable, or null
+ * @return new IStatus object
+ */
+ static public IStatus newStatus(Plugin plugin, int severity,
+ String message, Throwable thr) {
+ if (message == null) {
+ if (thr != null) {
+ message = thr.getLocalizedMessage();
+ }
+ if (message == null) {
+ message = thr.getClass().getName();
+ }
+ }
+
+ MultiStatus vitalInfoStatus;
+
+ if (plugin == null || plugin.getBundle() == null) {
+ return new Status(severity, "???", 0,
+ message, thr);
+ }
+
+ Bundle bundle = plugin.getBundle();
+ String symbolicName = bundle.getSymbolicName();
+ String bundleName = "" + bundle.getHeaders().get("Bundle-Name"); //$NON-NLS-1$
+ String bundleVendor = "" + bundle.getHeaders().get("Bundle-Vendor"); //$NON-NLS-1$
+ String bundleVersion = "" + bundle.getHeaders().get("Bundle-Version"); //$NON-NLS-1$
+
+ vitalInfoStatus = new MultiStatus(symbolicName, severity,
+ message, thr);
+
+ // Put new info in separate status containers to force newlines in
+ // dialog
+ vitalInfoStatus.add(new Status(severity, symbolicName, 0,
+ "Plug-in Vendor: " + bundleVendor, null)); //$NON-NLS-1$
+ vitalInfoStatus.add(new Status(severity, symbolicName, 0,
+ "Plug-in Name: " + bundleName, null)); //$NON-NLS-1$
+ vitalInfoStatus.add(new Status(severity, symbolicName, 0,
+ "Plug-in ID: " + symbolicName, null)); //$NON-NLS-1$
+ vitalInfoStatus.add(new Status(severity, symbolicName, 0,
+ "Plug-in Version: " + bundleVersion, null)); //$NON-NLS-1$
+
+ return vitalInfoStatus;
+ }
+
+ /**
+ * Create an IStatus instance eminating from the given plugin.
+ *
+ * @param plugin
+ * the offending plugin
+ * @param severity
+ * the severity (IStatus.ERROR,WARNING,INFO)
+ * @param message
+ * the localized error string
+ * @return new IStatus object
+ */
+ static public IStatus newStatus(Plugin plugin, int severity, String message) {
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+
+ return newStatus(plugin, severity, message, null);
+ }
+
+
+ /**
+ * Create an IStatus instance wrapping an unwanted exception eminating from
+ * the given plugin.
+ *
+ * @param plugin
+ * the offending plugin
+ * @param thr
+ * the throwable, or null
+ * @return new IStatus object
+ */
+ static public IStatus newStatus(Plugin plugin, Throwable thr) {
+ return newStatus(plugin, IStatus.ERROR, thr.getLocalizedMessage(), thr);
+ }
+
+ /**
+ * Create an IStatus instance without plugin context information
+ * (e.g. for logging)
+ *
+ * @param plugin
+ * the plugin
+ * @param severity
+ * the severity (IStatus.ERROR,WARNING,INFO)
+ * @param message
+ * the localized error string
+ * @param thr
+ * the throwable, or null
+ *
+ * @return new IStatus object
+ */
+ static public IStatus newSimpleStatus(Plugin plugin, int severity, String message, Throwable thr) {
+ return new Status(severity, plugin.getBundle().getSymbolicName(),
+ 0, message, thr);
+ }
+
+ /**
+ * Create an IStatus instance occurring presumably a number of steps up the
+ * call chain (e.g. library code, for which the current plugin is not
+ * known). We report the class name from the stack trace stored in the
+ * exception. (Eclipse doesn't have a mechanism for looking up the plugin
+ * from a class (multiple plugins can have the same class).)
+ *
+ * @param depth
+ * stack depth relative to thr(0 = caller that created thr, 1 =
+ * caller's caller...)
+ * @param severity
+ * the severity (IStatus.ERROR,WARNING,INFO)
+ * @param message
+ * the localized error string
+ * @param thr
+ * the throwable (if null, assume depth refers to caller)
+ *
+ * @return new IStatus object
+ */
+ static public IStatus newSimpleStatus(int depth, int severity, String message, Throwable thr) {
+ StackTraceElement els[];
+ if (thr != null)
+ els = thr.getStackTrace();
+ else {
+ els = new Exception().getStackTrace();
+ depth++;
+ }
+
+ if (depth >= els.length)
+ depth = els.length - 1;
+
+ String klass = els[depth].getClassName();
+ return new Status(severity, klass, 0, message, thr);
+ }
+
+ /**
+ * Create an IStatus instance occurring presumably a number of steps up the
+ * call chain (e.g. library code, for which the current plugin is not
+ * known). We report the class name from the stack trace stored in the
+ * exception. (Eclipse doesn't have a mechanism for looking up the plugin
+ * from a class (multiple plugins can have the same class).)
+ *
+ * @param depth
+ * stack depth relative to thr(0 = caller that created thr, 1 =
+ * caller's caller...)
+ * @param thr
+ * the throwable, or null
+ *
+ * @return new IStatus object
+ */
+ static public IStatus newSimpleStatus(int depth, Throwable thr) {
+ return newSimpleStatus(depth, IStatus.ERROR, thr.getLocalizedMessage(), thr);
+ }
+
+ /**
+ * Tell if plugin configured for debugging and a debug option is enabled
+ *
+ * @param plugin
+ * the offending plugin
+ * @param option
+ * The debug option to test. The plugin's symbolic name is
+ * prepended to the option name, e.g.
+ * "com.nokia.myplugin"+"/"+option
+ * @return true if debugging enabled and option enabled (e.g. defined and
+ * set to "true")
+ */
+ static public boolean isDebugOptionEnabled(Plugin plugin, String option) {
+ if (plugin == null || !plugin.isDebugging())
+ return false;
+ String filter = Platform.getDebugOption(plugin.getBundle()
+ .getSymbolicName()
+ + "/" + option); //$NON-NLS-1$
+ return (filter != null && "true".equalsIgnoreCase(filter)); //$NON-NLS-1$
+ }
+
+ /**
+ * Send a message to the Error Log or stdout if plugin
+ * not defined or not loaded.
+ *
+ * @param plugin
+ * the calling plugin
+ * @param status
+ * the status object
+ *
+ */
+ static public void log(Plugin plugin, IStatus status) {
+
+ for (Iterator<ILogListener> iter = listeners.iterator(); iter.hasNext();) {
+ ILogListener listener = (ILogListener) iter.next();
+ listener.logging(status, plugin != null ? plugin.getBundle().getSymbolicName() : null);
+ }
+
+ boolean logToConsole = alwaysLogToConsole;
+ if (plugin != null && plugin.getLog() != null) {
+ plugin.getLog().log(status);
+ } else {
+ logToConsole = true;
+ }
+
+ if (consoleLog != null && logToConsole) {
+ consoleLog.println(status.getMessage());
+ if (status.getPlugin() != null)
+ consoleLog.println(Messages.getString("Logging.FromPlugin")+status.getPlugin()); //$NON-NLS-1$
+ if (status.getException() != null) {
+ consoleLog.println(Messages.getString("Logging.DueToException")); //$NON-NLS-1$
+ status.getException().printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Send a message to the Error Log or stdout
+ * if a given debug option is enabled.
+ *
+ * @param plugin
+ * the calling plugin, or null
+ * @param option
+ * the debug option to test. The plugin name is prepended to the
+ * option name, e.g. "com.nokia.myplugin"+"/"+option
+ * @param status
+ * the status object
+ * @see Logging#isDebugOptionEnabled(Plugin, String)
+ */
+ static public void logIf(Plugin plugin, String option, IStatus status) {
+ if (!isDebugOptionEnabled(plugin, option))
+ return;
+ log(plugin, status);
+ }
+
+ /**
+ * Utility to display an error dialog reporting an IStatus.
+ *
+ * @param title
+ * title of dialog (if null, use "Error")
+ * @param message
+ * concise error message (if null, use status message or status'
+ * wrapped exception message)
+ * @param status
+ * the offending status
+ */
+ static public void showErrorDialog(String title, String message, final IStatus status) {
+ showErrorDialog(null, title, message, status);
+ }
+
+ /**
+ * Utility to display an error dialog reporting an IStatus.
+ *
+ * @param shell the parent shell
+ * @param title
+ * title of dialog (if null, use "Error")
+ * @param message
+ * concise error message (if null, use status message or status'
+ * wrapped exception message)
+ * @param status
+ * the offending status
+ */
+ static public void showErrorDialog(final Shell shell, String title, String message, final IStatus status) {
+ if (!Platform.isRunning())
+ return;
+
+ if (title == null)
+ title = Messages.getString("Logging.ErrorTitle"); //$NON-NLS-1$
+
+ if (message == null) {
+ // this leads to a lot of redundant text
+ /*if (status != null) {
+ message = status.getMessage();
+ if (message == null) {
+ if (status.getException() != null) {
+ message = status.getException().getLocalizedMessage();
+ if (message == null)
+ message = Messages.getString("Logging.NoMessage"); //$NON-NLS-1$
+ }
+ }
+ }*/
+ message = Messages.getString("Logging.GenericErrorMessage"); //$NON-NLS-1$
+ }
+
+ final String title_ = title;
+ final String message_ = message;
+
+ // yes, syncExec(): this is presumably an important error
+ // that shouldn't wait for cascading failures to complete
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ ErrorDialog.openError(shell, title_, message_, status);
+ }
+ });
+ }
+ // stack of start times (n.b.: Stack is a Vector and is synchronized)
+ private static Stack<Long> timeStack = new Stack<Long>();
+ // stack of end times (n.b.: Stack is a Vector and is synchronized)
+ private static Stack<String> timeLabelStack = new Stack<String>();
+
+ private static long lastTime;
+
+ /**
+ * Start timing a task, reported to console if Logging#SHOW_TIMINGS is set.
+ * Up to 16 timed tasks can be nested at time.
+ * @param label
+ */
+ public synchronized static void timeStart(String label) {
+ long currentTime = System.currentTimeMillis();
+ if (SHOW_TIMINGS) {
+ if (currentTime > lastTime + 333 && lastTime != 0) {
+ IStatus status = newSimpleStatus(1, IStatus.INFO, "missing time: " + (currentTime - lastTime) + " ms", null); //$NON-NLS-1$
+ log(UtilsCorePlugin.getDefault(), status);
+ }
+ IStatus status = newSimpleStatus(1, IStatus.INFO, label + " start...", null); //$NON-NLS-1$
+ log(UtilsCorePlugin.getDefault(), status);
+ }
+ timeLabelStack.push(label);
+ timeStack.push(currentTime);
+ lastTime = currentTime;
+ }
+
+ /**
+ * Stop timing a task, reporting results to console if Logging#SHOW_TIMINGS is set
+ * @return time elapsed in ms
+ */
+ public synchronized static long timeEnd() {
+ lastTime = System.currentTimeMillis();
+ long elapsed = lastTime - timeStack.pop();
+ String label = timeLabelStack.pop();
+ if (SHOW_TIMINGS) {
+ IStatus status = newSimpleStatus(1, IStatus.INFO, label + " end: " + elapsed + " ms", null); //$NON-NLS-1$ //$NON-NLS-2$
+ log(UtilsCorePlugin.getDefault(), status);
+ }
+ return elapsed;
+ }
+
+ /**
+ * Time a task and report results if Logging#SHOW_TIMINGS is set.
+ * @param task
+ * @return elapsed time in milliseconds
+ */
+ public synchronized static long timeTask(ITimedTask task) {
+ timeStart(task.getLabel());
+ long elapsed = 0;
+ try {
+ task.run();
+ } finally {
+ elapsed = timeEnd();
+ }
+ return elapsed;
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Message.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Message.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Message.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,241 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+
+import com.nokia.cpp.utils.core.noexport.Messages;
+import com.nokia.cpp.utils.core.noexport.UtilsCorePlugin;
+
+import java.text.MessageFormat;
+
+
+/**
+ * A message.
+ * <p>
+ * A message is identified by a key, a location,
+ * and a severity.
+ * <p>
+ * When constructing a message, the key is the name of a
+ * property (in this plugin's messages.properties file),
+ * which is used to format a string with the optional arguments.
+ * <p>
+ * The key is retained to identify the message later (e.g.
+ * for unit tests).
+ *
+ * @author eswartz
+ *
+ */
+public class Message implements IMessage {
+
+ /** Message severity (INFO, WARNING, ERROR) */
+ public int severity;
+ /** Location associated with message */
+ public MessageLocation ref;
+ /** Message key */
+ public String key;
+ /** Expanded and formatted message */
+ public String text;
+
+ /**
+ * Create a message
+ * @param severity (Message.xxx)
+ * @param ref
+ * @param key message key
+ * @param locMsg localized string (unformatted)
+ * @param args
+ */
+ public Message(int severity, MessageLocation ref, String key, String locMsg, Object[] args) {
+ Check.checkArg(key);
+ Check.checkArg(locMsg);
+ Check.checkArg(ref);
+ this.severity = severity;
+ this.ref = ref;
+ this.key = key;
+ this.text = MessageFormat.format(locMsg, args);
+ }
+
+ /**
+ * Create a message
+ * @param severity (Message.xxx)
+ * @param ref
+ * @param key message key
+ * @param locMsg localized string (unformatted)
+ * @param arg
+ */
+ public Message(int severity, MessageLocation ref, String key, String locMsg, Object arg) {
+ Check.checkArg(key);
+ Check.checkArg(locMsg);
+ Check.checkArg(ref);
+ this.severity = severity;
+ this.ref = ref;
+ this.key = key;
+ if (arg == null)
+ arg = ""; //$NON-NLS-1$
+ this.text = MessageFormat.format(locMsg, new Object[] { arg });
+ }
+
+ /**
+ * Create a message
+ * @param severity (Message.xxx)
+ * @param ref
+ * @param key message key
+ * @param locMsg localized string (unformatted)
+ */
+ public Message(int severity, MessageLocation ref, String key, String locMsg) {
+ Check.checkArg(key);
+ Check.checkArg(locMsg);
+ Check.checkArg(ref);
+ this.severity = severity;
+ this.ref = ref;
+ this.key = key;
+ this.text = locMsg;
+ }
+
+ public String getSeverityString() {
+ if (severity == INFO) return ""; //$NON-NLS-1$
+ else if (severity == WARNING) return Messages.getString("Message.Warning"); //$NON-NLS-1$
+ else return Messages.getString("Message.Error"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Message))
+ return false;
+ Message other = (Message) obj;
+ return other.severity == severity
+ && ((ref == null && other.ref == null)
+ || (ref != null && other.ref != null && other.ref.equals(ref)))
+ && key.equals(other.key)
+ && text.equals(other.text);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return (severity << 20)
+ ^ (ref != null ? ref.hashCode() : 0)
+ ^ key.hashCode()
+ ^ text.hashCode()
+ ^ 0x49482721;
+ }
+
+ public String toString() {
+ return (ref != null ? ref + ": " : "") //$NON-NLS-1$ //$NON-NLS-2$
+ + getSeverityString()
+ + text;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.sdt.component.sourcegen.ISourceGenProblem#getSeverity()
+ */
+ public int getSeverity() {
+ return severity;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.sdt.utils.IMessage#getMessageLocation()
+ */
+ public MessageLocation getMessageLocation() {
+ return ref;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.sdt.utils.IMessage#getLocation()
+ */
+ public IPath getLocation() {
+ return ref != null ? ref.getLocation() : null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.sdt.utils.IMessage#getPath()
+ */
+ public IPath getPath() {
+ return ref != null ? ref.getPath() : null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.sdt.component.sourcegen.ISourceGenProblem#getLineNumber()
+ */
+ public int getLineNumber() {
+ return ref != null ? ref.getLineNumber() : -1;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.sdt.sourcegen.ISourceGenMessage#getColumnNumber()
+ */
+ public int getColumnNumber() {
+ return ref != null ? ref.getColumnNumber() : -1;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.sdt.component.sourcegen.ISourceGenProblem#getMessage()
+ */
+ public String getMessage() {
+ return text;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.sdt.component.sourcegen.ISourceGenProblem#getMessageKey()
+ */
+ public String getMessageKey() {
+ return key;
+ }
+
+ /**
+ * Create a problem marker for the message.
+ * @return
+ */
+ public IMarker createMarker(IResource resource, String modelMarkerType) {
+ try {
+ IMarker marker = resource.createMarker(modelMarkerType);
+
+ marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
+ switch (getSeverity()) {
+ case IStatus.ERROR:
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ break;
+ case IStatus.WARNING:
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
+ break;
+ case IStatus.INFO:
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
+ break;
+ }
+
+ MessageLocation location = getMessageLocation();
+
+ // remove superfluous tabs and newlines that might be in the message (bug 3152)
+ String message = getMessage().replaceAll("[\t\r\n]+", " "); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // no resource was located in the workspace, but perhaps
+ // there is info available
+ if (resource == ResourcesPlugin.getWorkspace().getRoot() && location != null && getLineNumber() != 0) {
+ marker.setAttribute(IMarker.MESSAGE,
+ "(" + location.toShortString() +") " + message); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ else
+ marker.setAttribute(IMarker.MESSAGE, message);
+
+ if (getLineNumber() != 0)
+ marker.setAttribute(IMarker.LINE_NUMBER, getLineNumber());
+
+ return marker;
+ } catch (CoreException e) {
+ Logging.log(UtilsCorePlugin.getDefault(),
+ Logging.newStatus(UtilsCorePlugin.getDefault(), e));
+ return null;
+ }
+
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/MessageLocation.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/MessageLocation.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/MessageLocation.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+
+import java.io.File;
+import java.net.URI;
+
+/**
+ * A reference to a location in a file. It contains a source,
+ * a line, and a column (the latter both 1-based).
+ * <p>
+ * The source is presumably a file, but you can use
+ * whatever is needed. The source should implement
+ * toString() in an appropriate manner for reporting
+ * the source reference as a string.
+ *
+ * @author eswartz
+ *
+ */
+public class MessageLocation {
+ /** The full path of the offending resource */
+ private URI uri;
+ /** The line number where this node starts (1-based) */
+ private int lineNumber;
+ /** The character offset of the column where the node starts (1-based) */
+ private int columnNumber;
+
+ /**
+ * Create a new source reference
+ * @param project the project (may not be null)
+ * @param line line (1-based)
+ * @param column column (1-based)
+ */
+ public MessageLocation(IProject project, int line, int column) {
+ if (project == null)
+ throw new IllegalArgumentException();
+ if (project.getLocationURI() != null)
+ throw new IllegalArgumentException();
+ this.uri = project.getLocationURI();
+ lineNumber = line;
+ columnNumber = column;
+ }
+
+ /**
+ * Create a new source reference
+ * @param fullpath the full filesystem path to the offending resource (may not be null)
+ * @param line line (1-based)
+ * @param column column (1-based)
+ */
+ public MessageLocation(IPath fullpath, int line, int column) {
+ if (fullpath == null)
+ throw new IllegalArgumentException();
+ this.uri = URIUtil.toURI(fullpath);
+ lineNumber = line;
+ columnNumber = column;
+ }
+
+ /**
+ * Create a new source reference
+ * @param uri the uri to the offending resource (may not be null)
+ * @param line line (1-based)
+ * @param column column (1-based)
+ */
+ public MessageLocation(URI uri, int line, int column) {
+ if (uri == null)
+ throw new IllegalArgumentException();
+ this.uri = uri;
+ lineNumber = line;
+ columnNumber = column;
+ }
+
+ /**
+ * @param path the full filesystem path to the offending resource (may not be null)
+ */
+ public MessageLocation(IPath path) {
+ this(path, 0, 0);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (!(obj instanceof MessageLocation))
+ return false;
+ MessageLocation other = (MessageLocation) obj;
+ return uri.equals(other.uri)
+ && lineNumber == other.lineNumber
+ && columnNumber == other.columnNumber;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return uri.hashCode()
+ ^ (lineNumber << 16)
+ ^ (columnNumber << 8)
+ ^ 0x18283782;
+ }
+
+ public int getColumnNumber() {
+ return columnNumber;
+ }
+
+ public int getLineNumber() {
+ return lineNumber;
+ }
+
+ /**
+ * Return full path in filesystem
+ */
+ public IPath getLocation() {
+ return URIUtil.toPath(uri);
+ }
+
+ /**
+ * @return the URI for the message
+ */
+ public URI getURI() {
+ return uri;
+ }
+
+ /**
+ * Get the workspace-relative path, or <code>null</code> if
+ * not resolvable to the workspace
+ */
+ public IPath getPath() {
+ return FileUtils.convertToWorkspaceLocation(getLocation());
+ }
+
+ public String toString() {
+ IPath path = getPath();
+ if (path == null)
+ path = getLocation();
+ return path+":"+lineNumber+":"+columnNumber; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public String toShortString() {
+ return new File(uri.getPath()).getName()+":"+lineNumber; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Set the full path
+ */
+ public void setLocation(IPath newPath) {
+ this.uri = URIUtil.toURI(newPath);
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/MultiResourceChangeListenerDispatcher.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/MultiResourceChangeListenerDispatcher.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/MultiResourceChangeListenerDispatcher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.IPath;
+
+import java.util.*;
+
+/**
+ * Generic handler for reporting changes to registered paths
+ * in the workspace.<p>
+ * This manages a single resource change listener
+ * and has advantages over installing new listeners for each and every
+ * path being tracked.
+ * <p>
+ * This handles only {@link IResourceChangeEvent#POST_CHANGE}
+ * events where the content of the given file is changed.
+ * @author eswartz
+ *
+ */
+public class MultiResourceChangeListenerDispatcher {
+
+ public interface IResourceChangeHandler {
+ /** Reports a change to an entry at the given workspace path. */
+ void resourceChanged(IPath workspacePath);
+ }
+
+ private List<Pair<IPath, IResourceChangeHandler>> trackedResources;
+ private IResourceChangeListener listener;
+
+ public MultiResourceChangeListenerDispatcher() {
+
+ }
+
+ /**
+ * Add a path to a resource and a handler to call when it is changed.
+ * Only simple {@link IResourceChangeEvent#POST_CHANGE} events for content
+ * change deltas are handled; use more specific listeners for other tasks.
+ * <p>
+ * @param workspacePath workspace-relative path. Existing combinations of workspacePath and handler are ignored.
+ * @param handler routine called to handle changes
+ */
+ public synchronized void addResource(IPath workspacePath, IResourceChangeHandler handler) {
+ Check.checkArg(workspacePath != null && workspacePath.getDevice() == null);
+ Check.checkArg(handler);
+
+ // canonicalize, as it were
+ workspacePath = workspacePath.makeRelative().removeTrailingSeparator();
+
+ if (trackedResources == null) {
+ trackedResources = new LinkedList<Pair<IPath, IResourceChangeHandler>>();
+ listener = new IResourceChangeListener() {
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ Pair<IPath, IResourceChangeHandler>[] array;
+ synchronized (MultiResourceChangeListenerDispatcher.this) {
+ if (event.getDelta() == null
+ || event.getDelta().getKind() != IResourceDelta.CHANGED
+ || event.getType() != IResourceChangeEvent.POST_CHANGE
+ || trackedResources == null)
+ return;
+ array = trackedResources.toArray(new Pair[trackedResources.size()]);
+ }
+ for (Pair<IPath, IResourceChangeHandler> entry : array) {
+ IResourceDelta delta = event.getDelta().findMember(entry.first);
+ if (delta != null) {
+ // honor any added and removed events. for changed events, make sure it's the content
+ // that changed and not the description or marker or something.
+ if (delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.REMOVED ||
+ (delta.getKind() == IResourceDelta.CHANGED && (delta.getFlags() & IResourceDelta.CONTENT) != 0)) {
+ entry.second.resourceChanged(entry.first);
+ }
+ }
+ }
+ }
+
+ };
+
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(
+ listener, IResourceChangeEvent.POST_CHANGE);
+
+ }
+
+ Pair<IPath, IResourceChangeHandler> entry = new Pair<IPath, IResourceChangeHandler>(workspacePath, handler);
+ if (!trackedResources.contains(entry))
+ trackedResources.add(entry);
+ }
+
+ /**
+ * Stop listening for changes for the given workspace path and handler
+ * combination.
+ * @param workspacePath
+ */
+ public synchronized void removeResource(IPath workspacePath, IResourceChangeHandler handler) {
+ Check.checkArg(workspacePath);
+ if (trackedResources == null) {
+ return;
+ }
+
+ // canonicalize, as it were
+ workspacePath = workspacePath.makeRelative().removeTrailingSeparator();
+
+ Pair<IPath, IResourceChangeHandler> entry = new Pair<IPath, IResourceChangeHandler>(workspacePath, handler);
+ trackedResources.remove(entry);
+
+ if (trackedResources.isEmpty()) {
+ trackedResources = null;
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
+ listener = null;
+ }
+ }
+
+
+ /**
+ * Remove all entries in the listener.
+ */
+ public synchronized void removeAll() {
+ if (trackedResources == null)
+ return;
+ Pair<IPath, IResourceChangeHandler>[] entries = (Pair<IPath, IResourceChangeHandler>[]) trackedResources.toArray(new Pair[trackedResources.size()]);
+ for (Pair<IPath, IResourceChangeHandler> entry : entries) {
+ removeResource(entry.first, entry.second);
+ }
+ }
+
+ /**
+ * Remove all entries in the listener for paths with the given prefix.
+ */
+ public void removeAllForPrefix(IPath path) {
+ if (trackedResources == null)
+ return;
+ Pair<IPath, IResourceChangeHandler>[] entries = (Pair<IPath, IResourceChangeHandler>[]) trackedResources.toArray(new Pair[trackedResources.size()]);
+ for (Pair<IPath, IResourceChangeHandler> entry : entries) {
+ if (path.isPrefixOf(entry.first))
+ removeResource(entry.first, entry.second);
+ }
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ObjectUtils.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ObjectUtils.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ObjectUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+
+import java.util.ArrayList;
+
+/**
+ * Utilities routines relying only on Object type
+ */
+public abstract class ObjectUtils {
+
+ public static boolean equals(Object obj1, Object obj2) {
+ if (obj1 == obj2)
+ return true;
+ if (obj1 != null && obj2 != null)
+ return obj1.equals(obj2);
+ return false;
+ }
+
+ public static int findEqualObject(Object[] array, Object obj) {
+ if (array == null || obj == null)
+ return -1;
+ int result = -1;
+ for (int i = 0; i < array.length; i++) {
+ Object curr = array[i];
+ if (curr != null && curr.equals(obj)) {
+ result = i;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Return an ArrayList with the passed array or elements
+ * as the initial contents. Differs from Arrays#asList() in that
+ * the list is not fixed sized.
+ * @param <T> type of list elements
+ * @param a An array or sequence of params of type T
+ */
+ public static <T> ArrayList<T> asList(T... a) {
+ ArrayList<T> result = new ArrayList<T>();
+ for (T t : a) {
+ result.add(t);
+ }
+ return result;
+ }
+
+ /**
+ * Utility to handle boilerplate code for locating the
+ * given interface on an object. It uses instanceof,
+ * checks if the object implements IAdaptable, and uses
+ * the platform adapter manager.
+ */
+ public static Object getAdapter(Object target, Class<?> interfaceType) {
+ if (target == null) return null;
+ Object result = null;
+ if (interfaceType.isInstance(target)) {
+ result = target;
+ }
+ else if (target instanceof IAdaptable) {
+ result = ((IAdaptable)target).getAdapter(interfaceType);
+ }
+ if (result == null) {
+ result = Platform.getAdapterManager().getAdapter(target, interfaceType);
+ }
+ return result;
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Pair.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Pair.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Pair.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+/**
+ * A pair of objects.
+ * @author eswartz
+ *
+ * @param <T>
+ * @param <U>
+ */
+public class Pair<T,U> {
+ public T first;
+ public U second;
+
+ public Pair(T first, U second) {
+ this.first = first;
+ this.second = second;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+ if (obj instanceof Pair) {
+ return ObjectUtils.equals(((Pair)obj).first, first)
+ && ObjectUtils.equals(((Pair)obj).second, second);
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return ((first != null) ? first.hashCode() : 0)
+ ^ (((second != null) ? second.hashCode() : 0) << 1);
+ }
+
+ @Override
+ public String toString() {
+ return "< " + first + " / " + second + " >"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ProjectUtils.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ProjectUtils.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/ProjectUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ProjectUtils {
+ static public IProject createAndOpenProject(String projname) throws CoreException {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ IProject newProjectHandle = root.getProject(projname);
+ IProjectDescription description = workspace.newProjectDescription(projname);
+ newProjectHandle.create(description, null);
+ newProjectHandle.open(null);
+ return newProjectHandle;
+ }
+
+ public static IProject importProject(File containingFolder) throws FileNotFoundException, CoreException {
+ Check.checkArg(isProjectDirectory(containingFolder));
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+
+ File projectFile = new File(containingFolder, ".project");
+ IPath path = new Path(projectFile.getPath());
+ IProjectDescription description = workspace.loadProjectDescription(path);
+ IProject newProjectHandle = root.getProject(description.getName());
+ newProjectHandle.create(description, null);
+ newProjectHandle.open(null);
+ return newProjectHandle;
+ }
+
+ /**
+ * Return true if the given directory seems to be an Eclipse project directory
+ */
+ public static boolean isProjectDirectory(File projectFolder) {
+ boolean result = false;
+ if (projectFolder.isDirectory()) {
+ File projectFile = new File(projectFolder, ".project");
+ result = projectFile.exists();
+ }
+ return result;
+ }
+
+ static public void closeAndDeleteProject(String projname) throws CoreException {
+ closeAndDeleteProject(projname, true);
+ }
+
+ static public void closeAndDeleteProject(String projname, boolean deleteContent) throws CoreException {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ // When this method was called from unit tests we were seeing
+ // sporadic failures. Under the theory that this might be to do
+ // with file system changes underneath Eclipse we make sure the
+ // workspace is in synch before deleting the project.
+ root.refreshLocal(IResource.DEPTH_INFINITE, null);
+
+ IProject projectHandle = root.getProject(projname);
+ projectHandle.close(null);
+ try {
+ projectHandle.delete(deleteContent, false, new NullProgressMonitor());
+ } catch (CoreException e) {
+ try {
+ root.refreshLocal(IResource.DEPTH_INFINITE, null);
+ Thread.sleep(1000);
+ } catch (InterruptedException e2) {
+
+ }
+ projectHandle.delete(deleteContent, deleteContent, new NullProgressMonitor());
+ }
+ }
+
+ /**
+ * Get the project location where its contents live on disk,
+ * accounting for linked resources.
+ * @param project
+ * @return full path on filesystem to project contents
+ */
+ public static IPath getRealProjectLocation(IProject project) {
+ if (project == null)
+ return null;
+ IPath path = project.getRawLocation();
+ if (path == null)
+ path = project.getLocation();
+ return path;
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/TextUtils.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/TextUtils.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/TextUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,551 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.nokia.cpp.utils.core.noexport.Messages;
+
+/**
+ * Text handling utilities
+ * @author eswartz
+ *
+ */
+public class TextUtils {
+
+ /** Pattern describing a run of illegal identifier characters */
+ private static final Pattern illegalIdentifierCharsPattern = Pattern.compile("[^A-Za-z0-9_]+"); //$NON-NLS-1$
+
+ /**
+ * Return true if text is null or zero-length
+ */
+ public static boolean isEmpty(String text) {
+ return text == null || text.length() == 0;
+ }
+
+ /**
+ * Return the given text or an empty string, never null
+ */
+ public static String safeStr(String text) {
+ return text != null? text : "";
+ }
+
+ /**
+ * Return string length or zero for null string
+ * @param text
+ * @return length, or 0
+ */
+ public static int strlen(String text) {
+ return text != null? text.length() : 0;
+ }
+
+ /**
+ * Strip the rightmost extension from a file name,
+ * e.g. foo.a.b -> foo.a.
+ * If the string is an extension only, e.g. .foo then
+ * nothing is stripped.
+ * @param text
+ * @return new string, without trailing period
+ */
+ public static String stripExtension(String text) {
+ String result = text;
+ if (text != null) {
+ int pos = text.lastIndexOf('.');
+ if (pos >= 1) {
+ result = text.substring(0, pos);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get the rightmost extension from a file name.
+ * If the string is an extension only, e.g. .foo then
+ * the whole string is returned. If there's no '.' then
+ * null is returned
+ * @param text
+ * @return the extension, without a period
+ */
+ public static String getExtension(String text) {
+ String result = null;
+ if (text != null) {
+ int pos = text.lastIndexOf('.');
+ if (pos >= 0) {
+ result = text.substring(pos+1);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Clean up text from an XML node. Removes leading and trailing
+ * text and converts all runs of whitespace to single spaces.
+ *
+ * @param text input string
+ * @return cleaned-up string
+ */
+ public static String cleanUpXMLText(String text) {
+ if (text == null)
+ return null;
+ // map embedded whitespace to space characters
+ Pattern patt = Pattern.compile("\\s+", Pattern.MULTILINE); //$NON-NLS-1$
+ Matcher matcher = patt.matcher(text);
+ text = matcher.replaceAll(" "); //$NON-NLS-1$
+ // remove leading & trailing whitespace
+ return text.trim();
+ }
+
+ /**
+ * Parse a string into an integer, returning a default
+ * value instead of throwing an exception for invalid strings.
+ */
+ public static int parseInt(String s, int defaultValue) {
+ int result = defaultValue;
+ // avoid spurious IllegalArgumentException
+ if (s != null) {
+ try {
+ result = Integer.parseInt(s);
+ }
+ catch (NumberFormatException x) {
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Parse a string into a float, returning a default
+ * value instead of throwing an exception for invalid strings.
+ */
+ public static float parseFloat(String s, float defaultValue) {
+ float result = defaultValue;
+ try {
+ result = Float.parseFloat(s);
+ }
+ catch (NumberFormatException x) {
+ }
+ return result;
+ }
+
+ /**
+ * Escape all the characters in the string which might be
+ * used in regular expressions
+ * @param text
+ * @return escaped text
+ */
+ public static String regexEscape(String text) {
+ StringBuffer buffer = new StringBuffer();
+ char[] chars = text.toCharArray();
+ for (int i = 0; i < chars.length; i++) {
+ if ("[{()}]\\+*^$|".indexOf(chars[i]) >= 0) { //$NON-NLS-1$
+ buffer.append('\\');
+ }
+ buffer.append(chars[i]);
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Change all the newlines to "\n"
+ * @param text
+ * @return text with canonical newlines
+ */
+ public static String canonicalizeNewlines(String text) {
+ return canonicalizeNewlines(text, "\n"); //$NON-NLS-1$
+ }
+
+ /**
+ * Change all the newlines to the given eol sequence
+ * @param text
+ * @param eol
+ * @return text with canonical newlines
+ */
+ public static String canonicalizeNewlines(String text, String eol) {
+ Matcher matcher = ANY_NEWLINE_MATCHING_PATTERN.matcher(text);
+ return matcher.replaceAll(eol); //$NON-NLS-1$
+ }
+
+ static final Pattern patternUnixNewlineMatch = Pattern.compile("\n"); //$NON-NLS-1$
+ static final Pattern patternUnixNewlinesMatch = Pattern.compile("\n+"); //$NON-NLS-1$
+ public static final String LINE_ENDING_PATTERN_STRING = "(\r\n|\r|\n)"; //$NON-NLS-1$
+ /** Pattern which matches a single instance of any newline pattern. */
+ public static final Pattern ANY_NEWLINE_MATCHING_PATTERN = Pattern.compile(LINE_ENDING_PATTERN_STRING); //$NON-NLS-1$
+
+
+ /**
+ * Return a pattern which matches the given literal text,
+ * except that the particular newline in use (represented by '\n' in the
+ * literal) can match any newline style in the target.
+ * @param lit
+ * @param newlineRuns if true, match >=1 newlines for each \n, else match
+ * only the exact number provided
+ * @return pattern
+ */
+ public static Pattern getNewlineIndependentPattern(String lit, boolean newlineRuns) {
+ String rxLit = regexEscape(lit);
+ Matcher matcher = patternUnixNewlineMatch.matcher(rxLit);
+ String repl = LINE_ENDING_PATTERN_STRING;
+ rxLit = matcher.replaceAll(newlineRuns ? repl + "+" : repl); //$NON-NLS-1$
+ return Pattern.compile(rxLit);
+ }
+
+ /**
+ * Return the string in Titlecase, i.e. the first character is capitalized.
+ * If the first character is not a letter, there is no change.
+ * @param name
+ * @return titlecased string
+ */
+ public static String titleCase(String name) {
+ if (name.length() == 0)
+ return name;
+ return Character.toUpperCase(name.charAt(0)) + name.substring(1);
+ }
+
+ /**
+ * Return the string in inverse titlecase, i.e. the first character is lowercased.
+ * If the first character is not a letter, there is no change.
+ * @param name
+ * @return inverse titlecased string
+ */
+ public static String inverseTitleCase(String name) {
+ if (name.length() == 0)
+ return name;
+ return Character.toLowerCase(name.charAt(0)) + name.substring(1);
+ }
+
+ /**
+ * Tell if the given name is a legal identifier, according to the
+ * common rules that it must start with an letter or underscore
+ * and be followed by alphanumeric characters or underscores.
+ * @param name
+ * @return true: legal
+ */
+ public static boolean isLegalIdentifier(String name) {
+ return !illegalIdentifierCharsPattern.matcher(name).find();
+ }
+
+
+ /**
+ * Return a version of the name with all the runs of illegal
+ * characters changed to underscores.
+ * @param name
+ * @return identifier-legal string
+ */
+ public static String legalizeIdentifier(String name) {
+ // replace runs of non-identifier characters with "_";
+ Matcher matcher = illegalIdentifierCharsPattern.matcher(name);
+ name = matcher.replaceAll("_"); //$NON-NLS-1$
+ if (name.length() > 0 && Character.isDigit(name.charAt(0)))
+ return "_" + name; //$NON-NLS-1$
+ else
+ return name;
+ }
+
+ /**
+ * Escape a string 'val' into C/C++ style, doubling
+ * backslashes and escaping the quote character.
+ * @param val incoming "pure" string
+ * @param quote the quote character
+ * @return the string with interesting characters escaped
+ */
+ static public String escape(String val, char quote) {
+ StringBuffer buff = new StringBuffer();
+ for (int i = 0; i < val.length(); i++) {
+ char ch = val.charAt(i);
+ if (ch == quote || ch == '\\') {
+ buff.append('\\');
+ buff.append(ch);
+ }
+ else if (ch < 32) {
+ switch (ch) {
+ case '\t':
+ buff.append("\\t"); //$NON-NLS-1$
+ break;
+ case '\n':
+ buff.append("\\n"); //$NON-NLS-1$
+ break;
+ case '\r':
+ buff.append("\\r"); //$NON-NLS-1$
+ break;
+ case '\f':
+ buff.append("\\f"); //$NON-NLS-1$
+ break;
+ case '\b':
+ buff.append("\\b"); //$NON-NLS-1$
+ break;
+ default:
+ buff.append("\\");
+ buff.append(String.format("%03o", Integer.valueOf(ch)));
+ break;
+ }
+ } else if (isLineOrParaSeparator(ch)) {
+ buff.append("\\u"); //$NON-NLS-1$
+ buff.append(Integer.toHexString(ch));
+ } else
+ buff.append(ch);
+ }
+ return buff.toString();
+ }
+
+ private static boolean isLineOrParaSeparator(char ch) {
+ int type = Character.getType(ch);
+ return ch > 127 &&
+ (type == Character.PARAGRAPH_SEPARATOR || type == Character.LINE_SEPARATOR);
+ }
+
+ /**
+ * Quote a string, escaping it into C/C++ style
+ * @param val incoming "pure" string
+ * @param quote the quote character
+ * @return an escaped string surrounded with quotes.
+ */
+ static public String quote(String val, char quote) {
+ StringBuffer buff = new StringBuffer();
+ buff.append(quote);
+ buff.append(escape(val, quote));
+ buff.append(quote);
+ return buff.toString();
+ }
+
+ /**
+ * Unescape escaped chars in a string 'val'.
+ * No surrounding quotes or RSS-style escapes should be in here.
+ *
+ */
+ static public String unescape(String val) {
+ StringBuffer buff = new StringBuffer();
+ for (int i = 0; i < val.length(); i++) {
+ char ch = val.charAt(i);
+ if (ch == '\\' && i + 1 < val.length()) {
+ ch = val.charAt(++i);
+ if (Character.digit(ch, 8) >= 0 && i + 2 < val.length()) {
+ String code = val.substring(i, i+3);
+ i += 2;
+ try {
+ int octal = Integer.parseInt(code, 8);
+ buff.append((char) octal);
+ } catch (NumberFormatException x) {
+// UtilsPlugin.log(x);
+ }
+ } else {
+ switch (ch) {
+ case 't':
+ buff.append('\t');
+ break;
+ case 'n':
+ buff.append('\n');
+ break;
+ case 'r':
+ buff.append('\r');
+ break;
+ case 'f':
+ buff.append('\f');
+ break;
+ case 'b':
+ buff.append('\b');
+ break;
+ case 'u':
+ try {
+ String code = val.substring(i+1, i+5);
+ buff.append((char) Integer.parseInt(code, 16));
+ i+=4;
+ } catch (NumberFormatException e) {
+ buff.append('\\');
+ buff.append('u');
+ }
+ break;
+ case '\\':
+ buff.append('\\');
+ break;
+ case '"':
+ buff.append('"');
+ break;
+ case '\'':
+ buff.append('\'');
+ break;
+ default:
+ buff.append('\\');
+ buff.append(ch);
+ break;
+ }
+ }
+ } else {
+ buff.append(ch);
+ }
+ }
+ return buff.toString();
+ }
+
+ /**
+ * Remove any surrounding quotes from a string
+ * @param string
+ * @param quote quoting character
+ * @return udpated string
+ */
+ public static String unquote(String string, char quote) {
+ if (string.length() >= 2
+ && string.charAt(0) == quote
+ && string.charAt(string.length() - 1) == quote)
+ return string.substring(1, string.length() - 1);
+ else
+ return string;
+ }
+
+ /**
+ * Escape quoted strings in text 'val', doubling backslashes.
+ * @param val incoming string
+ * @param quote the quote character
+ * @return the string with escapes inside quoted strings double-escaped
+ */
+ static public String escapeStrings(String val, char quote) {
+ StringBuffer buff = new StringBuffer();
+ boolean inQuote = false;
+ for (int i = 0; i < val.length(); i++) {
+ char ch = val.charAt(i);
+ if (ch == quote) {
+ // changing quote state
+ inQuote = true;
+ buff.append(ch);
+ } else if (inQuote) {
+ // handle escape chars inside string
+ if (ch == '\\') {
+ buff.append('\\');
+ buff.append(ch);
+ if (i + 1 < val.length() && val.charAt(i+1) == quote) {
+ // if quote is already escaped, pass it through (don't toggle quote state)
+ buff.append(quote);
+ i++;
+ }
+ } else {
+ buff.append(ch);
+ }
+ } else {
+ // not quoted
+ buff.append(ch);
+ }
+ }
+ return buff.toString();
+ }
+
+ /**
+ * Format a string for dumping to console, e.g.
+ * by adding a newline whereever a newline escape appears.
+ * @param string
+ * @return formatted string
+ */
+ public static String formatForDump(String string) {
+ String[] lines = string.split("\\n"); //$NON-NLS-1$
+ StringBuilder builder = new StringBuilder();
+ boolean hadLine = false;
+ for (int i = 0; i < lines.length; i++) {
+ if (lines[i].length() > 0) {
+ if (hadLine)
+ builder.append('\n');
+ builder.append(lines[i]);
+ builder.append("\\n"); //$NON-NLS-1$
+ hadLine = true;
+ }
+ }
+ return builder.toString();
+ }
+
+ /**
+ * Return a string equivalent to the input, but with
+ * all illegal XML characters escaped.
+ */
+ public static String escapeXML(String s) {
+ StringBuffer result = new StringBuffer();
+ int len = s != null? s.length() : 0;
+ for (int i = 0; i < len; i++) {
+ char ch = s.charAt(i);
+ switch (ch) {
+ case '&':
+ result.append("&"); //$NON-NLS-1$
+ break;
+ case '"':
+ result.append("""); //$NON-NLS-1$
+ break;
+ case '\'':
+ result.append("'"); //$NON-NLS-1$
+ break;
+ case '<':
+ result.append("<"); //$NON-NLS-1$
+ break;
+ case '>':
+ result.append(">"); //$NON-NLS-1$
+ break;
+ default:
+ result.append(ch);
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Format a list of items into a text string that can be displayed
+ * in a dialog.
+ * @param messages
+ * @return string with embedded tabs and newlines
+ */
+ public static String formatTabbedList(Collection<?> items) {
+ StringBuilder builder = new StringBuilder();
+ for (Iterator<?> iter = items.iterator(); iter.hasNext();) {
+ String item = iter.next().toString();
+ builder.append('\t');
+ builder.append(item);
+ builder.append('\n');
+ }
+ return builder.toString();
+ }
+
+ /**
+ * Title case every word in a sentence, except for conjunctions
+ * @param string
+ * @return String Titlecased Like This
+ */
+ public static String titleCaseSentence(String string) {
+ Pattern conjunction = Pattern.compile(Messages.getString("TextUtils.Conjunctions"));
+ Pattern pattern = Pattern.compile("\\b");
+ String[] pieces = pattern.split(string);
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < pieces.length; i++) {
+ if (!conjunction.matcher(pieces[i]).matches())
+ pieces[i] = titleCase(pieces[i]);
+ builder.append(pieces[i]);
+ }
+ return builder.toString();
+ }
+
+ /**
+ * @param string input string with '\' + return breaking lines
+ * @return string with '\' + return breaks removed
+ */
+ public static String catenateBrokenLines(String string) {
+ if (string == null)
+ return null;
+ return string.replaceAll("\\\\" + LINE_ENDING_PATTERN_STRING, "");
+ }
+
+ /**
+ * Catenate all the Object.toStrings() together, with an optional string in between.
+ */
+ public static String catenateStrings(Object[] objects, String separator) {
+ StringBuilder builder = new StringBuilder();
+ boolean first = true;
+ for (Object o : objects) {
+ if (first)
+ first = false;
+ else if (separator != null)
+ builder.append(separator);
+ builder.append(o);
+ }
+ return builder.toString();
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/TrackedResource.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/TrackedResource.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/TrackedResource.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+
+import com.nokia.cpp.utils.core.noexport.UtilsCorePlugin;
+
+/**
+ * Helper class to track changes to a resource handle. To the extent
+ * that Eclipse provides the necessary notification, moves and
+ * renames will be tracked and getResource() will return a
+ * reference to the resource.
+ * A listener interface is provided to give notifications of
+ * moves, content changes, and deletions.
+ * Upon deletion, since this object can no longer provide any
+ * useful servce, the dispose method is automatically called
+ * @author dpodwall
+ *
+ */
+public class TrackedResource implements IDisposable {
+
+ private IResource resource;
+ private long modificationStamp;
+ private IPath resourcePath;
+ private Class<?> resourceClass;
+ private ListenerList<IListener> listeners = new ListenerList<IListener>();
+ private ResourceHandler handler;
+
+ public interface IListener {
+ void resourceChanged(TrackedResource resource);
+ /**
+ * Called after a resource has been moved and the
+ * TrackedResource has been updated.
+ * @param oldPath the previous location of the resource
+ */
+ void resourceMoved(TrackedResource resource, IPath oldPath);
+ void resourceDeleted(TrackedResource resource);
+ }
+
+ /**
+ * Initialize with the desired resource and being
+ * listening for changes. Once initialized the initial
+ * IResource shouldn't be kept, call getResource as
+ * needed to get the valid resource handle.
+ */
+ public TrackedResource(IResource resource) {
+ Check.checkArg(resource);
+ this.resource = resource;
+ this.resourceClass = resource.getClass();
+ this.resourcePath = resource.getFullPath();
+ Check.checkState(resourcePath != null);
+ enableTracking(true);
+ }
+
+ /**
+ * Dispose must be called in order to unregister the workspace listener.
+ * It is automatically called if the resource is deleted.
+ */
+ public void dispose() {
+ if (handler != null) {
+ enableTracking(false);
+ resourcePath = null;
+ }
+ }
+
+ /**
+ * Set the tracking status to the desired status and return the
+ * previous state.
+ */
+ public synchronized boolean enableTracking(boolean enable) {
+ boolean wasEnabled = handler != null;
+ if (enable == wasEnabled) {
+ return wasEnabled;
+ }
+
+ if (enable) {
+ if (handler == null) {
+ handler = new ResourceHandler();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(handler);
+ modificationStamp = resource.getModificationStamp();
+ }
+
+ } else if (handler != null){
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(handler);
+ handler = null;
+ }
+ return wasEnabled;
+ }
+
+ /**
+ * Get the current resource handle. It will differ from
+ * the constructor argument if the resource moved.
+ * Can return null if the resource was deleted
+ *
+ * If non-null, the value will be compatible with
+ * the original resource. In other words if an IFile
+ * was originally used, this will return an IFile (or subclass)
+ * or null.
+ */
+ public IResource getResource() {
+ return resource;
+ }
+
+ /**
+ * Returns the last seen modification stamp.
+ */
+ public long getLastModificationStamp() {
+ return modificationStamp;
+ }
+
+ /**
+ * Force an update of the cached modification stamp to
+ * the lastest value. This will inhibit notifications for
+ * the same modification stamp value.
+ */
+ public void updateModificationStamp() {
+ try {
+ resource.refreshLocal(0, null);
+ } catch (CoreException x) {
+ UtilsCorePlugin.log(x);
+ }
+ modificationStamp = resource.getModificationStamp();
+ }
+
+ /**
+ * Convenience routine to return as IFile
+ */
+ public IFile getFile() {
+ IFile result = null;
+ if (resource instanceof IFile) {
+ result = (IFile) resource;
+ }
+ return result;
+ }
+
+ /**
+ * Convenience routine to return resource's project.
+ * If the resource is a project it will return that resource,
+ * otherwise the containing project.
+ */
+ public IProject getProject() {
+ IProject result = null;
+ if (resource != null) {
+ result = resource.getProject();
+ }
+ return result;
+ }
+
+ /**
+ * Listener for change events on the tracked resource.
+ * Note that these events may be delivered on
+ * threads other than the UI thread.
+ */
+ public void addListener(IListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeListener(IListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void fireResourceChanged() {
+ for (IListener l : listeners) {
+ l.resourceChanged(this);
+ }
+ }
+
+ private void fireResourceMoved(IPath oldPath) {
+ for (IListener l : listeners) {
+ l.resourceMoved(this, oldPath);
+ }
+ }
+
+ private void fireResourceDeleted() {
+ for (IListener l : listeners) {
+ l.resourceDeleted(this);
+ }
+ }
+
+ private void handleDeletion() {
+ fireResourceDeleted();
+ dispose();
+ }
+
+ private void handleMove(IResourceDelta delta) {
+ IPath movedToPath = delta.getMovedToPath();
+ if (movedToPath != null) {
+ IResource newResource = ResourcesPlugin.getWorkspace().getRoot().findMember(movedToPath);
+ if (newResource != null) {
+ // the new resource should be compatible with the previous, e.g.
+ // if we started with an IFile the new one should be an IFile
+ Check.checkState(resourceClass.isInstance(newResource));
+ resource = newResource;
+ modificationStamp = resource.getModificationStamp();
+ IPath oldPath = resourcePath;
+ resourcePath = movedToPath;
+ fireResourceMoved(oldPath);
+ }
+ }
+ }
+
+ private void resourceChanged(IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ if (delta != null && resourcePath != null) {
+ delta = delta.findMember(resourcePath);
+ if (delta != null) {
+ int kind = delta.getKind();
+ switch (kind) {
+ case IResourceDelta.CHANGED:
+ if ((IResourceDelta.CONTENT & delta.getFlags()) != 0) {
+ long currStamp = delta.getResource().getModificationStamp();
+ if (currStamp != modificationStamp) {
+ modificationStamp = currStamp;
+ fireResourceChanged();
+ }
+ }
+ break;
+
+ case IResourceDelta.REMOVED:
+ if ((IResourceDelta.MOVED_TO & delta.getFlags()) != 0) {
+ handleMove(delta);
+ }
+ else {
+ handleDeletion();
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private class ResourceHandler implements IResourceChangeListener {
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ TrackedResource.this.resourceChanged(event);
+ }
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Triple.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Triple.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Triple.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+/**
+ * A triple of objects.
+ * @author eswartz
+ *
+ * @param <T>
+ * @param <U>
+ * @param <V>
+ */
+public class Triple<T,U,V> {
+ public T first;
+ public U second;
+ public V third;
+
+ public Triple(T first, U second, V third) {
+ this.first = first;
+ this.second = second;
+ this.third = third;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+ if (obj instanceof Triple) {
+ return ObjectUtils.equals(((Triple)obj).first, first)
+ && ObjectUtils.equals(((Triple)obj).second, second)
+ && ObjectUtils.equals(((Triple)obj).third, third);
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return ((first != null) ? first.hashCode() : 0)
+ ^ (((second != null) ? second.hashCode() : 0) << 1)
+ ^ (((third != null) ? third.hashCode() : 0) << 2);
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Tuple.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Tuple.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/Tuple.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.core;
+
+/**
+ * A tuple of zero or more items.
+ * @author eswartz
+ *
+ */
+public class Tuple {
+ private Object[] args;
+
+ public Tuple(Object... args) {
+ this.args = args;
+ }
+
+ public Object get(int index) {
+ return args[index];
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+ if (!(obj instanceof Tuple))
+ return false;
+ Object[] otherArgs = ((Tuple) obj).args;
+ if (args.length != otherArgs.length)
+ return false;
+ for (int i = 0; i < otherArgs.length; i++) {
+ if (!ObjectUtils.equals(args[i], otherArgs[i]))
+ return false;
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ int hashCode = 0x12345678;
+ for (int i = 0; i < args.length; i++) {
+ hashCode ^= (args[i] != null ? args[i].hashCode() : 0);
+ }
+ return hashCode;
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/VariableSubstitutionEngine.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/VariableSubstitutionEngine.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/VariableSubstitutionEngine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,170 @@
+/**
+ * (c) 2006 Nokia
+ */
+package com.nokia.cpp.internal.api.utils.core;
+
+import com.nokia.cpp.utils.core.noexport.Messages;
+
+import java.text.MessageFormat;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+/**
+ * Simple utility to replace variables in the form "${varname}"
+ * or "$(varname)" in a string from a map of replacements, with
+ * support for fallbacks for unknown variables.
+ * @author eswartz
+ *
+ */
+public class VariableSubstitutionEngine {
+
+ private IMessageListener msgListener;
+ private MessageLocation location;
+ private boolean recursive;
+ private Pattern thePattern = curlyBraces;
+ private static final Pattern curlyBraces = Pattern.compile("(\\$\\{([^}]+)\\})");
+ private static final Pattern parentheses = Pattern.compile("(\\$\\(([^)]+)\\))");
+
+ /**
+ * Create an engine which will report any errors against
+ * the given location to the given listener. The default
+ * variable token is '{'.
+ * @param msgListener
+ * @param location
+ */
+ public VariableSubstitutionEngine(IMessageListener msgListener, MessageLocation location) {
+ this.msgListener = msgListener;
+ this.location = location;
+ setVariableToken('{');
+ }
+
+ /**
+ * Set the token delimiting variables (either '{' or '(')
+ * @param token
+ */
+ public void setVariableToken(char token) {
+ if (token == '{') {
+ thePattern = curlyBraces;
+ }
+ else if (token == '(') {
+ thePattern = parentheses;
+ } else {
+ Check.checkArg(false);
+ }
+ }
+
+ /**
+ * Substitute all instances of "${varname}" or "$(varname)"
+ * with values using the callback.
+ *
+ * @param variables
+ * @param expr
+ * @return
+ * @see #setVariableToken(char)
+ */
+ public String substitute(IVariableLookupCallback variableLookupCallback, String expr) {
+ if (expr == null)
+ return null;
+ Check.checkArg(variableLookupCallback);
+ StringBuilder buffer;
+ // variables we've replaced, ever
+ Set<String> replaces = new HashSet<String>();
+ boolean replaced;
+ do {
+ // variables we've replaced in this line
+ Set<String> lineReplaces = new HashSet<String>();
+ buffer = new StringBuilder();
+ replaced = false;
+ Matcher matcher = thePattern.matcher(expr);
+ int startPosition = 0;
+ int prevPosition = 0;
+ while (startPosition < expr.length() && matcher.find(startPosition)) {
+ String key = matcher.group(2);
+ if (recursive && replaces.contains(key) && !lineReplaces.contains(key)) {
+ if (msgListener != null) {
+ msgListener.emitMessage(new Message(IMessage.ERROR,
+ location,
+ "SimpleSubstitutionEngine.InfiniteRecursion", //$NON-NLS-1$
+ MessageFormat.format(
+ Messages.getString("SimpleSubstitutionEngine.InfiniteRecursion"), //$NON-NLS-1$
+ new Object[] { key })));
+ }
+ startPosition = matcher.end();
+ continue;
+ }
+ Object value = variableLookupCallback.getValue(key);
+ replaces.add(key);
+ lineReplaces.add(key);
+ if (value == null) {
+ if (msgListener != null)
+ msgListener.emitMessage(new Message(IMessage.ERROR,
+ location,
+ "SimpleSubstitutionEngine.UnknownVariable", //$NON-NLS-1$
+ MessageFormat.format(
+ Messages.getString("SimpleSubstitutionEngine.UnknownVariable"), //$NON-NLS-1$
+ new Object[] { key })));
+ startPosition = matcher.end();
+ buffer.append(expr.substring(prevPosition, matcher.end()));
+ prevPosition = matcher.end();
+ } else {
+ String valueString = value.toString();
+ if (!recursive && thePattern.matcher(valueString).find()) {
+ if (msgListener != null)
+ msgListener.emitMessage(new Message(IMessage.ERROR,
+ location,
+ "SimpleSubstitutionEngine.InvalidSubstitution", //$NON-NLS-1$
+ MessageFormat.format(
+ Messages.getString("SimpleSubstitutionEngine.InvalidSubstitution"), //$NON-NLS-1$
+ new Object[] { key, value })));
+ return expr;
+ }
+
+ buffer.append(expr.substring(prevPosition, matcher.start()));
+ buffer.append(valueString);
+ prevPosition = matcher.end();
+ replaced = true;
+
+ // don't replace anymore
+ int lastCharacterMatched = matcher.end();
+ startPosition = lastCharacterMatched;
+ }
+ }
+ buffer.append(expr.substring(prevPosition));
+ expr = buffer.toString();
+ } while (recursive && replaced);
+ return expr;
+ }
+
+ /**
+ * Substitute all instances of "${varname}" or "$(varname)"
+ * with values from the map.
+ *
+ * @param variables
+ * @param expr
+ * @return
+ * @see #setVariableToken(char)
+ */
+ public String substitute(final Map<String, String> variables, String expr) {
+ return substitute(new IVariableLookupCallback() {
+ public Object getValue(String var) {
+ return variables.get(var);
+ }
+ }, expr);
+ }
+
+
+ /**
+ * Allow recursive substitution of variables with values that
+ * contain ${...}
+ * @param enable
+ */
+ public void allowRecursion(boolean enable) {
+ this.recursive = enable;
+ }
+
+
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/Messages.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/Messages.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/Messages.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.utils.core.noexport;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * @author eswartz
+ *
+ */
+public class Messages {
+ private static final String BUNDLE_NAME = "com.nokia.cpp.utils.core.noexport.messages";//$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/UtilsCorePlugin.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/UtilsCorePlugin.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/UtilsCorePlugin.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.utils.core.noexport;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+import com.nokia.cpp.internal.api.utils.core.Logging;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class UtilsCorePlugin extends Plugin {
+ public static final String ID = "com.nokia.cpp.utils.core";
+
+ //The shared instance.
+ private static UtilsCorePlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+ public UtilsCorePlugin() {
+ super();
+ plugin = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ resourceBundle = null;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static UtilsCorePlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = UtilsCorePlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ try {
+ if (resourceBundle == null)
+ resourceBundle = ResourceBundle.getBundle("com.nokia.sdt.utils.UtilsPluginResources"); //$NON-NLS-1$
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ return resourceBundle;
+ }
+
+ static public void log(IStatus status) {
+ Logging.log(plugin, status);
+ }
+
+ static public void log(Throwable thr) {
+ Logging.log(plugin, Logging.newStatus(plugin, thr));
+ }
+
+ static public void log(Throwable thr, String msg) {
+ Logging.log(plugin, Logging.newStatus(plugin, IStatus.ERROR, msg, thr));
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/messages.properties
===================================================================
--- trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/messages.properties (rev 0)
+++ trunk/common/com.nokia.cpp.utils.core/src/com/nokia/cpp/utils/core/noexport/messages.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,15 @@
+Check.RuntimeError=Runtime Error
+Check.ArgumentIsNull=argument is null
+Check.ArgumentIsInvalid=argument is invalid
+Check.ObjectIsInconsistent=object state is inconsistent
+Check.ApiAssertionFailed=assertion on API contract failed
+Logging.ErrorTitle=Error
+Logging.FromPlugin=plugin:
+Logging.DueToException=exception:
+Logging.NoMessage=???
+Logging.GenericErrorMessage=An error has occurred.\nPlease see the Error Log for more details.
+Message.Error=error:
+Message.Warning=warning:
+SimpleSubstitutionEngine.UnknownVariable=unknown variable ''{0}''
+SimpleSubstitutionEngine.InvalidSubstitution=invalid substitution of variable ''{0}'' with value ''{1}''
+TextUtils.Conjunctions=(in|to|of|and|or|but|if|as)
Property changes on: trunk/common/com.nokia.cpp.utils.ui
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/com.nokia.cpp.utils.ui/.classpath
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/.classpath (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/com.nokia.cpp.utils.ui/.project
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/.project (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.nokia.cpp.utils.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/com.nokia.cpp.utils.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Fri Jul 25 18:42:18 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/com.nokia.cpp.utils.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Carbide.c++ UI Utilities
+Bundle-SymbolicName: com.nokia.cpp.utils.ui
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: com.nokia.cpp.utils.ui.noexport.UtilsUIPlugin
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.ide,
+ com.nokia.cpp.utils.core,
+ org.eclipse.ui.forms,
+ org.eclipse.core.resources
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: com.nokia.cpp.internal.api.utils.ui
Added: trunk/common/com.nokia.cpp.utils.ui/build.properties
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/build.properties (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = .,\
+ META-INF/
+src.includes = META-INF/,\
+ src/
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ControlVisitor.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ControlVisitor.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ControlVisitor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public abstract class ControlVisitor {
+
+ public interface Visitor {
+ /**
+ * Visit one control.
+ * @return null to continue traveral, non-null to terminate
+ */
+ Object visit(Control control);
+ }
+
+ /**
+ * Visit the given control and its children.
+ * Returns the first non-null value returned
+ * by the visitor, or null if all controls visited
+ * and no value was returned.
+ */
+ public static Object visit(Composite control, Visitor v) {
+ Object result = v.visit(control);
+ if (result == null) {
+ result = visitChildren(control, v);
+ }
+ return result;
+ }
+
+ /**
+ * Visit the given control's children, but not
+ * the control itself.
+ * Returns the first non-null value returned
+ * by the visitor, or null if all controls visited
+ * and no value was returned.
+ */
+ public static Object visitChildren(Composite control, Visitor v) {
+ Object result = null;
+ Control[] children = control.getChildren();
+ if (children != null) {
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
+ if (child instanceof Composite) {
+ result = visit((Composite)child, v);
+ }
+ else {
+ result = v.visit(child);
+ }
+ if (result != null)
+ break;
+ }
+ }
+ return result;
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/DirectorySelectorWithHistory.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/DirectorySelectorWithHistory.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/DirectorySelectorWithHistory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+
+import com.nokia.cpp.utils.ui.noexport.Messages;
+
+import java.io.File;
+import java.util.*;
+import java.util.List;
+
+/**
+ * A utility class for a directory combo, browse button, and a history.
+ * @author eswartz
+ *
+ */
+public class DirectorySelectorWithHistory extends Composite {
+ public interface DirectoryChangeListener {
+ void setDirectory();
+ }
+
+ private static final String RECENT_FS_DIRECTORIES_STORE_BASE =
+ "com.nokia.sdt.utils.ui.filesystem.browse.history"; //$NON-NLS-1$
+
+ private Combo directoryCombo;
+ private Button chooseButton;
+ private File dir;
+ private java.util.List<String> recentDirectories;
+
+ private List<DirectoryChangeListener> listeners;
+
+ private IDialogSettings settings;
+ private String recentDirectoriesStoreKey;
+
+ /**
+ * Create an instance in the parent.
+ * @param parent parent, which must have a GridLayout.
+ * @param settings the settings to use to restore/save the directory list
+ * @param directoryGroup optional subgroup of directories (so that clients can either share
+ * directory lists or keep private ones), or null for master list
+ */
+ public DirectorySelectorWithHistory(final Composite parent, IDialogSettings settings, String directoryGroup) {
+ super(parent, SWT.NONE);
+ setLayout(new GridLayout(2, false));
+
+ this.settings = settings;
+ dir = new File("."); //$NON-NLS-1$
+ this.recentDirectories = new ArrayList<String>();
+ this.listeners = new ArrayList<DirectoryChangeListener>();
+ recentDirectoriesStoreKey = RECENT_FS_DIRECTORIES_STORE_BASE;
+ if (directoryGroup != null)
+ recentDirectoriesStoreKey += "." + directoryGroup; //$NON-NLS-1$
+
+
+ directoryCombo = new Combo(this, SWT.BORDER);
+ directoryCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ directoryCombo.setText(dir.getAbsolutePath());
+ directoryCombo.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ updateCurrentDirectory();
+ }
+ });
+ directoryCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateCurrentDirectory();
+ }
+ });
+ chooseButton = new Button(this, SWT.PUSH);
+ chooseButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ chooseButton.setText(Messages.getString("DirectorySelectorWithHistory.BrowseLabel")); //$NON-NLS-1$
+ chooseButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dlg = new DirectoryDialog(parent.getShell());
+ String curPath = directoryCombo.getText();
+ if (curPath.length() > 0)
+ dlg.setFilterPath(curPath);
+ else
+ dlg.setFilterPath("."); //$NON-NLS-1$
+ String dir = dlg.open();
+ if (dir != null) {
+ directoryCombo.setText(dir);
+ updateCurrentDirectory();
+ }
+ }
+
+ });
+
+ restoreDialogSettings();
+
+ }
+
+ public void addListener(DirectoryChangeListener listener) {
+ if (!listeners.contains(listener))
+ listeners.add(listener);
+ }
+
+ protected void updateCurrentDirectory() {
+ File newDir = new File(directoryCombo.getText());
+ if (newDir.equals(dir))
+ return;
+ dir = newDir;
+ saveDialogSettings();
+ for (DirectoryChangeListener listener : listeners) {
+ listener.setDirectory();
+ }
+ }
+
+ private void saveDialogSettings() {
+ if (settings != null) {
+ // remove the bld.inf file from the stack if it exists
+ recentDirectories.remove(directoryCombo.getText());
+
+ // add the selected bld.inf file to the top of the stack
+ recentDirectories.add(0, directoryCombo.getText());
+
+ // keep the stack at 20 strings
+ if (recentDirectories.size() > 20) {
+ recentDirectories.remove(20);
+ }
+
+ settings.put(recentDirectoriesStoreKey, recentDirectories.toArray(new String[recentDirectories.size()]));
+ }
+ }
+
+ private void restoreDialogSettings() {
+ if (settings != null) {
+ String[] files = settings.getArray(recentDirectoriesStoreKey);
+ if (files != null && files.length > 0) {
+ recentDirectories.addAll(Arrays.asList(files));
+ directoryCombo.setItems(files);
+ directoryCombo.select(0);
+ dir = new File(directoryCombo.getText());
+ }
+ }
+ }
+
+ /**
+ * @return
+ */
+ public File getCurrentDirectory() {
+ return dir;
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/FilesListDialog.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/FilesListDialog.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/FilesListDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+import com.nokia.cpp.internal.api.utils.core.Check;
+
+import java.util.List;
+
+/**
+ * A dialog that displays files in a table with checkboxes.
+ * Constructor argument is List<IFile> and the dialog modifies the list with only the checked files if ok.
+ */
+public class FilesListDialog extends Dialog {
+
+ private class FilesListContentProvider implements IStructuredContentProvider {
+ public Object[] getElements(Object inputElement) {
+ Check.checkArg(inputElement instanceof List);
+ List<IFile> paths = (List<IFile>) inputElement;
+ return paths.toArray();
+ }
+
+ public void dispose() {}
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+ }
+
+ private class FilesListLabelProvider extends LabelProvider {
+ private ILabelProvider wbLabelProvider;
+
+ public FilesListLabelProvider() {
+ wbLabelProvider = WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider();
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return wbLabelProvider.getImage(element);
+ }
+
+ @Override
+ public String getText(Object element) {
+ IFile file = (IFile) element;
+ return file.getFullPath().makeRelative().toString();
+ }
+ }
+
+ private CheckboxTableViewer filesTableViewer;
+ private final List<IFile> filesList;
+ private String caption;
+ private String title;
+ private Button okButton;
+ private Text label;
+ private boolean initiallyChecked;
+
+ /**
+ * Create the dialog
+ * @param parentShell
+ * @param filesList
+ * @param title
+ * @param caption
+ */
+ public FilesListDialog(Shell parentShell, List<IFile> filesList, String title, String caption, boolean initiallyChecked) {
+ super(parentShell);
+ setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MODELESS);
+ this.filesList = filesList;
+ this.title = title;
+ this.caption = caption;
+ this.initiallyChecked = initiallyChecked;
+ }
+
+ /**
+ * Create contents of the dialog
+ * @param parent
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite area = (Composite) super.createDialogArea(parent);
+ Composite container = new Composite(area, SWT.NONE);
+ container.setLayout(new FillLayout(SWT.VERTICAL));
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ final Composite contents = new Composite(container, SWT.NONE);
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ gridLayout.verticalSpacing = 20;
+ gridLayout.marginTop = 10;
+ gridLayout.marginRight = 10;
+ gridLayout.marginLeft = 10;
+ gridLayout.marginBottom = 10;
+ gridLayout.horizontalSpacing = 20;
+ contents.setLayout(gridLayout);
+
+ label = new Text(contents, SWT.WRAP | SWT.READ_ONLY);
+ final GridData gd_label = new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1);
+ gd_label.widthHint = 400;
+ label.setLayoutData(gd_label);
+ label.setText(caption);
+
+ filesTableViewer = CheckboxTableViewer.newCheckList(contents, SWT.BORDER);
+ final GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
+ gd_table.widthHint = 350;
+ filesTableViewer.getTable().setLayoutData(gd_table);
+ //
+ filesTableViewer.setContentProvider(new FilesListContentProvider());
+ filesTableViewer.setLabelProvider(new FilesListLabelProvider());
+ filesTableViewer.setInput(filesList);
+ filesTableViewer.setAllChecked(initiallyChecked);
+ filesTableViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ updateOkButtonEnabled();
+ }
+ });
+
+ final Button selectAllButton = new Button(contents, SWT.NONE);
+ selectAllButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ filesTableViewer.setAllChecked(true);
+ updateOkButtonEnabled();
+ }
+ });
+ selectAllButton.setLayoutData(new GridData(90, SWT.DEFAULT));
+ selectAllButton.setText("Select &All");
+
+ final Button selectNoneButton = new Button(contents, SWT.NONE);
+ selectNoneButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ filesTableViewer.setAllChecked(false);
+ updateOkButtonEnabled();
+ }
+ });
+ selectNoneButton.setLayoutData(new GridData(90, SWT.DEFAULT));
+ selectNoneButton.setText("&Deselect All");
+
+ filesTableViewer.getControl().forceFocus();
+
+ return area;
+ }
+
+ /**
+ * Create contents of the button bar
+ * @param parent
+ */
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ updateOkButtonEnabled();
+
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ private void updateOkButtonEnabled() {
+ okButton.setEnabled(filesTableViewer.getCheckedElements().length > 0);
+ }
+
+ protected void okPressed() {
+ TableItem[] tableItems = filesTableViewer.getTable().getItems();
+ for (int i = 0; i < tableItems.length; i++) {
+ TableItem tableItem = tableItems[i];
+ if (!tableItem.getChecked()) {
+ filesList.remove((IFile) tableItem.getData());
+ }
+ }
+ super.okPressed();
+ }
+ /**
+ * Return the initial size of the dialog
+ */
+ @Override
+ protected Point getInitialSize() {
+ return new Point(500, 375);
+ }
+
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(title);
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/IColorConverter.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/IColorConverter.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/IColorConverter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.RGB;
+
+public interface IColorConverter {
+ /**
+ * Convert the given image RGB value to an RGB value
+ * that reflects the representation in another color space.
+ * @param palette a palette configured for R=0xff, G=0xff00, B=0xff0000 space
+ * @param outColors array of colors to convert to (TODO: not used)
+ * @param rgb RGB in inPalette space
+ * @return new pixel in outPalette space
+ */
+ public int convertPixel(PaletteData palette, RGB[] outColors, RGB rgb);
+}
\ No newline at end of file
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/IToolTipLabelProvider.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/IToolTipLabelProvider.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/IToolTipLabelProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+
+/**
+ * This interface may be implemented on a label provider used in
+ * the ThumbnailGridViewer to provide tooltips for items.
+ * @author eswartz
+ *
+ */
+public interface IToolTipLabelProvider extends ILabelProvider {
+ /** Return the tooltip, or null */
+ String getToolTipText(Object element);
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ModelObjectComboBoxCellEditor.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ModelObjectComboBoxCellEditor.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ModelObjectComboBoxCellEditor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+import java.util.*;
+
+/**
+ * This is a cell editor that manages a list of model objects
+ * whose strings are provided through an ILabelProvider. It is
+ * read only so items cannot be typed in.
+ * <p>
+ * Use instead of EMF's ExtendedComboBoxCellEditor which is overloaded
+ * with buggy features that make it hard to use.
+ * @author eswartz
+ *
+ */
+public class ModelObjectComboBoxCellEditor extends ComboBoxCellEditor {
+
+ protected List<?> modelItems;
+
+ public ModelObjectComboBoxCellEditor(Composite parent,
+ List<?> items,
+ ILabelProvider labelProvider) {
+ super(parent, getItemStrings(items, labelProvider), SWT.READ_ONLY);
+ this.modelItems = items;
+ }
+
+ public static String[] getItemStrings(List<?> items, ILabelProvider labelProvider) {
+ String[] array = new String[items.size()];
+ int i = 0;
+ for (Object obj : items) {
+ array[i++] = labelProvider.getText(obj);
+ }
+ return array;
+ }
+
+ @Override
+ protected Object doGetValue() {
+ Object value = super.doGetValue();
+ if (value instanceof Number) {
+ // look up model at index
+ int index = ((Number) value).intValue();
+ if (index < 0)
+ return null;
+ value = modelItems.get(index);
+ }
+ return value;
+ }
+
+ @Override
+ protected void doSetValue(Object value) {
+ // look up the model object to reestablish index
+ int index = modelItems.indexOf(value);
+ if (index != -1) {
+ super.doSetValue(index);
+ }
+ }
+
+ public void setModelItems(List<?> items, ILabelProvider labelProvider) {
+ setItems(getItemStrings(items, labelProvider));
+ this.modelItems = items;
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/NotifyWithBooleanPrefDialog.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/NotifyWithBooleanPrefDialog.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/NotifyWithBooleanPrefDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import com.nokia.cpp.utils.ui.noexport.Messages;
+
+/**
+ * Utility that wraps a JFace dialog to which notifies the user
+ * of a situation. The dialog has a checkbox indicating whether
+ * to show the dialog again.
+ *
+ * @see org.eclipse.jface.dialogs.MessageDialogWithToggle
+ * @author eswartz
+ *
+ */
+public class NotifyWithBooleanPrefDialog {
+
+ protected String prefName;
+
+ private IPreferenceStore preferences;
+
+ private Shell parentShell;
+
+ private String title;
+
+ private String prompt;
+
+ /**
+ * Create the dialog
+ * @param parentShell parent of the dialog, null for default
+ * @param title the dialog title, required
+ * @param prompt the prompt text, required
+ * @param plugin the plugin owning the preference, required
+ * @param prefName the name of the boolean preference, required
+ */
+ public NotifyWithBooleanPrefDialog(Shell parentShell,
+ String title, String prompt,
+ AbstractUIPlugin plugin, String prefName) {
+ this.parentShell = parentShell;
+ this.title = title;
+ this.prompt = prompt;
+ this.preferences = plugin.getPreferenceStore();
+ this.prefName = prefName;
+ }
+
+
+
+ /**
+ * Main method to query for a setting. If the preference setting
+ * is at the skip value then the call returns immediately.
+ * <p>
+ * If the user clicks OK with the "don't ask" checkbox checked
+ * then the preference setting is automatically updated.
+ */
+ public void doNotify() {
+
+ String value = preferences.contains(prefName)
+ ? preferences.getString(prefName)
+ : null;
+ if (value != null) {
+ if (value.equals(MessageDialogWithToggle.ALWAYS))
+ return;
+ // else, bogus, and go to dialog
+ }
+
+ MessageDialogWithToggle.openInformation(
+ parentShell, title, prompt, Messages.getString("NotifyWithBooleanPrefDialog.DoNotNotifyAgain"), //$NON-NLS-1$
+ false, preferences, prefName);
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ProjectFolderSelectionDialog.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ProjectFolderSelectionDialog.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ProjectFolderSelectionDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+import com.nokia.cpp.internal.api.utils.core.FileUtils;
+import com.nokia.cpp.utils.ui.noexport.Messages;
+
+import java.util.ArrayList;
+
+/**
+ * Dialog allowing selection of a folder inside a given container
+ * (like ContainerSelectionDialog, but actually limiting the scope).
+ * @author eswartz
+ *
+ */
+public class ProjectFolderSelectionDialog extends Dialog {
+
+ private Label messageLabel;
+ private String message;
+ private IContainer root;
+ private TreeViewer folderList;
+ protected IPath path;
+
+ public ProjectFolderSelectionDialog(Shell parentShell, IContainer root, String message) {
+ super(parentShell);
+ this.root = root;
+ this.message = message != null ? message : Messages.getString("ProjectFolderSelectionDialog.SelectFolderDescriptionLabel"); //$NON-NLS-1$
+ this.path = new Path(""); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(Messages.getString("ProjectFolderSelectionDialog.SelectFolderTitle")); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ messageLabel = new Label(composite, SWT.NONE);
+ messageLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ messageLabel.setText(message);
+
+ folderList = new TreeViewer(composite);
+ folderList.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ folderList.setContentProvider(new WorkbenchContentProvider() {
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.model.BaseWorkbenchContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object element) {
+ Object[] orig = super.getChildren(element);
+ java.util.List<Object> containers = new ArrayList<Object>();
+ for (Object item : orig) {
+ if (item instanceof IContainer) {
+ containers.add(item);
+ }
+ }
+ return containers.toArray();
+ }
+ });
+ folderList.setLabelProvider(new WorkbenchLabelProvider());
+ folderList.setInput(root);
+
+ folderList.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ if (selection.isEmpty())
+ path = null;
+ else
+ path = FileUtils.removePrefixFromPath(root.getLocation(),
+ ((IResource)selection.getFirstElement()).getLocation());
+ }
+
+ });
+
+ return composite;
+ }
+
+ /**
+ * @return
+ */
+ public IPath getPath() {
+ return path;
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/QueryWithBooleanPrefDialog.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/QueryWithBooleanPrefDialog.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/QueryWithBooleanPrefDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.jface.dialogs.*;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Utility to query the user with an OK/Cancel dialog
+ * that is tied to a boolean preference. The preference
+ * controls whether the dialog is shown or skipped. <p>
+ * A checkbox can be set in the dialog to enable the preference.<p>
+ * If the checkbox is set, only one response to the dialog
+ * means it will be suppressed for the future.
+ * @author dpodwall
+ *
+ */
+public class QueryWithBooleanPrefDialog {
+
+ private MessageDialogWithToggle dialog;
+
+ protected String prefName;
+ protected boolean valueToSkipDialog;
+ protected boolean dontAskValue;
+
+ private IPreferenceStore preferences;
+
+ /**
+ * Create the dialog
+ * @param parentShell parent of the dialog, null for default
+ * @param title the dialog title, required
+ * @param prompt the prompt text, required
+ * @param plugin the plugin owning the preference, required
+ * @param prefName the name of the boolean preference, required
+ * @param valueToSkipDialog the boolean preference value which corresponds to
+ * skipping the dialog.
+ */
+ public QueryWithBooleanPrefDialog(Shell parentShell,
+ String title, String prompt,
+ AbstractUIPlugin plugin, String prefName, boolean valueToSkipDialog) {
+ preferences = plugin.getPreferenceStore();
+ dialog = new MessageDialogWithToggle(parentShell, title,
+ null, prompt, MessageDialog.INFORMATION,
+ new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0,
+ null,
+ preferences.getBoolean(prefName) == valueToSkipDialog);
+ this.prefName = prefName;
+ this.valueToSkipDialog = valueToSkipDialog;
+ }
+
+
+ /**
+ * Main method to query for OK/Cancel. If the preference setting
+ * is at the "don't skip" value then the dialog is run. If the
+ * preference setting is at the skip value then true is always
+ * returned.<p>
+ * If the user clicks OK with the "don't ask" checkbox checked
+ * then the preference setting is automatically updated.
+ */
+ public boolean doQuery() {
+ boolean result = false;
+ boolean prefValue = preferences.getBoolean(prefName);
+ if (prefValue != valueToSkipDialog) {
+ result = (dialog.open() == IDialogConstants.OK_ID);
+ if (dialog.getToggleState()) {
+ preferences.setValue(prefName, valueToSkipDialog);
+ }
+ }
+ else {
+ result = true;
+ }
+ return result;
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/QueryWithTristatePrefDialog.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/QueryWithTristatePrefDialog.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/QueryWithTristatePrefDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import com.nokia.cpp.internal.api.utils.core.Check;
+
+/**
+ * Utility that wraps a JFace dialog to which asks the user
+ * a boolean question. The dialog has a checkbox indicating whether
+ * to remember the decision (yea or nay) for later.
+ * <p>
+ * This differs from QueryWithBooleanPrefDialog which only
+ * remembers a decision if it was answered one way or the other.
+ *
+ * @see org.eclipse.jface.dialogs.MessageDialogWithToggle
+ * @see com.nokia.sdt.utils.ui.QueryWithBooleanPrefDialog
+ * @author dpodwall
+ * @author eswartz
+ *
+ */
+public class QueryWithTristatePrefDialog {
+
+ public static final int QUERY_YES_NO = 1;
+ public static final int QUERY_OK_CANCEL = 2;
+
+ protected String prefName;
+ protected boolean valueToSkipDialog;
+ protected boolean dontAskValue;
+
+ private IPreferenceStore preferences;
+
+ private Shell parentShell;
+
+ private String title;
+
+ private String prompt;
+
+ private boolean initialSetting;
+
+ private int type;
+
+ /**
+ * Create the dialog
+ * @param parentShell parent of the dialog, null for default
+ * @param title the dialog title, required
+ * @param prompt the prompt text, required
+ * @param plugin the plugin owning the preference, required
+ * @param prefName the name of the boolean preference, required
+ * @param initialSetting the initial setting for the toggle
+ * @param type the query to perform (QUERY_YES_NO, QUERY_OK_CANCEL)
+ */
+ public QueryWithTristatePrefDialog(Shell parentShell,
+ String title, String prompt,
+ AbstractUIPlugin plugin, String prefName,
+ boolean initialSetting, int type) {
+ Check.checkArg(type == QUERY_OK_CANCEL || type == QUERY_YES_NO);
+ this.parentShell = parentShell;
+ this.title = title;
+ this.prompt = prompt;
+ this.preferences = plugin.getPreferenceStore();
+ this.prefName = prefName;
+ this.initialSetting = initialSetting;
+ this.type = type;
+ }
+
+
+
+ /**
+ * Main method to query for a setting. If the preference setting
+ * is at the "don't skip" value then the dialog is run. If the
+ * preference setting is at the skip value then the retained value
+ * is always returned.<p>
+ * If the user clicks OK with the "don't ask" checkbox checked
+ * then the preference setting is automatically updated.
+ * @return true if the "always" pref is set or the positive value (yes/ok)
+ * was selected, false if the "never" pref or the negative value (no/cancel)
+ * was selected.
+ */
+ public boolean doQuery() {
+
+ String value = preferences.contains(prefName)
+ ? preferences.getString(prefName)
+ : null;
+ if (value != null) {
+ if (value.equals(MessageDialogWithToggle.ALWAYS))
+ return true;
+ if (value.equals(MessageDialogWithToggle.NEVER))
+ return false;
+ // else, bogus, and go to dialog
+ }
+
+ MessageDialogWithToggle dialog;
+ boolean confirmed = false;
+ if (type == QUERY_YES_NO) {
+ dialog = MessageDialogWithToggle.openYesNoQuestion(
+ parentShell, title, prompt, null,
+ initialSetting, preferences,
+ prefName);
+ confirmed = dialog.getReturnCode() == IDialogConstants.YES_ID;
+ }
+ else if (type == QUERY_OK_CANCEL) {
+ dialog = MessageDialogWithToggle.openYesNoQuestion(
+ parentShell, title, prompt, null,
+ initialSetting, preferences,
+ prefName);
+ confirmed = dialog.getReturnCode() == IDialogConstants.OK_ID;
+ }
+ else
+ Check.checkState(false);
+ return confirmed;
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/RadioButtonTableViewer.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/RadioButtonTableViewer.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/RadioButtonTableViewer.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,262 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.TableEditor;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.*;
+
+import com.nokia.cpp.internal.api.utils.core.ListenerList;
+
+import java.util.*;
+import java.util.Map.Entry;
+
+/**
+ * A TableViewer supporting embedded radio button controls.
+ * The content provider should implement the IRadioButtonContentProvider
+ * interface in order to tell the viewer which items have radio buttons
+ * and which is the initially selected item.
+ */
+public class RadioButtonTableViewer extends TableViewer {
+
+ class RadioItem {
+ TableEditor editor;
+ Button button;
+ }
+
+ /**
+ * Callback to notify clients when the currently
+ * selected item has changed.
+ */
+ public interface IRadioStateListener {
+ /** Called when current radio button changes.
+ * @param prevSelected previous selected item, or null
+ * @param newSelected new selected item, or null
+ */
+ void radioStateChanged(Object prevSelected, Object newSelected);
+ }
+
+ public interface IRadioButtonContentProvider {
+ /**
+ * Return the element whose radio button should be selected
+ */
+ Object getSelectedElement();
+
+ /**
+ * Return true if the element should have a radio button
+ */
+ boolean hasRadioButton(Object element);
+ }
+
+ private int radioColumn = 0;
+ private boolean forceSelectedItem = true;
+ private Map<Object, RadioItem> itemMap = new HashMap<Object, RadioItem>();
+ private ListenerList<IRadioStateListener> listeners = new ListenerList<IRadioStateListener>();
+ private int style = 0;
+
+ public RadioButtonTableViewer(Table table) {
+ super(table);
+ }
+
+ public void addRadioStateListener(IRadioStateListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeRadioStateListener(IRadioStateListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Set the column to hold radio buttons. Must be set
+ * before the viewer is initially populated.
+ * @param column the column index
+ */
+ public void setRadioColumn(int column) {
+ this.radioColumn = column;
+ }
+
+ /**
+ * When true, the viewer attempts to make
+ * @param force
+ */
+ public void setForceSelectedIem(boolean force) {
+ this.forceSelectedItem = force;
+ }
+
+ @Override
+ protected void inputChanged(Object input, Object oldInput) {
+ super.inputChanged(input, oldInput);
+ IContentProvider cp = getContentProvider();
+ if (cp instanceof IRadioButtonContentProvider) {
+ IRadioButtonContentProvider rbcp = (IRadioButtonContentProvider) cp;
+ Object selectedElement = rbcp.getSelectedElement();
+ if (selectedElement != null) {
+ setSelectedItem(selectedElement);
+ }
+ else if (forceSelectedItem) {
+ forceSelectedItem();
+ }
+ }
+ }
+
+ private void fireRadioStateChanged(Object oldSelected, Object newSelected) {
+ for (IRadioStateListener l : listeners) {
+ l.radioStateChanged(oldSelected, newSelected);
+ }
+ }
+
+ public void setSelectedItem(Object item) {
+ RadioItem ri = itemMap.get(item);
+ if (ri != null) {
+ for (RadioItem currRI : itemMap.values()) {
+ currRI.button.setSelection(currRI == ri);
+ }
+ }
+ }
+
+ public Object getSelectedItem() {
+ Object result = null;
+ for (Iterator<Entry<Object, RadioItem>> iter = itemMap.entrySet().iterator(); iter.hasNext();) {
+ Entry<Object, RadioItem> entry = iter.next();
+ if (entry.getValue().button.getSelection()) {
+ result = entry.getKey();
+ break;
+ }
+ }
+ return result;
+ }
+
+ private void updateSelectedRadio(Button changedButton, boolean isSelected) {
+ Object oldSelected = null;
+ Object newSelected = null;
+ // ensure single item only is selected
+ if (isSelected) {
+ for (Iterator<Entry<Object, RadioItem>> iter = itemMap.entrySet().iterator(); iter.hasNext();) {
+ Entry<Object, RadioItem> entry = iter.next();
+ Button currBtn = entry.getValue().button;
+ if (currBtn.getSelection()) {
+ if (currBtn == changedButton) {
+ newSelected = entry.getKey();
+ } else {
+ oldSelected = entry.getKey();
+ currBtn.setSelection(false);
+ }
+ }
+ }
+
+ fireRadioStateChanged(oldSelected, newSelected);
+ }
+ // ensure some item is selected, if possible
+ else if (forceSelectedItem) {
+ forceSelectedItem();
+ }
+ }
+
+ public void forceSelectedItem() {
+ if (getSelectedItem() == null) {
+ Object newSelected = null;
+ // selected first eligible item, from top down
+ for (int i = 0; i < getTable().getItemCount(); i++) {
+ Object curr = getElementAt(i);
+ RadioItem ri = itemMap.get(curr);
+ if (ri != null) {
+ ri.button.setSelection(true);
+ newSelected = curr;
+ break;
+ }
+ }
+ if (newSelected != null) {
+ fireRadioStateChanged(null, newSelected);
+ }
+ }
+ }
+
+ /**
+ * Set additional style bits for radio button appearance.
+ * Most likely style added may be FLAT when in a non-3D view.
+ * @param style int
+ * @see SWT#FLAT
+ */
+ public void setStyle(int style) {
+ this.style = style;
+ }
+
+ /**
+ * We override associate to maintain each items optional
+ * radio button information.
+ */
+ @Override
+ protected void associate(Object element, Item item) {
+ super.associate(element, item);
+ IContentProvider contentProvider = getContentProvider();
+ if (contentProvider instanceof IRadioButtonContentProvider) {
+ Table table = getTable();
+ IRadioButtonContentProvider rbcp = (IRadioButtonContentProvider) contentProvider;
+ RadioItem ri = itemMap.get(element);
+ if (rbcp.hasRadioButton(element)) {
+ if (ri == null) {
+ ri = new RadioItem();
+ itemMap.put(element, ri);
+ ri.editor = new TableEditor(table);
+ ri.button = new Button(table, SWT.RADIO | style);
+ ri.button.pack();
+ ri.button.setBackground(table.getBackground());
+ ri.editor.grabHorizontal = true;
+ ri.editor.setEditor(ri.button, (TableItem)item, radioColumn);
+ ri.editor.minimumWidth = ri.button.getSize().x;
+ ri.editor.horizontalAlignment = SWT.LEFT;
+
+ ri.button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button btn = (Button) e.getSource();
+ updateSelectedRadio(btn, btn.getSelection());
+ }
+ });
+ }
+ }
+ else if (ri != null) {
+ ri.editor.dispose();
+ ri.button.dispose();
+ itemMap.remove(element);
+ }
+ }
+ }
+
+ /**
+ * We override disassociate to clean up any
+ * allocated radio button information and to
+ * help implement force selection.
+ */
+ @Override
+ protected void disassociate(Item item) {
+ boolean wasSelected = false;
+ Object element = item.getData();
+ RadioItem ri = itemMap.get(element);
+ if (ri != null) {
+ wasSelected = ri.button.getSelection();
+ ri.editor.dispose();
+ ri.button.dispose();
+ itemMap.remove(element);
+ }
+ super.disassociate(item);
+
+ if (wasSelected && forceSelectedItem) {
+ Display.getCurrent().asyncExec(new Runnable() {
+ public void run() {
+ forceSelectedItem();
+ }
+ });
+ }
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/RunRunnableWhenWorkbenchVisibleJob.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/RunRunnableWhenWorkbenchVisibleJob.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/RunRunnableWhenWorkbenchVisibleJob.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A job that runs an action once the workbench is visible.
+ */
+public class RunRunnableWhenWorkbenchVisibleJob extends Job {
+
+ private final Runnable runnable;
+ private Shell shell;
+
+ public RunRunnableWhenWorkbenchVisibleJob(Runnable runnable) {
+ super(""); // never shown //$NON-NLS-1$
+ this.runnable = runnable;
+ this.shell = WorkbenchUtils.getActiveShell();
+
+ // don't show up on the Progress view
+ setUser(false);
+ setSystem(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ while (true) {
+ final boolean executed[] = { false };
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ if (shell != null && shell.isVisible()) {
+ runnable.run();
+ executed[0] = true;
+ }
+ }
+ });
+ if (executed[0])
+ break;
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Create and schedule a job to run a Runnable once the shell is visible.
+ * @param runnable the Runnable to run
+ */
+ public static void start(Runnable runnable) {
+ Job job = new RunRunnableWhenWorkbenchVisibleJob(runnable);
+ job.schedule();
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ShowDialogWhenWorkbenchVisibleJob.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ShowDialogWhenWorkbenchVisibleJob.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/ShowDialogWhenWorkbenchVisibleJob.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A job that shows a dialog only once the workbench is visible.
+ * @author eswartz
+ *
+ */
+public class ShowDialogWhenWorkbenchVisibleJob extends Job {
+
+ private Dialog dialog;
+ private Shell shell;
+
+ public ShowDialogWhenWorkbenchVisibleJob(Shell shell, Dialog dialog) {
+ super("Dialog job"); // never shown //$NON-NLS-1$
+ this.shell = shell;
+ if (this.shell == null)
+ this.shell = WorkbenchUtils.getActiveShell();
+ this.dialog = dialog;
+
+ // don't show up on the Progress view
+ setUser(false);
+ setSystem(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ while (true) {
+ final boolean executed[] = { false };
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ if (shell.isVisible()) {
+ dialog.open();
+ executed[0] = true;
+ }
+ }
+ });
+ if (executed[0])
+ break;
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Create and schedule a job to show a dialog once the shell is visible.
+ * No response will be reported from the dialog, so we mark it non-blocking.
+ * @param shell the shell, or null to select the active workbench window
+ * @param dialog the dialog to show
+ */
+ public static void start(Shell shell, Dialog dialog) {
+ dialog.setBlockOnOpen(false);
+ Job job = new ShowDialogWhenWorkbenchVisibleJob(shell, dialog);
+ job.schedule();
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/UITaskUtils.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/UITaskUtils.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/UITaskUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.cpp.utils.ui.noexport.UtilsUIPlugin;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * This class provides utilities to perform various long-running
+ * operations in a UI-friendly way.
+ * <p>
+ * At the time of writing the primary issue is that the data model and sourcegen
+ * operations must be performed on the UI thread, and at the same time provide
+ * progress information to avoid unresponsiveness.
+ *
+ * @author eswartz
+ *
+ */
+public class UITaskUtils {
+
+ private UITaskUtils() {
+ }
+
+ /**
+ * Run this task immediately and do not return until it is
+ * finished.
+ * @param runnable
+ * @return true for succeess, false for failure
+ */
+ public static boolean runImmediately(IRunnableWithProgress runnable) {
+ return runImmediately(runnable, ResourcesPlugin.getWorkspace().getRoot());
+ }
+
+ /**
+ * Run this task immediately and do not return until it is
+ * finished. Provide the scheudling rule.
+ * @param runnable
+ * @param rule
+ * @return true for succeess, false for failure
+ */
+ public static boolean runImmediately(IRunnableWithProgress runnable, ISchedulingRule rule) {
+ try {
+ // claim the operation depends on the entire workspace
+ PlatformUI.getWorkbench().getProgressService().runInUI(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+ runnable,
+ rule);
+ return true;
+ } catch (InvocationTargetException e) {
+ UtilsUIPlugin.log(e);
+ return false;
+ } catch (InterruptedException e) {
+ return false;
+ }
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/WorkbenchUtils.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/WorkbenchUtils.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/WorkbenchUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.*;
+import org.eclipse.ui.internal.ide.IDEInternalPreferences;
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.ui.testing.TestableObject;
+
+import com.nokia.cpp.internal.api.utils.core.Check;
+
+public abstract class WorkbenchUtils {
+
+ /**
+ * Return true if running JUnit tests, false if normal interactive run
+ */
+ public static boolean isJUnitRunning() {
+ boolean result = false;
+ TestableObject testableObject = PlatformUI.getTestableObject();
+ if (testableObject != null) {
+ result = testableObject.getTestHarness() != null;
+ }
+ return result;
+ }
+
+ /**
+ * Get the active workbench shell.
+ * This can return null if the shell is in the background!
+ * @return current foreground workbench window shell
+ */
+ public static Shell getActiveShell() {
+ if (!Platform.isRunning())
+ return null;
+
+ final Shell[] shell = { null };
+
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ final IWorkbench workbench;
+ try {
+ workbench = PlatformUI.getWorkbench();
+ } catch (IllegalStateException e) {
+ return;
+ }
+
+ final IWorkbenchWindow[] activeWorkbenchWindow = { null };
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ activeWorkbenchWindow[0] = workbench.getActiveWorkbenchWindow();
+ }
+ });
+ if (activeWorkbenchWindow[0] == null)
+ return;
+
+ shell[0] = activeWorkbenchWindow[0].getShell();
+
+ }
+ });
+
+ return shell[0];
+ }
+
+ /**
+ * Get a shell that is preferably the active workbench window,
+ * but pick some other workbench shell or even a random SWT
+ * shell if none is active. Fail if no shells are available.
+ * @return shell, never null
+ * @throws IllegalStateException if no shells visible
+ */
+ public static Shell getSafeShell() {
+ Shell shell = getActiveShell();
+ if (shell != null)
+ return shell;
+
+ try {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
+ if (activeWorkbenchWindow != null) {
+ shell = activeWorkbenchWindow.getShell();
+ }
+ if (shell == null) {
+ for (IWorkbenchWindow window : workbench.getWorkbenchWindows()) {
+ shell = window.getShell();
+ if (shell != null)
+ return shell;
+ }
+ }
+ } catch (IllegalStateException e) {
+ // platform not running
+ }
+
+ // resort to SWT
+ final Shell[] shellEntry = { null };
+
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ Shell[] shells = PlatformUI.getWorkbench().getDisplay().getShells();
+ if (shells.length > 0) {
+ shellEntry[0] = shells[0];
+ }
+ }
+ });
+ shell = shellEntry[0];
+
+ Check.checkState(shell != null);
+ return shell;
+ }
+
+ /**
+ * This should be called in IWorkbenchPart.createPartControl(Composite parent)
+ * to set the help context id for that IViewPart or IEditorPart.
+ *
+ * @param control the control on which to register the context id
+ * @param contextId the context id to use when F1 help is invoked
+ */
+ public static void setHelpContextId(Control control, String contextId) {
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(control, contextId);
+ }
+
+ /**
+ * Reads the General > Workspace > Save automatically before build option and, if true,
+ * saves all open editor windows
+ *
+ */
+ @SuppressWarnings("restriction")
+ public static void saveOpenEditorsIfRequired(){
+ IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore();
+ if (store != null && store.getBoolean(IDEInternalPreferences.SAVE_ALL_BEFORE_BUILD)){
+ PlatformUI.getWorkbench().saveAllEditors(false);
+ }
+ }
+
+ /**
+ * Load and provide a view part with the given id.
+ * @param viewID
+ * @return IViewPart
+ * @throws PartInitException
+ */
+ public static IViewPart getView(String viewID) throws PartInitException {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IViewPart view = workbenchWindow.getActivePage().showView(viewID);
+ return view;
+ }
+
+
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/ComposeableEditingContext.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/ComposeableEditingContext.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/ComposeableEditingContext.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui.editor;
+
+import org.eclipse.core.runtime.IStatus;
+
+public abstract class ComposeableEditingContext implements IEditingContext {
+
+ private IEditingContext outerContext;
+
+ protected ComposeableEditingContext(IEditingContext outerContext) {
+ this.outerContext = outerContext;
+ }
+
+ protected abstract IStatus showSelf();
+
+ public IStatus show() {
+ IStatus result = null;
+ if (outerContext != null) {
+ result = outerContext.show();
+ }
+ if (result == null) {
+ result = showSelf();
+ }
+ return result;
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/EditingContextOperation.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/EditingContextOperation.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/EditingContextOperation.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui.editor;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.cpp.utils.ui.noexport.Messages;
+
+
+/**
+ * Implementation of AbstractOperation (still abstract) that
+ * interacts with an IEditingContext.
+ * Failure to restore an editing context does not abort execution, but
+ * it does display a dialog.
+ *
+ * The execute, undo, and redo commands are routed to new abstract methods
+ * prefixed with "do", e.g. doExecute().
+ */
+public abstract class EditingContextOperation extends AbstractOperation implements IAdaptable {
+
+ private IEditingContext editingContext;
+
+ protected EditingContextOperation(String label, IEditingContext editingContext) {
+ super(label);
+ this.editingContext = editingContext;
+ }
+
+ public Object getAdapter(Class adapter) {
+ Object result = null;
+ if (IEditingContext.class == adapter) {
+ result = editingContext;
+ } else if (Shell.class == adapter) {
+ result = getShell();
+ } else if (adapter != null && adapter.isInstance(this)) {
+ result = this;
+ }
+ return result;
+ }
+
+ public void setEditingContext(IEditingContext context) {
+ this.editingContext = context;
+ }
+
+ public IEditingContext getEditingContext() {
+ return editingContext;
+ }
+
+ /**
+ * Utility to retrieve the IEditingContext from an operation, if it has one
+ */
+ public static IEditingContext getEditingContextForOperation(IUndoableOperation op) {
+ IEditingContext result = null;
+ if (op instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) op;
+ result = (IEditingContext) adaptable.getAdapter(IEditingContext.class);
+ }
+ return result;
+ }
+
+ protected Shell getShell() {
+ Shell result = null;
+ if (editingContext != null) {
+ result = editingContext.getShell();
+ }
+ if (result == null) {
+ result = Display.getDefault().getActiveShell();
+ }
+ return result;
+ }
+
+ protected void restoreEditingContext(IAdaptable info) {
+ if (editingContext != null) {
+ IStatus status = editingContext.show();
+ if (status != null && !status.isOK()) {
+ String fmt = Messages.getString("EditingContextOperation.cantShowCommandLocation"); //$NON-NLS-1$
+ Object params[] = {getLabel()};
+ String msg = MessageFormat.format(fmt, params);
+ ErrorDialog.openError(getShell(), Messages.getString("EditingContextOperation.errorDialogTitle"), msg, status); //$NON-NLS-1$
+ }
+ }
+ }
+
+ protected abstract IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException;
+ protected abstract IStatus doUndo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException;
+ protected abstract IStatus doRedo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException;
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return doExecute(monitor, info);
+ }
+
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ restoreEditingContext(info);
+ return doRedo(monitor, info);
+ }
+
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ restoreEditingContext(info);
+ return doUndo(monitor, info);
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/ErrorPage.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/ErrorPage.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/ErrorPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui.editor;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+public class ErrorPage extends FormPage {
+
+ private String errorString;
+ private String titleString;
+
+ /**
+ * Create the form page
+ * @param id
+ * @param title
+ */
+ public ErrorPage(String id, String title) {
+ super(id, title);
+ }
+
+ /**
+ * Create the form page
+ * @param editor
+ * @param id
+ * @param title
+ */
+ public ErrorPage(FormEditor editor, String id, String title) {
+ super(editor, id, title);
+ }
+
+ public void setErrorString(String errorString) {
+ this.errorString = errorString;
+ }
+
+ public void setTitleString(String titleString) {
+ this.titleString = titleString;
+ }
+
+ /**
+ * Create contents of the form
+ * @param managedForm
+ */
+ @Override
+ protected void createFormContent(IManagedForm managedForm) {
+ FormToolkit toolkit = managedForm.getToolkit();
+ ScrolledForm form = managedForm.getForm();
+ form.setText(titleString);
+ Composite body = form.getBody();
+ body.setLayout(new GridLayout());
+ toolkit.paintBordersFor(body);
+
+ final Label separator = toolkit.createSeparator(body, SWT.HORIZONTAL);
+ final GridData gd_separator = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ separator.setLayoutData(gd_separator);
+
+ final Label errorTextLabel = toolkit.createLabel(body, errorString, SWT.NONE);
+ final GridData gd_errorTextLabel = new GridData(SWT.FILL, SWT.FILL, true, true);
+ errorTextLabel.setLayoutData(gd_errorTextLabel);
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/FormEditorEditingContext.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/FormEditorEditingContext.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/FormEditorEditingContext.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui.editor;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.IFormPage;
+
+import com.nokia.cpp.internal.api.utils.core.Check;
+import com.nokia.cpp.internal.api.utils.core.Logging;
+import com.nokia.cpp.utils.ui.noexport.Messages;
+import com.nokia.cpp.utils.ui.noexport.UtilsUIPlugin;
+
+public class FormEditorEditingContext extends ComposeableEditingContext {
+
+ private FormEditor formEditor;
+ private Object inputObject;
+
+ public FormEditorEditingContext(IEditingContext outerContext, FormEditor editor, Object inputObject) {
+ super(outerContext);
+ Check.checkArg(editor);
+ this.formEditor = editor;
+ this.inputObject = inputObject;
+ }
+
+ public FormEditorEditingContext(FormEditor editor, Object inputObject) {
+ super(null);
+ Check.checkArg(editor);
+ this.formEditor = editor;
+ this.inputObject = inputObject;
+ }
+
+ public IStatus showSelf() {
+ IStatus result = null;
+ IFormPage page = formEditor.selectReveal(inputObject);
+ if (page != null) {
+ if (formEditor.getActivePageInstance() != page) {
+ formEditor.setActivePage(page.getId());
+ }
+ if (inputObject instanceof Control) {
+ Control ctl = (Control) inputObject;
+ ctl.setFocus();
+ }
+ }
+ else {
+ String msg = Messages.getString("FormEditorEditingContext.cantShowUndo"); //$NON-NLS-1$
+ result = Logging.newSimpleStatus(UtilsUIPlugin.getDefault(), IStatus.WARNING, msg, null);
+ }
+ return result;
+ }
+
+ public Shell getShell() {
+ return formEditor.getSite().getShell();
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/IEditingContext.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/IEditingContext.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/editor/IEditingContext.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.internal.api.utils.ui.editor;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Interface used with org.eclipse.core.commands.operations.IUndoableOperation. *
+ * We use this to allow the command to cooperate with restoring the editing context.
+ * For example a multi-page editor may execute undo on a page different from the
+ * page holding the modified item(s). Upon undo, the page should be changed so the
+ * user can see what was undone. The command itself need not know that details, but
+ * it does need to know to query the info parameter for an IEditingContext and invoke
+ * the show method.
+ *
+ * Implementations of this interface should also implement getAdapter to return a Shell,
+ * as per the comments in IUndoableOperation.
+ */
+public interface IEditingContext {
+
+ /**
+ * Show the UI context, e.g. page, visible gui controls, etc., appropriate
+ * to the command.
+ * @return IStatus indicating success or failure.
+ */
+ IStatus show();
+
+ /**
+ * Return the most relevant shell for this context, e.g. for dialogs
+ */
+ Shell getShell();
+}
\ No newline at end of file
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/Messages.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/Messages.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/Messages.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.utils.ui.noexport;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * @author eswartz
+ *
+ */
+public class Messages {
+ private static final String BUNDLE_NAME = "com.nokia.cpp.utils.ui.noexport.messages";//$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/UtilsUIPlugin.java
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/UtilsUIPlugin.java (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/UtilsUIPlugin.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+
+package com.nokia.cpp.utils.ui.noexport;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+import com.nokia.cpp.internal.api.utils.core.Logging;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UtilsUIPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.nokia.carbide.cpp.utils.ui";
+
+ // The shared instance
+ private static UtilsUIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public UtilsUIPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UtilsUIPlugin getDefault() {
+ return plugin;
+ }
+
+ static public void log(IStatus status) {
+ Logging.log(plugin, status);
+ }
+
+ static public void log(Throwable thr) {
+ Logging.log(plugin, Logging.newStatus(plugin, thr));
+ }
+
+ static public void log(Throwable thr, String msg) {
+ Logging.log(plugin, Logging.newStatus(plugin, IStatus.ERROR, msg, thr));
+ }
+
+}
Added: trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/messages.properties
===================================================================
--- trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/messages.properties (rev 0)
+++ trunk/common/com.nokia.cpp.utils.ui/src/com/nokia/cpp/utils/ui/noexport/messages.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+DirectorySelectorWithHistory.BrowseLabel=Browse...
+EditingContextOperation.cantShowCommandLocation=Unable to display the location for the '{0}' command.
+EditingContextOperation.errorDialogTitle=Error
+FormEditorEditingContext.cantShowUndo=Unable to show undo location.
+NotifyWithBooleanPrefDialog.DoNotNotifyAgain=Do not ¬ify me again
+ProjectFolderSelectionDialog.SelectFolderDescriptionLabel=Select a folder:
+ProjectFolderSelectionDialog.SelectFolderTitle=Select a folder
Property changes on: trunk/common/org.indt.esbox.core.compatibility
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.indt.esbox.core.compatibility/.classpath
===================================================================
--- trunk/common/org.indt.esbox.core.compatibility/.classpath (rev 0)
+++ trunk/common/org.indt.esbox.core.compatibility/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/org.indt.esbox.core.compatibility/.project
===================================================================
--- trunk/common/org.indt.esbox.core.compatibility/.project (rev 0)
+++ trunk/common/org.indt.esbox.core.compatibility/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.indt.esbox.core.compatibility</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.indt.esbox.core.compatibility/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.indt.esbox.core.compatibility/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/org.indt.esbox.core.compatibility/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 09:57:22 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/org.indt.esbox.core.compatibility/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.indt.esbox.core.compatibility/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.indt.esbox.core.compatibility/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Compatibility Plug-in
+Bundle-SymbolicName: org.indt.esbox.core;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-CoreActivator: compatibility.CoreActivator
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.cpp.project.core;bundle-version="1.5.0",
+ org.eclipse.core.resources;bundle-version="3.4.0",
+ org.eclipse.cdt.make.core;bundle-version="5.0.1",
+ org.maemo.esbox.python.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Activator: org.indt.esbox.internal.core.compatibility.Activator
+Bundle-Vendor: INdT / Nokia
Added: trunk/common/org.indt.esbox.core.compatibility/build.properties
===================================================================
--- trunk/common/org.indt.esbox.core.compatibility/build.properties (rev 0)
+++ trunk/common/org.indt.esbox.core.compatibility/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/common/org.indt.esbox.core.compatibility/plugin.xml
===================================================================
--- trunk/common/org.indt.esbox.core.compatibility/plugin.xml (rev 0)
+++ trunk/common/org.indt.esbox.core.compatibility/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <!-- This plugin contains extensions that refer to the old
+ org.indt.esbox.core name -->
+
+ <!-- this one is obsolete and used to provide a builder which prompts for conversion;
+ removing the nature declaration will cause Eclipse to spew errors, so keep until we drop support for 1.4 -->
+ <extension
+ id="ESboxNature"
+ name="Old ESbox Project Nature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+ class="org.maemo.esbox.cpp.project.core.OldESboxProjectNature">
+ </run>
+ </runtime>
+ </extension>
+
+ <extension
+ id="esboxPythonNature"
+ name="Old ESbox Project Python Nature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+ class="org.maemo.esbox.python.project.core.OldESboxPythonProjectNature">
+ </run>
+ </runtime>
+ <!-- this won't actually get used... -->
+ <builder
+ id="org.indt.esbox.core.esboxOldPythonBuilder">
+ </builder>
+ </extension>
+
+
+ <!-- This is a stub builder which issues an error and asks the user to convert
+ the project manually. -->
+ <extension
+ id="esboxMakeBuilder"
+ name="Old ESbox C/C++ Project Converter"
+ point="org.eclipse.core.resources.builders">
+ <builder
+ callOnEmptyDelta="true"
+ hasNature="false"
+ isConfigurable="false">
+ <run
+ class="org.indt.esbox.internal.compatibility.core.ESboxOldCppProjectBuilder">
+ <parameter
+ name="defaultCommand"
+ value="make">
+ </parameter>
+ </run>
+ </builder>
+ </extension>
+
+ <!-- this won't actually get called since existing projects already have a builder assigned -->
+ <extension
+ id="esboxOldPythonBuilder"
+ name="Old ESbox Python Project Converter"
+ point="org.eclipse.core.resources.builders">
+ <builder
+ callOnEmptyDelta="true"
+ hasNature="false"
+ isConfigurable="false">
+ <run
+ class="org.indt.esbox.internal.compatibility.core.ESboxOldPythonProjectBuilder">
+ </run>
+ </builder>
+ </extension>
+
+</plugin>
Added: trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility/core/ESboxOldCppProjectBuilder.java
===================================================================
--- trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility/core/ESboxOldCppProjectBuilder.java (rev 0)
+++ trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility/core/ESboxOldCppProjectBuilder.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.indt.esbox.internal.compatibility.core;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.project.core.IOldESboxProjectBuilder;
+
+import java.util.Map;
+
+/**
+ * This builder runs when old projects are detected, and merely emits a Problem about the project
+ * being out of date.
+ * @author eswartz
+ *
+ */
+public class ESboxOldCppProjectBuilder extends IncrementalProjectBuilder implements IOldESboxProjectBuilder {
+
+ public ESboxOldCppProjectBuilder() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IncrementalProjectBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected IProject[] build(final int kind, Map args, IProgressMonitor monitor)
+ throws CoreException {
+
+ if (kind == AUTO_BUILD)
+ return null;
+
+ IProject project = getProject();
+
+ IMarker[] markers = project.findMarkers(IMarker.PROBLEM, false, 0);
+
+ boolean found = false;
+ for (IMarker marker : markers) {
+ if (marker.getAttribute(IOldESboxProjectBuilder.ATTR_NEEDS_CONVERSION) != null) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ IMarker marker = project.createMarker(IMarker.PROBLEM);
+ marker.setAttribute(IMarker.MESSAGE, "Outdated project format; please convert (File > New > Convert to Maemo C/C++ Project)");
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ marker.setAttribute(IOldESboxProjectBuilder.ATTR_NEEDS_CONVERSION, Boolean.TRUE);
+ }
+
+ return null;
+ }
+
+
+}
Added: trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility/core/ESboxOldPythonProjectBuilder.java
===================================================================
--- trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility/core/ESboxOldPythonProjectBuilder.java (rev 0)
+++ trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/compatibility/core/ESboxOldPythonProjectBuilder.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.indt.esbox.internal.compatibility.core;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.project.core.IOldESboxProjectBuilder;
+
+import java.util.Map;
+
+/**
+ * This builder runs when old projects are detected, and merely emits a Problem about the project
+ * being out of date.
+ * <p>
+ * Note: this won't actually run ;p
+ * @author eswartz
+ *
+ */
+public class ESboxOldPythonProjectBuilder extends IncrementalProjectBuilder implements IOldESboxProjectBuilder {
+
+ public ESboxOldPythonProjectBuilder() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IncrementalProjectBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected IProject[] build(final int kind, Map args, IProgressMonitor monitor)
+ throws CoreException {
+
+ if (kind == AUTO_BUILD)
+ return null;
+
+ IProject project = getProject();
+
+ IMarker[] markers = project.findMarkers(IMarker.PROBLEM, false, 0);
+
+ boolean found = false;
+ for (IMarker marker : markers) {
+ if (marker.getAttribute(IOldESboxProjectBuilder.ATTR_NEEDS_CONVERSION) != null) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ IMarker marker = project.createMarker(IMarker.PROBLEM);
+ marker.setAttribute(IMarker.MESSAGE, "Outdated project format; please convert (File > New > Convert to Maemo Python Project)");
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ marker.setAttribute(IOldESboxProjectBuilder.ATTR_NEEDS_CONVERSION, Boolean.TRUE);
+ }
+
+ return null;
+ }
+
+
+}
Added: trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/core/compatibility/Activator.java
===================================================================
--- trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/core/compatibility/Activator.java (rev 0)
+++ trunk/common/org.indt.esbox.core.compatibility/src/org/indt/esbox/internal/core/compatibility/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,50 @@
+package org.indt.esbox.internal.core.compatibility;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.indt.esbox.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Property changes on: trunk/common/org.maemo.esbox.analysis
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.analysis/.classpath
===================================================================
--- trunk/common/org.maemo.esbox.analysis/.classpath (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/org.maemo.esbox.analysis/.project
===================================================================
--- trunk/common/org.maemo.esbox.analysis/.project (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.analysis</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.analysis/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.maemo.esbox.analysis/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 13:51:02 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/org.maemo.esbox.analysis/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.analysis/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Core Analysis Plug-in
+Bundle-SymbolicName: org.maemo.esbox.analysis;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-CoreActivator: org.maemo.esbox.analysis.core.noexport.CoreActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.analysis.adapters,
+ org.maemo.esbox.internal.analysis.oprofile,
+ org.maemo.esbox.internal.analysis.valgrind
+Bundle-Activator: org.maemo.esbox.internal.analysis.core.Activator
Added: trunk/common/org.maemo.esbox.analysis/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.analysis/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/common/org.maemo.esbox.analysis/plugin.xml
===================================================================
--- trunk/common/org.maemo.esbox.analysis/plugin.xml (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.maemo.esbox.core.tool">
+ <tool
+ id="org.maemo.esbox.analysis.core.tool.oprofile"
+ name="OProfile">
+ <provider
+ class="org.maemo.esbox.internal.analysis.oprofile.OProfileToolProvider">
+ </provider>
+ </tool>
+ <tool
+ id="org.maemo.esbox.analysis.core.tool.valgrind"
+ name="Valgrind">
+ <provider
+ class="org.maemo.esbox.internal.analysis.valgrind.ValgrindToolProvider"></provider>
+ </tool>
+ <tool
+ id="org.maemo.esbox.analysis.core.tool.opreport"
+ name="OPreport">
+ <provider
+ class="org.maemo.esbox.internal.analysis.oprofile.OPreportToolProvider"></provider>
+ </tool>
+ </extension>
+
+</plugin>
Added: trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis/adapters/IOProfileSupportAdapter.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis/adapters/IOProfileSupportAdapter.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis/adapters/IOProfileSupportAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.analysis.adapters;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.machine.IMachine;
+
+/**
+ * This adapter is used to determine whether an SDK target (on a host or a
+ * device) supports oprofile
+ * (either statically, according to its platform and target, or dynamically,
+ * whether the packages are installed).
+ * @author eswartz
+ *
+ */
+public interface IOProfileSupportAdapter {
+ // XXX: allow deriving an ISDKTarget from a different IMachine so we don't have to pass IMachine here
+ /**
+ * Provide an error message if valgrind is not (known to be) supported on the target.
+ * @param the machine we're targeting (either ISDKTarget#getMachine() or some other one)
+ * @return String for error or <code>null</code> for success
+ */
+ String validateSupport(IMachine machine);
+
+ /**
+ * Perform a pre-launch check, determining whether the necessary tools are
+ * installed on the target.
+ * @return true: everything succeeded; false: error occurred and user canceled
+ * @throws CoreException bigger problems occurred
+ */
+ boolean preLaunchCheck(Shell shell) throws CoreException;
+}
Added: trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis/adapters/IValgrindSupportAdapter.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis/adapters/IValgrindSupportAdapter.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/analysis/adapters/IValgrindSupportAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.analysis.adapters;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.machine.IMachine;
+
+/**
+ * This adapter is used to determine whether an SDK target (on a host or device) supports valgrind
+ * (either statically, according to its platform and target, or dynamically,
+ * whether the packages are installed).
+ * @author eswartz
+ *
+ */
+public interface IValgrindSupportAdapter {
+ // XXX: allow deriving an ISDKTarget from a different IMachine so we don't have to pass IMachine here
+ /**
+ * Provide an error message if valgrind is not (known to be) supported on the target.
+ * @param the machine we're targeting (either ISDKTarget#getMachine() or some other one)
+ * @return String for error or <code>null</code> for success
+ */
+ String validateSupport(IMachine machine);
+
+ /**
+ * Perform a pre-launch check, determining whether the necessary tools are
+ * installed on the target.
+ * @return true: everything succeeded; false: error occurred and user canceled
+ * @throws CoreException bigger problems occurred
+ */
+ boolean preLaunchCheck(Shell shell) throws CoreException;
+}
Added: trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/core/Activator.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/core/Activator.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/core/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,131 @@
+package org.maemo.esbox.internal.analysis.core;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.core.analysis";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OPreportToolProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OPreportToolProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OPreportToolProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.analysis.oprofile;
+
+import org.maemo.esbox.core.tool.IToolProvider;
+import org.maemo.esbox.core.tool.IToolRunner;
+
+/**
+ *
+ */
+public class OPreportToolProvider implements IToolProvider {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.IToolProvider#getRunner()
+ */
+ public IToolRunner getRunner() {
+ return OPreportToolRunner.getInstance();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.IToolProvider#isInstalled()
+ */
+ public boolean isInstalled() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OPreportToolRunner.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OPreportToolRunner.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OPreportToolRunner.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.analysis.oprofile;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.ProcessRunnerParameters;
+import org.maemo.esbox.core.tool.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ */
+public class OPreportToolRunner implements IToolRunner {
+
+ private static final String OPREPORT = "opreport";
+
+ private static List<IToolListener> listeners;
+
+ private static OPreportToolRunner singleton;
+
+ private OPreportToolRunner() {
+ listeners = new ArrayList<IToolListener>();
+ }
+
+ public static synchronized OPreportToolRunner getInstance() {
+ if (singleton == null)
+ singleton = new OPreportToolRunner();
+ return singleton;
+ }
+
+ public ProcessRunnerParameters createProcessRunnerParameters() throws ESboxException {
+ ProcessRunnerParameters runnerInfo = new ProcessRunnerParameters();
+ List<String> commandLine = runnerInfo.getCommandLine();
+ commandLine.add(OPREPORT);
+ runnerInfo.setBrandNew(false);
+ runnerInfo.setSendToConsole(false);
+ runnerInfo.setConsoleName(null);
+ return runnerInfo;
+ }
+
+ public void trackProcess(Process process) throws ESboxException {
+ sendToolExecutedSignal(process);
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ throw new ESboxException(e);
+ }
+ }
+
+ public synchronized void addListener(IToolListener l) {
+ if (!listeners.contains(l))
+ listeners.add(l);
+ }
+
+ public synchronized boolean removeListener(IToolListener l) {
+ return listeners.remove(l);
+ }
+
+ public void sendToolExecutedSignal(Process process) {
+ ToolEvent event = new ToolEvent(process);
+ for (IToolListener listener : listeners) {
+ listener.toolExecuted(event);
+ }
+ }
+
+}
Added: trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OProfileToolProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OProfileToolProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OProfileToolProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.analysis.oprofile;
+
+import org.maemo.esbox.core.tool.IToolProvider;
+import org.maemo.esbox.core.tool.IToolRunner;
+
+/**
+ *
+ */
+public class OProfileToolProvider implements IToolProvider {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.IToolProvider#getRunner()
+ */
+ public IToolRunner getRunner() {
+ return OProfileToolRunner.getInstance();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.IToolProvider#isInstalled()
+ */
+ public boolean isInstalled() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OProfileToolRunner.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OProfileToolRunner.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/oprofile/OProfileToolRunner.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.analysis.oprofile;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.ProcessRunnerParameters;
+import org.maemo.esbox.core.tool.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ */
+public class OProfileToolRunner implements IToolRunner {
+
+ private static final String OPROFILE = "opcontrol";
+
+ private static List<IToolListener> listeners;
+
+ private static OProfileToolRunner singleton;
+
+ private OProfileToolRunner() {
+ listeners = new ArrayList<IToolListener>();
+ }
+
+ public static synchronized OProfileToolRunner getInstance() {
+ if (singleton == null)
+ singleton = new OProfileToolRunner();
+ return singleton;
+ }
+
+ public ProcessRunnerParameters createProcessRunnerParameters() throws ESboxException {
+ ProcessRunnerParameters runnerInfo = new ProcessRunnerParameters();
+ List<String> commandLine = runnerInfo.getCommandLine();
+ commandLine.add(OPROFILE);
+ runnerInfo.setBrandNew(false);
+ runnerInfo.setSendToConsole(true);
+ runnerInfo.setConsoleName("OProfile Tool");
+ return runnerInfo;
+ }
+
+ public void trackProcess(Process process) throws ESboxException {
+ sendToolExecutedSignal(process);
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ throw new ESboxException(e);
+ }
+ }
+
+ public synchronized void addListener(IToolListener l) {
+ if (!listeners.contains(l))
+ listeners.add(l);
+ }
+
+ public synchronized boolean removeListener(IToolListener l) {
+ return listeners.remove(l);
+ }
+
+ public void sendToolExecutedSignal(Process process) {
+ ToolEvent event = new ToolEvent(process);
+ for (IToolListener listener : listeners) {
+ listener.toolExecuted(event);
+ }
+ }
+
+}
Added: trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/valgrind/ValgrindToolProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/valgrind/ValgrindToolProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/valgrind/ValgrindToolProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.analysis.valgrind;
+
+import org.maemo.esbox.core.tool.IToolProvider;
+import org.maemo.esbox.core.tool.IToolRunner;
+
+/**
+ *
+ */
+public class ValgrindToolProvider implements IToolProvider {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.IToolProvider#getRunner()
+ */
+ public IToolRunner getRunner() {
+ return ValgrindToolRunner.getInstance();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.IToolProvider#isInstalled()
+ */
+ public boolean isInstalled() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/valgrind/ValgrindToolRunner.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/valgrind/ValgrindToolRunner.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis/src/org/maemo/esbox/internal/analysis/valgrind/ValgrindToolRunner.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.analysis.valgrind;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.ProcessRunnerParameters;
+import org.maemo.esbox.core.tool.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ */
+public class ValgrindToolRunner implements IToolRunner {
+
+ private static final String VALGRIND = "valgrind";
+
+ private static List<IToolListener> listeners;
+
+ private static ValgrindToolRunner singleton;
+
+ private ValgrindToolRunner() {
+ listeners = new ArrayList<IToolListener>();
+ }
+
+ public static synchronized ValgrindToolRunner getInstance() {
+ if (singleton == null)
+ singleton = new ValgrindToolRunner();
+ return singleton;
+ }
+
+ public ProcessRunnerParameters createProcessRunnerParameters() throws ESboxException {
+ ProcessRunnerParameters runnerInfo = new ProcessRunnerParameters();
+ List<String> commandLine = runnerInfo.getCommandLine();
+ commandLine.add(VALGRIND);
+ runnerInfo.setBrandNew(false);
+ runnerInfo.setSendToConsole(false);
+ runnerInfo.setConsoleName(null);
+ return runnerInfo;
+ }
+
+ public void trackProcess(Process process) throws ESboxException {
+ sendToolExecutedSignal(process);
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ throw new ESboxException(e);
+ }
+ }
+
+ public synchronized void addListener(IToolListener l) {
+ if (!listeners.contains(l))
+ listeners.add(l);
+ }
+
+ public synchronized boolean removeListener(IToolListener l) {
+ return listeners.remove(l);
+ }
+
+ public void sendToolExecutedSignal(Process process) {
+ ToolEvent event = new ToolEvent(process);
+ for (IToolListener listener : listeners) {
+ listener.toolExecuted(event);
+ }
+ }
+
+}
Property changes on: trunk/common/org.maemo.esbox.analysis.launch
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.analysis.launch/.classpath
===================================================================
--- trunk/common/org.maemo.esbox.analysis.launch/.classpath (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.launch/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/org.maemo.esbox.analysis.launch/.project
===================================================================
--- trunk/common/org.maemo.esbox.analysis.launch/.project (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.launch/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.analysis.launch</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.analysis.launch/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.maemo.esbox.analysis.launch/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.launch/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 13:51:02 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/org.maemo.esbox.analysis.launch/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.analysis.launch/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.launch/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Core Analysis Launch Plug-in
+Bundle-SymbolicName: org.maemo.esbox.analysis.launch;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-CoreActivator: org.maemo.esbox.analysis.launch.noexport.CoreActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.ui;bundle-version="1.5.0",
+ org.eclipse.debug.ui;bundle-version="3.4.0",
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.maemo.esbox.analysis;bundle-version="1.5.0",
+ org.maemo.esbox.analysis.ui;bundle-version="1.5.0",
+ org.maemo.esbox.ssh;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.maemo.esbox.internal.analysis.launch.Activator
+Export-Package: org.maemo.esbox.analysis.launch
Added: trunk/common/org.maemo.esbox.analysis.launch/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.analysis.launch/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.launch/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis/launch/OProfileRemoteLaunchProxy.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis/launch/OProfileRemoteLaunchProxy.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis/launch/OProfileRemoteLaunchProxy.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,490 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 30, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.analysis.launch;
+
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+import org.maemo.esbox.analysis.adapters.IOProfileSupportAdapter;
+import org.maemo.esbox.analysis.ui.IAnalysisViews;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.tool.IToolListener;
+import org.maemo.esbox.core.tool.ToolEvent;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.ILaunchProtocol;
+import org.maemo.esbox.launch.core.*;
+import org.maemo.esbox.ssh.ui.SSHPreferenceUtils;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author LWang
+ *
+ */
+public class OProfileRemoteLaunchProxy extends AbstractRemoteLaunchProxy {
+
+ private ILaunchProxy fAppLaunchProxy;
+
+ private IRemoteLaunchParameterAccessor fLPA;
+
+ private MessageConsole fLogConsole;
+
+ /**
+ * @param configuration
+ * @param appLaunchProxy
+ * The launch proxy that handles launching of application. It
+ * could be a CPP launch proxy or Python launch proxy.
+ * @throws CoreException
+ */
+ public OProfileRemoteLaunchProxy(ILaunchConfiguration configuration,
+ ILaunchProxy appLaunchProxy) throws CoreException {
+ super(configuration);
+
+ // The application launchProxy must be based on the same launch configuration.
+ assert(configuration.equals(appLaunchProxy.getLaunchConfiguration()));
+
+ fAppLaunchProxy = appLaunchProxy;
+
+ if (!(appLaunchProxy.getLaunchParameterAccessor() instanceof IRemoteLaunchParameterAccessor))
+ throw newCoreException("This OProfile launch is only for remote application.");
+
+ fLPA = (IRemoteLaunchParameterAccessor)appLaunchProxy.getLaunchParameterAccessor();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.AbstractLaunchProxy#preLaunchCheck(java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public boolean preLaunchCheck(String mode, IProgressMonitor monitor)
+ throws CoreException {
+ if (!super.preLaunchCheck(mode, monitor))
+ return false;
+
+ IOProfileSupportAdapter oprofileSupport = (IOProfileSupportAdapter) fLPA.getSDKTarget().getAdapter(IOProfileSupportAdapter.class);
+ if (oprofileSupport == null)
+ throw newCoreException("OProfile support is not available for this target.");
+
+ String errMsg = oprofileSupport.validateSupport(fLPA.getMachine());
+ if (errMsg != null)
+ throw newCoreException(errMsg);
+
+ return oprofileSupport.preLaunchCheck(WorkbenchUtils.getActiveShell());
+ }
+
+ @Override
+ public void runApplication(ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
+
+ monitor.beginTask("", 10);
+
+ ILaunchProtocol protocol = fLPA.getLaunchProtocol();
+
+ // We need to run as superuser to run oprofile.
+ protocol.requireRunAsRoot();
+
+ protocol.enableLogToConsole(false); // we'll handle logging ourselves.
+ fLogConsole = ESboxLaunchUtils.getLaunchLogConsole(getLaunchConfiguration());
+
+ monitor.subTask("Starting OProfile on device...");
+ try {
+
+ startOProfile(protocol, new SubProgressMonitor(monitor, 1));
+
+ } catch (ESboxException e) {
+ if (e == ESboxException.CANCEL_EXCEPTION)
+ throw new CoreException(Status.CANCEL_STATUS);
+
+ // Following check depends on certain error text from OProfile commands,
+ // which is not perfect but that's life, as those commands do not give
+ // different error code and even if it did would the error code check time-proof ?
+ //
+
+ if (e.getMessage().contains("permission denied") || // $NON-NLS-1$
+ e.getMessage().contains("Normal users are limited")) { // $NON-NLS-1$
+ warnOprofileRequiresSuperuser();
+
+ // Treat as cancel so that no more dialog for user to click.
+ throw new CoreException(Status.CANCEL_STATUS);
+ }
+
+ if (e.getMessage().contains("Kernel doesn't support oprofile")) {// $NON-NLS-1$
+ warnOProfileRequiresSpecialKernel();
+ throw new CoreException(Status.CANCEL_STATUS);
+ }
+
+ throw newCoreException("Failed to start OProfile. \n\n", e);
+ }
+
+ // Launch the application.
+ monitor.subTask("Launch application...");
+ fAppLaunchProxy.runApplication(launch, new SubProgressMonitor(monitor, 2));
+
+ /*
+ * Let user decide when to stop OProfile data collecting, which can be
+ * after the application exits. Anyway, it's up to the user.
+ */
+ waitForUserInstructionToStop();
+
+ monitor.subTask("Stop OProfile data collecting...");
+ try {
+ stopOProfile(protocol, new SubProgressMonitor(monitor, 2));
+ } catch (ESboxException e) {
+ if (e == ESboxException.CANCEL_EXCEPTION)
+ throw new CoreException(Status.CANCEL_STATUS);
+
+ throw newCoreException("Failed to stop OProfile.", e);
+ }
+
+ monitor.subTask("Prepare OProfile data report...");
+ try {
+ runOPreport(protocol, new SubProgressMonitor(monitor, 5));
+ } catch (ESboxException e) {
+ throw newCoreException("Failed to generate OProfile report.", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.AbstractLaunchProxy#doRunApplication(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected Process doRunApplication(IProgressMonitor monitor)
+ throws CoreException {
+ // We have our own implementation of runApplicaiton() that requires no doRunApplication().
+ return null;
+ }
+
+ public ILaunchParameterAccessor getLaunchParameterAccessor() {
+ return fAppLaunchProxy.getLaunchParameterAccessor();
+ }
+
+ public String getPluginID() {
+ return fAppLaunchProxy.getPluginID();
+ }
+
+ private void runOPreport(
+ ILaunchProtocol protocol,
+ IProgressMonitor monitor) throws ESboxException {
+
+ // Internal upper limit. User can cancel anytime he likes.
+ int timeout = 120; // in seconds. This command may take some time.
+
+ // do not log data to launch console as we'll show it in OProfileView.
+ protocol.enableLogToConsole(false);
+
+ List<String> cmdLine = new ArrayList<String>();
+
+ cmdLine.add("opreport");
+ cmdLine.add("-a");
+ cmdLine.add("-l");
+ cmdLine.add("-g");
+
+ StringBuilder stdoutData = new StringBuilder();
+
+ monitor.beginTask("", timeout);
+
+ invokeOProfileCommand(protocol, cmdLine, stdoutData, timeout, monitor);
+
+ final ESboxException exception[] = new ESboxException[1];
+ exception[0] = null;
+
+ // Now we have all report data, show it in the View.
+ final InputStream stream = new ByteArrayInputStream(stdoutData.toString().getBytes());
+
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ ToolEvent event = new ToolEvent(stream);
+ IToolListener opView = null;
+ try {
+ opView = (IToolListener)WorkbenchUtils.getView(IAnalysisViews.OPROFILE_VIEW_ID);
+ } catch (PartInitException e) {
+ exception[0] = new ESboxException("Failed to get OProfile view to show the data.");
+ }
+
+ if (opView != null) {
+ opView.toolExecuted(event);
+ }
+ }});
+
+ if (exception[0] != null)
+ throw exception[0];
+ }
+
+ private void stopOProfile(ILaunchProtocol protocol, IProgressMonitor monitor) throws ESboxException {
+ // Internal upper limit. User can cancel anytime he likes.
+ int timeout = 120; // in seconds. this command may take some time.
+
+ monitor.beginTask("", timeout);
+
+ List<String> cmdLine = new ArrayList<String>();
+
+ cmdLine.add("opcontrol");
+ cmdLine.add("--stop");
+ invokeOProfileCommand(protocol, cmdLine, null, timeout, monitor);
+ }
+
+ private void startOProfile(ILaunchProtocol protocol, IProgressMonitor monitor) throws ESboxException {
+
+ // Internal upper limit. User can cancel anytime he likes.
+ int timeout = 16; // in seconds.
+
+ List<String> cmdLine = new ArrayList<String>();
+
+ monitor.beginTask("", timeout * 3);
+
+ cmdLine.add("opcontrol");
+ cmdLine.add("--init");
+ invokeOProfileCommand(protocol, cmdLine, null, timeout, monitor);
+
+ cmdLine.remove(cmdLine.size() - 1);
+ cmdLine.add("--no-vmlinux");
+ invokeOProfileCommand(protocol, cmdLine, null, timeout, monitor);
+
+ cmdLine.remove(cmdLine.size() - 1);
+ cmdLine.add("--start");
+ invokeOProfileCommand(protocol, cmdLine, null, timeout, monitor);
+ }
+
+ private void invokeOProfileCommand(
+ ILaunchProtocol protocol,
+ List<String> cmdLine,
+ StringBuilder stdoutData,
+ int timeout,
+ IProgressMonitor monitor) throws ESboxException {
+
+ MessageConsoleStream outStream = fLogConsole.newMessageStream();
+ MessageConsoleStream errStream = fLogConsole.newMessageStream();
+
+ ProcessLauncherParameters parameters = new ProcessLauncherParameters(
+ null, cmdLine, null);
+
+ IProcessLauncher pLauncher = protocol.createRemoteCommandLauncher(parameters);
+
+ List<String> wholeCmd = pLauncher.getLaunchCommandArguments();
+
+ String cmd = CommandLineArguments.toString(wholeCmd);
+ outStream.println(cmd);
+
+ Process process = pLauncher.createProcess();
+
+ monitorProcessStream(process, cmdLine.toString(), errStream, stdoutData, timeout, monitor);
+ }
+
+ /**
+ * XXX: merge this with ESboxScriptLauncher#waitForProcess, ScratchboxCommand#runAndWaitForProcess, etc
+ * Spend time monitoring output stream or error stream of the process, during which
+ * user can cancel the operation.<br><br>
+ *
+ * @param process
+ * @param errLogStream
+ * - a console log stream for logging stderr output. can be null.
+ * @param stdoutData
+ * - if non-null, examine the stdout of the process and collect data
+ * from stdout of the process. No check on stderr. if null, only
+ * check stderr.
+ * @param timeout
+ * - in seconds.
+ * @param monitor
+ * - progress monitor, also for user to quit/cancel the process. Can be null,
+ * @throws ESboxException - contain error message.
+ */
+ protected static void monitorProcessStream(
+ final Process process,
+ String processName,
+ final MessageConsoleStream errLogStream,
+ final StringBuilder stdoutData,
+ int timeout,
+ IProgressMonitor monitor) throws ESboxException {
+
+ final int[] exitCode = {0};
+ final Exception[] exception = {null};
+ final StringBuilder errorMessages = new StringBuilder();
+
+ Thread monitorThread = new Thread("ProcessMonitor: "+processName) { //$NON-NLS-1$
+ public void run() {
+ try {
+ String line;
+
+ InputStreamReader errISR = new InputStreamReader(process.getErrorStream());
+ BufferedReader errReader = new BufferedReader(errISR);
+ BufferedReader outputReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+
+ while (true) {
+ // Collect stdout data if so requested.
+ //
+ if (stdoutData != null) {
+ if ((line = outputReader.readLine()) == null)
+ break;
+
+ stdoutData.append(line);
+ stdoutData.append("\n");
+
+ continue;
+ }
+
+ // Check error output
+ if ((line = errReader.readLine()) == null)
+ break;
+
+ if (errLogStream != null)
+ errLogStream.println(line);
+
+ line = line.trim();
+
+ if (errorMessages != null)
+ errorMessages.append(line + "\n");
+ }
+ } catch (IOException e) {
+ // Ignore this as for unknown reason IOException is thrown at
+ // end of reading stdout of a process (e.g. opreport).
+ // exception[0] = e;
+ }
+ }
+ };
+
+ monitorThread.start();
+
+ int timepass = 0;
+
+ boolean cancelled = false;
+
+ try {
+ // Now wait for the process to either fail or succeeds
+ for (timepass = 0; timepass < timeout; timepass += 1) {
+ if (monitorThread.isAlive()) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ if (monitor != null && monitor.isCanceled()) {
+ cancelled = true;
+ throw ESboxException.CANCEL_EXCEPTION;
+ }
+
+ if (monitor != null )
+ monitor.worked(1);
+ } else {
+ break;
+ }
+ }
+
+ monitor.worked(timeout-timepass);
+
+ if (exception[0] != null)
+ throw new ESboxException("IOException occurred : " + exception[0].getLocalizedMessage(), exception[0]);
+
+ if (monitorThread.isAlive()) {
+ throw ESboxException.TIMEOUT_EXCEPTION;
+ }
+ }
+ catch (ESboxException e) {
+ throw e;
+ }
+ finally {
+
+ boolean alive = false;
+ // Check if process exits.
+ try {
+ exitCode[0] = process.exitValue();
+ }
+ catch (IllegalThreadStateException exc) {
+ alive = true;
+ }
+
+ if (alive && cancelled)
+ {
+ process.destroy(); // make sure the process is terminated so that no lingering process exits.
+ }
+
+ if (monitorThread.isAlive()) {
+ try {
+ monitorThread.interrupt();
+ monitorThread.join(1000);
+ } catch (InterruptedException e) {
+ throw new ESboxException("Failed to interrupt the monitor thread: " + monitorThread.getName());
+ }
+ }
+ }
+
+ if (exitCode[0] !=0)
+ throw new ESboxException("Command Failed: " + processName + "\n" + //$NON-NLS-2$
+ errorMessages.toString());
+ }
+
+ private void waitForUserInstructionToStop() {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog.openInformation(null,
+ "OProfile Collecting Data",
+ "Your application is running on the device now and OProfile is "+
+ "collecting data. \n\n" +
+ "When you think it's time, click the OK button to stop " +
+ "OProfile data collecting. And profiler data will soon be shown "+
+ "in OProfile View");
+ }});
+ }
+
+ private void warnOProfileRequiresSpecialKernel() {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ boolean yes = MessageDialog.openQuestion(null,
+ "Kernel required",
+ "Your current kernel image on device does not support OProfile.\n\n"+
+ "There are instructions on the Web on how to get and install a " +
+ "kernel that supports OProfile.\n\n"+
+ "Would you like to go to that web page now ? \n" +
+ "(After you click yes, please check it out in your web browser window)");
+
+ if (yes) {
+ ESboxLaunchUtils.showWebPageInBrowser(
+ "http://maemo.org/development/tools/doc/chinook/oprofile/"); // $NON-NLS-1$
+ }
+ }});
+ }
+
+ private void warnOprofileRequiresSuperuser() {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ boolean yes = MessageDialog.openQuestion(null,
+ "Superuser required",
+ "Superuser privilege on device is required to run OProfile.\n\n"+
+ "Please go to the global preference panel \"ESbox => SSH\" "+
+ "and change the user account to one with superuser priviledge like \"root\".\n\n" +
+ "Would you like to open that preference panel now ?");
+
+ if (yes) {
+ SSHPreferenceUtils.showGlobalSSHPanel(null);
+ }
+ }});
+
+ }
+
+ public IProcessLauncher getProcessLauncherForRun() throws CoreException {
+ // More than one commands involved. No supported....07/31/08
+ throw newCoreException("Not supported: " + this.getClass().getSimpleName() + ".getProcessLauncherForRun()");
+ }
+}
Added: trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis/launch/ValgrindLocalLaunchProxy.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis/launch/ValgrindLocalLaunchProxy.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/analysis/launch/ValgrindLocalLaunchProxy.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 31, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.analysis.launch;
+
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.ui.PartInitException;
+import org.maemo.esbox.analysis.adapters.IValgrindSupportAdapter;
+import org.maemo.esbox.analysis.ui.IAnalysisViews;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.tool.*;
+import org.maemo.esbox.internal.analysis.launch.Activator;
+import org.maemo.esbox.internal.analysis.valgrind.ValgrindToolRunner;
+import org.maemo.esbox.launch.core.*;
+
+import java.util.List;
+
+/**
+ * Valgrind launch proxy that handles local valgrind launch for any types of
+ * application (e.g. CPP, Python).
+ *
+ * @author LWang
+ *
+ */
+public class ValgrindLocalLaunchProxy extends AbstractLocalLaunchProxy {
+
+ private ILaunchProxy fAppLaunchProxy;
+
+ private IESboxLaunchParameterAccessor fLPA;
+
+ /**
+ * @param configuration
+ * @param appLaunchProxy
+ * - The launch proxy that handles launching of application. It
+ * could be a CPP launch proxy or Python launch proxy or else.
+ *
+ * @throws CoreException
+ */
+ public ValgrindLocalLaunchProxy(ILaunchConfiguration configuration,
+ ILaunchProxy appLaunchProxy) throws CoreException {
+ super(configuration);
+
+ // The application launchProxy must be based on the same launch configuration.
+ assert(configuration.equals(appLaunchProxy.getLaunchConfiguration()));
+
+ fAppLaunchProxy = appLaunchProxy;
+
+ if (!(appLaunchProxy.getLaunchParameterAccessor() instanceof IESboxLaunchParameterAccessor))
+ throw newCoreException("The Valgrind launch only works on applications running in Scratchbox.");
+
+ fLPA = (IESboxLaunchParameterAccessor)appLaunchProxy.getLaunchParameterAccessor();
+ }
+
+ @Override
+ public boolean preLaunchCheck(String mode, IProgressMonitor monitor)
+ throws CoreException {
+ // XXX: do we need to save SDKTarget in launch config of valgrind ?
+// if (!super.preLaunchCheck(mode, monitor))
+// return false;
+
+ IValgrindSupportAdapter valgrindSupportAdapter = (IValgrindSupportAdapter) fLPA.getSDKTarget().getAdapter(IValgrindSupportAdapter.class);
+ if (valgrindSupportAdapter == null)
+ throw newCoreException("Valgrind support is not available for this target.");
+
+ String errMsg = valgrindSupportAdapter.validateSupport(fLPA.getMachine());
+ if (errMsg != null)
+ throw newCoreException(errMsg);
+
+ return valgrindSupportAdapter.preLaunchCheck(WorkbenchUtils.getActiveShell());
+ }
+
+ @Override
+ public ProcessRunnerParameters createProgramLauncherParameters()
+ throws CoreException {
+
+ ProcessRunnerParameters info = fAppLaunchProxy.createProgramLauncherParameters();
+
+ List<String> cmdLine = info.getCommandLine();
+
+ String valgrind = "valgrind -q --tool=memcheck --leak-check=yes"; //$NON-NLS-1$
+ List<String> valgrindCmd = CommandLineArguments.createFromCommandLine(valgrind);
+
+ cmdLine.addAll(0, valgrindCmd);
+
+ return info;
+ }
+
+ @Override
+ protected Process doRun(ProcessLauncherParameters info) throws CoreException {
+
+ ITool valgrind = ESboxToolEngine.getInstance().getTool("Valgrind")[0];
+
+ Activator.getDefault().getWorkbench().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ try {
+ ValgrindToolRunner.getInstance().addListener((IToolListener)WorkbenchUtils.getView(
+ IAnalysisViews.VALGRIND_VIEW_ID));
+ } catch (PartInitException e) {
+ Activator.getErrorLogger().logAndShowError("Failed to initialize Valgrind view", e);
+ }
+ }
+ });
+
+
+ Process process = null;
+ try {
+ process = super.doRun(info);
+
+ valgrind.getProvider().getRunner().trackProcess(process);
+ } catch (ESboxException e) {
+ abort("Could not launch valgrind", e, 0);
+ }
+
+ return process;
+ }
+
+ public ILaunchParameterAccessor getLaunchParameterAccessor() {
+ return fAppLaunchProxy.getLaunchParameterAccessor();
+ }
+
+ public String getPluginID() {
+ return fAppLaunchProxy.getPluginID();
+ }
+}
Added: trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/internal/analysis/launch/Activator.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/internal/analysis/launch/Activator.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.launch/src/org/maemo/esbox/internal/analysis/launch/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,139 @@
+package org.maemo.esbox.internal.analysis.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.*;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.analysis.launch";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ public IViewPart getView(String viewID) throws PartInitException {
+ IWorkbench workbench = this.getWorkbench();
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IViewPart view = workbenchWindow.getActivePage().showView(viewID);
+ return view;
+ }
+
+}
Property changes on: trunk/common/org.maemo.esbox.analysis.ui
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.analysis.ui/.classpath
===================================================================
--- trunk/common/org.maemo.esbox.analysis.ui/.classpath (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.ui/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/org.maemo.esbox.analysis.ui/.project
===================================================================
--- trunk/common/org.maemo.esbox.analysis.ui/.project (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.ui/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.analysis.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.analysis.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.maemo.esbox.analysis.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.ui/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 13:51:02 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/org.maemo.esbox.analysis.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.analysis.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.ui/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Core Analysis UI Plug-in
+Bundle-SymbolicName: org.maemo.esbox.analysis.ui;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-CoreActivator: org.maemo.esbox.analysis.ui.noexport.CoreActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.ui;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.analysis.ui
+Bundle-Activator: org.maemo.esbox.internal.analysis.Activator
Added: trunk/common/org.maemo.esbox.analysis.ui/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.analysis.ui/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.ui/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/common/org.maemo.esbox.analysis.ui/icons/full/view16/oprofile_view.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.analysis.ui/icons/full/view16/oprofile_view.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.analysis.ui/icons/full/view16/valgrind_view.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.analysis.ui/icons/full/view16/valgrind_view.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.analysis.ui/plugin.xml
===================================================================
--- trunk/common/org.maemo.esbox.analysis.ui/plugin.xml (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.ui/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension point="org.eclipse.ui.views">
+ <view category="org.maemo.esbox.ui.view"
+ id="org.maemo.esbox.analysis.ui.views.valgrindView"
+ name="Valgrind"
+ class="org.maemo.esbox.internal.analysis.ui.ValgrindView"
+ icon="icons/full/view16/valgrind_view.png"/>
+ <view category="org.maemo.esbox.ui.view"
+ id="org.maemo.esbox.analysis.ui.views.oProfileView"
+ name="OProfile"
+ class="org.maemo.esbox.internal.analysis.ui.OProfileView"
+ icon="icons/full/view16/oprofile_view.png"/>
+ </extension>
+
+</plugin>
Added: trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/analysis/ui/IAnalysisViews.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/analysis/ui/IAnalysisViews.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/analysis/ui/IAnalysisViews.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.analysis.ui;
+
+import org.maemo.esbox.internal.analysis.Activator;
+
+/**
+ * View IDs for known views.
+ * @author eswartz
+ *
+ */
+public interface IAnalysisViews {
+
+ String OPROFILE_VIEW_ID = Activator.PLUGIN_ID + ".views.oProfileView";
+ String VALGRIND_VIEW_ID = Activator.PLUGIN_ID + ".views.valgrindView";
+
+}
Added: trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/Activator.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/Activator.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,130 @@
+package org.maemo.esbox.internal.analysis;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.analysis.ui";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
Added: trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/ui/OProfileView.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/ui/OProfileView.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/ui/OProfileView.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,301 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.analysis.ui;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.maemo.esbox.core.tool.IToolListener;
+import org.maemo.esbox.core.tool.ToolEvent;
+import org.maemo.esbox.internal.analysis.Activator;
+import org.maemo.esbox.ui.common.PixelConverter;
+import org.maemo.esbox.ui.common.SWTUtil;
+
+import java.io.*;
+import java.util.*;
+import java.util.List;
+
+public class OProfileView extends ViewPart implements IToolListener {
+
+ /**
+ * Table that contains the oprofile entries
+ */
+ protected Table table;
+
+ protected TableViewer tableViewer;
+
+ /**
+ * Used on table
+ */
+ protected TableColumn[] columns;
+
+ protected String[] columnNames;
+
+ /**
+ *
+ */
+ private static class OProfileEntry {
+
+ public List<String> entries;
+
+ public OProfileEntry() {
+ entries = new ArrayList<String>();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( !this.getClass().equals(obj.getClass()) )
+ return false;
+ OProfileEntry entry = (OProfileEntry)obj;
+ return entry.entries.equals(entries);
+ }
+
+ }
+
+ private static class OProfileTableSorter extends ViewerSorter {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ return getComparator().compare(((OProfileEntry) e1).entries, ((OProfileEntry) e2).entries);
+ }
+
+ @Override
+ protected Comparator getComparator() {
+
+ return new Comparator() {
+ public int compare(Object o1, Object o2) {
+ return (-1) * (((List<String>) o1).get(0)).compareTo(((List<String>) o1).get(0));
+ }
+ };
+ }
+ }
+
+ private class OProfileLabelProvider extends LabelProvider implements ITableLabelProvider, IFontProvider {
+
+ public OProfileLabelProvider() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element) {
+ return getColumnText(element, 0);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ OProfileEntry entry = (OProfileEntry) element;
+ if (columnIndex >= entry.entries.size())
+ return "";
+ else
+ return entry.entries.get(columnIndex);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
+ */
+ public Font getFont(Object element) {
+ return null;
+ }
+ }
+
+ private Action removeAction;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ createActions();
+ createMenu();
+ createTable(parent);
+ }
+
+ private void createActions() {
+ removeAction = new Action() {
+ public void run() {
+ table.removeAll();
+ }
+ };
+ removeAction.setText("Delete");
+ removeAction.setToolTipText("Delete Current Sample");
+ removeAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+ getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ }
+
+ private void createMenu() {
+ IToolBarManager toolBar = getViewSite().getActionBars().getToolBarManager();
+ toolBar.add(removeAction);
+ }
+
+ public void createTable(Composite parent) {
+ Composite tablePane = new Composite(parent, SWT.NONE);
+ GridLayout tablePaneLayout = new GridLayout();
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+
+ tablePaneLayout.marginHeight = 0;
+ tablePaneLayout.marginWidth = 0;
+
+ tablePane.setLayout(tablePaneLayout);
+ tablePane.setLayoutData(gridData);
+
+ tableViewer = new TableViewer(tablePane, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+ tableViewer.setSorter(new OProfileTableSorter());
+ tableViewer.setLabelProvider(new OProfileLabelProvider());
+
+ table = tableViewer.getTable();
+
+ gridData = new GridData(GridData.FILL_BOTH);
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.grabExcessVerticalSpace = true;
+ gridData.heightHint = SWTUtil.getTableHeightHint(table, 8);
+ gridData.widthHint = new PixelConverter(parent).convertWidthInCharsToPixels(60);
+
+ table.setLayoutData(gridData);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ //adds a selection listener. This listener guarantees that just one item is checked (and also selected).
+ table.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+
+ }
+ });
+
+ initTable();
+ table.pack();
+ }
+
+ public void initTable() {
+ columnNames = new String[] { "Samples", "Cum. Samples (%)", "%", "Cum. (%)", "Line Info", "Application Name", "Symbol Name" };
+ columns = new TableColumn[columnNames.length];
+
+ for(int i = 0; i < columnNames.length; i++) {
+ columns[i] = new TableColumn(table,SWT.LEFT);
+ columns[i].setText(columnNames[i]);
+ columns[i].setWidth(150);
+ }
+
+ }
+
+ public void fillTable(InputStream input) throws IOException {
+ BufferedReader in = new BufferedReader(new InputStreamReader(input));
+
+ String line = "";
+ while( (line = in.readLine()) != null) {
+ List<String> tokens = getTokens(line);
+
+ if(tokens.size() > 0) {
+ String token = tokens.get(0);
+ try {
+ // check if the first token is a number (sample) to make
+ // sure that first line of profile is reached.
+ Integer.parseInt(token);
+
+ OProfileEntry entry = new OProfileEntry();
+ entry.entries.add(token);
+ for(int i = 1; i < tokens.size(); i++) {
+ entry.entries.add(tokens.get(i));
+ }
+ tableViewer.add(entry);
+ } catch (NumberFormatException e) {
+
+ }
+ }
+ }
+ }
+
+ public List<String> getTokens(String line) {
+ List<String> result = new ArrayList<String>();
+
+ String[] tokens = line.split("(\\s)+");
+
+ String element = "";
+ String separator = "";
+
+ for (int i = 0; i < tokens.length; i++) {
+ String token = tokens[i];
+
+ element += separator + token;
+
+ if (hasOpenParentesis(element)) {
+ separator = " ";
+ if (hasCloseParentesis(element)) {
+ result.add(element);
+ separator = "";
+ element = "";
+ }
+ }
+ else {
+ result.add(element);
+ element = "";
+ }
+ }
+ return result;
+ }
+
+ private boolean hasOpenParentesis(String token) {
+ return token.contains("(");
+ }
+
+ private boolean hasCloseParentesis(String token) {
+ return token.contains(")");
+ }
+
+ @Override
+ public void setFocus() {
+ //TODO
+ }
+
+ public void toolExecuted(ToolEvent event) {
+ InputStream inStream = null;
+ if (event.getSource() instanceof Process)
+ inStream = ((Process)event.getSource()).getInputStream();
+ else if (event.getSource() instanceof InputStream)
+ inStream = (InputStream)event.getSource();
+ else // unsupported source
+ return;
+
+ final InputStream input = inStream;
+ Activator.getDefault().getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ fillTable(input);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/ui/ValgrindView.java
===================================================================
--- trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/ui/ValgrindView.java (rev 0)
+++ trunk/common/org.maemo.esbox.analysis.ui/src/org/maemo/esbox/internal/analysis/ui/ValgrindView.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Paulo Romulo (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.analysis.ui;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.DrillDownAdapter;
+import org.eclipse.ui.part.ViewPart;
+import org.maemo.esbox.core.tool.IToolListener;
+import org.maemo.esbox.core.tool.ToolEvent;
+
+import java.io.*;
+import java.util.ArrayList;
+
+public class ValgrindView extends ViewPart implements IToolListener {
+
+ private TreeViewer viewer;
+ //private DrillDownAdapter drillDownAdapter;
+ //private Action action1;
+ private Action removeAction;
+ private TreeParent invisibleRoot;
+
+ class TreeObject implements IAdaptable {
+ private String name;
+ private TreeParent parent;
+
+ public TreeObject(String name) {
+ this.name = name;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setParent(TreeParent parent) {
+ this.parent = parent;
+ }
+ public TreeParent getParent() {
+ return parent;
+ }
+ public String toString() {
+ return getName();
+ }
+ public Object getAdapter(Class key) {
+ return null;
+ }
+ }
+
+ class TreeParent extends TreeObject {
+ private ArrayList children;
+ public TreeParent(String name) {
+ super(name);
+ children = new ArrayList();
+ }
+ public void addChild(TreeObject child) {
+ children.add(child);
+ child.setParent(this);
+ }
+ public void removeChild(TreeObject child) {
+ children.remove(child);
+ child.setParent(null);
+ }
+ public TreeObject [] getChildren() {
+ return (TreeObject [])children.toArray(new TreeObject[children.size()]);
+ }
+ public boolean hasChildren() {
+ return children.size()>0;
+ }
+ }
+
+ class ViewContentProvider implements IStructuredContentProvider,
+ ITreeContentProvider {
+ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ }
+ public void dispose() {
+ }
+ public Object[] getElements(Object parent) {
+ if (parent.equals(getViewSite())) {
+ if (invisibleRoot == null)
+ invisibleRoot = new TreeParent("");
+ return getChildren(invisibleRoot);
+ }
+ return getChildren(parent);
+ }
+ public Object getParent(Object child) {
+ if (child instanceof TreeObject) {
+ return ((TreeObject)child).getParent();
+ }
+ return null;
+ }
+ public Object [] getChildren(Object parent) {
+ if (parent instanceof TreeParent) {
+ return ((TreeParent)parent).getChildren();
+ }
+ return new Object[0];
+ }
+ public boolean hasChildren(Object parent) {
+ if (parent instanceof TreeParent)
+ return ((TreeParent)parent).hasChildren();
+ return false;
+ }
+
+ }
+
+ class ViewLabelProvider extends LabelProvider {
+
+ public String getText(Object obj) {
+ return obj.toString();
+ }
+ public Image getImage(Object obj) {
+ String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
+ return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
+ }
+ }
+
+ class NameSorter extends ViewerSorter {
+ }
+
+ /**
+ * The constructor.
+ */
+ public ValgrindView() {
+ }
+
+ /**
+ * This is a callback that will allow us
+ * to create the viewer and initialize it.
+ */
+ public void createPartControl(Composite parent) {
+ viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ /*drillDownAdapter =*/ new DrillDownAdapter(viewer);
+
+ viewer.setContentProvider(new ViewContentProvider());
+ viewer.setLabelProvider(new ViewLabelProvider());
+ viewer.setSorter(new NameSorter());
+ viewer.setInput(getViewSite());
+
+ makeActions();
+ createMenu();
+ }
+
+ private void makeActions() {
+ removeAction = new Action() {
+ public void run() {
+ TreeObject[] children = invisibleRoot.getChildren();
+ for (TreeObject treeObject : children) {
+ invisibleRoot.removeChild(treeObject);
+ }
+ refreshTree();
+ }
+ };
+ removeAction.setText("Delete");
+ removeAction.setToolTipText("Delete Current Sample");
+ removeAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+ getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ }
+
+ private void createMenu() {
+ IToolBarManager toolBar = getViewSite().getActionBars().getToolBarManager();
+ toolBar.add(removeAction);
+ }
+
+ public void fillTree(InputStream input) throws IOException {
+ BufferedReader in = new BufferedReader(new InputStreamReader(input));
+ invisibleRoot = new TreeParent("");
+ TreeParent root = new TreeParent("");
+ String line = "";
+ while( (line = in.readLine()) != null) {
+ line = line.trim();
+ if (line.startsWith("==") && !line.endsWith("==")) {
+ if (isRoot(line)) {
+ root = new TreeParent(line);
+ invisibleRoot.addChild(root);
+ } else {
+ root.addChild(new TreeObject(line));
+ }
+ }
+ }
+ refreshTree();
+ }
+
+ private void refreshTree() {
+ getShell().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ viewer.refresh();
+ }
+ });
+ }
+
+ private boolean isRoot(String line) {
+ return !(line.contains(" at ") || line.contains(" by "));
+ }
+
+ private Shell getShell() {
+ return getViewSite().getShell();
+ }
+
+ public void toolExecuted(ToolEvent event) {
+ Process process = (Process)event.getSource();
+ try {
+ fillTree(process.getErrorStream());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void setFocus() { }
+
+}
Property changes on: trunk/common/org.maemo.esbox.core
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.core/.classpath
===================================================================
--- trunk/common/org.maemo.esbox.core/.classpath (rev 0)
+++ trunk/common/org.maemo.esbox.core/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/org.maemo.esbox.core/.project
===================================================================
--- trunk/common/org.maemo.esbox.core/.project (rev 0)
+++ trunk/common/org.maemo.esbox.core/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.maemo.esbox.core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/org.maemo.esbox.core/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 09:41:00 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/org.maemo.esbox.core/CHANGES-1.5.html
===================================================================
--- trunk/common/org.maemo.esbox.core/CHANGES-1.5.html (rev 0)
+++ trunk/common/org.maemo.esbox.core/CHANGES-1.5.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>ESbox Changes in 1.4</title>
+</head>
+
+<body>
+<h2>WINDOWS HOST</h2>
+<p>
+This release includes support for hosting on Windows. This requires the use of a properly configured virtual
+machine. Currently the way to launch, access, and use this machine is hard-coded to a machine running
+under QEMU with SSH access redirected to port 2222. The user account is devel/qatest on the VM.
+The workspace is expected to live in a shared folder from Windows under c:\sources\shared (which is
+mounted as /home/devel/shared and bound to /scratchbox/users/devel/home/devel/shared).
+</p>
+<p>
+
+
+<h2>USER-VISIBLE CHANGES</h2>
+
+<ul>
+</ul>
+
+<h2>INTERNALS</h2>
+
+<ul>
+<li>Added IMachine hierarchy to abstract the way files, processes, etc. are accessed for host machines,
+virtual build machines, remote build machines, and devices.
+</li>
+<li>Added IFileSystemAccess interface which allows EFS access to the filesystem on a machine, or an SDK
+target, or an SDK.
+</li>
+<li>Added IFileSystemMapping interface which handles mapping filepaths between machines or between the host
+the SDK targets. This allows reporting multiple matching targets from a host, which can be used in chained mappings
+to get more accurate results.
+</li>
+<li>Moved SSH and SBRSH access into IMachine interfaces, and make IDeviceLogicConnection a thin wrapper
+over them.
+</li>
+
+<li>Moved all C/C++, Python, Scratchbox, and Device details out into their own features. Extensions
+and adapters are used to allow the core code to support the maemo/etc specific details formerly
+hardcoded in :)</li>
+
+<li>Added ProjectManager, IESboxProjectInfo, and IESboxBuildConfiguration as the primary means
+to access projects. C/C++ and Python projects should both use these interfaces. ESboxProjectProperties
+is no more, but similar functionality is maintained for convenience via ProjectManager#getProjectProperties().
+</ul>
+
Added: trunk/common/org.maemo.esbox.core/ESboxRefactoringNotes.txt
===================================================================
--- trunk/common/org.maemo.esbox.core/ESboxRefactoringNotes.txt (rev 0)
+++ trunk/common/org.maemo.esbox.core/ESboxRefactoringNotes.txt 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,111 @@
+Refactoring notes
+====================
+
+//-- Try to remove UI dependency from Core (ErrorLogger, preference store, etc)
+
+//-- ESboxPropertyTester split for C++/Python/scratchbox; fix launch delegates
+
+//-- Changed ScratchboxException to ESboxException in core
+
+//-- whence ESboxScriptLauncher?
+
+//-- whence ESboxProjectProperties?
+// -- moved deprecated settings directly into OldStyleProjectPersistentProperties
+// -- sbox dependency here!
+
+//-- package manager isn't part of SDK target anymore, but package manager provides
+//instances for SDK targets
+// -- package manager provider for an SDK knows about any launching peculiarities
+
+//-- package manager ID reffed in package mappings
+
+//-- DebianPackageInstaller takes IMachine now, not SSHConfiguration
+
+//-- SBRSHConfigurationFileFactory#createStockMaemoSBRSHConfigurationFile takes
+rootstrap path
+
+//-- Need to rename CoreActivator, etc. to accord with the actual reasons we're using it. Error Loggers? Preferences? etc.
+
+//-- New script launchers for all the plugins
+
+//-- IProjectProperties accessor for C++ / Python projects; correlating this with IESboxProjectInfo, etc.
+
+//-- remember to move all UI elements to their respective plugins
+
+//-- merge ProjectManager with ESboxProjectManager
+
+//-- for all plugins, ensure build.properties exports what we need
+
+//-- remove CoreActivator references where possible
+
+//-- rename for internal/non-internal API?
+
+//-- remove duplicated icons
+
+//-- make sure pref pages are in right hierarchy
+
+//-- make sure views are in right place
+
+//-- make sure all project wizards work
+
+//-- SSH needs its own launch configuration attributes in order to know what
+ip addr/port to use for host and target
+
+//-- be consistent about Activator or UIActivator
+
+-- validate whether old projects build with correct "old" builder
+
+-- validate python remote path mapping wrt "files to download"
+
+-- BUG: the ESbox Build Configs page for unconverted Python projects does not activate "OK"
+
+
+// NEXT SPRINT
+
+-- replace PLUGIN_ID with getUniqueIdentifier() (I went through and did the opposite,
+without knowing why)
+
+-- Template engine must have a non-CDT dependent implementation for Python project wizard
+to use
+
+-- rewrite even the Cpp use of templates -- this copies a lot of CDT code just to
+add some new attributes. Currently we overload the template extension point (esbox_template) and
+add a hanging-on template-association extension point (esbox_templateAssociations) --
+instead, move additional fields into safer place; yet avoid loading all the template XML just
+to populate/filter the list of known templates
+
+-- template processes should be generic so ValidateAndInstallPackages can be
+available to Python without making it depend on cpp
+
+-- group templates into groups defined by extension point
+
+-- move sb configuration flags & preference constants to their own independent
+plugins rather than mixing them all into one plugin
+
+-- remove Linux package dependency from cpp project ui plugin (processes)
+
+-- try to move SSH plugin into devices area; the core should not know about this
+
+-- remove SSH dependency from Linux modules (creating a Debian package installer)
+
+-- remove SSH dependency from Python debugger, which needs a common way to determine
+the address of a host from the point of view of a device (SSHConfiguration has a start
+to this, but it must be pushed up into IMachine)
+
+// FUTURE
+
+
+-- make common image cache for images, e.g., in the target/sdk icons used in the project wizard -- avoid copying these all over the plugin space
+
+-- why does Python launch config have all the variables for sb2?
+
+-- Need to make IP-clean versions of icons for build targets/SDKs/etc. Pretty much every icon
+except for the maemo-specific ones were copied from CDT or Eclipse.
+
+-- Initial SDK target for ESboxBaseProjectTargetSelectionPage comes from
+the ESboxConfigHandler now, not the active SDK target. We need SB-specific
+wizard initialization that sets this up. *** Jarmo wants the latest maemo platform
+
+-- Activator#createErrorStatus() needs to forward to utility; the pattern
+ #createErrorStatus(null, e) will make blank status message
+
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/KNOWN-ISSUES.html
===================================================================
--- trunk/common/org.maemo.esbox.core/KNOWN-ISSUES.html (rev 0)
+++ trunk/common/org.maemo.esbox.core/KNOWN-ISSUES.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,192 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>ESbox Known Issues in 1.4.1</title>
+</head>
+
+
+<body>
+ <ol>
+ <p><b>General</b></p>
+ <li><p>
+ Eclipse and ESbox require a Sun or IBM Java VM (JRE5.0 / 1.5) or newer.
+ gcj will not work properly. Eclipse will launch but spurious errors and "class not found"
+ exceptions will arise.
+ </p></li>
+
+ <p><b>Build & SDKs</b></p>
+ <li><p>
+ Eclipse will build all the projects in the workspace before running/launching an application.
+ If you are using several scratchbox SDKs, this may result in switching targets multiple times
+ and killing maemo before the application launches.
+ </p></li>
+ <li><p>
+ If you install or remove scratchbox targets, outside the <b>Window > Preferences > ESbox >
+ Installed Targets</b> UI, use the "Refresh" button to update the information.
+ </p></li>
+
+ <p><b>SBRSH</b></p>
+ <li><p>
+ Please use sbrsh7.5.2maemo9 or newer for best results.
+ </p></li>
+ <li>
+ <p>ESbox supports autogenerated sbrsh configuration files, and these are used by default for
+ new launch configurations. The expected remote setup is "sandbox mode", where the
+ contents of the scratchbox rootstrap are used as the root filesystem for SBRSH apps.</p>
+ <p>In this model, almost all the applications and libraries used by an application must
+ be transferred over the wire; thus, launching maemo or python apps over SBRSH incurs a
+ long initial delay as the filesystem contents are cached. Successive launches should be
+ faster.
+ </p></li>
+
+ <p><b>Scratchbox 1</b></p>
+ <li>
+ <p>
+ You usually need to provide the "doctools" devkit in your scratchbox installation in order to
+ build localizable applications using "intltool". If you get errors like:</p>
+ <pre>
+configure: error: Your intltool is too old. You need intltool 0.23 or later.
+ </pre>
+ during project configuration, reconfigure your scratchbox target like this:
+ <pre>
+sb-conf setup CHINOOK_ARMEL --force --cputransp=/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2 \
+ --compiler=cs2005q3.2-glibc2.5-arm --devkits=perl:debian-etch:maemo3-tools:cputransp:<b>doctools</b>
+ </pre>
+(or establish a similar configuration via sb-menu), then invoke "Build Application > Generate Configure" and rebuild.
+ </p></li>
+
+ <p><b>Scratchbox 2</b></p>
+ <li>
+ At the time of release, scratchbox 2 SDKs do not support launching maemo apps under the emulator, but
+ ESbox does not warn you of this. You will merely see "osso_initialize failed" in the console when
+ trying to launch maemo or a maemo app.
+ </p></li>
+
+ <p><b>C/C++</b></p>
+ <li><p>
+ There is only one wizard for both C and C++ projects, and the templates are mixed together in the
+ wizard. Be sure to select the appropriate template for the kind of project you want.
+ </p></li>
+ <li><p>
+ This release of ESbox properly sets up the C/C++ indexer for new projects. Unfortunately,
+ this can result in a lot
+ of memory usage at creation time.</p>
+ <p>
+ If you do not want indexing, disable it globally with
+ <b>Window > Preferences > C/C++ > Indexer > Select Indexer</b> = <b>No Indexer</b>, or per-project in the
+ same project property.</p>
+ <p>If you want indexing, code completion, and all the goodies, then ensure your VM has enough
+ memory. If using a Sun JVM, run eclipse with <b>"-vmargs -Xmx256M"</b> or more
+ to avoid out-of-memory errors.
+ </p></li>
+ <li><p>
+ The autotools files are not updated when you change files in the project. You
+ need to manually update configure.ac/Makefile.am as needed.
+ </p></li>
+ <li><p>
+ The C/C++ indexer settings are not updated when you change targets or dependent libraries in the project. You
+ need to manually update <b>project > C/C++ Project Paths and Settings</b> as needed.
+ </p></li>
+ <li><p>
+ In remote on-device debug, when you step in a function without debug information (not compiled with debug enabled),
+ it may take a long time (seconds to minutes, depending on what the function does) for the stepping to finish. That's
+ because gdb "Step" command keeps stepping until it reaches the first instruction of a source line. The workaround is
+ to enable "Instruction Stepping Mode" (click on the "Instruction Stepping Mode" button in the Debug View) if you need
+ to do assembly level debug, or otherwise just do "Step Over" :)
+ </p></li>
+
+ <p><b>Python</b></p>
+ <li><p>
+ ESbox debugging works best against PyDev version 1.3.13. ESbox includes slightly modified versions of
+ the debug scripts used by PyDev in order to work with scratchbox, and the PyDev plugins will expect to
+ communicate with the same version of those scripts. We expect this dependency to be removed in a future release.
+ </p></li>
+ <li><p>
+ You must set up the default Python interpreter in <b>Window > Preferences > Pydev > Interpreter - Python</b> to use
+ python.
+ </p></li>
+ <li><p>
+ You must also specify <b>"/usr/bin/python2.5"</b> as the interpreter, since this path is used in scratchbox and
+ on the device as well. "/usr/bin/python" will not work since it brings in python 2.3 from scratchbox,
+ which is NOT what you want.
+ </p></li>
+ <li><p>
+ For emulator-side development, it's recommended to use an X86 target. (The qemu-arm emulator shipped by
+ default in scratchbox is missing implementations for several system calls which will break python.)
+ </p></li>
+ <li><p>
+ When using remote Python debugging, the debugger's "Terminate" button kills the debugger
+ but fails to kill the application on the Tablet. You need to manually kill 'python2.5' on the Tablet using
+ ssh. This is a known problem for some versions of PyDev.
+ </p></li>
+ <li><p>
+ During debug of a python applicaiton, if you let the program run, when control is in certain functions
+ (e.g. gtk.main()), debugger may fail to show that the program is running, namely still show that it's suspended
+ with all debug commands (step, run, etc) enabled. To suspend the program, the workaround is to set a breakpoint
+ at a place where you know the program will run to.
+ </p></li>
+ <li><p>
+ Remote debugging of Python over SSH is known to have problems hitting breakpoints unless you ensure
+ that the <b>Window > Preferences > ESbox > SSH > Destination folder</b> points to the same path as your project under sbox
+ (e.g. /home/user/workspace/MyProject). We recommend using SBRSH in any case.
+ </p></li>
+
+ <p><b>Maemo Toolbar Menu</b></p>
+ <li><p>
+ The command to <b>Restart</b> maemo, which uses the af-sb-init.sh script, does not always successfully restart maemo.
+ You should be able to <b>Stop</b> and <b>Start</b> as a workaround for more predictable operation.
+ </p><p>
+ Similarly, starting maemo may fail in some situations (you'll see errors and aborts in the Console). If this happens, Stop and
+ Start maemo again.
+ </p></li>
+
+ <p><b>Debian packaging</b></p>
+ <li><p>
+ Only a few project templates are configured for Debian packaging, namely the Hildon GUI, Hildon Desktop Plugins,
+ and MaemoPad.
+ </p></li>
+ <li><p>
+ When creating projects, ESbox does not detect or prevent the use of a project name which will be incompatible
+ with dpkg-buildpkg. Currently the name of the project is the same name used to create the Debian package,
+ so for best results, only use lowercase letters, numbers, and underscores to name your project.
+ </p></li>
+ <li><p>
+ ESbox has no support for editing or creating Debian control files, so you need to copy some from a known
+ working program or consult Debian documentation for assistance.
+ </p></li>
+ <li><p>
+ ESbox does not know how to parse Debian control files, so the <b>project > Debian Package > Install Debian Package on Device</b>
+ command will guess at the .deb file which has been built by looking up one level from the project directory
+ and finding an existing .deb package with the same prefix as the project.
+ </p><p>
+ If none has been built previously, the filename will be left blank and you will need
+ to separately invoke a <b>Create Package </b>command. Thereonafter you can use
+ <b>Install Debian Package on Device</b> to build and launch packages.
+ </p></li>
+ <li><p>
+ The <b>Debian Package > Create Package</b> and <b>Debian Package > Install Debian Package to Device</b>
+ commands will create a package for the currently selected target. For most conceivable uses of this
+ command, you need the ARMEL target. If you're debugging under the X86 emulator target, then you
+ need to remember to manually switch targets to ARMEL
+ via <b>project > Properties > ESBox Build Target</b> before creating/installing a Debian package.
+ </p></li>
+
+ <p><b>OProfile</b></p>
+ <li><p>
+ The OProfile support in general is very new. Usability issues will be addressed in subsequent releases.
+ </p></li>
+ <li><p>
+ Local (x86) oprofile support is not available.
+ </p></li>
+ <li><p>
+ Running OProfile through SBRSH is not supported.
+ </p></li>
+ <li><p>
+ In the OProfile (C/C++ and Python) launch configurations, you cannot specify the target IP address.
+ The default <b>192.168.2.15</b> will always be used.
+ </p></li>
+
+ </ol>
+<body>
Added: trunk/common/org.maemo.esbox.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.maemo.esbox.core/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,36 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Core Plug-in
+Bundle-SymbolicName: org.maemo.esbox.core;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-CoreActivator: org.maemo.esbox.core.noexport.CoreActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.ui;visibility:=reexport,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.console;visibility:=reexport,
+ org.eclipse.debug.ui,
+ org.eclipse.core.net,
+ org.eclipse.ui.net,
+ org.eclipse.core.filesystem;bundle-version="1.2.0";visibility:=reexport,
+ org.eclipse.jface.text;bundle-version="3.4.0";visibility:=reexport,
+ com.nokia.cpp.utils.core;bundle-version="1.0.0";visibility:=reexport,
+ com.nokia.cpp.utils.ui;bundle-version="1.0.0";visibility:=reexport
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.core,
+ org.maemo.esbox.core.adapters,
+ org.maemo.esbox.core.cpp,
+ org.maemo.esbox.core.env,
+ org.maemo.esbox.core.execEnv,
+ org.maemo.esbox.core.machine,
+ org.maemo.esbox.core.model,
+ org.maemo.esbox.core.process,
+ org.maemo.esbox.core.sdk,
+ org.maemo.esbox.core.tool,
+ org.maemo.esbox.core.xml,
+ org.maemo.esbox.internal.api.core,
+ org.maemo.esbox.internal.api.core.machine,
+ org.maemo.esbox.internal.api.core.sdk,
+ org.maemo.esbox.internal.core.cpp
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Activator: org.maemo.esbox.internal.core.Activator
+
Added: trunk/common/org.maemo.esbox.core/about.html
===================================================================
--- trunk/common/org.maemo.esbox.core/about.html (rev 0)
+++ trunk/common/org.maemo.esbox.core/about.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+<h3>About This Content</h3>
+
+<h3>ESbox</h3>
+
+<p><a href="http://esbox.garage.maemo.org/" target="_blank">ESbox</a>
+is an Eclipse plug-in that helps programmers to develop applications for
+maemo platform on Scratchbox Apophis. It supports C/C++ and Python programming
+languages. Maemo 4.x SDKs (and later) will be supported.
+</p>
+
+<h3>License</h3>
+
+<p>See <a href="about_files/epl-v10.html">Eclipse Public License Version 1.0 ("EPL")</a>.
+</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>ESbox has a set of open source templates to help the development of applications. Such templates are distributed
+under <a href="about_files/COPYING.LESSER">LGPL license.</a></p>
+
+<address> © Copyright 2007-2008 INdT. All rights reserved. </address>
Added: trunk/common/org.maemo.esbox.core/about_files/epl-v10.html
===================================================================
--- trunk/common/org.maemo.esbox.core/about_files/epl-v10.html (rev 0)
+++ trunk/common/org.maemo.esbox.core/about_files/epl-v10.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ at font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+ at page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.core/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.core/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = .,\
+ plugin.xml,\
+ conf/,\
+ META-INF/,\
+ about.html,\
+ about_files/,\
+ schema/
Added: trunk/common/org.maemo.esbox.core/conf/esbox_common.xml
===================================================================
--- trunk/common/org.maemo.esbox.core/conf/esbox_common.xml (rev 0)
+++ trunk/common/org.maemo.esbox.core/conf/esbox_common.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>This file contains all properties of ESbox for common preferences</comment>
+
+ <!-- bump when any you want to destructively reset existing preferences
+ [sync with ESboxPreferenceInitializer!] -->
+ <entry key="VERSION_PREFS_MAJOR">16</entry>
+ <!-- bumped when new preferences added to this file or the sbox_version_1.0 or sbox_version_2.0 files; forces nondestructive merge
+ [sync with ESboxPreferenceInitializer!] -->
+ <entry key="VERSION_PREFS_MINOR">22</entry>
+
+ <entry key="LOG_COMMANDS">false</entry>
+ <entry key="LOG_COMMANDS_PATH">/tmp/esbox_commands.txt</entry>
+
+ <entry key="RUN_SCRIPT_LOC">/scratchbox/users/${USER}/home/${USER}/.esbox/</entry>
+ <entry key="SBRSH_CONFIG_COMMAND">sbrsh-conf ${ACTIONS} ${OPTIONS}</entry>
+
+ <!-- actions of command sbrsh-conf -->
+ <entry key="CONFIGURE_ACT">configure</entry>
+ <entry key="ADD_ACT">add</entry>
+ <entry key="MOUNT_ACT">mount</entry>
+ <entry key="UNMOUNT_ACT">unmoun</entry>
+
+ <!-- options for action configure -->
+ <entry key="NFS_SERVER_HOSTNAME">--nfs-host=${HOSTNAME}</entry>
+
+ <!-- others commands -->
+ <entry key="DISPLAY_X_COMMAND_UNIX">Xephyr ${DISPLAY} -host-cursor -screen 800x480x16 -dpi 96 -ac -extension Composite</entry>
+ <entry key="DISPLAY_X_COMMAND_WIN32">c:/cygwin/usr/X11R6/bin/Xwin ${DISPLAY} -lesspointer -swcursor -screen 0 800x480x16 -dpi 96 -ac -extension Composite</entry>
+ <!-- this is initialized dynamically <entry key="DISPLAY_X_COMMAND"></entry> -->
+ <entry key="MAEMO_COMMAND">af-sb-init.sh ${ACTIONS}</entry>
+ <entry key="MAEMO_START_ACTION">start</entry>
+ <entry key="MAEMO_RESTART_ACTION">restart</entry>
+ <entry key="MAEMO_STOP_ACTION">stop</entry>
+ <!-- Differentiate for SB1 & SB2
+ <entry key="SBOX_GDB_REMOTE_QEMU">qemu-arm -g ${PORT}</entry>
+ -->
+ <entry key="SBOX_GDB_REMOTE">gdbserver ${IP}:${PORT}</entry>
+ <entry key="TERMINAL_COMMAND">gnome-terminal --working-directory=${{HOSTDIR}} -x ${COMMAND}</entry>
+
+ <!-- sbrsh -->
+ <entry key="SBRSH_CONFIG_FILE_LOCATION">/home/${USER}/.sbrsh</entry>
+ <entry key="SBRSH_EXEC_FILE_LOCATION">/usr/bin/sbrsh</entry>
+ <entry key="SBRSH_SELECTED_BIN_PATH"></entry>
+
+ <!-- ssh -->
+ <entry key="SSH_USERNAME">root</entry>
+ <entry key="SSH_DEST_FOLDER">./</entry>
+ <entry key="SSH_CONNECTION_TIMEOUT">3</entry>
+
+ <!-- setting such as Scratchbox location and user name -->
+ <entry key="USER">${USER}</entry>
+
+</properties>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/conf/sbox_version_1.0.xml
===================================================================
--- trunk/common/org.maemo.esbox.core/conf/sbox_version_1.0.xml (rev 0)
+++ trunk/common/org.maemo.esbox.core/conf/sbox_version_1.0.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>This file contains all properties of ESbox for Scratchbox version 1.0</comment>
+
+ <!-- WHEN ANY DEFAULTS CHANGED warranting rewriting prefs,
+ bump pref version in esbox_common.xml and adjust ESboxPreferenceInitializer#RPEFS_VERSION_MAJOR ;
+ WHEN ANYTHING ELSE CHANGED which can be merged into existing prefs,
+ adjust ESboxPreferenceInitializer#RPEFS_VERSION_MINOR -->
+
+ <entry key="SB1_LOGIN_COMMAND">/scratchbox/login -d ${RUN_SCRIPT_DIRECTORY} "./run.sh ${{DIRECTORY}} \\\"${{{EXPORTS}}}\\\" \\\"${{{COMMAND}}} ${{{ARGS}}}\\\""</entry>
+ <entry key="SB1_SBOX_COMMAND">sb-conf ${ACTIONS} ${OPTIONS}</entry>
+
+ <!-- this uses ${QEMU} because the default qemu-arm is an often misconfigured softlink: see GetGdbQemuCommandPatternCommand -->
+ <entry key="SB1_GDB_REMOTE_QEMU">${QEMU} -g ${PORT}</entry>
+
+ <!-- actions of command sb-conf -->
+
+ <entry key="SB1_VERSION_ACT">version</entry>
+ <entry key="SB1_SETUP_ACT">setup</entry>
+ <entry key="SB1_INSTALL_ACT">install</entry>
+ <entry key="SB1_ROOTSTRAP_ACT">rootstrap</entry>
+ <entry key="SB1_SELECT_ACT">select</entry>
+ <entry key="SB1_RESET_ACT">reset</entry>
+ <entry key="SB1_KILLALL_ACT">killall</entry>
+ <entry key="SB1_REMOVE_ACT">remove</entry>
+ <entry key="SB1_SHOW_ACT">show</entry>
+ <entry key="SB1_LIST_ACT">list</entry>
+ <entry key="SB1_CURRENT_ACT">current</entry>
+
+ <!-- options for action rootstrap -->
+ <entry key="SB1_ROOTSTRAP_OPT_FORCE">--force</entry>
+ <entry key="SB1_SETUP_ACT">setup</entry>
+
+ <!-- options for action remove -->
+ <entry key="SB1_REMOVE_OPT_FORCE">--force</entry>
+
+ <!-- options for action setup -->
+ <entry key="SB1_SETUP_OPT_COMPILER">--compiler=${COMPILER}</entry>
+ <entry key="SB1_SETUP_OPT_DEVKITS">--devkits=${LIST}</entry>
+ <entry key="SB1_SETUP_OPT_CPUTRANSP">--cputransp=${METHOD}</entry>
+ <entry key="SB1_SETUP_OPT_FORCE">--force</entry>
+
+ <!-- options for action killall -->
+ <entry key="SB1_KILLALL_OPT_SIGNAL">signal=${SIGNAL}</entry>
+
+ <!-- options for action install -->
+ <entry key="SB1_INSTALL_OPT_CLIB">--clibrary</entry>
+ <entry key="SB1_INSTALL_OPT_ETC">--etc</entry>
+ <entry key="SB1_INSTALL_OPT_DEVKITS">--devkits</entry>
+ <entry key="SB1_INSTALL_OPT_FAKE">--fakeroot</entry>
+ <entry key="SB1_INSTALL_OPT_GDB">--gdb</entry>
+ <entry key="SB1_INSTALL_OPT_STRACE">--strace</entry>
+
+ <!-- options for action show -->
+ <entry key="SB1_SHOW_OPT_COMPILERS">--compilers</entry>
+ <entry key="SB1_SHOW_OPT_DEVKITS">--devkits</entry>
+ <entry key="SB1_SHOW_OPT_CPU">--cputransp</entry>
+ <entry key="SB1_SHOW_OPT_COMP_ARCH">--compiler-arch</entry>
+ <entry key="SB1_SHOW_OPT_COMP_SUBARCH">--compiler-subarch</entry>
+ <entry key="SB1_SHOW_OPT_COMP_CLIB">--compiler-clib</entry>
+
+ <!-- options for action list -->
+ <entry key="SB1_LIST_OPT_COMPILERS">--compilers</entry>
+ <entry key="SB1_LIST_OPT_DEVKITS">--devkits</entry>
+ <entry key="SB1_LIST_OPT_CPU">--cputransps</entry>
+ <entry key="SB1_LIST_OPT_TARGETS">--targets</entry>
+ <entry key="SB1_LIST_OPT_SESSIONS">--sessions</entry>
+
+ <!-- setting such as Scratchbox location and user name -->
+ <entry key="SB1_SBOX_LOCATION">/scratchbox</entry>
+ <entry key="SB1_SBOX_SANDBOX">/scratchbox/users/${USER}</entry>
+ <entry key="SB1_SBOX_WORKSPACE">/scratchbox/users/${USER}/home/${USER}/workspace/</entry>
+
+</properties>
Added: trunk/common/org.maemo.esbox.core/conf/sbox_version_2.0.xml
===================================================================
--- trunk/common/org.maemo.esbox.core/conf/sbox_version_2.0.xml (rev 0)
+++ trunk/common/org.maemo.esbox.core/conf/sbox_version_2.0.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>This file contains all properties of ESbox for Scratchbox version 2.0</comment>
+
+ <!-- WHEN ANY DEFAULTS CHANGED warranting rewriting prefs,
+ bump pref version in esbox_common.xml and adjust ESboxPreferenceInitializer#RPEFS_VERSION_MAJOR ;
+ WHEN ANYTHING ELSE CHANGED which can be merged into existing prefs,
+ adjust ESboxPreferenceInitializer#RPEFS_VERSION_MINOR -->
+
+ <entry key="SB2_MAPPING_MODE">maemo</entry>
+ <entry key="SB2_INSTALL_MAPPING_MODE">emulate</entry>
+ <entry key="SB2_LOG_LEVEL"></entry>
+
+ <entry key="SB2_EXEC_COMMAND">sb2 -Qx -m ${MAPPING_MODE} ${LOG_OPTION} -t ${TARGET} "${{COMMAND}} ${{ARGS}}"</entry>
+
+ <!-- this qemu-arm link is expected to be valid; we don't try to substitute unlike for sb1: see GetGdbQemuCommandPatternCommand -->
+ <entry key="SB2_GDB_REMOTE_QEMU">sb2-qemu-arm -g ${PORT}</entry>
+
+ <!-- The hash-bang in these scripts don't properly launch bash! -->
+ <entry key="SB2_INIT_COMMAND">/bin/bash -c "sb2-init ${{OPTIONS}} ${{TARGET}} ${{COMPILER}}"</entry>
+ <entry key="SB2_CONFIG_COMMAND">/bin/bash -c "sb2-config ${{ACTIONS}} ${{OPTIONS}}"</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_COMMAND">/bin/bash -c "maemo-rootstrap ${{OPTIONS}}"</entry>
+ <entry key="SB2_SB2_SHOW_COMMAND">sb2-show</entry>
+
+ <!-- actions of command sb2-config -->
+
+ <entry key="SB2_VERSION_ACT">-v</entry>
+ <entry key="SB2_LIST_ACT">-l</entry>
+
+ <!-- actions of command maemo-rootstrap -->
+ <entry key="SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT">--host-tools</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_FORCE_OPT">--force</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT">available</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_LIST_ACT">list</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_INSTALL_ACT">install</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_REMOVE_ACT">remove</entry>
+ <entry key="SB2_MAEMO_ROOTSTRAP_PATH_ACT">path</entry>
+
+ <!-- actions of command sb2-show -->
+ <entry key="SB2_SB2_SHOW_PATH_ACTION">path</entry>
+ <entry key="SB2_SB2_SHOW_PATH_OUTPUT_PATTERN">(.+)\s+=>\s+(\S+).*</entry>
+
+</properties>
Added: trunk/common/org.maemo.esbox.core/plugin.xml
===================================================================
--- trunk/common/org.maemo.esbox.core/plugin.xml (rev 0)
+++ trunk/common/org.maemo.esbox.core/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="tool" name="Tool" schema="schema/tool.exsd"/>
+ <extension-point id="sdk_provider" name="SDK Provider" schema="schema/sdk_provider.exsd"/>
+ <extension-point id="execution_environment" name="Execution Environment" schema="schema/execution_environment.exsd"/>
+ <extension-point id="build_machine_factory" name="Build Machine Factory" schema="schema/build_machine_factory.exsd"/>
+
+
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.maemo.esbox.internal.core.ESboxPreferenceInitializer">
+ </initializer>
+ </extension>
+
+ <extension
+ id="org.maemo.esbox.core.execution_environments"
+ name="name"
+ point="org.maemo.esbox.core.execution_environment">
+ <execution_environment
+ class="org.maemo.esbox.core.execEnv.UnknownExecutionEnvironment"
+ id="org.maemo.esbox.core.execution_environment.unknown">
+ </execution_environment>
+ <execution_environment
+ class="org.maemo.esbox.core.execEnv.ConsoleExecutionEnvironment"
+ id="org.maemo.esbox.core.execution_environment.console">
+ </execution_environment>
+ </extension>
+
+
+
+</plugin>
Added: trunk/common/org.maemo.esbox.core/schema/build_machine_factory.exsd
===================================================================
--- trunk/common/org.maemo.esbox.core/schema/build_machine_factory.exsd (rev 0)
+++ trunk/common/org.maemo.esbox.core/schema/build_machine_factory.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,107 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.maemo.esbox.core" id="build_machine_provider" name="Build Machine Provider"/>
+ </appinfo>
+ <documentation>
+ This extension point defines build machine providers (via IBuildMachineProvider) which can create the build machines which host builds or execute programs.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="build_machine_factory"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="build_machine_factory">
+ <annotation>
+ <documentation>
+ Defines an IMachineFactory which will be queried for capable build machines.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class which implements IBuildMachineFactory
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.maemo.esbox.core.machine.IBuildMachineFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 1.5
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ see org.maemo.esbox.core.machine.IBuildMachineFactory
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ The built-in implementation can create a provider for the host Linux machine and any known virtual machines.
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: trunk/common/org.maemo.esbox.core/schema/execution_environment.exsd
===================================================================
--- trunk/common/org.maemo.esbox.core/schema/execution_environment.exsd (rev 0)
+++ trunk/common/org.maemo.esbox.core/schema/execution_environment.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,112 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.maemo.esbox.core" id="execution_environment" name="Execution Environment"/>
+ </appInfo>
+ <documentation>
+ This defines an execution environment for a project or program. The 'class' specified must implement org.maemo.esbox.core.IExecutionEnvironment.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="execution_environment" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="execution_environment">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ ESbox 1.4
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/common/org.maemo.esbox.core/schema/sdk_provider.exsd
===================================================================
--- trunk/common/org.maemo.esbox.core/schema/sdk_provider.exsd (rev 0)
+++ trunk/common/org.maemo.esbox.core/schema/sdk_provider.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,107 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.maemo.esbox.core" id="sdk_provider" name="SDK Provider"/>
+ </appinfo>
+ <documentation>
+ This defines a provider of ISDK objects. The 'class' specified must implement org.maemo.esbox.core.sdk.ISDKProvider.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="sdk_provider" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="sdk_provider">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.maemo.esbox.core.sdk.ISDKProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ ESbox 1.4
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ public interface ISDKProvider {
+ public static String SDK_PROVIDER_EXTENSION_ID = CoreActivator.PLUGIN_ID + ".sdk_provider";
+
+ /**
+ * Get the SDKs for this provider.
+ * @return list of SDKs, never <code>null</code>
+ */
+ List&lt;ISDK&gt; createSDKs() throws ESboxException;
+
+}
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: trunk/common/org.maemo.esbox.core/schema/tool.exsd
===================================================================
--- trunk/common/org.maemo.esbox.core/schema/tool.exsd (rev 0)
+++ trunk/common/org.maemo.esbox.core/schema/tool.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,154 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.maemo.esbox.core" id="tool" name="Tool"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="tool" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="provider">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.maemo.esbox.core.tool.IToolProvider"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="param">
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="value" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="tool">
+ <complexType>
+ <sequence>
+ <element ref="provider"/>
+ <element ref="param" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/common/org.maemo.esbox.core/src/org/eclipse/cdt/core/ProcessClosure.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/eclipse/cdt/core/ProcessClosure.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/eclipse/cdt/core/ProcessClosure.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.core;
+
+import java.io.*;
+
+/**
+ * Bundled state of a launched process including the threads linking the process
+ * in/output to console documents.
+ * <p>
+ * EJS: this is copied from CDT 5.0 and included here to avoid making ESbox core depend on CDT.
+ */
+public class ProcessClosure {
+
+ /**
+ * Thread which continuously reads from a input stream and pushes the read
+ * data to an output stream which is immediately flushed afterwards.
+ */
+ protected static class ReaderThread extends Thread {
+
+ private InputStream fInputStream;
+ private OutputStream fOutputStream;
+ private boolean fFinished = false;
+ private String lineSeparator;
+ /*
+ * outputStream can be null
+ */
+ public ReaderThread(ThreadGroup group, String name, InputStream in, OutputStream out) {
+ super(group, name);
+ fOutputStream = out;
+ fInputStream = in;
+ setDaemon(true);
+ lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ try {
+ try {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(fInputStream));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ line += lineSeparator;
+ fOutputStream.write(line.getBytes());
+ }
+ } catch (IOException x) {
+ // ignore
+ } finally {
+ try {
+ // writer.flush();
+ fOutputStream.flush();
+ } catch (IOException e) {
+ // ignore
+ }
+ try {
+ fInputStream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ } finally {
+ complete();
+ }
+ }
+
+ public synchronized boolean finished() {
+ return fFinished;
+ }
+
+ public synchronized void waitFor() {
+ while (!fFinished) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+
+ public synchronized void complete() {
+ fFinished = true;
+ notify();
+ }
+
+ public void close() {
+ try {
+ fOutputStream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+ protected static int fCounter = 0;
+
+ protected Process fProcess;
+
+ protected OutputStream fOutput;
+ protected OutputStream fError;
+
+ protected ReaderThread fOutputReader;
+ protected ReaderThread fErrorReader;
+
+ /**
+ * Creates a process closure and connects the launched process with a
+ * console document.
+ *
+ * @param outputStream
+ * prcess stdout is written to this stream. Can be
+ * <code>null</code>, if not interested in reading the output
+ * @param errorStream
+ * prcess stderr is written to this stream. Can be
+ * <code>null</code>, if not interested in reading the output
+ */
+ public ProcessClosure(Process process, OutputStream outputStream, OutputStream errorStream) {
+ fProcess = process;
+ fOutput = outputStream;
+ fError = errorStream;
+ }
+
+ /**
+ * Live links the launched process with the configured in/out streams using
+ * reader threads.
+ */
+ public void runNonBlocking() {
+ ThreadGroup group = new ThreadGroup("CBuilder" + fCounter++); //$NON-NLS-1$
+
+ InputStream stdin = fProcess.getInputStream();
+ InputStream stderr = fProcess.getErrorStream();
+
+ fOutputReader = new ReaderThread(group, "OutputReader", stdin, fOutput); //$NON-NLS-1$
+ fErrorReader = new ReaderThread(group, "ErrorReader", stderr, fError); //$NON-NLS-1$
+
+ fOutputReader.start();
+ fErrorReader.start();
+ }
+
+ public void runBlocking() {
+ runNonBlocking();
+
+ boolean finished = false;
+ while (!finished) {
+ try {
+ fProcess.waitFor();
+ } catch (InterruptedException e) {
+ //System.err.println("Closure exception " +e);
+ }
+ try {
+ fProcess.exitValue();
+ finished = true;
+ } catch (IllegalThreadStateException e) {
+ //System.err.println("Closure exception " +e);
+ }
+ }
+
+ // @@@FIXME: Windows 2000 is screwed; double-check using output threads
+ if (!fOutputReader.finished()) {
+ fOutputReader.waitFor();
+ }
+
+ if (!fErrorReader.finished()) {
+ fErrorReader.waitFor();
+ }
+
+ fOutputReader.close();
+ fErrorReader.close();
+ // it seems that thread termination and stream closing is working
+ // without
+ // any help
+ fProcess = null;
+ fOutputReader = null;
+ fErrorReader = null;
+ }
+
+ public boolean isAlive() {
+ if (fProcess != null) {
+ if (fOutputReader.isAlive() || fErrorReader.isAlive()) {
+ return true;
+ }
+ fProcess = null;
+ fOutputReader.close();
+ fErrorReader.close();
+ fOutputReader = null;
+ fErrorReader = null;
+ }
+ return false;
+ }
+
+ /**
+ * The same functionality as "isAlive()"
+ * but does not affect out streams,
+ * because they can be shared among processes
+ */
+ public boolean isRunning() {
+ if (fProcess != null) {
+ if (fOutputReader.isAlive() || fErrorReader.isAlive()) {
+ return true;
+ }
+ fProcess = null;
+ }
+ return false;
+ }
+ /**
+ * Forces the termination the launched process
+ */
+ public void terminate() {
+ if (fProcess != null) {
+ fProcess.destroy();
+ fProcess = null;
+ }
+ if (!fOutputReader.finished()) {
+ fOutputReader.waitFor();
+ }
+ if (!fErrorReader.finished()) {
+ fErrorReader.waitFor();
+ }
+ fOutputReader.close();
+ fErrorReader.close();
+ fOutputReader = null;
+ fErrorReader = null;
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/CorePlugin.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/CorePlugin.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/CorePlugin.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.core;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.core.Activator;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ *
+ */
+public class CorePlugin {
+ // The message console
+ private ESboxMessageConsole console;
+ private ServiceTracker bundleTracker;
+
+ private BundleContext context;
+
+
+ private IPreferenceProvider corePreferenceProvider;
+
+ private static CorePlugin instance = new CorePlugin();
+
+ public static CorePlugin getDefault() {
+ return instance;
+ }
+
+ public IPreferenceStore getPreferenceStore() {
+ return Activator.getDefault().getPreferenceStore();
+ }
+ /**
+ * Convenience method to return a build console which just prints messages and parses errors.
+ * @param brandNew if true, always create a new console, else append to the last one with the same name
+ * @param sdkTarget the SDK target associated, or <code>null</code>
+ * @param name the name of the console.
+ * @return a console with the given name.
+ */
+ public ESboxMessageConsole getConsole(boolean brandNew, ISDKTarget sdkTarget, String name) {
+ if (!PlatformUI.isWorkbenchRunning())
+ return null;
+
+ if (brandNew == true || console == null) {
+
+ String prefix = "ESbox Console";
+ if (sdkTarget != null) {
+ prefix += " - " + sdkTarget.getName();
+ }
+
+ String consoleName = prefix;
+ if (name != null) {
+ consoleName += " - " + name;
+ }
+
+ // remove any consoles for this target when allocating a new one
+ // TODO: reconcile this behavior against the "brandNew" flag
+ org.eclipse.ui.console.IConsole[] existing = ConsolePlugin.getDefault()
+ .getConsoleManager().getConsoles();
+
+ for (int i = 0; i < existing.length; i++) {
+ if (existing[i].getName().indexOf(/*prefix*/ consoleName) != -1) {
+ ConsolePlugin.getDefault().getConsoleManager()
+ .removeConsoles(new org.eclipse.ui.console.IConsole[] { existing[i] });
+ }
+ }
+
+ console = new ESboxMessageConsole(consoleName, null);
+
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(
+ new org.eclipse.ui.console.IConsole[] { console });
+ }
+
+ ConsolePlugin.getDefault().getConsoleManager().showConsoleView(console);
+
+ return console;
+
+ }
+
+ /**
+ * Get the core preferences provider.
+ */
+ public IPreferenceProvider getCorePreferenceProvider() {
+ if (corePreferenceProvider == null) {
+ corePreferenceProvider = new PreferenceProvider(null, Activator.getDefault().getPreferenceStore());
+ }
+ return corePreferenceProvider;
+ }
+
+ private PackageAdmin getPackageAdmin() {
+ if (bundleTracker == null) {
+ bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
+ bundleTracker.open();
+ }
+ return (PackageAdmin) bundleTracker.getService();
+ }
+
+ public static Bundle getBundle(String symbolicName) {
+ PackageAdmin packageAdmin = getDefault().getPackageAdmin();
+ if (packageAdmin == null)
+ return null;
+ Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
+ if (bundles == null)
+ return null;
+ //Return the first bundle that is not installed or uninstalled
+ for (int i = 0; i < bundles.length; i++) {
+ if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
+ return bundles[i];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param context2
+ */
+ public void setContext(BundleContext context) {
+ this.context = context;
+ }
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxException.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxException.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxException.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.core;
+
+public class ESboxException extends Exception {
+
+ public static final ESboxException CANCEL_EXCEPTION = new ESboxException("user cancelled");
+
+ public static final ESboxException TIMEOUT_EXCEPTION = new ESboxException("timeout");
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public ESboxException(String message) {
+ super(message);
+ }
+
+ public ESboxException(Throwable cause) {
+ super(cause);
+ }
+
+ public ESboxException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxMessageConsole.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxMessageConsole.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxMessageConsole.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,31 @@
+package org.maemo.esbox.core;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.console.MessageConsole;
+
+/**
+ * This is a message console variant which allows you to update the label (console name).
+ * @author eswartz
+ *
+ */
+public class ESboxMessageConsole extends MessageConsole {
+ /**
+ * @param name
+ * @param imageDescriptor
+ */
+ public ESboxMessageConsole(String name, ImageDescriptor imageDescriptor) {
+ super(name, imageDescriptor);
+ }
+
+ public void updateName(final String name) {
+ if (!getName().equals(name)) {
+ Runnable r = new Runnable() {
+ public void run() {
+ setName(name);
+ }
+ };
+ Display.getDefault().asyncExec(r);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxPreferenceConstants.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxPreferenceConstants.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ESboxPreferenceConstants.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.core;
+
+/**
+ *
+ * This enumeration contains the preference constants which are used to retrive
+ * ESbox preferences.
+ *
+ */
+public enum ESboxPreferenceConstants {
+
+ ADD_ACT,
+ //CHOOSE_TARGET_COMMAND,
+ CONFIGURE_ACT,
+ DISPLAY_X_COMMAND,
+ GAZPACHO_COMMAND,
+ LOG_COMMANDS,
+ LOG_COMMANDS_PATH,
+
+ MAEMO_COMMAND,
+ MAEMO_START_ACTION,
+ MAEMO_STOP_ACTION,
+ MAEMO_RESTART_ACTION,
+ MOUNT_ACT,
+ NFS_SERVER_HOSTNAME,
+ RUN_SCRIPT_LOC,
+ SBOX_GDB_REMOTE,
+ SBRSH_CONFIG_COMMAND,
+ SBRSH_CONFIG_FILE_LOCATION,
+ SBRSH_EXEC_FILE_LOCATION,
+ SBRSH_SELECTED_BIN_PATH,
+ SSH_USERNAME,
+ SSH_DEST_FOLDER,
+ SSH_CONNECTION_TIMEOUT,
+ START_GDB_SERVER,
+ TERMINAL_COMMAND,
+ UNMOUNT_ACT,
+ USE_X_HOST,
+ USER,
+ VERSION_PREFS_MAJOR,
+ VERSION_PREFS_MINOR,
+ X_HOST_CMD,
+
+
+ /* SB1 configuration options */
+ SB1_GDB_REMOTE_QEMU,
+ SB1_CURRENT_ACT,
+ SB1_SBOX_COMMAND,
+ SB1_REMOVE_ACT,
+ SB1_REMOVE_OPT_FORCE,
+ SB1_RESET_ACT,
+ SB1_ROOTSTRAP_ACT,
+ SB1_ROOTSTRAP_OPT_FORCE,
+ SB1_INSTALL_ACT,
+ SB1_INSTALL_OPT_CLIB,
+ SB1_INSTALL_OPT_DEVKITS,
+ SB1_INSTALL_OPT_ETC,
+ SB1_INSTALL_OPT_FAKE,
+ SB1_INSTALL_OPT_GDB,
+ SB1_INSTALL_OPT_STRACE,
+ SB1_KILLALL_ACT,
+ SB1_KILLALL_OPT_SIGNAL,
+ SB1_LIST_ACT,
+ SB1_LIST_OPT_COMPILERS,
+ SB1_LIST_OPT_CPU,
+ SB1_LIST_OPT_DEVKITS,
+ SB1_LIST_OPT_SESSIONS,
+ SB1_LIST_OPT_TARGETS,
+ SB1_LOGIN_COMMAND,
+ SB1_SBOX_SANDBOX,
+ SB1_SELECT_ACT,
+ SB1_SETUP_ACT,
+ SB1_SETUP_OPT_COMPILER,
+ SB1_SETUP_OPT_CPUTRANSP,
+ SB1_SETUP_OPT_DEVKITS,
+ SB1_SETUP_OPT_FORCE,
+ SB1_SHOW_ACT,
+ SB1_SHOW_OPT_COMP_ARCH,
+ SB1_SHOW_OPT_COMP_CLIB,
+ SB1_SHOW_OPT_COMP_SUBARCH,
+ SB1_SHOW_OPT_COMPILERS,
+ SB1_SHOW_OPT_CPU,
+ SB1_SHOW_OPT_DEVKITS,
+ SB1_VERSION_ACT,
+
+ /* SB2 configuration options */
+ SB2_GDB_REMOTE_QEMU,
+ SB2_CONFIG_COMMAND,
+ SB2_EXEC_COMMAND,
+ SB2_INIT_COMMAND,
+ SB2_VERSION_ACT,
+ SB2_LIST_ACT,
+ SB2_MAPPING_MODE,
+ SB2_INSTALL_MAPPING_MODE,
+ SB2_LOG_LEVEL,
+ SB2_INIT_OPT_COMPILER,
+ SB2_MAEMO_ROOTSTRAP_COMMAND,
+ SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT,
+ SB2_MAEMO_ROOTSTRAP_LIST_ACT,
+ SB2_MAEMO_ROOTSTRAP_INSTALL_ACT,
+ SB2_MAEMO_ROOTSTRAP_FORCE_OPT,
+ SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT,
+ SB2_MAEMO_ROOTSTRAP_REMOVE_ACT,
+ SB2_SB2_SHOW_COMMAND,
+ SB2_SB2_SHOW_PATH_ACTION,
+ SB2_SB2_SHOW_PATH_OUTPUT_PATTERN,
+ SB2_MAEMO_ROOTSTRAP_PATH_ACT,
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ErrorLogger.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ErrorLogger.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/ErrorLogger.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.core;
+
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class performs error logging. The error can be logged, shown or both. It
+ * is important to log errors to clearly identify the plug-in as the source of
+ * problems.
+ *
+ */
+public abstract class ErrorLogger {
+
+ public interface Listener {
+ void statusLogged(IStatus status);
+ }
+
+ private static List<Listener> listeners = new ArrayList<Listener>();
+
+ public ErrorLogger() {
+ }
+
+ /**
+ * Add listener to logged errors for all instances of ErrorLogger.
+ * @param listener listener, duplicates ignored
+ */
+ public static synchronized void addListener(Listener listener) {
+ if (!listeners.contains(listener))
+ listeners.add(listener);
+ }
+ /**
+ * Remove listener for logged errors for all instances of ErrorLogger.
+ * @param listener listener,missing ignored
+ */
+ public static synchronized void removeListener(Listener listener) {
+ listeners.remove(listener);
+ }
+
+ protected static void fireListener(IStatus status) {
+ Listener[] array;
+ synchronized(listeners) {
+ array = (Listener[]) listeners.toArray(new Listener[listeners.size()]);
+ }
+ for (Listener listener : array) {
+ listener.statusLogged(status);
+ }
+ }
+
+ /**
+ * Show an error.
+ * @param mainMessage the error message.
+ * @param exception the exception caused by the error.
+ */
+ public void showError(String mainMessage_, Throwable exception) {
+ IStatus status_ = null;
+ if (mainMessage_ != null && mainMessage_.length() == 0) {
+ mainMessage_ = null;
+ }
+ if (mainMessage_ == null && exception instanceof CoreException) {
+ status_ = ((CoreException) exception).getStatus();
+ }
+ if (exception instanceof InvocationTargetException){
+ exception = ((InvocationTargetException) exception).getTargetException();
+ exception = exception.getCause();
+ if (mainMessage_ == null && exception.getMessage() != null) {
+ mainMessage_ = exception.getMessage();
+ }
+ }
+ if (status_ == null) {
+ if (mainMessage_ == null)
+ mainMessage_ = "<<unknown problem>>";
+ status_ = createStatus(IStatus.ERROR, exception == null ? mainMessage_ : null, exception);
+ if (exception == null)
+ mainMessage_ = null;
+ }
+ final String mainMessage = mainMessage_;
+ final IStatus status = status_;
+ final Shell shell = WorkbenchUtils.getSafeShell();
+ Runnable runnable = new Runnable() {
+ public void run() {
+ ErrorDialog.openError(shell, "Error", mainMessage, status);
+ }
+ };
+ Display.getDefault().syncExec(runnable);
+ }
+
+ private IStatus createStatus(int severity, String mainMessage, Throwable exception) {
+ String pluginID = getPluginID();
+ final IStatus status = new Status(severity, pluginID, 0,
+ mainMessage != null ? mainMessage : exception.getMessage(),
+ exception);
+ return status;
+ }
+
+ /**
+ * Log an error.
+ * @param mainMessage the error message (may be <code>null</code> to use the exception message)
+ * @param exception the exception caused by the error (may be <code>null</code>)
+ */
+ public void logError(String mainMessage, Throwable t) {
+ log(IStatus.ERROR, mainMessage, t);
+ }
+
+ /**
+ * Log a message
+ * @param severity one of {@value IStatus#ERROR} {@value IStatus#WARNING} {@value IStatus#INFO}
+ * @param mainMessage the error message (may be <code>null</code> to use the exception message)
+ * @param exception the exception caused by the error (may be <code>null</code>)
+ */
+ public void log(int severity, String mainMessage, Throwable exception) {
+ IStatus status;
+ if (mainMessage == null && exception instanceof CoreException)
+ status = ((CoreException) exception).getStatus();
+ else
+ status = createStatus(severity, mainMessage, exception);
+
+ if (getPlugin() != null)
+ getPlugin().getLog().log(status);
+ else
+ System.err.println(status.toString());
+
+ fireListener(status);
+ }
+
+ /**
+ * Convenience method for log and show an error.
+ * @param mainMessage the error message (may be <code>null</code> to use the exception message)
+ * @param exception the exception caused by the error (may be <code>null</code>)
+ */
+ public void logAndShowError(String mainMessage, Throwable exception) {
+ this.logError(mainMessage, exception);
+ this.showError(mainMessage, exception);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public abstract Plugin getPlugin();
+
+ public abstract String getPluginID();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/GeneralUtils.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/GeneralUtils.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/GeneralUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Apr 1, 2008
+ *******************************************************************************/
+package org.maemo.esbox.core;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.testing.TestableObject;
+
+import java.io.*;
+
+/**
+ * Place holder for general utilities.
+ *
+ * @author LWang.
+ *
+ */
+public abstract class GeneralUtils {
+
+ static public boolean isValidNameOrIP(String nameOrIP) {
+ if (nameOrIP == null || nameOrIP.length() == 0)
+ return false;
+
+ return nameOrIP.matches("(\\w)+") || // word
+ nameOrIP.matches("[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}");// IP address
+ }
+
+ public static boolean isValidPortNumber( String portNumber ) {
+ try {
+ int port = Integer.parseInt( portNumber );
+ return ( port > 0 && port <= 0xFFFF );
+ }
+ catch( NumberFormatException e ) {
+ return false;
+ }
+ }
+
+ /**
+ * Read given file content to string.
+ *
+ * @param filename
+ * @return
+ * @throws IOException
+ */
+ public static String readTextFileToString(IFileStore file) throws IOException {
+ StringBuilder filecontent = new StringBuilder();
+ if (!file.fetchInfo().exists())
+ return filecontent.toString();
+
+ BufferedReader in;
+ try {
+ in = new BufferedReader(new InputStreamReader(file.openInputStream(EFS.NONE, null)));
+ } catch (CoreException e) {
+ throw (IOException) new IOException().initCause(e);
+ }
+ try {
+ String str;
+ while ((str = in.readLine()) != null) {
+ filecontent.append(str);
+ filecontent.append('\n');
+ }
+ } finally {
+ in.close();
+ }
+
+ return filecontent.toString();
+ }
+
+ public static boolean isJUnitRunning() {
+ TestableObject testableObject = PlatformUI.getTestableObject();
+ if (testableObject != null) {
+ return testableObject.getTestHarness() != null;
+ }
+ return false;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/HostUtils.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/HostUtils.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/HostUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core;
+
+import org.eclipse.core.runtime.*;
+
+import java.io.File;
+
+/**
+ * Utilities to isolate host dependencies
+ * @author eswartz
+ *
+ */
+public class HostUtils {
+ private static String newline = null;
+
+ private static boolean isWin32;
+ private static IPath tmpPath;
+
+ static {
+ try {
+ isWin32 = Platform.getOS().equals(Platform.OS_WIN32);
+ } catch (Exception e) {
+ isWin32 = File.separatorChar == '\\';
+ }
+ newline = isWin32 ? "\r\n" : "\n";
+ }
+
+ public static boolean isWindows() {
+ return isWin32;
+ }
+
+ public static String getNewline() {
+ return newline;
+ }
+
+ public static IPath getTemporaryPath() {
+ if (tmpPath == null) {
+ if (isWindows()) {
+ String tmp = System.getenv("TEMP");
+ if (tmp == null)
+ tmp = System.getenv("TMP");
+ if (tmp == null) {
+ tmp = "c:/temp";
+ }
+ tmpPath = new Path(tmp);
+ tmpPath.toFile().mkdirs();
+ } else {
+ tmpPath = new Path("/tmp");
+ }
+ }
+ return tmpPath;
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/IPersistentPropertyAccess.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/IPersistentPropertyAccess.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/IPersistentPropertyAccess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core;
+
+/**
+ * This interface wraps a method of storing persistent properties.
+ * This interface does not guarantee <i>when</i> properties are persisted;
+ * it is up to the caller to decide.
+ * @author eswartz
+ *
+ */
+public interface IPersistentPropertyAccess {
+ /**
+ * Read a property with the given (scope-relative) unique id.
+ * @param propertyId
+ * @return value or <code>null</code>
+ */
+ String read(String propertyId);
+
+ /**
+ * Write a property with the given (scope-relative) unique id.
+ * @param propertyId
+ * @param value
+ */
+ void write(String propertyId, String value);
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/IPluginErrorLogger.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/IPluginErrorLogger.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/IPluginErrorLogger.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core;
+
+import org.eclipse.core.runtime.Plugin;
+
+/**
+ * This interface makes an ErrorLogger work for a specific plugin.
+ * @author eswartz
+ *
+ */
+public interface IPluginErrorLogger {
+ String getPluginID();
+ Plugin getPlugin();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/JobUtils.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/JobUtils.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/JobUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class JobUtils {
+ /**
+ * Wait for a scheduled job to complete without (hopefully) deadlocking
+ * @param job the job, already #schedule()'d
+ * @param monitor a monitor to use while waiting for the job to finish
+ */
+ public static void waitForJob(Job job, IProgressMonitor monitor, String monitorMsg) {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ monitor.beginTask(monitorMsg, IProgressMonitor.UNKNOWN);
+ Display display = Display.getCurrent();
+ while (true) {
+ IStatus status = job.getResult();
+ if (status != null)
+ break;
+ monitor.worked(1);
+ if (monitor.isCanceled()) {
+ job.cancel();
+ break;
+ }
+ if (display != null) {
+ while (display.readAndDispatch()) ;
+ }
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ job.cancel();
+ break;
+ }
+ }
+ monitor.done();
+ }
+
+ public interface IJob {
+ IStatus run(IProgressMonitor monitor);
+ }
+
+ /**
+ * Wait for a runnable to complete without (hopefully) deadlocking
+ * @param runnable a runnable
+ * @param monitor a monitor to use while waiting for the job to finish
+ */
+ public static void waitForRunnable(final IJob runnable, IProgressMonitor monitor, String monitorMsg) {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ IWorkbench workbench = null;
+ try {
+ workbench = PlatformUI.getWorkbench();
+ } catch (IllegalStateException e) {
+
+ }
+ Display display = Display.getCurrent();
+ if (display != null && workbench != null) {
+ monitor.beginTask(monitorMsg, IProgressMonitor.UNKNOWN);
+ final IStatus[] statuses = { null };
+ try {
+ workbench.getProgressService().busyCursorWhile(new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ statuses[0] = runnable.run(monitor);
+ }
+
+ });
+ } catch (InvocationTargetException e) {
+ statuses[0] = Activator.createErrorStatus("Failed running: " + monitorMsg, e);
+ } catch (InterruptedException e) {
+ statuses[0] = Activator.createErrorStatus("Failed running: " + monitorMsg, e);
+ }
+ if (!statuses[0].isOK()) {
+ Activator.getErrorLogger().logAndShowError(statuses[0].getMessage(), statuses[0].getException());
+ }
+ } else if (display != null) {
+ IStatus status = runnable.run(monitor);
+ if (!status.isOK()) {
+ Activator.getErrorLogger().logAndShowError(status.getMessage(), status.getException());
+ }
+ } else {
+
+ Job job = new Job(monitorMsg) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ return runnable.run(monitor);
+ }
+
+ };
+ job.schedule();
+ waitForJob(job, monitor, monitorMsg);
+ }
+ monitor.done();
+ }
+
+ /**
+ * @param thread
+ * @param monitor
+ */
+ public static void waitForThread(Thread thread, IProgressMonitor monitor) {
+ try {
+ for (int num = 0; num < 10; num++) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ while (display.readAndDispatch()) ;
+ }
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return;
+ thread.join(100);
+ }
+ } catch (InterruptedException e) {
+ }
+
+ thread.interrupt();
+
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/Policy.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/Policy.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/Policy.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * @author eswartz
+ *
+ */
+public class Policy {
+
+ /** Close a stream and ignore errors */
+ public static void close(Closeable closeable) {
+ if (closeable != null) {
+ try {
+ closeable.close();
+ } catch (IOException e) {
+
+ }
+ }
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/PreferenceProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/PreferenceProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/PreferenceProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.core;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+
+/**
+ * @author eswartz
+ *
+ */
+public class PreferenceProvider implements IPreferenceProvider {
+
+ private IPreferenceStore preferenceStore;
+ private Preferences preferences;
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ String userName = null;
+ private final IMachine machine;
+
+ /**
+ * @param preferenceStore
+ */
+ public PreferenceProvider(IMachine machine, IPreferenceStore preferenceStore) {
+ this.machine = machine;
+ this.preferenceStore = preferenceStore;
+ }
+ public PreferenceProvider(IMachine machine, Preferences preferences) {
+ this.machine = machine;
+ this.preferences = preferences;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.IPreferenceProvider#getPreferenceValue(org.maemo.esbox.core.ESboxPreferenceConstants)
+ */
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ String value;
+ if (preferenceStore != null)
+ value = preferenceStore.getString(key.toString());
+ else
+ value = preferences.getString(key.toString());
+
+ if (value.contains("${")) {
+ // now expand any known templated variables
+
+ if (userName == null) {
+ if (machine != null)
+ userName = machine.getUserName();
+ else
+ userName = System.getProperty("user.name");
+
+ substitutor.define("USER", userName);
+ }
+
+ value = substitutor.substitute(value);
+ }
+ return value;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/adapters/IDefaultExecutionEnvironmentAdapter.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/adapters/IDefaultExecutionEnvironmentAdapter.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/adapters/IDefaultExecutionEnvironmentAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.adapters;
+
+import org.eclipse.core.resources.IProject;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+
+/**
+ * This adapter allows determining the default execution environment, e.g.
+ * for new projects or for those which for some reason have lost this information
+ * @author eswartz
+ *
+ */
+public interface IDefaultExecutionEnvironmentAdapter {
+ /**
+ * Return an instance of the default execution environment for
+ * this project
+ * @param project or <code>null</code>
+ * @return {@link IExecutionEnvironment} or <code>null</code>
+ */
+ IExecutionEnvironment getDefaultExecutionEnvironment(IProject project);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/adapters/ISDKManageTargetAdapter.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/adapters/ISDKManageTargetAdapter.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/adapters/ISDKManageTargetAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.adapters;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+import java.util.List;
+
+/**
+ * This adapter may be fetched on ISDK in order to provide the methods
+ * for installing new SDK targets.
+ * @author eswartz
+ *
+ */
+public interface ISDKManageTargetAdapter {
+
+ /**
+ * Install a new SDK target, presenting whatever UI and doing whatever
+ * actions are meaningful.
+ * @param shell
+ * @param installed list into which new installed SDK targets are added
+ * @return status of installation attempt
+ */
+ IStatus installSDKTargets(Shell shell, List<ISDKTarget> installed);
+
+ /**
+ * Remove the given SDK target from the SDK. This runs on the UI thread
+ * and can allow the user to ignore.
+ * @param shell
+ * @param selectedTarget
+ * @return IStatus of removal attempt
+ */
+ IStatus removeSDKTarget(Shell shell, ISDKTarget selectedTarget);
+
+ /**
+ * Prepare to refresh the SDK provider. This currently is used to clear cached data;
+ * the SDKFactory will handle the task of actually repopulating SDKs and SDK targets.
+ */
+ void prepareRefresh();
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/cpp/DefineFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/cpp/DefineFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/cpp/DefineFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.cpp;
+
+import org.maemo.esbox.internal.core.cpp.Define;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Factory providing instances of IDefine.
+ * @author eswartz
+ *
+ */
+public abstract class DefineFactory {
+ private static Pattern MACRO_SPLIT_PATTERN = Pattern.compile("\\s*([A-Za-z0-9_]+)\\s*(=?)\\s*(.*)"); //$NON-NLS-1$
+
+ /**
+ * Create a new argument-less macro definition whose expansion is implicitly "1"
+ * @param macroName macro name, e.g. "MYMAC"
+ * @return new IDefine
+ * @throws IllegalArgumentException if macro name is null or invalid
+ */
+ public static IDefine createDefine(String macroName) {
+ return new Define(macroName, null, null);
+ }
+
+ /**
+ * Create a new argument-less macro definition with the given expansion. No newlines
+ * should be in the expansion.
+ * @param macroName macro name, e.g. "MYMAC"
+ * @param macroArgs list of argument names, e.g. { "a", "b" }
+ * @param expansion value of macro; may be null to explicitly expand to "1"
+ * @return new IDefine
+ * @throws IllegalArgumentException if macro name is null or invalid
+ */
+ public static IDefine createDefine(String macroName, String expansion) {
+ return new Define(macroName, null, expansion);
+ }
+
+ /**
+ * Create a function-like macro definition with the given argument
+ * names and expansion.
+ * @param macroName macro name, e.g. "MYMAC"
+ * @param macroArgs list of argument names, e.g. { "a", "b" }
+ * @param expansion value of macro; may be null to explicitly expand to "1"
+ * @return new IDefine
+ * @throws IllegalArgumentException if macro name is null or invalid
+ */
+ public static IDefine createDefine(String macroName, String[] macroArgs, String expansion) {
+ return new Define(macroName, macroArgs, expansion);
+ }
+
+ /**
+ * Create a define from an argument-less macro definition, which may include an "=" or a space
+ * and an expansion. Extra whitespace is trimmed. If no value is provided, the macro
+ * has an implicit value of "1".
+ * @param macro string in the form "FOO=value", "FOO value", or "MACRO"
+ * @return new IDefine
+ * @throws IllegalArgumentException if macro name is null or invalid
+ */
+ public static IDefine createSimpleFreeformDefine(String macro) {
+ // if it has an expansion then it will be separated by an = or space char
+ Matcher matcher = MACRO_SPLIT_PATTERN.matcher(macro);
+ if (matcher.matches()) {
+ // check whether = is present
+ if (matcher.group(2).length() > 0)
+ return createDefine(matcher.group(1), matcher.group(3).trim());
+ // check whether we just have a bare macro with extra spaces
+ else if (matcher.group(3).length() > 0)
+ return createDefine(matcher.group(1), matcher.group(3).trim());
+ }
+ return createDefine(macro.trim());
+ }
+
+
+}
+
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/cpp/IDefine.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/cpp/IDefine.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/cpp/IDefine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.cpp;
+
+/**
+ * High-level information about a macro definition.
+ * @author eswartz
+ *
+ */
+public interface IDefine {
+ /**
+ * Get the macro name (never null)
+ */
+ String getName();
+
+ /**
+ * Get the macro argument names, or null for parameter-less macros (an empty
+ * array is returned for, e.g., #define FOO() ... )
+ */
+ String[] getArgumentNames();
+
+ /**
+ * Get the macro name plus the argument names, as seen on the left-hand side
+ * of a macro.
+ * @return a String in the form "MACRO" or "MACRO()" or "MACRO(arg,arg...)"
+ */
+ String getPrototype();
+
+ /**
+ * Get the text in the macro expansion, excluding newline.
+ * Never returns null. An empty macro returns "". Macros
+ * defined as if from a command line -DMACRO argument return "1".
+ */
+ String getExpansion();
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/ESboxCommonVariables.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/ESboxCommonVariables.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/ESboxCommonVariables.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.env;
+
+import org.maemo.esbox.core.HostUtils;
+
+/**
+ * This defines commonly used and referenced global variables that are passed
+ * to launched processes.
+ * @author eswartz
+ *
+ */
+public class ESboxCommonVariables {
+
+ public static final String XSERVER_PATH = "HOST$XSERVER_PATH";
+ public static final String DISPLAY = "HOST$DISPLAY";
+ public static final String DISPLAY_DEFAULT_VALUE = ":2";
+
+ /**
+ * Iniitialize by adding missing variables
+ * @param envBlock
+ */
+ static void initialize(IEnvironmentVariableBlock envBlock) {
+ initVariable(envBlock, ESboxCommonVariables.DISPLAY, ESboxCommonVariables.DISPLAY_DEFAULT_VALUE);
+ // XXX: need a way to know the IP of the host from a remote machine
+ initVariable(envBlock, "SSH$DISPLAY", "10.0.2.2:2");
+ initVariable(envBlock, "REMOTE$DISPLAY", ":0");
+
+ initVariable(envBlock, "REMOTE$DBUS_SESSION_BUS_ADDRESS", "unix:path=/tmp/session_bus_socket");
+ initVariable(envBlock, "SSH$DBUS_SESSION_BUS_ADDRESS", "unix:path=/tmp/session_bus_socket");
+
+ if (HostUtils.isWindows()) {
+ initVariable(envBlock, XSERVER_PATH, "c:/cygwin/bin");
+ }
+
+ }
+
+ /**
+ * Initialize a variable if it is not defined already
+ * @param envBlock
+ * @param name
+ * @param value
+ */
+ private static void initVariable(IEnvironmentVariableBlock envBlock,
+ String name, String value) {
+ if (envBlock.getVariable(name) == null)
+ envBlock.define(name, value);
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariable.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariable.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariable.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.env;
+
+/**
+ * Standard implementation.
+ * @author eswartz
+ *
+ */
+public class EnvironmentVariable implements IEnvironmentVariable {
+
+ private final String name;
+ private String value;
+
+ /**
+ * @param name
+ * @param value
+ */
+ public EnvironmentVariable(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariable#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariable#getValue()
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariable#setValue(java.lang.String)
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariableBlock.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariableBlock.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariableBlock.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.env;
+
+import com.nokia.cpp.internal.api.utils.core.IVariableLookupCallback;
+import com.nokia.cpp.internal.api.utils.core.VariableSubstitutionEngine;
+
+import java.util.*;
+
+
+/**
+ * Standard implementation.
+ * @author eswartz
+ *
+ */
+public class EnvironmentVariableBlock implements IEnvironmentVariableBlock {
+
+ private Map<String, IEnvironmentVariable> map;
+ private VariableSubstitutionEngine expansionEngine;
+
+ public EnvironmentVariableBlock() {
+ map = new LinkedHashMap<String, IEnvironmentVariable>();
+ expansionEngine = new VariableSubstitutionEngine(null, null);
+ expansionEngine.allowRecursion(true);
+ expansionEngine.setVariableToken('{');
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariableBlock#define(java.lang.String, java.lang.String)
+ */
+ public void define(String name, String value) {
+ synchronized (map) {
+ map.put(name, new EnvironmentVariable(name, value));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariableBlock#getVariable(java.lang.String)
+ */
+ public IEnvironmentVariable getVariable(String name) {
+ synchronized (map) {
+ return map.get(name);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariableBlock#getVariables()
+ */
+ public IEnvironmentVariable[] getVariables() {
+ synchronized (map) {
+ return (IEnvironmentVariable[]) map.values().toArray(new IEnvironmentVariable[map.values().size()]);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariableBlock#undefine(java.lang.String)
+ */
+ public void undefine(String name) {
+ synchronized (map) {
+ map.put(name, new EnvironmentVariable(name, null));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariableBlock#expandVariable(org.maemo.esbox.core.env.IEnvironmentVariable, org.maemo.esbox.core.env.IVariableLookupCallback)
+ */
+ public String expandString(String value,
+ final IVariableProvider variableProvider) {
+ if (value == null)
+ return null;
+
+ IVariableLookupCallback variableLookupCallback = new IVariableLookupCallback() {
+
+ public Object getValue(String var) {
+ // environment itself trumps provider
+ IEnvironmentVariable existing = map.get(var);
+ if (existing != null)
+ return existing.getValue() != null ? existing.getValue() : "";
+
+ if (variableProvider != null)
+ return variableProvider.getValue(var);
+ else
+ return null;
+ }
+
+ };
+
+ return expansionEngine.substitute(variableLookupCallback, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariableBlock#expandVariable(org.maemo.esbox.core.env.IEnvironmentVariable, org.maemo.esbox.core.env.IVariableLookupCallback)
+ */
+ public String expand(IEnvironmentVariable variable,
+ final IVariableProvider variableProvider) {
+ if (variable.getValue() == null)
+ return null;
+
+ return expandString(variable.getValue(), variableProvider);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariableBlock#export(java.util.Properties, org.maemo.esbox.core.env.IVariableLookupCallback)
+ */
+ public void export(Properties env, IVariableProvider variableProvider) {
+ IEnvironmentVariable[] variables = getVariables();
+
+ for (IEnvironmentVariable variable : variables) {
+ if (variable.getValue() == null) {
+ env.remove(variable.getName());
+ } else {
+ env.put(variable.getName(), expand(variable, variableProvider));
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariableBlock#clear()
+ */
+ public void clear() {
+ synchronized (map) {
+ map.clear();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariableBlock#remove(org.maemo.esbox.core.env.IEnvironmentVariable)
+ */
+ public void remove(IEnvironmentVariable var) {
+ synchronized (map) {
+ map.remove(var.getName());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.env.IEnvironmentVariableBlock#copyTo(org.maemo.esbox.core.env.IEnvironmentVariableBlock)
+ */
+ public void copyTo(IEnvironmentVariableBlock destination) {
+ destination.clear();
+ for (IEnvironmentVariable variable : map.values()) {
+ destination.define(variable.getName(), variable.getValue());
+ }
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariableManager.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariableManager.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentVariableManager.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.env;
+
+import org.eclipse.core.runtime.CoreException;
+import org.maemo.esbox.internal.core.Activator;
+
+
+/**
+ * @author eswartz
+ *
+ */
+public class EnvironmentVariableManager {
+
+
+ private static EnvironmentVariableManager instance;
+
+ public static EnvironmentVariableManager getInstance() {
+ if (instance == null) {
+ instance = new EnvironmentVariableManager();
+ }
+ return instance;
+ }
+
+ private EnvironmentVariableBlock envBlock;
+
+ protected EnvironmentVariableManager() {
+ envBlock = new EnvironmentVariableBlock();
+ }
+
+ /**
+ * Perform actions needed for workspace startup (e.g.
+ * reading variables from storage, propagating them to
+ * language-specific backends, etc.)
+ */
+ public void startup() {
+ boolean needsSave = false;
+ try {
+ load();
+ } catch (CoreException e) {
+ needsSave = true;
+ }
+ ESboxCommonVariables.initialize(envBlock);
+
+ if (needsSave) {
+ try {
+ save();
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Unable to save global environment", e);
+ }
+ }
+ }
+
+ /**
+ * Get the block for globally-visible environment variables.
+ * @return
+ */
+ public IEnvironmentVariableBlock getGlobalEnvironmentBlock() {
+ return envBlock;
+ }
+
+ /**
+ * Get the standard provider for expanding variables.
+ * @return
+ */
+ public IVariableProvider getStandardVariableProvider() {
+ return null;
+ }
+
+ /**
+ * Load contents from persistent storage.
+ */
+ public void load() throws CoreException {
+ EnvironmentXMLStorage storage = new EnvironmentXMLStorage();
+ storage.load();
+ storage.readEnvironmentBlock(getGlobalEnvironmentBlock(), null);
+ }
+
+ /**
+ * Save contents to persistent storage.
+ */
+ public void save() throws CoreException {
+ EnvironmentXMLStorage storage = new EnvironmentXMLStorage();
+ storage.create();
+ storage.writeEnvironmentBlock(getGlobalEnvironmentBlock(), null);
+ storage.save();
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentXMLStorage.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentXMLStorage.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/EnvironmentXMLStorage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.env;
+
+import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.HostUtils;
+import org.maemo.esbox.core.xml.EFSXMLFileStorage;
+import org.maemo.esbox.core.xml.XMLUtils;
+import org.maemo.esbox.internal.core.Activator;
+import org.w3c.dom.Element;
+
+import java.net.URI;
+
+/**
+ * Storage for the environment block.
+ * @author eswartz
+ *
+ */
+public class EnvironmentXMLStorage extends EFSXMLFileStorage {
+
+ private static final String ENVIRONMENT = "environment";
+ private static final String VARIABLE = "variable";
+ private static final String NAME = "name";
+ private static final String UNDEFINE = "undefine";
+ private static final String CATEGORY = "category";
+
+ public EnvironmentXMLStorage() {
+ super(URIUtil.toURI(getEnvironmentPath()));
+ }
+
+ public EnvironmentXMLStorage(URI uri) {
+ super(uri);
+ }
+
+ protected static IPath getEnvironmentPath() {
+ Activator plugin = Activator.getDefault();
+ IPath storePath;
+ if (plugin != null)
+ storePath = plugin.getStateLocation().append(".environment");
+ else
+ storePath = HostUtils.getTemporaryPath().append(".environment");
+ return storePath;
+ }
+
+ public void load() throws CoreException {
+ load(ENVIRONMENT);
+ }
+
+ /**
+ * Find or create the element storing variables in a category.
+ * @param category name of category or <code>null</code> for global
+ * @return Element
+ */
+ private Element getCategoryElement(String category) {
+ Element element = getDocumentElement();
+ if (category != null) {
+ element = XMLUtils.findOrCreateChildElement(getDocument(), element, CATEGORY);
+ element.setAttribute(NAME, category);
+ }
+ return element;
+ }
+
+ /**
+ * Read environment variables from the given category
+ * @param envBlock
+ * @param category or <code>null</code> for globals
+ */
+ public void readEnvironmentBlock(
+ IEnvironmentVariableBlock envBlock, String category) {
+ envBlock.clear();
+
+ // create the category element
+ Element element = getCategoryElement(category);
+
+ Element[] vars = XMLUtils.getChildElementsNamed(element, VARIABLE);
+ for (Element var : vars) {
+ String name = var.getAttribute(NAME);
+ if ("true".equals(var.getAttribute(UNDEFINE)))
+ envBlock.define(name, null);
+ else
+ envBlock.define(var.getAttribute(NAME), XMLUtils.getText(var));
+ }
+ }
+
+ /**
+ * Save an environment block to the given category
+ * @param envBlock
+ * @param category name of category or <code>null</code> for globals
+ */
+ public void writeEnvironmentBlock(IEnvironmentVariableBlock envBlock,
+ String category) {
+ Element element = getCategoryElement(category);
+
+ // clear out existing elements
+ Element[] vars = XMLUtils.getChildElementsNamed(element, VARIABLE);
+ for (Element var : vars) {
+ element.removeChild(var);
+ }
+
+ // add variables
+ for (IEnvironmentVariable variable : envBlock.getVariables()) {
+ Element var = getDocument().createElement(VARIABLE);
+ var.setAttribute(NAME, variable.getName());
+
+ if (variable.getValue() == null)
+ var.setAttribute(UNDEFINE, "true");
+ else
+ XMLUtils.setText(var, variable.getValue());
+
+ element.appendChild(var);
+ }
+ }
+
+ /**
+ *
+ */
+ public void create() throws CoreException {
+ create(ENVIRONMENT);
+ }
+
+
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariable.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariable.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariable.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.env;
+
+/**
+ * Abstraction for an environment variable
+ * @author eswartz
+ *
+ */
+public interface IEnvironmentVariable {
+
+ /**
+ * Get the name of the variable.
+ * @return String, never <code>null</code>
+ */
+ String getName();
+
+ /**
+ * Get the value of the variable, which is either a non-<code>null</code> string that
+ * is exported to the target environment, or <code>null</code> to undefine the variable
+ * in the target environment.
+ * @return String or <code>null</code>
+ */
+ String getValue();
+
+ /**
+ * Set the value of the variable, which is either a non-<code>null</code> string that
+ * is exported to the target environment, or <code>null</code> to undefine the variable
+ * in the target environment.
+ * @param value String or <code>null</code>
+ */
+ void setValue(String value);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariableBlock.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariableBlock.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariableBlock.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.env;
+
+import java.util.Properties;
+
+/**
+ * This is an abstraction for a collection of environment variables.
+ * These may be combined with other blocks and variable-expanded into a Properties map.
+ * @author eswartz
+ *
+ */
+public interface IEnvironmentVariableBlock {
+ /**
+ * Define a variable. This will replace any existing variable with the same name.
+ * @param name
+ * @param value value, never <code>null</code>
+ */
+ void define(String name, String value);
+
+ /**
+ * Undefine a variable. This will undefine any existing variable with the same name
+ * or remember that such a variable should be removed when exporting against a known
+ * environment.
+ * @param name
+ */
+ void undefine(String name);
+
+ /**
+ * Get all the variables.
+ * @return array, never <code>null</code>
+ */
+ IEnvironmentVariable[] getVariables();
+
+ /**
+ * Find a variable with the given name.
+ * @return IEnvironmentVariable or <code>null</code>
+ */
+ IEnvironmentVariable getVariable(String name);
+
+ /**
+ * Expand a single given string, which may contain references to other variables via ${...} or
+ * to arbitrary other variables (handled by variableProvider).
+ * @param value a string
+ * @param variableProvider an implementation that provides values for ${...} sequences in variable values
+ * @return String the expanded value
+ */
+ String expandString(String value, IVariableProvider variableProvider);
+
+ /**
+ * Expand a single given variable, which may contain references to other variables via ${...} or
+ * to arbitrary other variables (handled by variableProvider).
+ * @param variable never <code>null</code>
+ * @param variableProvider an implementation that provides values for ${...} sequences in variable values
+ * @return String the expanded value, or <code>null</code> if this is an "undefining" variable
+ */
+ String expand(IEnvironmentVariable variable, IVariableProvider variableProvider);
+
+ /**
+ * Export the variables into the Properties map (incremental update; does not clear map).
+ * This will override variables and undefine any for which {@link IEnvironmentVariable#getValue()} is <code>null</code>.
+ * @param env environment to update
+ * @param variableProvider an implementation that provides values for ${...} sequences in variable values
+ */
+ void export(Properties env, IVariableProvider variableProvider);
+
+ /**
+ * Delete all the variables (nothing is defined or undefined).
+ */
+ void clear();
+
+ /**
+ * Remove a variable from the list (it is neither defined nor undefined).
+ * @param var
+ */
+ void remove(IEnvironmentVariable var);
+
+ /**
+ * Copy the block into another.
+ * @param destination
+ */
+ void copyTo(IEnvironmentVariableBlock destination);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariableManager.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariableManager.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IEnvironmentVariableManager.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.env;
+
+/**
+ * This interface provides several blocks of environment variables for use in
+ * the workspace.
+ * @author eswartz
+ *
+ */
+public interface IEnvironmentVariableManager {
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IVariableProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IVariableProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/env/IVariableProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.env;
+
+/**
+ * This interface may be implemented by clients to provide values for variables.
+ * @author eswartz
+ *
+ */
+public interface IVariableProvider {
+ /**
+ * Get an variable's value.
+ * @return non-<code>null</code> value if known, or <code>null</code> for unknown variable
+ */
+ public Object getValue(String var);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/BaseExecutionEnvironment.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/BaseExecutionEnvironment.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/BaseExecutionEnvironment.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.execEnv;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.internal.core.Activator;
+
+
+/**
+ * This base class handles common tasks.
+ * @author eswartz
+ *
+ */
+public abstract class BaseExecutionEnvironment implements IExecutionEnvironment {
+ /** Base id for builtin execution environment ids */
+ public static final String EXEC_ENV_BASE = Activator.PLUGIN_ID + ".execution_environment";
+
+ private String name;
+ private String id;
+
+ public BaseExecutionEnvironment(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ /** The BaseExecutionEnvironment implementation does nothing. */
+ public void establishEnvironment(Shell shell, IProject project)
+ throws CoreException {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IExecutionEnvironment#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/ConsoleExecutionEnvironment.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/ConsoleExecutionEnvironment.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/ConsoleExecutionEnvironment.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.execEnv;
+
+
+
+/**
+ * Environment for a console application.
+ * @author eswartz
+ *
+ */
+public class ConsoleExecutionEnvironment extends BaseExecutionEnvironment {
+ public static final String ID = EXEC_ENV_BASE + ".console";
+
+ public ConsoleExecutionEnvironment() {
+ super(ID, "Console");
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/ExecutionEnvironmentFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/ExecutionEnvironmentFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/ExecutionEnvironmentFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.execEnv;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.util.*;
+
+
+/**
+ * Factory providing execution environments
+ * @author eswartz
+ */
+public class ExecutionEnvironmentFactory {
+
+ private static final String CLASS = "class";
+ public static String ID = "id";
+
+ /* singleton instance */
+ private static ExecutionEnvironmentFactory singleton = null;
+
+ private Map<String, IExecutionEnvironment> execEnvMap;
+
+ /**
+ * Private constructor.
+ */
+ private ExecutionEnvironmentFactory() {
+ execEnvMap = new HashMap<String, IExecutionEnvironment>();
+ initializeExecutionEnvironments();
+ }
+
+ /**
+ * Return the singleton instance of this engine.
+ * @return the singleton instance of this engine.
+ */
+ public static synchronized ExecutionEnvironmentFactory getInstance() {
+ if (singleton == null)
+ singleton = new ExecutionEnvironmentFactory();
+ return singleton;
+ }
+
+ /**
+ * Initialize the list of defined execution environments.
+ * Such environments are described by plug-ins extension point org.maemo.esbox.core.execution_environment
+ */
+ private void initializeExecutionEnvironments() {
+ ErrorLogger logger = Activator.getErrorLogger();
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(
+ IExecutionEnvironment.EXTENSION_ID).getExtensions();
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+
+ String id = config.getAttribute(ID);
+
+ try {
+ IExecutionEnvironment execEnv = (IExecutionEnvironment) config.createExecutableExtension(CLASS);
+ if (!id.equals(execEnv.getId())) {
+ logger.logError("Mismatch in execution environment id: " + id + " vs " + execEnv.getId(), null);
+ }
+ execEnvMap.put(id, execEnv);
+ } catch (Exception e) {
+ logger.logError("Could not instantiate IExecutionEnvironment: " + config, e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Return the list of extension point instances
+ * @return list, never null
+ */
+ public List<IExecutionEnvironment> getExecutionEnvironments() {
+ return new ArrayList<IExecutionEnvironment>(execEnvMap.values());
+ }
+
+ /**
+ * Get the execution environment registered for the given id
+ * @param execEnvId id
+ * @return {@link IExecutionEnvironment} or <code>null</code>
+ */
+ public IExecutionEnvironment findExecutionEnvironment(String execEnvId) {
+ return execEnvMap.get(execEnvId);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/IExecutionEnvironment.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/IExecutionEnvironment.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/IExecutionEnvironment.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.execEnv;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.internal.core.Activator;
+
+
+/**
+ * This interface is implemented by extenders of the extension point
+ * org.maemo.esbox.core.execution_environment. It is used to classify projects
+ * according to their runtime requirements.
+ * @author eswartz
+ *
+ */
+public interface IExecutionEnvironment {
+ public static String EXTENSION_ID = Activator.PLUGIN_ID + ".execution_environment";
+
+ /**
+ * Get the unique extension id
+ * @return
+ */
+ String getId();
+
+ /**
+ * Get the human-readable name
+ */
+ String getName();
+
+ /**
+ * Make sure the environment is properly configured, using the given shell
+ * if necessary to communicate with the user. This call will be made from a UI thread.
+ * Usually this call precedes a local run or debug launch. Throw an exception to abort that launch.
+ * @param shell the shell in which to invoke dialogs
+ * @param project the project, for use in querying files/settings and providing UI to the user
+ * @throws CoreException if environment could not be configured
+ */
+ public void establishEnvironment(Shell shell, IProject project) throws CoreException;
+
+ /**
+ * Configure a project with the necessary settings for this execution environment.
+ * @param project an existing IProject
+ * @throws CoreException
+ */
+ //public void configureProject(IProject project) throws CoreException;
+
+ /**
+ * Remove from a project anything established by #configureProject(IProject).
+ * @param project an existing IProject
+ * @throws CoreException
+ */
+ //public void deconfigureProject(IProject project) throws CoreException;
+
+ /**
+ * Establish default settings for a launch configuration.
+ * @param launchConfig a launch configuration
+ * @throws CoreException
+ */
+ //public void configureLaunchConfiguration(ILaunchConfigurationWorkingCopy launchConfig) throws CoreException;
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/UnknownExecutionEnvironment.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/UnknownExecutionEnvironment.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/execEnv/UnknownExecutionEnvironment.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.execEnv;
+
+
+
+/**
+ * Environment for an unknown project. Stores nothing in the project and does not
+ * have a pre-launch setup.
+ * @author eswartz
+ *
+ */
+public class UnknownExecutionEnvironment extends BaseExecutionEnvironment {
+ /**
+ *
+ */
+ public static final String ID = EXEC_ENV_BASE + ".unknown";
+
+ public UnknownExecutionEnvironment() {
+ super(ID, "Unknown");
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/BuildMachineFactoryProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/BuildMachineFactoryProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/BuildMachineFactoryProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This is a provider managing the extensions for creating build machines.
+ * The extension point "build_machine_factory" is used to determine how these
+ * machines will be generated, which allows for flexibility in the future.
+ * @author eswartz
+ *
+ */
+public class BuildMachineFactoryProvider {
+
+ private static BuildMachineFactoryProvider instance;
+ private static final String MACHINE_CLASS = "class";
+
+ public static synchronized BuildMachineFactoryProvider getInstance() {
+ if (instance == null) {
+ instance = new BuildMachineFactoryProvider();
+ }
+ return instance;
+ }
+
+ private List<IBuildMachineFactory> buildMachineFactories;
+
+ private BuildMachineFactoryProvider() {
+ buildMachineFactories = null;
+ }
+
+ /**
+ * Iterate the extensions implementing machine providers and return them
+ */
+ private static List<IBuildMachineFactory> loadBuildMachineFactories() {
+ List<IBuildMachineFactory> factories = new ArrayList<IBuildMachineFactory>();
+ if (!Platform.isRunning())
+ return factories;
+
+ ErrorLogger logger = Activator.getErrorLogger();
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(
+ IBuildMachineFactory.EXTENSION_POINT_ID).getExtensions();
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+
+ try {
+ IBuildMachineFactory buildMachineFactory = (IBuildMachineFactory) config.createExecutableExtension(MACHINE_CLASS);
+ factories.add(buildMachineFactory);
+ } catch (Exception e) {
+ logger.logError("Could not instantiate IBuildMachineFactory in " + config.getName(), e);
+ }
+ }
+ }
+
+ return factories;
+ }
+
+ public synchronized IBuildMachineFactory[] getBuildMachineFactories() {
+ if (buildMachineFactories == null) {
+ buildMachineFactories = loadBuildMachineFactories();
+ }
+ return (IBuildMachineFactory[]) buildMachineFactories.toArray(new IBuildMachineFactory[buildMachineFactories.size()]);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IBuildMachine.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IBuildMachine.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IBuildMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+/**
+ * This is a machine which can build code for a given OS.
+ * @author eswartz
+ *
+ */
+public interface IBuildMachine extends IMachine {
+ /** Tell whether this can build for the given OS. */
+ boolean canBuildFor(String os);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IBuildMachineFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IBuildMachineFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IBuildMachineFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+
+import org.maemo.esbox.internal.api.core.machine.IBuildMachineImpl;
+import org.maemo.esbox.internal.core.Activator;
+
+/**
+ * Create machines via the IBuildMachineProvider interface.
+ * @author eswartz
+ *
+ */
+public interface IBuildMachineFactory {
+ public static final String EXTENSION_POINT_ID = Activator.PLUGIN_ID + ".build_machine_factory";
+
+ /**
+ * Create the build machines. This is called only if other factories return no results.
+ * The state of the machines is unknown.
+ * @return non-null array of new IBuildMachineImpl
+ */
+ IBuildMachineImpl[] createMachines();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IDeviceMachine.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IDeviceMachine.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IDeviceMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+/**
+ * Interface indicating this machine is a device.
+ * @author eswartz
+ *
+ */
+public interface IDeviceMachine extends IMachine {
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemAccess.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemAccess.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemAccess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IPath;
+
+import java.net.URI;
+
+/**
+ * Accessor for the target (machine, SDK target, etc) filesystem.
+ * This provides IFileStore and URI objects from target-relative paths.
+ * @author eswartz
+ *
+ */
+public interface IFileSystemAccess {
+
+ /** Convert a target-relative path to the URI for use with EFS.
+ * @param path target-relative absolute path
+ * @return URI, never <code>null</code>
+ */
+ URI getURIForPath(IPath path);
+
+ /** Get the IFileStore for the given path on the target.
+ * This is a handle-only method; the path need not exist.
+ * @param path target-relative absolute path
+ * @return IFileStore, never <code>null</code>
+ */
+ IFileStore getFileStore(IPath path);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemMapping.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemMapping.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemMapping.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * This interface wraps a mapping of paths over a shared filesystem.
+ * <p>
+ * This consists of a mapping algorithm, where a set of "rooted" paths on the
+ * host are defined to map to "rooted" paths on the target. Anything that
+ * is visible to both filesystems should be represented here.
+ * <p>
+ * Within a root, any subtree of paths is expected to map uniformly to
+ * its analogous root. If this breaks down (e.g., a directory or file is a softlink within
+ * a target's side of the root, which would not be referenceable from the host),
+ * then a new root must be defined.
+ * <p>
+ * <p>
+ * In this interface, "host" refers to the local filesystem and
+ * "target" refers to the remote filesystem.
+ * @author eswartz
+ *
+ */
+public interface IFileSystemMapping {
+
+ /**
+ * Convert a full host filesystem path to a full target-relative path.
+ * <p>
+ * Note: there's no guarantee that {@link #convertTargetToHostPath(IPath)} and this
+ * method's results are one-to-one.
+ * @param hostPath an absolute path
+ * @return a new IPath or <code>null</code> if cannot map
+ */
+ IPath convertHostToTargetPath(IPath hostPath);
+
+ /**
+ * Convert a full host filesystem path to any full target-relative paths that
+ * apply. More than one path may apply, for instance, when bind mounts are used.
+ * This isn't guaranteed to return all possible matches (i.e. behind symlinks).
+ * @param hostPath an absolute path
+ * @return array of IPath, never <code>null</code>; the paths are sorted by length
+ */
+ IPath[] convertHostToTargetPaths(IPath hostPath);
+
+ /**
+ * Convert a target-relative path to a full filesystem path.
+ * <p>
+ * Note: there's no guarantee that {@link #convertHostToTargetPath(IPath)} and this
+ * method's results are one-to-one.
+ * @param remotePath an absolute path
+ * @return a new IPath or <code>null</code> if cannot map
+ */
+ IPath convertTargetToHostPath(IPath remotePath);
+
+
+ /**
+ * @return
+ */
+ IPathCanonicalizer getHostPathCanonicalizer();
+
+ /**
+ * @return
+ */
+ IPathCanonicalizer getTargetPathCanonicalizer();
+
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemMappingListener.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemMappingListener.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IFileSystemMappingListener.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+/**
+ * Listen to changes in mappings.
+ * @author eswartz
+ *
+ */
+public interface IFileSystemMappingListener {
+ void mappingsChanged(IFileSystemMapping mapping);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ILocalMachine.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ILocalMachine.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ILocalMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+
+/**
+ * A machine implementing this interface is a local machine (the same one on
+ * which Eclipse runs), so it can be assumed to have certain performance
+ * characteristics.
+ * @author eswartz
+ *
+ */
+public interface ILocalMachine extends IMachine {
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachine.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachine.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+
+import java.net.URI;
+import java.util.*;
+
+/**
+ * This interface provides access to a machine with a
+ * process list, process launcher, and filesystem.
+ * <p>
+ * A machine might be the local machine, a scratchbox machine,
+ * a virtual machine, a remote machine, ...
+ * <p>
+ * Access to any of these methods will return immediately,
+ * but if the machine does not have a good status, they will fail.
+ * Use the {@link #isAlive()} and {@link #revive()} methods to check beforehand, if necessary.
+ * @author eswartz
+ *
+ */
+public interface IMachine extends IMachineBackend {
+
+ /** Get human-readable name */
+ String getName();
+
+ /** Get the OS the machine is running (Platform.OS_xxx) */
+ String getOS();
+
+ /**
+ * Get the name of the user on this machine.
+ * @return String
+ */
+ String getUserName();
+
+ /**
+ * Get user's home directory on this machine.
+ * @return
+ */
+ IPath getUserHome();
+
+ /**
+ * Get the unique prefix -- before '$' -- for ESbox environment variables automatically
+ * applied to launches for this machine. Such variables' prefixes and '$'
+ * are removed before being added to the launches for those machines.
+ * Variables for other machines containing a prefix and '$' are stripped out.
+ * <p>
+ * @return a prefix, e.g. "HOST" or "BUILD" or "REMOTE"
+ */
+ String getEnvironmentVariablePrefix();
+
+ /**
+ * Tell if the machine (appears to be) alive.
+ * This check is very fast but relies on cached information.
+ */
+ boolean isAlive();
+
+ /**
+ * Create a process running on the machine.
+ * @param workingDirectory the current working directory relative to the launch environment; may be null
+ * @param commandLine executable and arguments; for the executable, bare filename implies program on $PATH,
+ * relative path with "./", etc., implies a script in the working directory,
+ * and a full path is an absolute path in the launch environment
+ * @param environment the environment to pass (null to use the standard environment, else override the
+ * environment)
+ * @param usePty the PTY to use or <code>null</code> for default
+ * @return a new process
+ * @throws Exception
+ */
+ Process createProcess(IPath workingDirectory, List<String> commandLine, Properties environment, boolean usePty)
+ throws Exception;
+
+ /**
+ * Get the process launcher for the machine.
+ * @return a process launcher, never <code>null</code>
+ */
+ IProcessLauncherFactory getProcessLauncherFactory();
+
+ /**
+ * Read the user's default environment.
+ * @return map of name to value, or <code>null</code>
+ */
+ Map<String, String> getStandardEnvironment();
+
+ /**
+ * Get the URI identifying the machine. This should only contain an authority.
+ * @return URI, never <code>null</code>
+ */
+ URI getURI();
+
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineBackend.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineBackend.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineBackend.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+
+/**
+ * This method encapsulates the backend methods for a machine,
+ * independent of the IMachineController.
+ * @author eswartz
+ *
+ */
+public interface IMachineBackend {
+ /**
+ * Get the filesystem mapping for the machine.
+ * @return a filesystem mapping, never <code>null</code>
+ */
+ IFileSystemMapping getFileSystemMapping();
+
+ /**
+ * Get filesystem access for the machine.
+ * @return a filesystem accessor, never <code>null</code>
+ */
+ IFileSystemAccess getFileSystemAccess();
+
+ /**
+ * Get the process lister for the machine.
+ * @return a process lister, never <code>null</code>
+ */
+ IProcessLister getProcessLister();
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineController.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineController.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineController.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import com.nokia.cpp.internal.api.utils.core.IListener;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * An implementation of a machine, which controls its state.
+ * <p>
+ * All of these methods may involve long-running operations or UI calls,
+ * so they must be invoked from the UI thread. Also, they are expected to be called
+ * from a centralized client or something which otherwise synchronizes access to the controller,
+ * so redundant operations are not called unnecessarily. Clients should typically
+ * use {@link IMachine#isAlive()} and fail-fast.
+ * @author eswartz
+ *
+ */
+public interface IMachineController extends IListener<IMachineControllerListener> {
+ /**
+ * Try to contact the machine to ensure it's ready to be used.
+ * This does not modify the state of the IMachine object at all.
+ * @param machine
+ * @param monitor
+ * @return IStatus status of the machine; OK means everything is alright,
+ * warning means it's in a state that's not reliable, error means it's
+ * not available or broken (message contains details)
+ * @throws IllegalStateException if the UI thread is not the caller
+ */
+ public IStatus probeMachine(IMachine machine, IProgressMonitor monitor);
+
+ /**
+ * Acquire the machine, making it usable. This may
+ * involve repairing a warning or error.
+ * <p>
+ * This must be called from the UI thread.
+ * @param machine
+ * @param monitor
+ * @return status of acquisition (only OK is successful).
+ * @throws IllegalStateException if the UI thread is not the caller
+ */
+ public IStatus acquireMachine(IMachine machine, IProgressMonitor monitor);
+
+ /**
+ * Release the machine. At the implementation's discretion, this may
+ * involve suspending or going into standby, not necessarily terminating
+ * it.
+ * <p>
+ * This must be called from the UI thread.
+ * @param machine
+ * @param monitor
+ * @return status of release
+ * @throws IllegalStateException if the UI thread is not the caller
+ */
+ public IStatus releaseMachine(IMachine machine, IProgressMonitor monitor);
+
+ enum Result {
+ RETRY,
+ IGNORE,
+ ABORT
+ };
+
+ /**
+ * Show UI to the user reporting status about the machine and asking the user
+ * to connect it, configure it, etc. Return a boolean indicating whether the
+ * user wants to continue.
+ * <p>
+ * This must be called from the UI thread.
+ * @param machine
+ * @param shell the shell to use, or <code>null</code>
+ * @param status the failing status
+ * @return Result from user query
+ */
+ Result askUserToRepairMachine(IMachine machine, Shell shell, IStatus status);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineControllerListener.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineControllerListener.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineControllerListener.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+/**
+ * Listener for events triggered by IMachineImpl instances
+ * @author eswartz
+ *
+ */
+public interface IMachineControllerListener {
+ /**
+ * The machine's state changed
+ * @see IMachine#isReady()
+ */
+ void machineStateChanged(IMachineController machine);
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineManager.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineManager.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineManager.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.Job;
+
+/**
+ * Controls the creation, tracking, and destruction of machines.
+ * <p>
+ * Since a machine may take a long time to probe, start up, or shut down, and since
+ * such operations may require UI, we serialize and manage access to those
+ * operations here.
+ * <p>
+ * Also, some machines may be
+ * @author eswartz
+ *
+ */
+public interface IMachineManager {
+ /**
+ * Probe the machine and return status. Provide a monitor for cancellation, if necessary.
+ * @param machine
+ * @param monitor the progress monitor, or <code>null</code>
+ * @return IStatus of the probe (OK or not)
+ */
+ IStatus probeMachine(IMachine machine, IProgressMonitor monitor);
+
+ /**
+ * Acquire the machine, showing progress and allowing UI interaction with the user.
+ * @param machine
+ * @param monitor the progress monitor, or <code>null</code>
+ * @return IStatus of the revival (OK or not)
+ */
+ IStatus acquireMachine(IMachine machine, IProgressMonitor monitor);
+
+ /**
+ * Schedule an attempt to acquire the machine. This will launch the acquisition asynchronously.
+ * @param machine
+ * @return the Job which is doing the work; you may listen to job change events to determine when it is complete
+ */
+ Job scheduleAcquireMachine(IMachine machine);
+
+ /**
+ * Release use of the machine, allowing it to shut down (if needed).
+ * This may place the machine in an idle state, and it may be used again by acquiring it.
+ * @param machine
+ * @param monitor the progress monitor, or <code>null</code>
+ * @return IStatus of the shutdown (OK or not)
+ */
+ IStatus releaseMachine(IMachine machine, IProgressMonitor monitor);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineStatusListener.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineStatusListener.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineStatusListener.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+/**
+ * @author eswartz
+ *
+ */
+public interface IMachineStatusListener {
+ void machineStarted();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineStatusReporter.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineStatusReporter.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IMachineStatusReporter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import com.nokia.cpp.internal.api.utils.core.IListener;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * This interface encapsulates checking and listening for
+ * a machine's status.
+ * @author eswartz
+ *
+ */
+public interface IMachineStatusReporter extends IListener<IMachineStatusListener> {
+
+ /** Query the machine's status. */
+ IStatus getStatus(IProgressMonitor monitor);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IPathCanonicalizer.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IPathCanonicalizer.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IPathCanonicalizer.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import org.eclipse.core.runtime.IPath;
+
+public interface IPathCanonicalizer {
+ IPath getCanonicalPath(IPath path);
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcess.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcess.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import java.io.IOException;
+
+/**
+ * A representation of a process on a machine.
+ * @author eswartz
+ *
+ */
+public interface IProcess {
+ /**
+ * Get the name of the process, usually the executable name.
+ * @return String, never <code>null</code>
+ */
+ String getName();
+
+ /**
+ * Get the command line of the process
+ * @return String never <code>null</code>
+ */
+ String getCommandLine();
+
+ /**
+ * Get the unique identifier for the process.
+ * <p>This is not unique among all distinct processes at different
+ * times; it is only unique with respect to other processes in a list.
+ * @return identifier
+ */
+ int getId();
+
+ /** Terminate the process politely, waiting for it to finish.
+ *
+ * @throws IOException if not allowed or otherwise unable to attempt
+ */
+ void terminate() throws IOException;
+
+ /** Kill the process immediately.
+ * @throws IOException if not allowed or otherwise unable to attempt
+ */
+ void kill() throws IOException;
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcessFilter.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcessFilter.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcessFilter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+/**
+ * This interface is instantiated by the user to tell
+ * whether a given process should be returned by
+ * {@link IProcessLister#getProcesses(IProcessFilter)}
+ * @author eswartz
+ *
+ */
+public interface IProcessFilter {
+ boolean filter(IProcess process);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcessLister.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcessLister.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IProcessLister.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import java.util.List;
+
+/**
+ * This provides a way to query and manipulate the processes on a machine.
+ * @author eswartz
+ *
+ */
+public interface IProcessLister {
+ List<IProcess> getProcesses(IProcessFilter filter);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ISharedFilesystemProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ISharedFilesystemProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ISharedFilesystemProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import org.eclipse.core.runtime.IPath;
+
+import java.util.Map;
+
+/**
+ * This interface provides information about the shared filesystems between
+ * machines. It's usually used to initialize a machine's IFileSystemMapping implementation.
+ * @author eswartz
+ *
+ */
+public interface ISharedFilesystemProvider {
+ /** Get the known shared folders.
+ * @return map of host paths to target paths
+ */
+ Map<IPath, IPath> getSharedFolders();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IVirtualMachine.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IVirtualMachine.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/IVirtualMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+
+/**
+ * A machine implementing this interface is a virtual machine.
+ * @author eswartz
+ *
+ */
+public interface IVirtualMachine extends IMachine {
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineException.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineException.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineException.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+/**
+ * @author eswartz
+ *
+ */
+public class MachineException extends Exception {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4404943319548434722L;
+
+ /**
+ *
+ */
+ public MachineException(String message) {
+ super(message);
+ }
+
+ /**
+ *
+ */
+ public MachineException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineManager.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineManager.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineManager.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.progress.UIJob;
+import org.maemo.esbox.core.machine.IMachineController.Result;
+import org.maemo.esbox.internal.api.core.machine.IMachineImpl;
+
+/**
+ * @author eswartz
+ *
+ */
+public class MachineManager implements IMachineManager {
+
+ private static MachineManager manager;
+ public static synchronized IMachineManager getInstance() {
+ if (manager == null) {
+ manager = new MachineManager();
+ }
+ return manager;
+ }
+
+ private MachineManager() {
+ }
+
+ public synchronized IStatus probeMachine(IMachine machine_, final IProgressMonitor monitor) {
+ if (!(machine_ instanceof IMachineImpl))
+ throw new IllegalArgumentException();
+
+ final IMachineImpl machine = (IMachineImpl) machine_;
+
+ final IStatus[] statuses = { null };
+
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ statuses[0] = machine.getMachineController().probeMachine(machine, monitor);
+ }
+
+ });
+
+ return statuses[0];
+ }
+
+ public synchronized IStatus acquireMachine(IMachine machine_, final IProgressMonitor monitor) {
+ if (!(machine_ instanceof IMachineImpl))
+ throw new IllegalArgumentException();
+
+ final IMachineImpl machine = (IMachineImpl) machine_;
+
+ final IStatus[] statuses = { null };
+
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ statuses[0] = acquireMachineImpl(machine, monitor);
+ }
+
+ });
+
+ return statuses[0];
+ }
+
+ /**
+ * @param monitor
+ * @return
+ */
+ protected IStatus acquireMachineImpl(IMachineImpl machine, IProgressMonitor monitor) {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ do {
+ // always re-check in case multiple acquisitions were queued
+ IStatus status = machine.getMachineController().probeMachine(machine, new SubProgressMonitor(monitor, 1));
+
+ if (status.isOK() || status.getSeverity() == IStatus.WARNING) {
+ return status;
+ } else {
+ Result result = machine.getMachineController().askUserToRepairMachine(machine, null, status);
+ if (result == Result.ABORT)
+ return Status.CANCEL_STATUS;
+ if (result == Result.IGNORE)
+ break;
+
+ // else, retry
+ }
+ } while (true);
+
+ return machine.getMachineController().acquireMachine(machine, new SubProgressMonitor(monitor, 1));
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachineManager#scheduleAcquireMachine(org.maemo.esbox.core.machine.IMachine)
+ */
+ public Job scheduleAcquireMachine(final IMachine machine_) {
+ if (!(machine_ instanceof IMachineImpl))
+ throw new IllegalArgumentException();
+
+ final IMachineImpl machine = (IMachineImpl) machine_;
+
+ UIJob job = new UIJob("Acquiring " + machine.getName()) {
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ return acquireMachineImpl(machine, monitor);
+ }
+
+ };
+ job.schedule();
+ return job;
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IMachineManager#releaseMachine(testrse.IMachine)
+ */
+ public synchronized IStatus releaseMachine(IMachine machine_, final IProgressMonitor monitor) {
+ if (!(machine_ instanceof IMachineImpl))
+ throw new IllegalArgumentException();
+ final IMachineImpl machine = (IMachineImpl) machine_;
+
+ final IStatus[] statuses = { null };
+
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ statuses[0] = machine.getMachineController().releaseMachine(machine, monitor);
+ }
+ });
+
+ return statuses[0];
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineRegistry.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineRegistry.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/MachineRegistry.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.internal.api.core.machine.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class tracks which machines are known to the system.
+ * @author eswartz
+ *
+ */
+public class MachineRegistry {
+
+ private static MachineRegistry instance;
+
+ public static synchronized MachineRegistry getInstance() {
+ if (instance == null) {
+ instance = new MachineRegistry();
+ }
+ return instance;
+ }
+
+ private IMachineImpl localMachine;
+ private List<IBuildMachine> buildMachines;
+
+ /**
+ *
+ */
+ public MachineRegistry() {
+ buildMachines = null;
+ }
+
+ /**
+ * Get the instance of the local machine, on which Eclipse is running.
+ * @return IMachine the local machine
+ */
+ public synchronized IMachine getLocalMachine() {
+ if (localMachine == null) {
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ localMachine = new HostWindowsMachine();
+ } else {
+ localMachine = new HostUnixMachine();
+ }
+ }
+ return localMachine;
+ }
+
+ /**
+ * Get the instances of possible build machines targeting the given OS.
+ * @param os the OS to target, or <code>null</code> for all
+ * @see IBuildMachine#canBuildFor(String)
+ * @return non-null array of IMachine
+ */
+ public synchronized IBuildMachine[] getBuildMachines() {
+ if (buildMachines == null) {
+ buildMachines = new ArrayList<IBuildMachine>();
+
+ // first, try the local machine
+ IMachine localMachine = getLocalMachine();
+ if (localMachine instanceof IBuildMachine) {
+ buildMachines.add((IBuildMachine) localMachine);
+ }
+
+ // then, go through the build machine factories,
+ // until we get something
+ if (buildMachines.isEmpty()) {
+ for (IBuildMachineFactory factory : BuildMachineFactoryProvider.getInstance().getBuildMachineFactories()) {
+ IBuildMachineImpl[] machines = factory.createMachines();
+ for (IBuildMachineImpl machine : machines) {
+ buildMachines.add(machine);
+ }
+ if (!buildMachines.isEmpty())
+ break;
+ }
+ }
+
+ }
+ return (IBuildMachine[]) buildMachines.toArray(new IBuildMachine[buildMachines.size()]);
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ProcessFilterCmdLineRegexp.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ProcessFilterCmdLineRegexp.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/ProcessFilterCmdLineRegexp.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.machine;
+
+import java.util.regex.Pattern;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ProcessFilterCmdLineRegexp implements IProcessFilter {
+
+ private Pattern pattern;
+
+ /**
+ * @param string
+ */
+ public ProcessFilterCmdLineRegexp(String pattern) {
+ this.pattern = Pattern.compile(pattern);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IProcessFilter#filter(org.maemo.esbox.core.machine.IProcess)
+ */
+ public boolean filter(IProcess process) {
+ return pattern.matcher(process.getCommandLine()).matches();
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/UnixProcess.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/UnixProcess.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/machine/UnixProcess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.machine;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author eswartz
+ *
+ */
+public class UnixProcess implements IProcess {
+
+ private String cmdLine;
+ private int pid;
+ private IProcessLauncherFactory processLauncherFactory;
+
+ /**
+ * @param pid
+ * @param cmdLine
+ */
+ public UnixProcess(IProcessLauncherFactory factory, int pid, String cmdLine) {
+ this.processLauncherFactory = factory;
+ this.pid = pid;
+ this.cmdLine = cmdLine;
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IProcess#getCommandLine()
+ */
+ public String getCommandLine() {
+ return cmdLine;
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IProcess#getId()
+ */
+ public int getId() {
+ return pid;
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IProcess#getName()
+ */
+ public String getName() {
+ return cmdLine.split(" ")[0];
+ }
+
+ protected void signal(int pid, int signal) throws IOException {
+ List<String> cmdLine = new ArrayList<String>();
+ cmdLine.add("/bin/kill");
+ cmdLine.add("-" + signal);
+ cmdLine.add("" + pid);
+
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ processLauncherFactory,
+ null,
+ cmdLine);
+
+ Process process;
+ try {
+ process = processLauncher.createProcess();
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ } catch (ESboxException e1) {
+ throw (IOException) new IOException().initCause(e1);
+ }
+ }
+
+ public void kill() throws IOException {
+ signal(pid, 9);
+ }
+
+ public void terminate() throws IOException {
+ signal(pid, 15);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/DefaultModelDocumentProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/DefaultModelDocumentProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/DefaultModelDocumentProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,204 @@
+package org.maemo.esbox.core.model;
+
+import com.nokia.cpp.internal.api.utils.core.Check;
+import com.nokia.cpp.internal.api.utils.core.FileUtils;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.IDocument;
+
+import java.io.File;
+import java.util.*;
+
+/**
+ * A default implementation of IModelDocumentProvider which
+ * caches documents. It keeps a maximum number of
+ * documents in memory at a time. It refreshes a
+ * document when the underlying file's timestamp changes.
+ *
+ * @author eswartz
+ * @see IModelDocumentProvider
+ *
+ */
+public class DefaultModelDocumentProvider implements IModelDocumentProvider {
+
+ private static DefaultModelDocumentProvider instance;
+
+ // not final or static for debugging
+ private boolean DUMP = false;
+
+ /** count of entries allowed */
+ private static final int DEFAULT_MAX_CACHE_SIZE = 32;
+ /** the minimum number of hits (accesses) to the TU to keep it when flushing cache. */
+ private static final int DEFAULT_MINIMUM_HITS_TO_KEEP = 8;
+
+ private Object lock;
+ private Map<File, IDocument> documentCache;
+ private Map<File, Integer> cacheHits;
+ private List<File> cacheOrder;
+ private Map<File, Long> cacheTimes;
+
+ private int maxCacheSize;
+
+ private Integer minimumHitsToKeep;
+
+ /**
+ * Get the singleton instanceof the translation unit provider.
+ * The provider owns the cache of TUs.
+ * @return instance, never null
+ */
+ public static DefaultModelDocumentProvider getInstance() {
+ if (instance == null) {
+ instance = new DefaultModelDocumentProvider();
+ }
+ return instance;
+ }
+
+ private DefaultModelDocumentProvider() {
+ maxCacheSize = DEFAULT_MAX_CACHE_SIZE;
+ minimumHitsToKeep = DEFAULT_MINIMUM_HITS_TO_KEEP;
+ lock = new Object();
+ documentCache = new HashMap<File, IDocument>();
+ cacheHits = new HashMap<File, Integer>();
+ cacheOrder = new LinkedList<File>();
+ cacheTimes = new HashMap<File, Long>();
+ }
+
+ public IDocument getDocument(final File file) {
+ IDocument document = null;
+ synchronized(lock) {
+ if (documentCache.containsKey(file)) {
+ // see if it's valid
+ if (!file.exists()) {
+ flushEntry(file);
+ } else {
+ long lastMod = file.lastModified();
+ long cachedLastMod = cacheTimes.get(file);
+ if (lastMod != cachedLastMod) {
+ flushEntry(file);
+ } else {
+ if (DUMP)
+ System.out.println("Used cached document for " + file); //$NON-NLS-1$
+ document = documentCache.get(file);
+ cacheHits.put(file, cacheHits.get(file) + 1);
+ cacheOrder.remove(file);
+ cacheOrder.add(0, file);
+ }
+ }
+ }
+ if (document == null) {
+ char[] text;
+ try {
+ text = FileUtils.readFileContents(file, null);
+ } catch (CoreException e) {
+ return null;
+ }
+ document = DocumentFactory.createDocument(new String(text));
+ documentCache.put(file, document);
+ cacheTimes.put(file, file.lastModified());
+ cacheHits.put(file, 1);
+ cacheOrder.add(file);
+ /*
+ document.addDocumentListener(new IDocumentListener() {
+
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ }
+
+ public void documentChanged(DocumentEvent event) {
+ if (DUMP)
+ System.out.println("Detected change to document " + file); //$NON-NLS-1$
+ flushTu(file);
+ }
+
+ });*/
+
+ }
+ return document;
+ }
+ }
+
+ /**
+ * Reduce cache size.
+ */
+ private void reduceCache() {
+ int toRemove = documentCache.size() - maxCacheSize;
+ if (toRemove <= 0)
+ return;
+
+ // try initial scan, removing obviously changed or unreferenced entries
+ for (ListIterator<File> iter = cacheOrder.listIterator(cacheOrder.size());
+ toRemove > 0 && iter.hasPrevious();)
+ {
+ File file = iter.previous();
+ Long cacheTime = cacheTimes.get(file);
+ Integer cacheHit = cacheHits.get(file);
+ if (!file.exists()
+ || cacheTime == null || cacheTime != file.lastModified()
+ || cacheHit == null || cacheHit < minimumHitsToKeep) {
+ flushEntry(file);
+ toRemove--;
+ }
+ }
+
+ // this second scan, which should usually be skipped
+ // because toRemove==0, removes referenced entries too
+ for (ListIterator<File> iter = cacheOrder.listIterator(cacheOrder.size());
+ toRemove > 0 && iter.hasPrevious();)
+ {
+ File file = iter.previous();
+ flushEntry(file);
+ toRemove--;
+ }
+
+ }
+
+ /**
+ * Flush one file entry.
+ */
+ private void flushEntry(File file) {
+ if (DUMP)
+ System.out.println("Releasing TU for " + file); //$NON-NLS-1$
+ documentCache.remove(file);
+ cacheHits.remove(file);
+ cacheTimes.remove(file);
+ cacheOrder.remove(file);
+ }
+
+ /**
+ * Configure the debugging flag. Results are sent
+ * to System.out.
+ * @param flag
+ */
+ public void setDebugFlag(boolean flag) {
+ this.DUMP = flag;
+ }
+
+ /**
+ * Set the maximum number of TU's to keep.
+ * <p>
+ * This attempts to reduces the cache.
+ * @param count number of TUs, must be nonnegative
+ */
+ public void setMaxCacheCount(int count) {
+ Check.checkArg(count >= 0);
+ synchronized(lock) {
+ this.maxCacheSize = count;
+ reduceCache();
+ }
+ }
+
+ /**
+ * Set the minimum number of hits setting, which
+ * controls the lower limit at which a TU will be kept
+ * in the cache.
+ * <p>
+ * This attempts to reduces the cache.
+ * @param minHits minimum hits, must be nonnegative
+ */
+ public void setMinimumHitsToKeep(int minHits) {
+ Check.checkArg(minHits >= 0);
+ synchronized(lock) {
+ this.minimumHitsToKeep = minHits;
+ reduceCache();
+ }
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/DocumentFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/DocumentFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/DocumentFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.model;
+
+import org.eclipse.jface.text.IDocument;
+
+/**
+ * Factory providing instances of IDocument useful for the model.
+ * These are merely JFace Documents with more useful #toString() methods.
+ * @author eswartz
+ *
+ */
+public abstract class DocumentFactory {
+ public static IDocument createDocument() {
+ return new ModelDocument();
+ }
+
+ public static IDocument createDocument(String content) {
+ return new ModelDocument(content);
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IIncludeFileLocator.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IIncludeFileLocator.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IIncludeFileLocator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,40 @@
+/**
+ * Copyright © 2005 Nokia
+ */
+package org.maemo.esbox.core.model;
+
+import java.io.File;
+
+/**
+ * This interface provides a means to look up include files
+ * using normal C/C++ semantics
+ *
+ * @author eswartz
+ *
+ */
+public interface IIncludeFileLocator {
+
+ /**
+ * Look up a file on the include paths
+ * @param file the filename
+ * @param isUser true: #include "...", false: #include <...>
+ * @param currentDir if not null, the current directory and implicit first directory to search
+ * @return the located file, or null; the file is a key to ITranslationUnitProvider.
+ */
+ public File findIncludeFile(String file, boolean isUser,
+ File currentDir);
+
+ /**
+ * Get the array of user include paths searched.
+ * @return array,never null
+ */
+ File[] getUserPaths();
+
+ /**
+ * Get the array of system include paths searched.
+ * @return array,never null
+ */
+ File[] getSystemPaths();
+
+
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModel.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModel.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModel.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.model;
+
+
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * This manages a single file's contents and provides "views" onto its contents
+ * and resolves changes to such views to rewrite the contents.
+ * <p>
+ * Instances of this interface are possibly shared and their documents managed
+ * by an IModelProvider.
+ * <p>
+ * BIG FAT WARNING: Upcasting to IOwnedModel to access the document is not
+ * allowed unless you are 100% sure you just created the model yourself and have
+ * not yet relinquished it to the provider!
+ *
+ * @author eswartz
+ *
+ */
+public interface IModel {
+ /**
+ * Get full filesystem path to file
+ * @return path, never <code>null</code> (even if file doesn't exist)
+ */
+ IPath getPath();
+
+ /**
+ * Get the model provider owning this model, if any.
+ * <p>
+ * Registering a model via @link{IModelProvider#registerModel()}
+ * or retrieving one via @link{IModelProvider#getSharedModel()} will
+ * set the model's provider.
+ */
+ IModelProvider<IOwnedModel, IModel> getModelProvider();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelDocumentProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelDocumentProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelDocumentProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,30 @@
+/**
+ * (c) 2007 Nokia, Inc.
+ */
+package org.maemo.esbox.core.model;
+
+import org.eclipse.jface.text.IDocument;
+
+import java.io.File;
+
+/**
+ * This interface is used to look up documents for files.
+ * <p>
+ * The provider must detect changes to any IDocument returned
+ * and reflect those changes when asked for the file the next time. The provider
+ * does <i>not</i> have to persist the contents of the file on a document change, though.
+ * <p>
+ * The key used here is File (instead of IPath) since it has proper
+ * case sensitivity. Such Files should be absolute canonical filesystem paths.
+ * @author eswartz
+ * @since Carbide.c++ 1.3
+ */
+public interface IModelDocumentProvider {
+ /**
+ * Locate an existing document or load it. Listen for future changes
+ * to the document and to the file.
+ * @param file full pathed file
+ * @return IDocument instance; return null only if the file does not exist.
+ */
+ IDocument getDocument(File file);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.model;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.text.IDocument;
+
+/**
+ * Factory interface for creating models.
+ * @author eswartz
+ *
+ */
+public interface IModelFactory<Model extends IOwnedModel> {
+ /**
+ * Create a model
+ * @param path full path used to identify the model
+ * @param document the document containing the model content
+ * @return new model
+ */
+ Model createModel(IPath path, IDocument document);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelListenerBase.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelListenerBase.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelListenerBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+/**
+ * (c) 2006 Nokia
+ */
+package org.maemo.esbox.core.model;
+
+/**
+ * This listener provides notifications of notable changes to the model.
+ * @author eswartz
+ *
+ */
+public interface IModelListenerBase {
+ /**
+ * Called when underlying source and DOM have changed with unknown deltas
+ * (e.g. external text edits, CVS checkout, direct document manipulation, etc)
+ */
+ void modelChanged(IOwnedModel model);
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelLoadResults.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelLoadResults.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelLoadResults.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.model;
+
+import com.nokia.cpp.internal.api.utils.core.IMessage;
+
+
+/**
+ * @author eswartz
+ *
+ */
+public interface IModelLoadResults {
+ /**
+ * Get the problems detected while parsing the model on load.
+ * @return array (never null)
+ */
+ IMessage[] getMessages();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IModelProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.model;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * Interface managing shared access to models.
+ * <p>
+ * The provider gives access to the factory, for creation of private Model
+ * instances, and provides shared instances through #findOrCreateModel(). The
+ * model provider is responsible for the real contents of the files provided to
+ * it through the #createModel(IPath) call, thus clients must use the provider
+ * for safe access to the file. Further, the provider exposes only the base
+ * interface IModel to limit inadvertent changes to shared models.
+ * <p>
+ * The domain of files managed is not specified by this interface - a model
+ * provider may work entirely on memory buffers. But if an implementations of
+ * the model provider manage resources in the workspace, it is responsible for
+ * synchronizing the models with the workspace; e.g. persisting changes to
+ * IDocuments to the workspace and listening for changes to such resources
+ * outside its own APIs.
+ *
+ * @author eswartz
+ *
+ */
+public interface IModelProvider<Model extends IOwnedModel & IModel, SharedModel extends IModel> {
+ /**
+ * Create a <b>new</b> model with an <b>empty</b> document, which is slated to live
+ * at the given workspace path. (See {@link #getSharedModel(IPath)}
+ * for the normal case of loading a model from an existing file.)
+ * <p>
+ * The returned model is not registered and its document is not tracked
+ * until {@link #registerModel(IOwnedModel))} is called.
+ *
+ * @param workspacePath
+ * workspace-relative path.
+ * @return model (never null)
+ */
+ Model createModel(IPath workspacePath);
+
+ /**
+ * Load the document of a model from persistent storage. Only allowed on owned models.
+ * This either updates the existing document or replaces a null document
+ * with a new one.
+ * @param model
+ */
+ void load(Model model) throws CoreException;
+
+ /**
+ * Save the contents of a model's document(s) to persistent storage.
+ * Only allowed on owned models.
+ * @param model
+ */
+ void save(Model model) throws CoreException;
+
+ /**
+ * Make a model visible to clients of the provider and manage its contents.
+ * <p>
+ * Once registered, the model's owned model is counted as a shared model
+ * reference. The caller should {@link #releaseSharedModel(IModel) release}
+ * this model eventually.
+ * <p>
+ * If the model has a <code>null</code> IDocument, then it will be loaded
+ * from storage. Otherwise, it will be persisted immediately from the document
+ * contents. Then, the model will be parsed.
+ * <p>
+ * The registered model always has a document, though it may be empty if
+ * the load failed.
+ * <p>
+ * Once registered, changes to the model's document are persisted to underlying storage,
+ * and changes to the persisted storage cause reloads of the model.
+ * @param model a newly created model
+ * @throws IllegalArgumentException if already registered
+ * @throws CoreException if problems registering model, loading (when existing), or saving contents
+ */
+ void registerModel(Model model) throws CoreException;
+
+ /**
+ * Make a model invisible to clients of the provider and stop managing its
+ * contents. Any pending changes in the view, if committed, will not be
+ * automatically persisted, and changes to the persisted storage are
+ * no longer tracked.
+ *
+ * @param model a registered model
+ * @throws IllegalArgumentException if not registered
+ */
+ void unregisterModel(Model model);
+
+ /**
+ * Find a registered Model instance for the given path.
+ * <p>
+ * The path is used to identify the model and is a key to its real contents
+ * (usually the given workspace resource, as implied by the name). The
+ * client has limited access to the model. The real work happens through
+ * IView.
+ * <p>
+ * The model must be {@link #releaseSharedModel(IModel) released} after use.
+ * @param workspacePath
+ * @return existing model or null
+ */
+ SharedModel findSharedModel(IPath workspacePath);
+
+ /**
+ * Load a model for shared use. This is the normal client use of the provider.
+ * <p>
+ * This finds a registered model instance. If none registered, it loads a new
+ * model instance and registers it, then loads and parse its contents.
+ * <p>
+ * If the persisted resource does not exist, a <code>null</code> model is returned.
+ * <p>
+ * The client is responsible for {@link #releaseSharedModel(IModel) releasing}
+ * the model when done.
+ * <p>
+ * The client has limited (read-only) direct access to the model but may
+ * create views and make changes through them.
+ *
+ * @param workspacePath
+ * @return model or null if no such path registered
+ * @throws org.eclipse.core.runtime.CoreException
+ * if model cannot be created, e.g. due to a problem loading it
+ * when it otherwise appears to exist
+ */
+ SharedModel getSharedModel(IPath workspacePath) throws CoreException;
+
+ /**
+ * Indicate that the client is no longer using the model, which allows it to
+ * be eventually cleaned up.
+ * <p>
+ * View created on the model must be disposed first.
+ *
+ * @param model
+ * @throws IllegalStateException
+ * if all clients have released the model, but views are still
+ * undisposed (this condition is delayed until all clients have
+ * released the model, so the last client to release will be
+ * blamed :( )
+ */
+ void releaseSharedModel(SharedModel model) throws IllegalStateException;
+
+ /**
+ * Update tracked files using the map of IPath -> IDocument mappings for the model.
+ * These can change as different #includes are detected as a result
+ * of different IViewFilters. The provider tracks these documents
+ * so that changes to #included files can be saved to disk.
+ */
+ void updateModelDocumentMappings(Model model);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IOwnedModel.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IOwnedModel.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/IOwnedModel.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.model;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.text.IDocument;
+
+import java.util.Map;
+
+/**
+ * This manages a single file's contents and provides "views" onto its contents
+ * and resolves changes to such views to rewrite the contents.
+ * <p>
+ * This model may be modified by the owner.
+ * @author eswartz
+ *
+ */
+public interface IOwnedModel extends IModel {
+ /**
+ * Get the document representing the main file text. A model is
+ * initially created with an empty document.
+ * @return main document
+ */
+ IDocument getDocument();
+
+ /**
+ * Set the model's main document. This is only allowed when no views
+ * are attached.
+ */
+ void setDocument(IDocument document);
+
+ /**
+ * Look up a document by full/absolute path.
+ * @param IPath the absolute path to the file as used in the DOM or
+ * IModel#getPath()
+ * @return IDocument or null for unknown file
+ */
+ IDocument getDocument(IPath path);
+
+ /**
+ * Look up a document by full/absolute path.
+ * This is only allowed to change existing documents when no views
+ * are attached.
+ * @param IPath the absolute path to the file as used in the DOM or
+ * IModel#getPath()
+ * @param document the document for the path
+ */
+ void setDocument(IPath path, IDocument document);
+
+ /**
+ * Get the map of used documents.
+ * @return map of absolute path (IPath) to document (IDocument)
+ */
+ Map<IPath, IDocument> getDocumentMap();
+
+ /**
+ * Parse the model from its document to create the preprocessor DOM.
+ * <p>
+ * This is only valid when the document is set.
+ * <p>
+ * If any changes are detected and any views are open, they are all marked
+ * unsynchronized.
+ * @return load results (never null)
+ */
+ IModelLoadResults parse();
+
+ /**
+ * Set the model provider. Called by a model provider only.
+ * @param modelProvider the provider that owns the model.
+ */
+ void setModelProvider(IModelProvider<IOwnedModel, IModel> modelProvider);
+
+ /**
+ * Dispose the model.
+ * <p>Throws IllegalStateException unless views are disposed.
+ */
+ void dispose();
+
+ /**
+ * This method is called by model providers to ensure that a model
+ * can be released and disposed.
+ * <p>
+ * This call does not imply that the
+ * model <i>will</i> be disposed -- save such work until {@link #dispose()}.
+ *
+ * XXX: this corresponds with if (sharedModel.getViews().length != 0) {
+ * @return true: ok to release, false: cannto release
+ */
+ boolean canBeReleased();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelBaseBase.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelBaseBase.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelBaseBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,435 @@
+/**
+ * (c) 2006 Nokia
+ * TODO: refactor Carbide similarly
+ */
+package org.maemo.esbox.core.model;
+
+import com.nokia.cpp.internal.api.utils.core.Check;
+import com.nokia.cpp.internal.api.utils.core.IMessage;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.text.*;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.util.*;
+
+/**
+ * Base (below TU-level) model implementation
+ * @author eswartz
+ *
+ */
+public abstract class ModelBaseBase implements IOwnedModel {
+
+ private IPath fullPath;
+ private Map<IPath, IDocument> documents;
+ private Map<IDocument, IDocumentListener> documentListeners;
+ //private IASTTranslationUnit tu;
+ private List<IModelListenerBase> listeners;
+ private IModelProvider<IOwnedModel, IModel> provider;
+
+ class ModelDocumentListener implements IDocumentListener {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
+ */
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
+ */
+ public void documentChanged(DocumentEvent event) {
+ // reparse the model
+ parse();
+ }
+
+ }
+
+ public ModelBaseBase(IPath path, IDocument document) {
+ Check.checkArg(path);
+ this.fullPath = path;
+ this.documents = new HashMap<IPath, IDocument>();
+ this.documents.put(path, document);
+ this.documentListeners = new HashMap<IDocument, IDocumentListener>();
+ IDocumentListener modelDocumentListener = new ModelDocumentListener();
+ if (document != null) {
+ this.documentListeners.put(document, modelDocumentListener);
+ document.addDocumentListener(modelDocumentListener);
+ }
+ this.listeners = new LinkedList<IModelListenerBase>();
+ //this.views = new LinkedList<IView>();
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IOwnedModel#dispose()
+ */
+ public synchronized void dispose() {
+ //if (views.size() != 0)
+ // throw new IllegalStateException("cannot dispose model with views active"); //$NON-NLS-1$
+ listeners.clear();
+ /*if (tu != null) {
+ tu.removeListener(tuListener);
+ tuListener = null;
+ tu = null;
+ }*/
+ for (Map.Entry<IDocument, IDocumentListener> entry : documentListeners.entrySet()) {
+ entry.getKey().removeDocumentListener(entry.getValue());
+ }
+ documentListeners.clear();
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IOwnedModel#getDocument()
+ */
+ public IDocument getDocument() {
+ synchronized (documents) {
+ return documents.get(fullPath);
+ }
+ }
+
+ public void setDocument(IDocument document) {
+ setDocument(fullPath, document);
+ }
+
+ public IDocument getDocument(IPath path) {
+ synchronized (documents) {
+ return documents.get(path);
+ }
+ }
+
+ public void setDocument(IPath path, IDocument document) {
+ synchronized (documents) {
+ IDocument existingDocument = documents.get(path);
+ IDocumentListener documentListener = null;
+ if (existingDocument != null) {
+ //Check.checkContract(views.size() == 0);
+
+ documentListener = documentListeners.get(existingDocument);
+ existingDocument.removeDocumentListener(documentListener);
+ // this is a temporary change, apparently (?) (removing it causes a failure in bld.inf view tests?)
+ documentListeners.put(existingDocument, null);
+ }
+ documents.put(path, document);
+ if (document != null) {
+ if (documentListener == null) {
+ documentListener = new ModelDocumentListener();
+ documentListeners.put(document, documentListener);
+ }
+ document.addDocumentListener(documentListener);
+ }
+ }
+ }
+
+ public Map<IPath, IDocument> getDocumentMap() {
+ synchronized (documents) {
+ return new HashMap<IPath, IDocument>(documents);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModel#getPath()
+ */
+ public IPath getPath() {
+ return fullPath;
+ }
+
+ //public IASTTranslationUnit getTranslationUnit() {
+ // return tu;
+ //}
+
+ /**
+ * Reparse the document without disturbing listeners or the TU object.
+ */
+ /*
+ protected Pair<IASTTranslationUnit, IMessage[]> reparse() {
+ IDocumentParser parser = ParserFactory.createPreParser();
+ IDocument document = null;
+ synchronized (documents) {
+ document = documents.get(fullPath);
+ }
+ IASTTranslationUnit tu = parser.parse(fullPath, document);
+
+ // find problems
+ IMessage[] messages;
+ if (parser.hadErrors()) {
+ ProblemVisitor visitor = new ProblemVisitor();
+ visitor.visit(tu);
+ messages = visitor.getMessages();
+ } else {
+ messages = new IMessage[0];
+ }
+
+ return new Pair<IASTTranslationUnit, IMessage[]>(tu, messages);
+ }
+ */
+
+ /*
+
+ protected IMessage[] modelParse() {
+ if (this.tu != null) {
+ this.tu.removeListener(tuListener);
+ this.tu = null;
+ this.tuListener = null;
+ }
+
+ final Pair<IASTTranslationUnit, IMessage[]> info = reparse();
+
+ // make it so
+ this.tu = info.first;
+ this.tuListener = new TranslationUnitListener();
+ this.tu.addListener(tuListener);
+
+ // model changed
+ fireModelChanged();
+
+ // sorry views, you're out of date
+ for (IView view : views) {
+ view.markUnsynchronized();
+ }
+
+ return info.second;
+ }
+ */
+
+ /**
+ * Parse the model and return the messages resulting.
+ * The model should reflect the current contents of the documents
+ * after this call. This call should call #fireModelChanged().
+ */
+ abstract protected IMessage[] modelParse();
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IOwnedModel#parse()
+ */
+ public synchronized IModelLoadResults parse() {
+ synchronized (documents) {
+ Check.checkState(documents.get(fullPath) != null);
+ }
+
+ final IMessage[] messages = modelParse();
+
+ return new IModelLoadResults() {
+ public IMessage[] getMessages() {
+ return messages;
+ }
+ };
+
+ }
+
+ /**
+ *
+ */
+ protected/*private*/ void fireModelChanged() {
+ for (IModelListenerBase listener : listeners) {
+ listener.modelChanged(this);
+ }
+ }
+
+ /**
+ * Create the view on the model.
+ * @return
+ */
+ //abstract protected View createView(ModelBaseBase model, IViewConfiguration configuration);
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModel#createView(com.nokia.carbide.cpp.epoc.engine.preprocessor.IViewConfiguration)
+ */
+ /*
+ public View createView(IViewConfiguration configuration) {
+ // must be parsed first
+ Check.checkState(tu != null);
+ View view = createView(this, configuration);
+ ((IView)view).revert();
+ synchronized (views) {
+ views.add((IView) view);
+ }
+ return view;
+ }
+ */
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModel#getViews()
+ */
+ /*
+ public IView[] getViews() {
+ synchronized (views) {
+ return (IView[]) views.toArray(new IView[views.size()]);
+ }
+ }
+ */
+
+ /** Internal notification that a view was disposed. */
+ /*
+ void viewDisposed(IView view) {
+ Check.checkState(views.contains(view));
+ views.remove(view);
+ }
+ */
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModel#addListener(com.nokia.carbide.cpp.epoc.engine.model.IModelListener)
+ */
+ public void addListener(IModelListenerBase listener) {
+ Check.checkArg(listener);
+ synchronized (listeners) {
+ if (!listeners.contains(listener))
+ listeners.add(listener);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModel#removeListener(com.nokia.carbide.cpp.epoc.engine.model.IModelListener)
+ */
+ public void removeListener(IModelListenerBase listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ /**
+ * Internal method used to allow changes to the DOM.
+ * Must be followed by #unlock()
+ */
+ /*
+ public synchronized void lock() {
+ tuListener.allowChanges(true);
+ }
+ */
+
+ /**
+ * Internal method used to release write lock on the DOM.
+ */
+ /*
+ public synchronized void unlock() {
+ tuListener.allowChanges(false);
+ }
+ */
+
+ /**
+ * Internal method used to allow changes to the documents.
+ * Must be followed by #unlockDocuments()
+ */
+ public synchronized void lockDocuments() {
+ for (Map.Entry<IDocument, IDocumentListener> entry : documentListeners.entrySet()) {
+ entry.getKey().removeDocumentListener(entry.getValue());
+ }
+ }
+
+ /**
+ * Internal method used to release write lock on the documents.
+ */
+ public synchronized void unlockDocuments() {
+ for (Map.Entry<IDocument, IDocumentListener> entry : documentListeners.entrySet()) {
+ entry.getKey().addDocumentListener(entry.getValue());
+ }
+ }
+
+ /**
+ * Write the document from a changed view. This is called under
+ * the control of IView#commit().
+ * @param view
+ */
+ /*
+ public synchronized boolean commitDocument(IPreprocessorResults ppResults, Map<File, IASTTranslationUnit> updatedFileMap, IView view) {
+
+ // write file changes
+ boolean changed = false;
+ lockDocuments();
+ try {
+ for (Map.Entry<File, IASTTranslationUnit> entry : updatedFileMap.entrySet()) {
+ IASTTranslationUnit inclTu = entry.getValue();
+ if (inclTu != null) {
+ changed |= DocumentUpdater.updateDocuments(ppResults, inclTu);
+ }
+ }
+ } finally {
+ unlockDocuments();
+ }
+
+ // Even if no changes made, need to reparse the TU to replace
+ // any non-PP statements back with PP-statements.
+ // Also, when changes are made, we need updated source ranges
+ // and updated problems.
+ Pair<IASTTranslationUnit, IMessage[]> info = reparse();
+ if (info.first != null && tu != null) {
+ info.first.getNodes().setParent(null);
+ tu.setNodes(info.first.getNodes());
+ }
+
+ return changed;
+ }
+ */
+
+ /**
+ * Notify that the model content changed.
+ * XXX: views should also fireViewChanged
+ */
+ public void fireChanged() {
+ if (provider != null) {
+ try {
+ provider.save(this);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to save model", e);
+ }
+ }
+ }
+
+ /**
+ * Notify that a view changed.
+ * @param base
+ */
+ /*
+ public void fireViewChanged(IView changedView) {
+ // tell other views they're out-of-sync
+ IView[] viewsCopy;
+ synchronized (views) {
+ viewsCopy = (IView[]) views.toArray(new IView[views.size()]);
+ }
+ for (IView view : viewsCopy) {
+ if (view != changedView)
+ view.markUnsynchronized();
+ }
+
+ // notify listeners
+ IModelListenerBase[] listenersCopy;
+ synchronized (listeners) {
+ listenersCopy = (IModelListenerBase[]) listeners.toArray(new IModelListenerBase[listeners.size()]);
+ }
+
+ for (IModelListenerBase listener : listenersCopy) {
+ listener.modelUpdated(this, changedView);
+ }
+ }
+ */
+
+ /**
+ * Merge the map of full paths to documents from a view
+ * @param documentMap
+ */
+ public synchronized void mergeDocumentMap(Map<IPath, IDocument> documentMap) {
+ for (Map.Entry<IPath, IDocument> entry : documentMap.entrySet()) {
+ documents.put(entry.getKey(), entry.getValue());
+ }
+ if (provider != null) {
+ provider.updateModelDocumentMappings(this);
+ }
+ }
+
+
+ public void setModelProvider(
+ IModelProvider<IOwnedModel, IModel> modelProvider) {
+ this.provider = modelProvider;
+ }
+
+ public IModelProvider<IOwnedModel, IModel> getModelProvider() {
+ return provider;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.model.IOwnedModel#canBeReleased()
+ */
+ public boolean canBeReleased() {
+ return true;
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelDocument.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelDocument.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelDocument.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+package org.maemo.esbox.core.model;
+
+import org.eclipse.jface.text.Document;
+
+public class ModelDocument extends Document {
+
+ public ModelDocument() {
+ }
+
+ public ModelDocument(String initialContent) {
+ super(initialContent);
+ }
+
+ @Override
+ public String toString() {
+ return "Document w/" + getLength() + " chars:\n" + get(); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelProviderBase.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelProviderBase.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/ModelProviderBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,534 @@
+/**
+ * (c) 2006 Nokia
+ */
+package org.maemo.esbox.core.model;
+
+import com.nokia.cpp.internal.api.utils.core.Check;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.text.IDocument;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.util.*;
+
+/**
+ * Base implementation of a model provider. Real implementations
+ * need to provide a mechanism for retrieving and saving file contents.
+ * @author eswartz
+ *
+ */
+public abstract class ModelProviderBase<Model extends IOwnedModel & IModel, SharedModel extends IModel> implements IModelProvider<Model, SharedModel> {
+
+ // not static or final so it can change during test
+ private boolean DUMP = false;
+
+ private static int gProviderCounter;
+ private int providerId;
+
+ private static final long RELEASE_DELAY = 5 * 1000;
+ private boolean cacheModels;
+
+ // this acts as the lock on all the state managed by this object
+ private Object modelLock = new Object();
+
+ private Map<IPath, Model> models;
+ private Map<IPath, Integer> modelUseCount;
+ private Map<IPath, Long> releasedModelTimes;
+ private Map<IPath, Model> releasedModels;
+ private Map<IPath, Set<Model>> modelFileReferences;
+ protected IModelFactory<Model> modelFactory;
+
+ private long lastFlushTime;
+
+ public ModelProviderBase(IModelFactory<Model> modelFactory) {
+ providerId = ++gProviderCounter;
+ Check.checkArg(modelFactory);
+ this.cacheModels = true;
+ this.modelFactory = modelFactory;
+ this.modelUseCount = new HashMap<IPath, Integer>();
+ this.models = new HashMap<IPath, Model>();
+ this.releasedModelTimes = new HashMap<IPath, Long>();
+ this.releasedModels = new HashMap<IPath, Model>();
+ this.modelFileReferences = new HashMap<IPath, Set<Model>>();
+ }
+
+ /**
+ * Get the canonical form of the path -- a full filesystem path.
+ */
+ protected abstract IPath getFullPath(IPath path);
+
+ /**
+ * Load the text from the given full path, or return null
+ * for a nonexistent file.
+ * @param fullPath full path to resource
+ * @return contents of file
+ * @throws CoreException if the file could not be read,
+ * for reasons other than not existing.
+ */
+ protected abstract String loadStorage(IPath fullPath) throws CoreException;
+
+ /**
+ * Save the text to the given full path, creating it and its parents if
+ * necessary. The implementation may ignore a save if the text does not differ.
+ * @param path full path to resource
+ * @param text the text
+ */
+ protected abstract void saveStorage(IPath fullPath, String text) throws CoreException;
+
+ /**
+ * Enable tracking for the storage underlying a registered model's contents.
+ * This may be called multiple times for an already-registered path.
+ * <p>
+ * If changes are detected, {@link #fireStorageChanged()} should be called.
+ * <p>
+ * A call to {@link #stopTrackingStorage(IPath)} is made around approved
+ * saves of documents, so implementors don't have to handle that.
+ */
+ protected abstract void startTrackingStorage(IPath fullPath);
+
+ /**
+ * Disable tracking for the storage underlying a registered model's contents.
+ */
+ protected abstract void stopTrackingStorage(IPath fullPath);
+
+ /**
+ * Called by implementors to notify that the storage at the given
+ * path has changed. This is called by the implementation
+ * when changes to tracked storage can be detected with listeners.
+ * @param path
+ * @see #startTrackingStorage(IPath)
+ * @see #stopTrackingStorage(IPath)
+ */
+ protected void fireStorageChanged(IPath fullPath) {
+ IOwnedModel model = lookupSharedModel(fullPath);
+ if (model != null) {
+ // the model document itself was modified
+ refreshModel(fullPath, model);
+ } else {
+ // see if a header for one of the models was modified
+ Collection<Model> referencingModels = modelFileReferences.get(fullPath);
+ if (referencingModels != null) {
+ for (IOwnedModel refModel : referencingModels) {
+ refreshModel(refModel.getPath(), refModel);
+ }
+ }
+ }
+ }
+
+ /**
+ * Check the model's file for changes. This acts as a polling solution for cases
+ * where changes to tracked storage cannot be implemented with listeners.
+ * <p>
+ * The implementation need only store modification information when files are
+ * loaded and saved and double-check that information here. This may return false
+ * if the implementation reports changes with {@link #fireStorageChanged(IPath)}.
+ * <p>
+ * The implementation must not call {@link #fireStorageChanged(IPath)}.
+ * @see #startTrackingStorage(IPath)
+ * @see #stopTrackingStorage(IPath)
+ */
+ protected abstract boolean hasTrackedStorageChanged(IPath fullPath);
+
+ public void updateModelDocumentMappings(Model model) {
+ startTrackingModelStorage(model);
+ }
+
+ /**
+ * Start tracking storage for all the documents owned by the model.
+ * @param model
+ */
+ private void startTrackingModelStorage(Model model) {
+ Map<IPath, IDocument> documentMap = model.getDocumentMap();
+ for (IPath path : documentMap.keySet()) {
+ Set<Model> models = modelFileReferences.get(path);
+ if (models == null) {
+ models = new HashSet<Model>();
+ modelFileReferences.put(path, models);
+ }
+ models.add(model);
+ startTrackingStorage(path);
+ }
+ }
+
+ /**
+ * Start tracking storage for all the documents owned by the model.
+ * @param model
+ */
+ private void stopTrackingModelStorage(Model model) {
+ Map<IPath, IDocument> documentMap = model.getDocumentMap();
+ for (IPath path : documentMap.keySet()) {
+ Set<Model> models = modelFileReferences.get(path);
+ if (models != null) {
+ models.remove(model);
+ if (models.isEmpty()) {
+ modelFileReferences.remove(path);
+ }
+ }
+ stopTrackingStorage(path);
+ }
+ }
+
+ /**
+ * Refresh the model's contents from storage, if changed.
+ * @param fullPath
+ * @param model
+ */
+ private void refreshModel(IPath fullPath, IOwnedModel model) {
+ try {
+ // get updated file
+ String text = loadStorage(fullPath);
+
+ // make model reload with new contents
+ String currentText = model.getDocument().get();
+ if (currentText == null || !currentText.equals(text)) {
+ model.getDocument().set(text != null ? text : ""); //$NON-NLS-1$
+
+ // the change to the document should trigger a reparse
+ // and invalidation of any open views
+ }
+
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to refresh model", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModelProvider#createModel(org.eclipse.core.runtime.IPath)
+ */
+ public Model createModel(IPath somePath) {
+ IPath fullPath = getFullPath(somePath);
+ return modelFactory.createModel(fullPath, null);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModelProvider#load(com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPOwnedModel)
+ */
+ public void load(IOwnedModel model) throws CoreException {
+ String text = loadStorage(model.getPath());
+ IDocument document = model.getDocument() != null ? model.getDocument() : DocumentFactory.createDocument();
+ if (text != null)
+ document.set(text);
+ if (document != model.getDocument()) {
+ model.setDocument(document);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModelProvider#save(com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPOwnedModel)
+ */
+ public void save(Model model) throws CoreException {
+ IPath path = model.getPath();
+ Check.checkState(model.getDocument() != null);
+ String text = model.getDocument().get();
+
+ if (models.containsKey(path)) {
+ stopTrackingModelStorage(model);
+ }
+
+ // check for changed documents and save modified files only
+ saveStorage(path, text);
+
+ Map<IPath, IDocument> documentMap = model.getDocumentMap();
+ for (Map.Entry<IPath, IDocument> entry : documentMap.entrySet()) {
+ saveStorage(entry.getKey(), entry.getValue().get());
+ }
+
+ if (models.containsKey(path)) {
+ startTrackingModelStorage(model);
+ }
+ }
+
+ /**
+ * Register a model whose document has been established.
+ * Called with modelLock held.
+ * @param model
+ * @throws CoreException
+ */
+ private void doRegisterModel(Model model) throws CoreException {
+ IPath path = model.getPath();
+ Check.checkArg(!models.containsKey(path));
+ if (DUMP) System.out.println(providerId+") " + "Registering "+ path); //$NON-NLS-1$ //$NON-NLS-2$
+ if (releasedModels.containsKey(path)) {
+ if (DUMP) System.out.println("--> registering released model"); //$NON-NLS-1$
+ releasedModels.remove(path);
+ releasedModelTimes.remove(path);
+ }
+ models.put(path, model);
+ model.setModelProvider((IModelProvider<IOwnedModel, IModel>) this);
+
+ // owner holds one reference
+ modelUseCount.put(path, new Integer(1));
+
+ // ensure the model is fully set up
+ model.parse();
+ startTrackingModelStorage(model);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModelProvider#registerModel(SharedModel)
+ */
+ public void registerModel(Model model) throws CoreException {
+ synchronized (modelLock) {
+ if (model.getDocument() != null) {
+ // create from initial contents
+ save(model);
+ } else {
+ // try to load, or make empty if not existing
+ load(model);
+ }
+
+ doRegisterModel(model);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModelProvider#unregisterModel(SharedModel)
+ */
+ public void unregisterModel(Model model) {
+ IPath path = model.getPath();
+ synchronized (modelLock) {
+ if (DUMP) System.out.println(providerId+") " + "Unregistering " + path); //$NON-NLS-1$ //$NON-NLS-2$
+ Check.checkArg(models.containsKey(path) || releasedModels.containsKey(path));
+ models.remove(path);
+ releasedModels.remove(path);
+ releasedModelTimes.remove(path);
+ model.setModelProvider(null);
+ }
+ stopTrackingModelStorage(model);
+ }
+
+ private Model lookupSharedModel(IPath fullPath) {
+ Model model;
+ if (DUMP) System.out.println(providerId+") " + "Finding shared model " + fullPath); //$NON-NLS-1$ //$NON-NLS-2$
+ // try to resurrect released model
+ model = releasedModels.get(fullPath);
+ if (model != null) {
+ if (DUMP) System.out.println("--> resurrecting"); //$NON-NLS-1$
+ models.put(fullPath, model);
+ releasedModels.remove(fullPath);
+ releasedModelTimes.remove(fullPath);
+ } else {
+ if (DUMP) System.out.println("--> looking up"); //$NON-NLS-1$
+ model = models.get(fullPath);
+ }
+ if (model != null) {
+ incrementUseCount(fullPath);
+ if (DUMP) System.out.println("--> found, refcount = " + testGetUseCount(model)); //$NON-NLS-1$
+ }
+ return model;
+ }
+
+ public SharedModel findSharedModel(IPath somePath) {
+ if (somePath == null) {
+ return null;
+ }
+ IPath fullPath = getFullPath(somePath);
+ synchronized (modelLock) {
+ Model model = lookupSharedModel(fullPath);
+ if (model != null && hasTrackedStorageChanged(fullPath)) {
+ refreshModel(fullPath, model);
+ }
+ return (SharedModel) model;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModelProvider#getSharedModel(org.eclipse.core.runtime.IPath, com.nokia.carbide.cpp.epoc.engine.model.IModelConfiguration)
+ */
+ public SharedModel getSharedModel(IPath somePath) throws CoreException {
+ if (somePath == null) {
+ throw new CoreException(Activator.createErrorStatus("Model path is null... perhaps outside workspace?", null)); //$NON-NLS-1$
+ }
+ IPath fullPath = getFullPath(somePath);
+ Model model;
+ synchronized (modelLock) {
+ if (DUMP) System.out.println(providerId+") " + "Get shared " + fullPath); //$NON-NLS-1$ //$NON-NLS-2$
+ model = releasedModels.get(fullPath);
+ if (model != null) {
+ if (DUMP) System.out.println("--> resurrect"); //$NON-NLS-1$
+ Check.checkState(modelUseCount.get(fullPath).equals(0));
+ models.put(fullPath, model);
+ releasedModels.remove(fullPath);
+ releasedModelTimes.remove(fullPath);
+ } else {
+ if (DUMP) System.out.println("--> lookup"); //$NON-NLS-1$
+ model = models.get(fullPath);
+ }
+ if (model == null) {
+ if (DUMP) System.out.println("--> load"); //$NON-NLS-1$
+
+ // try to load
+ String text = loadStorage(fullPath);
+ if (text == null)
+ return null;
+
+ if (DUMP) System.out.print("--> loading model " + fullPath + "... "); //$NON-NLS-1$ //$NON-NLS-2$
+
+ model = modelFactory.createModel(fullPath, DocumentFactory.createDocument(text));
+ doRegisterModel(model);
+ if (DUMP) System.out.println("loaded."); //$NON-NLS-1$
+ } else {
+ // check for changes under our nose
+ if (hasTrackedStorageChanged(fullPath)) {
+ refreshModel(fullPath, model);
+ }
+
+ // ensure the model is tracked now, if it wasn't before (e.g. because it was not yet in the workspace)
+ startTrackingModelStorage(model);
+
+ incrementUseCount(fullPath);
+ if (DUMP) System.out.println("--> incr refcount to " + testGetUseCount(model)); //$NON-NLS-1$
+ }
+ }
+
+ // try cleaning up (this could be called as a job too)
+ flushReleasedModels();
+
+ return (SharedModel) model;
+ }
+
+ /**
+ * TESTING ONLY.
+ * <p>
+ * @param model
+ * @return
+ */
+ public int testGetUseCount(IOwnedModel model) {
+ return modelUseCount.get(model.getPath());
+ }
+
+ /**
+ * Increment use count for the given model.<p>
+ * Called with #modelLock held.
+ * @param modelPath
+ */
+ private void incrementUseCount(IPath modelPath) {
+ Integer val = modelUseCount.get(modelPath);
+ modelUseCount.put(modelPath, new Integer(val.intValue() + 1));
+ }
+
+ /**
+ * Decrement use count for the given model.<p>
+ * Called with #modelLock held.
+ * @param modelPath
+ */
+ private int decrementUseCount(IPath modelPath) {
+ Integer val = modelUseCount.get(modelPath);
+ int newValue = val.intValue() - 1;
+ Check.checkState(newValue >= 0);
+ modelUseCount.put(modelPath, new Integer(newValue));
+ return newValue;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModelProvider#releaseSharedModel(SharedModel)
+ */
+ public void releaseSharedModel(SharedModel sharedModel) {
+ if (sharedModel == null)
+ return;
+
+ Model model = (Model) sharedModel;
+ IPath path = model.getPath();
+ synchronized (modelLock) {
+ if (DUMP) System.out.println(providerId+") " + "Releasing " + path); //$NON-NLS-1$ //$NON-NLS-2$
+ Check.checkState(models.containsKey(path));
+ int val = decrementUseCount(path);
+ if (val == 0) {
+ if (!model.canBeReleased()) {
+ incrementUseCount(path);
+ throw new IllegalStateException("Trying to release in-use model: " + path); //$NON-NLS-1$
+ }
+ if (DUMP) System.out.println("--> refcount == 0"); //$NON-NLS-1$
+ models.remove(path);
+ if (cacheModels) {
+ if (DUMP) System.out.println("--> released"); //$NON-NLS-1$
+ // move to released models cache
+ releasedModels.put(path, model);
+ releasedModelTimes.put(path, System.currentTimeMillis());
+ } else {
+ if (DUMP) System.out.println("--> disposing"); //$NON-NLS-1$
+ model.setModelProvider(null);
+ model.dispose();
+ modelUseCount.remove(path);
+ }
+ } else {
+ if (DUMP) System.out.println("--> refcount == " + val); //$NON-NLS-1$
+ }
+ }
+ }
+
+
+ /**
+ * Testing method to clear out the provider's contents.
+ */
+ public void reset() {
+ synchronized (modelLock) {
+ if (DUMP) System.out.println(providerId+") " + "Reset!"); //$NON-NLS-1$ //$NON-NLS-2$
+ models.clear();
+ modelUseCount.clear();
+ releasedModelTimes.clear();
+ releasedModels.clear();
+ }
+ }
+
+ /**
+ * Actually flush a model. This is done some time after the last
+ * #release is called.
+ * <p>
+ * Called with #modelLock held.
+ * @param model
+ * @param path
+ */
+ private void flushModel(IPath modelPath) {
+ if (!releasedModels.containsKey(modelPath)) {
+ Activator.getErrorLogger().logError("Flushing unreleased model? " + modelPath, null); //$NON-NLS-1$
+ }
+ try {
+ IOwnedModel model = releasedModels.get(modelPath);
+ model.setModelProvider(null);
+ model.dispose();
+ } catch (IllegalStateException e) {
+ throw e;
+ }
+ releasedModels.remove(modelPath);
+ releasedModelTimes.remove(modelPath);
+ modelUseCount.remove(modelPath);
+ }
+
+ /**
+ * Occasionally scan released models and free them,
+ * using a delay to avoid overhead of rescanning popular models.
+ */
+ private void flushReleasedModels() {
+ long now = System.currentTimeMillis();
+ if (lastFlushTime + RELEASE_DELAY > now) {
+ return;
+ }
+ synchronized (modelLock) {
+ if (DUMP) System.out.println(providerId+") " + "Flush models... "); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // work on copy so #flushModel can fix up everything
+ // (else we fix up the time map here, which is not symmetric)
+ Map<IPath, Long> timeMap = new HashMap<IPath, Long>(releasedModelTimes);
+ for (Iterator<Map.Entry<IPath, Long>> iter = timeMap.entrySet().iterator(); iter.hasNext(); ) {
+ Map.Entry<IPath, Long> entry = iter.next();
+ if (entry.getValue() + RELEASE_DELAY < now) {
+ if (DUMP) System.out.println("Flushing model " + entry.getKey()); //$NON-NLS-1$
+ flushModel(entry.getKey());
+ }
+ }
+ if (DUMP) System.out.println("flushed."); //$NON-NLS-1$
+ }
+ lastFlushTime = now;
+ }
+
+ public void cacheModels(boolean flag) {
+ this.cacheModels = flag;
+ }
+
+ public boolean isCachingModels() {
+ return cacheModels;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/WorkspaceModelProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/WorkspaceModelProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/model/WorkspaceModelProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,303 @@
+/**
+ * (c) 2006 Nokia
+ */
+package org.maemo.esbox.core.model;
+
+import com.nokia.cpp.internal.api.utils.core.*;
+import com.nokia.cpp.internal.api.utils.core.MultiResourceChangeListenerDispatcher.IResourceChangeHandler;
+
+import org.eclipse.core.filesystem.*;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.Policy;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.io.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This is the model provider implementation that understands workspace
+ * semantics. All paths are absolute. Files may be read or written inside or outside the workspace;
+ * we use workspace operations to read and write inside the workspace.
+ * @author eswartz
+ *
+ */
+public class WorkspaceModelProvider<Model extends IOwnedModel & IModel, SharedModel extends IModel> extends ModelProviderBase<Model, SharedModel> implements IResourceChangeHandler {
+
+ private static MultiResourceChangeListenerDispatcher resourceChangeHandler;
+ private Map<IPath, Long> externalFileModDateMap;
+
+ public WorkspaceModelProvider(IModelFactory<Model> modelFactory) {
+ super(modelFactory);
+ Check.checkState(Platform.isRunning());
+ this.externalFileModDateMap = new HashMap<IPath, Long>();
+
+ }
+
+ private IPath getAbsolutePath(IPath path) {
+ if (path.segmentCount() <= 1)
+ return null;
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if (resource == null || resource.getLocation() == null)
+ return null;
+ // get the real file if a linked resource
+ IPath rawLocation = resource.getRawLocation();
+ if (rawLocation != null)
+ return rawLocation;
+ else
+ return resource.getLocation();
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.model.ModelProviderBase#getCanonicalPath(org.eclipse.core.runtime.IPath)
+ */
+ @Override
+ protected IPath getFullPath(IPath path) {
+ IPath canonPath;
+
+ // oops, clients aren't following the "workspace-relative path" rule all the
+ // time; this seems like a good way to tell the difference.
+ if (path.getDevice() != null) {
+ canonPath = path;
+ } else {
+ canonPath = getAbsolutePath(path);
+ if (canonPath == null)
+ return path;
+ }
+ try {
+ return new Path(new java.io.File(canonPath.toOSString()).getCanonicalPath());
+ } catch (IOException e) {
+ Activator.getErrorLogger().logError("Failed to canonicalize path", e);
+ return canonPath;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.model.ModelProviderBase#loadDocument(org.eclipse.core.runtime.IPath)
+ */
+ @Override
+ protected String loadStorage(IPath fullPath) throws CoreException {
+ IFileStore store = getStore(fullPath);
+ if (store != null) {
+ IFileInfo info = store.fetchInfo();
+ if (info.exists()) {
+ externalFileModDateMap.put(fullPath, info.getLastModified());
+ return loadStore(store);
+ }
+ }
+ externalFileModDateMap.remove(fullPath);
+ return null;
+ }
+
+ /**
+ * @param store
+ * @return
+ */
+ private String loadStore(IFileStore store) throws CoreException {
+ InputStream is = store.openInputStream(0, null);
+ StringBuilder builder = new StringBuilder();
+ byte[] buf = new byte[1024];
+ int len;
+ try {
+ // XXX: use proper encoding
+ while ((len = is.read(buf, 0, buf.length)) > 0) {
+ builder.append(new String(buf, 0, len));
+ }
+ } catch (IOException e) {
+ throw new CoreException(Activator.createErrorStatus("Failure reading " + store, e));
+ } finally {
+ Policy.close(is);
+ }
+ return builder.toString();
+ }
+
+ /**
+ * @param store
+ * @return
+ */
+ private void saveStore(IFileStore store, String text) throws CoreException {
+ OutputStream os = store.openOutputStream(0, null);
+ try {
+ os.write(text.getBytes());
+ } catch (IOException e) {
+ throw new CoreException(Activator.createErrorStatus("Failure writing " + store, e));
+ } finally {
+ Policy.close(os);
+ }
+ }
+ /**
+ * @param store
+ * @return
+ */
+ private void saveResource(IFile file, String text) throws CoreException {
+ InputStream is = new ByteArrayInputStream(text.getBytes());
+ if (!file.exists()) {
+ file.create(is, IResource.NONE, null);
+ } else {
+ file.setContents(is, false, true, null);
+ }
+ }
+
+ /**
+ * @param fullPath
+ * @return
+ */
+ private IFileStore getStore(IPath fullPath) {
+ if (fullPath == null)
+ return null;
+ return EFS.getLocalFileSystem().getStore(fullPath);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.model.ModelProviderBase#saveDocument(org.eclipse.core.runtime.IPath, org.eclipse.jface.text.IDocument)
+ */
+ @Override
+ protected void saveStorage(IPath fullPath, final String text)
+ throws CoreException {
+ final IFileStore store = getStore(fullPath);
+ IFileInfo info = store.fetchInfo();
+ if (store != null) {
+ // get current contents and ignore save if nothing changed
+ try {
+ String currentText = loadStore(store);
+ if (currentText.equals(text)) {
+ return;
+ }
+ } catch (CoreException e) {
+ // ignore
+ }
+
+ // back up file if outside workspace
+ IPath wsPath = FileUtils.convertToWorkspacePath(fullPath, true);
+ if (wsPath == null || wsPath.segmentCount() < 2) {
+ IFileStore backup = getStore(fullPath.removeFileExtension().addFileExtension("bak")); //$NON-NLS-1$
+ try {
+ backup.delete(0, null);
+ } catch (CoreException e) {
+ // ignore
+ }
+
+ // copy it rather than rename it, so the original is always there. otherwise saveFileText will fail since the original
+ // resource would be missing
+ if (info.exists()) {
+ try {
+ store.copy(backup, 0, null);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to backup file: " + store, e);
+ }
+ }
+
+ saveStore(store, text);
+ info = store.fetchInfo();
+ externalFileModDateMap.put(fullPath, info.getLastModified());
+ } else {
+ // we can't be sure we have rights to modify the workspace
+ // (e.g. might be triggered through a resource listener), so do this in a job
+ //
+ // also, due to bug 4636, a resource which exists in multiple
+ // projects may be saved under a different scheduling rule;
+ // we need to trap this and try again in a job if necessary.
+
+ final IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(wsPath);
+
+ boolean retryInJob = false;
+ if (ResourcesPlugin.getWorkspace().isTreeLocked()) {
+ retryInJob = true;
+ } else {
+ try {
+ saveResource(file, text);
+ } catch (IllegalArgumentException e) {
+ // too bad there is not a more specific error :(
+ retryInJob = true;
+ }
+ }
+
+ if (retryInJob) {
+ WorkspaceJob job = new WorkspaceJob("Saving model") {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ saveResource(file, text);
+ return Status.OK_STATUS;
+ }
+ };
+ // note: because character sets might be changed, the rule is really the project
+ job.setRule(ResourcesPlugin.getWorkspace().getRoot().getProject(wsPath.segment(0)));
+ job.setPriority(WorkspaceJob.INTERACTIVE);
+ job.schedule();
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.model.ModelProviderBase#startTrackingStorage(org.eclipse.core.runtime.IPath)
+ */
+ protected void startTrackingStorage(IPath fullPath) {
+ // the path is canonical already
+ IPath wsPath = FileUtils.convertToWorkspacePath(fullPath, false);
+ if (wsPath == null) {
+ IFileStore store = getStore(fullPath);
+ externalFileModDateMap.put(fullPath, store.fetchInfo().getLastModified());
+ } else {
+ externalFileModDateMap.remove(fullPath);
+ getMultiResourceChangeListenerDispatcher().addResource(wsPath, this);
+ }
+ }
+
+ /**
+ * @return
+ */
+ private static synchronized MultiResourceChangeListenerDispatcher getMultiResourceChangeListenerDispatcher() {
+ if (resourceChangeHandler == null) {
+ resourceChangeHandler = new MultiResourceChangeListenerDispatcher();
+ }
+ return resourceChangeHandler;
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.model.ModelProviderBase#stopTrackingStorage(org.eclipse.core.runtime.IPath)
+ */
+ protected void stopTrackingStorage(IPath fullPath) {
+ // remove stragglers if they were originally external and now workspace files
+ externalFileModDateMap.remove(fullPath);
+ IPath wsPath = FileUtils.convertToWorkspacePath(fullPath, false);
+ if (wsPath != null) {
+ getMultiResourceChangeListenerDispatcher().removeResource(wsPath, this);
+ }
+ }
+
+ @Override
+ protected boolean hasTrackedStorageChanged(IPath fullPath) {
+ Long prevTime = externalFileModDateMap.get(fullPath);
+ if (prevTime == null) {
+ IFile wsFile = FileUtils.convertFileToIFile(fullPath.toFile());
+ // bug 4045: Eclipse may still give us a "workspace file" for something no
+ // longer visible in the workspace (e.g. due to its project being deleted)!
+ // But we can tell if the IFile doesn't "exist".
+ if (wsFile == null || !wsFile.exists()) {
+ // we don't even know about it: e.g., cleanly registered file
+ return true;
+ }
+ // if a workspace file, we're already tracking it
+ return false;
+ } else {
+ // originally an external file (tho it may possibly now be a workspace file)
+ IFileStore store = getStore(fullPath);
+ if (prevTime.longValue() != store.fetchInfo().getLastModified()) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.sdt.utils.MultiResourceChangeListenerDispatcher.IResourceChangeHandler#resourceChanged(org.eclipse.core.runtime.IPath)
+ */
+ public void resourceChanged(IPath workspacePath) {
+ fireStorageChanged(getFullPath(workspacePath));
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/BaseProcessLauncher.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/BaseProcessLauncher.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/BaseProcessLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,308 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.process;
+
+import org.eclipse.cdt.core.ProcessClosure;
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * The base process launcher implementation for either host-based or scratchbox-based
+ * launching.
+ * @author eswartz
+ *
+ */
+public abstract class BaseProcessLauncher implements IProcessLauncher {
+
+ private List<String> commandArguments;
+ private Properties environment;
+ private IPath cwdDir;
+ private String logToPath;
+ private Process process;
+ private boolean usePTY;
+
+ public BaseProcessLauncher(
+ List<String> commandArguments,
+ Properties environment,
+ IPath cwdDir,
+ IPreferenceProvider prefProvider
+ ) {
+ if (commandArguments == null)
+ throw new IllegalArgumentException();
+ this.commandArguments = commandArguments;
+ this.environment = environment;
+ this.cwdDir = cwdDir;
+ if (Boolean.parseBoolean(prefProvider.getPreferenceValue(
+ ESboxPreferenceConstants.LOG_COMMANDS))) {
+ this.logToPath = prefProvider.getPreferenceValue(
+ ESboxPreferenceConstants.LOG_COMMANDS_PATH);
+ }
+ }
+
+ public IPath getLaunchCurrentWorkingDirectory() {
+ return cwdDir;
+ }
+
+ public List<String> getLaunchCommandArguments() {
+ return commandArguments;
+ }
+
+ public Properties getLaunchEnvironment() {
+ return this.environment;
+ }
+
+ /**
+ * Sets up the launch environment. This may, for instance,
+ * set up a wrapper script, or launch an emulator, etc.
+ * @throws ESboxException if launch setup failed
+ */
+ abstract protected void setupForLaunch() throws ESboxException;
+
+ /**
+ * Create the process from the commandArguments, environent, cwdDir, and pty
+ * @return
+ * @throws Exception
+ */
+ abstract protected Process doCreateProcess() throws Exception;
+
+ public Process createProcess() throws ESboxException {
+ try {
+ setupForLaunch();
+
+
+ if (logToPath != null) {
+ String cwdPath = cwdDir != null ? cwdDir.toPortableString() : null;
+ dumpLaunchInfo(cwdPath);
+ }
+
+ process = doCreateProcess();
+
+ } catch (Exception e) {
+ process = null;
+ throw new ESboxException(e);
+ }
+ return process;
+ }
+
+ /** Get the prefix for the dumped launch information (add a space at the end if needed) */
+ protected abstract String getLaunchInfoPrefix();
+
+ /** Get the standard environment to use as a delta for the dumped launch information
+ * @return standard environment a process would use, or <code>null</code> */
+ protected abstract Map<String, String> getLaunchInfoStandardEnvironment();
+
+ private void dumpLaunchInfo(String cwd) {
+ File logFile = new File(logToPath);
+ try {
+ FileOutputStream fos = new FileOutputStream(logFile, true);
+ PrintWriter printWriter = new PrintWriter(fos);
+ printWriter.println(getLaunchInfoPrefix() +
+ "[" + cwd + "] " + CommandLineArguments.toString(commandArguments));
+ if (environment != null) {
+ Map<String, String> stdEnv = getLaunchInfoStandardEnvironment();
+ for (Map.Entry<Object, Object> entry : environment.entrySet()) {
+ // report new or modified variables
+ if (stdEnv == null || !stdEnv.containsKey(entry.getKey())) {
+ printWriter.println("\tadded " + entry.getKey() + "=" + entry.getValue());
+ } else if (stdEnv != null && !stdEnv.get(entry.getKey()).equals(entry.getValue())) {
+ printWriter.println("\tchanged " + entry.getKey() + "=[-]"
+ + stdEnv.get(entry.getKey()) + " [+]"
+ + entry.getValue());
+ }
+ }
+ if (stdEnv != null) {
+ for (Map.Entry<String, String> entry : stdEnv.entrySet()) {
+ // report deleted new or modified variables
+ if (!environment.containsKey(entry.getKey())) {
+ printWriter.println("\tremoved " + entry.getKey());
+ }
+ }
+ }
+ }
+
+ printWriter.close();
+ fos.close();
+ } catch (IOException e) {
+ Activator.getErrorLogger().logError("Failed to record launch arguments", e);
+ }
+ }
+
+ public String getCommandLineString() {
+ return CommandLineArguments.toCommandLine(getLaunchCommandArguments());
+ }
+
+ protected void printCommandLine(OutputStream os) {
+ if (os != null) {
+ new PrintStream(os).println(getCommandLineString());
+ }
+ }
+
+ /**
+ * This class waits for a process to finish, sending its output and error
+ * content to given streams
+ * @author eswartz
+ *
+ */
+ static class ProcessWaiter {
+ private static final int DELAY = 100;
+ private final Process process;
+ private final OutputStream out;
+ private final OutputStream err;
+
+ public ProcessWaiter(Process process, OutputStream out, OutputStream err) {
+ if (process == null)
+ throw new IllegalArgumentException();
+ this.process = process;
+ this.out = out;
+ this.err = err;
+ }
+
+ /**
+ * Wait for the process to complete and provide termination via the given
+ * progress monitor.
+ * @param monitor
+ * @return exit code of process or -1 if canceled
+ */
+ public int waitForCompletion(IProgressMonitor monitor) {
+ ProcessClosure closure = new ProcessClosure(process, out, err);
+ if (monitor == null) {
+ closure.runBlocking();
+ } else {
+ closure.runNonBlocking();
+
+ while (!monitor.isCanceled() && closure.isAlive()) {
+ try {
+ Thread.sleep(DELAY);
+ } catch (InterruptedException e) {
+ }
+ }
+
+ if (monitor.isCanceled()) {
+ closure.terminate();
+ }
+
+ while (!monitor.isCanceled()) {
+ try {
+ try {
+ Thread.sleep(DELAY);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ process.exitValue();
+ break;
+ // terminated
+ } catch (IllegalThreadStateException e) {
+ // still running
+ }
+ }
+
+ if (monitor.isCanceled()) {
+ process.destroy();
+ }
+ }
+
+ try {
+ return process.exitValue();
+ } catch (IllegalThreadStateException e) {
+ // perhaps canceled but not yet dead
+ return -1;
+ }
+ }
+
+ }
+
+ /**
+ * Reads output form the process to the streams.
+ */
+ public int waitAndRead(OutputStream out, OutputStream err) {
+ ProcessWaiter waiter = new ProcessWaiter(process, out, err);
+ return waiter.waitForCompletion(null);
+ }
+
+ public int waitAndRead(OutputStream out, OutputStream err, IProgressMonitor monitor) {
+ ProcessWaiter waiter = new ProcessWaiter(process, out, err);
+ return waiter.waitForCompletion(monitor);
+ }
+
+
+ public int waitAndRead(OutputStream out, OutputStream err,
+ boolean showCommand) {
+ if (showCommand) {
+ printCommandLine(out);
+ }
+ return waitAndRead(out, err);
+ }
+
+ public int waitAndRead(OutputStream out, OutputStream err,
+ IProgressMonitor monitor,
+ boolean showCommand) {
+ if (showCommand) {
+ printCommandLine(out);
+ }
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+ return waitAndRead(out, err, monitor);
+ }
+
+ public MessageConsole redirectToConsole(MessageConsole console,
+ IStreamLineMonitor monitor) {
+ if (process == null) {
+ throw new IllegalStateException("process is not running");
+ }
+ if (console == null)
+ return null;
+
+ // print all output to console
+ new StreamMonitor(process.getInputStream(), console, false, monitor, process);
+ // print all errors to console
+ new StreamMonitor(process.getErrorStream(), console, true, monitor, null);
+
+ return console;
+ }
+
+ public MessageConsole redirectToConsole(MessageConsole console) {
+ return redirectToConsole(console, null);
+ }
+
+ public MessageConsole redirectToConsole(boolean brandNew, ISDKTarget sdkTarget, String consoleName) {
+ return redirectToConsole(brandNew, sdkTarget, consoleName, null);
+ }
+
+ protected Object createPTYIfUsed() throws IOException {
+ return null;
+ }
+
+ public void usePTY(boolean flag) {
+ this.usePTY = flag;
+ }
+
+ public boolean isUsePTY() {
+ return usePTY;
+ }
+
+ public MessageConsole redirectToConsole(boolean brandNew, ISDKTarget sdkTarget,
+ String consoleName, IStreamLineMonitor monitor) {
+ MessageConsole console = CorePlugin.getDefault().getConsole(brandNew, sdkTarget, consoleName);
+ return redirectToConsole(
+ console,
+ monitor);
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/CommandLineArguments.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/CommandLineArguments.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/CommandLineArguments.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.process;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class provides support for converting back and forth from lists of
+ * arguments to quoted command-line strings for shells.
+ * XXX: Make this an interface returned from a target (behavior must differ in Unix and Windows)
+ * @author eswartz
+ *
+ */
+public class CommandLineArguments {
+ /** Construct with a command line (with spaces and quoting) */
+ public static List<String> createFromCommandLine(String cmdLine) {
+ List<String> arguments = new ArrayList<String>();
+ StringBuilder curArg = new StringBuilder();
+ char quoting = 0;
+ char[] cmdLineChars = cmdLine.toCharArray();
+ for (int idx = 0; idx < cmdLineChars.length; ) {
+ char ch = cmdLineChars[idx++];
+ if (ch == '\\' && idx < cmdLineChars.length) {
+ ch = cmdLineChars[idx++];
+ } else {
+ if (quoting != 0) {
+ if (ch == quoting) {
+ quoting = 0;
+ continue;
+ } else {
+ curArg.append(ch);
+ continue;
+ }
+ }
+ if (ch == '\'' || ch == '\"') {
+ quoting = ch;
+ continue;
+ }
+ if (ch == ' ') {
+ if (curArg.length() > 0) {
+ arguments.add(curArg.toString());
+ }
+ curArg.setLength(0);
+ continue;
+ }
+ }
+ curArg.append(ch);
+ }
+ if (curArg.length() > 0) {
+ arguments.add(curArg.toString());
+ }
+ return arguments;
+ }
+
+ /** Construct with a variadic list of arguments. */
+ public static List<String> createFromVarArgs(String... args) {
+ List<String> arguments = new ArrayList<String>();
+ for (String arg : args)
+ arguments.add(arg);
+ return arguments;
+ }
+
+ /** Construct with an array of arguments. */
+ public static List<String> createFromArray(String[] args) {
+ List<String> arguments = new ArrayList<String>();
+ for (String arg : args)
+ arguments.add(arg);
+ return arguments;
+ }
+
+ /** Convert argument list to a command line with spaces between quoted arguments. */
+ public static String toCommandLine(List<String> arguments) {
+ return toString(arguments, " ", true);
+ }
+
+ /** Convert argument list to a command line with the given program as the first argument. */
+ public static String toCommandLine(String program, List<String> arguments) {
+ List<String> copy = new ArrayList<String>(arguments);
+ copy.add(0, program);
+ return toCommandLine(copy);
+ }
+
+ /** Convert to a string with the space separator and quoting behavior. **/
+ public static String toString(List<String> arguments) {
+ return toString(arguments, " ", true);
+ }
+
+ /** Convert to a string with the given separator and optional quoting behavior. **/
+ public static String toString(List<String> arguments, String separator, boolean quote) {
+ StringBuilder builder = new StringBuilder();
+ boolean first = true;
+ for (String arg : arguments) {
+ if (first)
+ first = false;
+ else
+ builder.append(separator);
+
+ // don't handle general shell metacharacters; they may actually be part of the command!
+ //if (quote && (SHELL_CHARACTERS_PATTERN.matcher(arg).matches() || arg.contains(separator))) {
+ if (quote && (arg.contains("\"") || arg.contains(separator)) && !arg.matches("'.*'") && !arg.matches("`.*`")) {
+ builder.append('"');
+ // this takes a regex, so we're really just taking \ -> \\ here
+ arg = arg.replaceAll("\\\\", "\\\\\\\\");
+ // again, regex multiplication: really replacing " with \"
+ builder.append(arg.replaceAll("\"", "\\\\\""));
+ builder.append('"');
+ } else {
+ builder.append(arg);
+ }
+ }
+ return builder.toString();
+ }
+
+ /** Add all the given arguments to the end of the arguments list. */
+ public static List<String> append(List<String> arguments, String[] args) {
+ for (String argument : args)
+ arguments.add(argument);
+ return arguments;
+ }
+
+ /** Escape a string for a quoting context */
+ public static String escape(String arg) {
+ return escape(arg, true);
+ }
+
+ /** Escape a string for a quoting context */
+ public static String escape(String arg, boolean singleQuoteToo) {
+ arg = arg.replaceAll("\\\\", "\\\\\\\\");
+ arg = arg.replaceAll("\"", "\\\\\"");
+ if (singleQuoteToo)
+ arg = arg.replaceAll("'", "\\\\'");
+ arg = arg.replaceAll("\\$", "\\\\\\\\\\\\\\$");
+ arg = arg.replaceAll("\\%", "\\\\%");
+ return arg;
+ }
+
+ /**
+ * Convert the given command line for invocation as a script, by
+ * inserting /bin/sh -c in front and packaging all the existing arguments
+ * into one quoted and escaped string.
+ * @param cmdLine script name and arguments
+ * @return new command line launching a shell
+ */
+ public static List<String> wrapScriptCommandLineForShell(List<String> cmdLine) {
+ String command = CommandLineArguments.toCommandLine(cmdLine);
+ List<String> scriptCmdLine = new ArrayList<String>();
+ scriptCmdLine.add(0, "/bin/sh");
+ scriptCmdLine.add(1, "-c");
+ scriptCmdLine.add(command);
+ return scriptCmdLine;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/EnvironmentProperties.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/EnvironmentProperties.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/EnvironmentProperties.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.process;
+
+import java.util.*;
+import java.util.Map.Entry;
+
+/**
+ * This class helps with converting environment arrays to and from properties.
+ * @author eswartz
+ *
+ */
+public class EnvironmentProperties {
+
+ /**
+ * Create a property map from an array of environment settings.
+ * The entries are in the form "name[=value]".
+ * @param envp array of strings or <code>null</code>
+ * @return environment properties, never <code>null</code>
+ */
+ public static Properties createFromEnvp(String[] envp) {
+ Properties env = new Properties();
+ if (envp == null)
+ return env;
+
+ for (String entry : envp) {
+ int idx = entry.indexOf('=');
+ if (idx < 0)
+ env.put(entry, "");
+ else
+ env.put(entry.substring(0, idx), entry.substring(idx+1));
+ }
+
+ return env;
+ }
+
+ /**
+ * Create a list of environment settings from a property map.
+ * @param env property map <code>null</code>
+ * @param sort if true, sort map by variable name
+ * @return list of environment settings in the form "FOO" or "BAR=value", never <code>null</code>
+ */
+ public static List<String> createEnvpList(Properties env, boolean sort) {
+ List<String> envp = new ArrayList<String>(env != null ? env.size() : 0);
+ if (env == null)
+ return envp;
+
+ List<Map.Entry> entries = new ArrayList<Map.Entry>(env.entrySet());
+ if (sort) {
+ Collections.sort(entries, new Comparator<Map.Entry>() {
+
+ public int compare(Entry arg0, Entry arg1) {
+ return arg0.getKey().toString().compareTo(arg1.getKey().toString());
+ }
+
+ });
+ }
+
+ for (Map.Entry entry : entries) {
+ String mapping;
+ Object value = entry.getValue();
+ if (value == null || value.toString().length() == 0)
+ mapping = entry.getKey().toString();
+ else
+ mapping = entry.getKey() + "=" + value;
+ envp.add(mapping);
+ }
+
+ return envp;
+ }
+
+ /**
+ * Create an array of environment settings from a property map.
+ * @param env property map <code>null</code>
+ * @param sort if true, sort map by variable name
+ * @return array of environment settings in the form "FOO" or "BAR=value", never <code>null</code>
+ */
+ public static String[] createEnvp(Properties env, boolean sort) {
+ List<String> envList = createEnvpList(env, sort);
+ return (String[]) envList.toArray(new String[envList.size()]);
+ }
+
+ /**
+ * Make a copy of an environment property block
+ * @param environment, may be <code>null</code>
+ * @return Properties or <code>null</code>
+ */
+ public static Properties copyProperties(Properties environment) {
+ if (environment == null)
+ return null;
+
+ Properties env = new Properties();
+ env.putAll(environment);
+ return env;
+ }
+
+ /** Create properties by copying the contents of an environment map.
+ *
+ * @param env map, may be <code>null</code>
+ * @return Properties or <code>null</code>
+ */
+ public static Properties createFromMap(Map<String, String> env) {
+ if (env == null)
+ return null;
+ Properties properties = new Properties();
+ properties.putAll(env);
+ return properties;
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/HostProcessLauncherFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/HostProcessLauncherFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/HostProcessLauncherFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.process;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.internal.api.core.BaseProcessLauncherFactory;
+import org.maemo.esbox.internal.api.core.HostProcessLauncher;
+
+import java.util.List;
+import java.util.Properties;
+
+/**
+ *
+ * @author eswartz
+ *
+ */
+public class HostProcessLauncherFactory extends BaseProcessLauncherFactory {
+
+ public HostProcessLauncherFactory() {
+ super(Platform.getOS().equals(Platform.OS_WIN32));
+ }
+
+ private Properties standardEnv;
+
+ @Override
+ protected Properties readStandardEnvironment() {
+ if (standardEnv == null) {
+ standardEnv = new Properties();
+ // This isn't valid. User variables likely are intended for scratchbox
+ // environments, not the host's.
+ standardEnv.putAll(System.getenv());
+ //mergeOrSetUserVariables(standardEnv, System.getenv());
+ }
+ return standardEnv;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncherFactory#createProcessLaunchHandler(org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath, org.maemo.esbox.core.sdk.List<String>, java.util.Properties)
+ */
+ protected IProcessLauncher doCreateProcessLaunchHandler(IPath workingDirectory,
+ List<String> cmdLine, Properties environment) {
+ return new HostProcessLauncher(workingDirectory, cmdLine,
+ environment != null ? environment : readStandardEnvironment());
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IProcessLauncher.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IProcessLauncher.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IProcessLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.process;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * This encapsulates the mechanics needed to launch a process in
+ * a given environment. This involves wrapping a command,
+ * converting/inserting environment variables, and verifying the
+ * target environment before launch. It may be used for either
+ * standalone or SDK-hosted launching.
+ * @author eswartz
+ * @see IProcessLauncherFactory#createProcessLaunchHandler
+ *
+ */
+public interface IProcessLauncher {
+ /** Get the command line arguments which will invoke the process from the host
+ * <p>
+ * (useful for testing)
+ * @return argument list, never <code>null</code> (may be modified before launch)
+ */
+ List<String> getLaunchCommandArguments();
+
+ /**
+ * Get the environment to set in the host before invoking the process. Note
+ * that environment variables may have been encoded in the launch command
+ * arguments.
+ * <p>
+ * @return environment, may be empty or <code>null</code> (may be modified before launch)
+ */
+ Properties getLaunchEnvironment();
+
+ /**
+ * Get the current working directory specified for the process.
+ * @return IPath or <code>null</code>
+ */
+ IPath getLaunchCurrentWorkingDirectory();
+
+ /**
+ * Tells the launcher to use a PTY.
+ * @param flag use PTY?
+ */
+ void usePTY(boolean flag);
+
+ /**
+ * Tells whether a PTY will be used.
+ * @return flag
+ */
+ boolean isUsePTY();
+
+ /**
+ * Create a process launching in the context of the SDK.
+ * @return new Process, running asynchronously
+ * @return a process which is running asynchronously, never <code>null</code>.
+ * @throws ScratchboxException
+ */
+ Process createProcess() throws ESboxException;
+
+ /**
+ * Wait for the process to complete, reading its output and error streams,
+ * and returning its exit code. This call is not valid until {@link #createProcess()} is
+ * invoked.
+ * @param out stdout stream destination
+ * @param err stderr stream destination
+ * @see CommandLauncher#waitAndRead(OutputStream, OutputStream)
+ */
+ int waitAndRead(OutputStream out, OutputStream err);
+
+ /**
+ * Wait for the process to complete, reading its output and error streams,
+ * and returning its exit code. This call is not valid until {@link #createProcess()} is
+ * invoked.
+ * @param out stdout stream destination
+ * @param err stderr stream destination
+ * @param showCommand if true, show the invoked command in the output stream
+ * @see CommandLauncher#waitAndRead(OutputStream, OutputStream)
+ */
+ int waitAndRead(OutputStream out, OutputStream err, boolean showCommand);
+
+ /**
+ * Wait for the process to complete, reading its output and error streams,
+ * and returning its exit code. Use a progress monitor to allow cancellation.
+ * This call is not valid until {@link #createProcess()} is
+ * invoked.
+ * @param out stdout stream destination
+ * @param err stderr stream destination
+ * @param monitor the progress monitor, or <code>null</code>
+ * @see CommandLauncher#waitAndRead(OutputStream, OutputStream, IProgressMonitor)
+ */
+ int waitAndRead(OutputStream output, OutputStream err, IProgressMonitor monitor);
+
+ /**
+ * Wait for the process to complete, reading its output and error streams,
+ * and returning its exit code. Use a progress monitor to allow cancellation.
+ * This call is not valid until {@link #createProcess()} is
+ * invoked.
+ * @param out stdout stream destination
+ * @param err stderr stream destination
+ * @param monitor the progress monitor, or <code>null</code>
+ * @param showCommand if true, show the invoked command in the output stream
+ * @see CommandLauncher#waitAndRead(OutputStream, OutputStream, IProgressMonitor)
+ */
+ int waitAndRead(OutputStream output, OutputStream err, IProgressMonitor monitor, boolean showCommand);
+
+ /**
+ * Connect the process streams to a console.<p>
+ * NOTE: By doing this, the Process's
+ * stdout and stderr streams are consumed and cannot be used again.
+ * @param console the console to use. If it's <code>null</code>, the method does nothing.
+ * @return the console
+ */
+ MessageConsole redirectToConsole(MessageConsole console);
+
+ /**
+ * Connect the process streams to a console.<p>
+ * NOTE: By doing this, the Process's
+ * stdout and stderr streams are consumed and cannot be used again.
+ * @param console the console to use. If it's <code>null</code>, the method does nothing.
+ * @param monitor a monitor which is passed each line from the streams
+ * @return the console
+ */
+ MessageConsole redirectToConsole(MessageConsole console, IStreamLineMonitor monitor);
+
+
+ /**
+ * Connect the process streams to a console.<p>
+ * NOTE: By doing this, the Process's
+ * stdout and stderr streams are consumed and cannot be used again.
+ * @param brandNew if true, create a new console even if this one already exists
+ * @param sdkTarget if brandNew == <code>true</code> the target to use to decorate the console
+ * @param consoleName name of the console (may <b>not</b> be null)
+ * @return the created or existing console
+ */
+ MessageConsole redirectToConsole(boolean brandNew, ISDKTarget sdkTarget, String consoleName);
+
+ /**
+ * Connect the process streams to a console and examine the output as
+ * it's emitted.<p>
+ * The monitor is the only way to read the output of the process;
+ * do not use the streams from the Process.
+ * @param brandNew if true, create a new console even if this one already exists
+ * @param sdkTarget if brandNew == <code>true</code> the target to use to decorate the console
+ * @param consoleName name of the console (may <b>not</b> be null)
+ * @param monitor a monitor which is passed each line from the streams
+ * @return the created or existing console
+ */
+ MessageConsole redirectToConsole(boolean brandNew, ISDKTarget sdkTarget,
+ String consoleName, IStreamLineMonitor monitor);
+
+
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IProcessLauncherFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IProcessLauncherFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IProcessLauncherFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.process;
+
+import org.eclipse.core.runtime.IPath;
+
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * This interface creates process launcher, wrapping the logic needed to launch
+ * a process in a given context. It handles converting paths, wrapping
+ * command lines, and doing any other necessary things to make it work without
+ * exposing launch eccentricities to clients.
+ *
+ * @author eswartz
+ *
+ */
+public interface IProcessLauncherFactory {
+ /**
+ * Get a copy of the standard environment for launching processes. This is implicitly used
+ * when a process is launched passing a <code>null</code> environment.
+ * <p>
+ * Changes are not reflected in the standard environment. You may pass a modified version to
+ * to {@link #createProcessLaunchHandler(IPath, List, Properties)}.
+ * <p>
+ * This environment may contain ESbox Scratchbox environment overrides
+ * @return the environment block, may be empty if unknown (launching on remote target)
+ */
+ Properties getStandardEnvironment();
+
+ /**
+ * Create a process launch handler for the given command whose input and output
+ * are handled through the given PTY.
+ * @param workingDirectory the current working directory relative to the launch environment; may be null
+ * @param commandLine executable and arguments; for the executable, bare filename implies program on $PATH,
+ * relative path with "./", etc., implies a script in the working directory,
+ * and a full path is an absolute path in the launch environment
+ * @param environment the environment to pass (null to use the standard environment, else override the
+ * environment)
+ * @return a new process launch handler
+ */
+ IProcessLauncher createProcessLaunchHandler(
+ IPath workingDirectory,
+ List<String> commandLine,
+ Properties environment);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IStreamLineMonitor.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IStreamLineMonitor.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/IStreamLineMonitor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.process;
+
+import org.eclipse.core.resources.IProject;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * This interface is implemented for uses of
+ * {@link IProcessLauncher#redirectToConsole(IProject, ISDKTarget, String, IStreamLineMonitor)}
+ * {@link IProcessLauncher#redirectToConsole(IConsole, IStreamLineMonitor)}
+ * to examine output which is piped to a console
+ * @author eswartz
+ *
+ */
+public interface IStreamLineMonitor {
+ /**
+ * Handle a line of output
+ * @param line the line, without newlines
+ * @param errorStream if true, line came from stderr, else from stdout
+ */
+ void handleLine(String line, boolean errorStream);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherCreator.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherCreator.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherCreator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.process;
+
+import org.eclipse.core.runtime.IPath;
+
+import java.util.*;
+
+/**
+ * Utility class for creating various kinds of IProcessLaunchers with
+ * different amounts of information.
+ * <p>
+ * NOTE: these all create processes, e.g. executables. If you suspect that
+ * the host may not be able to execute a script directly, either due to incorrect
+ * execute permissions on the script or the filesystem, then wrap the
+ * command line if needed (see {@link CommandLineArguments#wrapScriptCommandLineForShell(List)})
+ * @author eswartz
+ *
+ */
+public abstract class ProcessLauncherCreator {
+
+ /**
+ * Create a process launch handler for the given command whose input and output
+ * are handled through the given PTY.
+ * @param processLauncherFactory the factory
+ * @param workingDirectory the current working directory relative to the launch environment; may be null
+ * @param commandLine executable and arguments; for the executable, bare filename implies program on $PATH,
+ * relative path with "./", etc., implies a script in the working directory,
+ * and a full path is an absolute path in the launch environment
+ * @param environment the environment to pass (null to use the standard environment, else override the
+ * environment)
+ * @param usePTY whether to use a PTY (if available)
+ * @return a new process launch handler
+ */
+ public static IProcessLauncher createProcessLauncher(
+ IProcessLauncherFactory processLauncherFactory,
+ IPath workingDirectory, List<String> commandLine,
+ Properties environment, boolean usePTY) {
+ IProcessLauncher launcher = processLauncherFactory.createProcessLaunchHandler(
+ workingDirectory, commandLine, environment);
+ launcher.usePTY(usePTY);
+ return launcher;
+ }
+
+ /**
+ * Create a process launch handler for the given command.
+ * @param processLauncherFactory the factory
+ * @param workingDirectory the current working directory relative to the launch environment; may be null
+ * @param commandLine executable and arguments; for the executable, bare filename implies program on $PATH,
+ * relative path with "./", etc., implies a script in the working directory,
+ * and a full path is an absolute path in the launch environment
+ * @param environment the environment to pass (null to use the standard environment, else override the
+ * environment)
+ * @return a new process launch handler
+ */
+ public static IProcessLauncher createProcessLauncher(
+ IProcessLauncherFactory processLauncherFactory,
+ IPath workingDirectory, List<String> commandLine,
+ Properties environment) {
+ return processLauncherFactory.createProcessLaunchHandler(
+ workingDirectory, commandLine, environment);
+ }
+
+ /**
+ * Create a process launch handler for the given command.
+ * @param processLauncherFactory the factory
+ * @param workingDirectory the current working directory relative to the launch environment; may be null
+ * @param commandLine executable and arguments; for the executable, bare filename implies program on $PATH,
+ * relative path with "./", etc., implies a script in the working directory,
+ * and a full path is an absolute path in the launch environment
+ * @return a new process launch handler
+ */
+ public static IProcessLauncher createProcessLauncher(
+ IProcessLauncherFactory processLauncherFactory,
+ IPath workingDirectory, List<String> commandLine) {
+ return processLauncherFactory.createProcessLaunchHandler(
+ workingDirectory,
+ commandLine,
+ null);
+ }
+
+ /**
+ * Create a process launch handler for the given command.
+ * @param processLauncherFactory the factory
+ * @param workingDirectory the current working directory relative to the launch environment; may be null
+ * @param executable the program to launch: bare filename implies program on $PATH,
+ * relative path with "./", etc., implies a script in the working directory,
+ * and a full path is an absolute path in the launch environment
+ * @param args the arguments to pass to the program, may be null
+ * @param environment the environment to pass (null to use the standard environment, else override the
+ * environment)
+ * @return a new process launch handler
+ */
+ public static IProcessLauncher createProcessLauncher(
+ IProcessLauncherFactory processLauncherFactory,
+ IPath workingDirectory, String executable, List<String> args,
+ Properties environment) {
+ List<String> cmdLine;
+ if (args != null)
+ cmdLine = new ArrayList<String>(args);
+ else
+ cmdLine = new ArrayList<String>();
+ cmdLine.add(0, executable);
+ return processLauncherFactory.createProcessLaunchHandler(
+ workingDirectory, cmdLine, environment);
+ }
+
+ /**
+ * Create a process launch handler for the given command with
+ * the standard environment from this launcher.
+ * @param processLauncherFactory the factory
+ * @param workingDirectory the current working directory relative to the launch environment; may be null
+ * @param executable the program to launch: bare filename implies program on $PATH,
+ * relative path with "./", etc., implies a script in the working directory,
+ * and a full path is an absolute path in the launch environment
+ * @param args the arguments to pass to the program, may be null
+ * @return a new process launch handler
+ */
+ public static IProcessLauncher createProcessLauncher(
+ IProcessLauncherFactory processLauncherFactory,
+ IPath workingDirectory, String executable, List<String> args) {
+ List<String> cmdLine;
+ if (args != null)
+ cmdLine = new ArrayList<String>(args);
+ else
+ cmdLine = new ArrayList<String>();
+ cmdLine.add(0, executable);
+ return processLauncherFactory.createProcessLaunchHandler(
+ workingDirectory, cmdLine, null);
+ }
+
+ /**
+ * Create a process launch handler for the given command line
+ * with the standard environment from this launcher.
+ * <p>
+ * <b>Do not</b> use this if you are constructing a command line
+ * from scratch. Use {@link #createProcessLaunchHandler(IPath, IPath, List<String>)}
+ * instead.
+ * @param processLauncherFactory the factory
+ * @param workingDirectory the current working directory relative to the launch environment; may be null
+ * @param commandLine a string formatted for shell invocation
+ * (e.g. space-containing arguments or shell metacharacters quoted or escaped)
+ * @return a new process launch handler
+ * @see CommandLineArguments
+ */
+ public static IProcessLauncher createProcessLauncher(
+ IProcessLauncherFactory processLauncherFactory,
+ IPath workingDirectory, String commandLine) {
+ return processLauncherFactory.createProcessLaunchHandler(
+ workingDirectory,
+ CommandLineArguments.createFromCommandLine(commandLine),
+ null);
+ }
+
+ /**
+ * Create a process launch handler for the given command line
+ * with the standard environment from this launcher, running
+ * in an unspecified directory.
+ * <p>
+ * <b>Do not</b> use this if you are constructing a command line
+ * from scratch. Use {@link #createProcessLaunchHandler(IPath, IPath, List<String>)}
+ * instead.
+ * @param processLauncherFactory the factory
+ * @param commandLine a string formatted for shell invocation
+ * (e.g. space-containing arguments or shell metacharacters quoted or escaped)
+ * @return a new process launch handler
+ * @see CommandLineArguments
+ */
+ public static IProcessLauncher createProcessLauncher(
+ IProcessLauncherFactory processLauncherFactory, String commandLine) {
+ return processLauncherFactory.createProcessLaunchHandler(
+ null,
+ CommandLineArguments.createFromCommandLine(commandLine),
+ null);
+ }
+
+ /**
+ * Create a process launcher with the given {@link ProcessLauncherParameters} object.
+ * <p>
+ * @param processLauncherFactory the factory
+ * @param ProcessLauncherParameters
+ * @return a new process launcher
+ */
+ public static IProcessLauncher createProcessLauncher(
+ IProcessLauncherFactory processLauncherFactory,
+ ProcessLauncherParameters pars) {
+ return processLauncherFactory.createProcessLaunchHandler(
+ pars.getCwd(),
+ pars.getCommandLine(),
+ pars.getEnvVars());
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherParameters.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherParameters.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherParameters.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT. Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.core.process;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import java.util.*;
+
+/**
+ * Record all parameters related to launching a process.
+ * This allows easy transferring of launch parameters and easy changing of the
+ * parameters on the fly (when needed) before launching the process.
+ */
+public class ProcessLauncherParameters {
+
+ /** command line (e.g. "oprofile", "mytool" or just "program args" ) */
+ private List<String> cmdLine;
+
+ /** new environment variables, or null if nothing needed */
+ private Properties envVars;
+
+ /** current directory to go to (host-relative, e.g. project path) */
+ private IPath cwd;
+
+ public ProcessLauncherParameters(IPath workingDir, List<String> cmdArgs, Properties env) {
+ cmdLine = cmdArgs;
+ envVars = env;
+ cwd = workingDir;
+ }
+
+ public ProcessLauncherParameters() {
+ setCommandLine(new ArrayList<String>());
+ setEnvVars(new Properties());
+ setCwd(new Path("."));
+ }
+
+ // ********* Get commands *********
+
+ public List<String> getCommandLine() {
+ return cmdLine;
+ }
+
+ public Properties getEnvVars() {
+ return envVars;
+ }
+
+ public IPath getCwd() {
+ return cwd;
+ }
+
+
+ // ********* Set commands *********
+
+ public void setCommandLine(List<String> cmdLine) {
+ this.cmdLine = cmdLine;
+ }
+
+ public void setEnvVars(Properties envVars) {
+ this.envVars = envVars;
+ }
+
+ public void setCwd(IPath cwd) {
+ this.cwd = cwd;
+ }
+
+ }
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherUtils.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherUtils.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessLauncherUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.process;
+
+import org.eclipse.core.net.proxy.IProxyData;
+import org.eclipse.core.net.proxy.IProxyService;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.core.ESboxException;
+
+import java.io.ByteArrayOutputStream;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * Utilities for process launching.
+ * @author eswartz
+ *
+ */
+public abstract class ProcessLauncherUtils {
+ private static final String LINE_ENDING_PATTERN_STRING = "(\r\n|\r|\n)";
+ private static final String NO_PROXY = "no_proxy"; //$NON-NLS-1$
+
+ private static final String HTTP_PROXY = "http_proxy"; //$NON-NLS-1$
+
+
+ public static class Results {
+ public int exitCode;
+ public String stdout;
+ public String stderr;
+ public Results(int exit, String stdout, String stderr) {
+ this.exitCode = exit;
+ this.stdout = stdout;
+ this.stderr = stderr;
+ }
+
+ public String[] getStdoutLines() {
+ return stdout.split(LINE_ENDING_PATTERN_STRING);
+ }
+ public String[] getStderrLines() {
+ return stderr.split(LINE_ENDING_PATTERN_STRING);
+ }
+ }
+
+ /**
+ * Create and launch a process, read its streams into memory, and wait for it to finish.
+ * Optionally mirror results in a console.
+ * @param processLauncherFactory factory for creating processes
+ * @param monitor optional progress monitor, allowing cancellation
+ * @param cwd the directory to run from, or <code>null</code>
+ * @param cmdLine the command line, may not be <code>null</code>
+ * @param env environment to set, or <code>null</code> for default
+ * @return results of process launch (if launch succeeded)
+ * @throws ESboxException if launch failed
+ */
+ public static Results launchAndReadStandardStreams(IProcessLauncherFactory processLauncherFactory,
+ IProgressMonitor monitor,
+ IPath cwd,
+ List<String> cmdLine,
+ Properties env) throws ESboxException {
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ processLauncherFactory,
+ cwd,
+ cmdLine,
+ env);
+
+ try {
+ processLauncher.createProcess();
+ } catch (Exception e) {
+ throw new ESboxException("Failed to launch: " + CommandLineArguments.toCommandLine(cmdLine), e);
+ }
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+
+ int exit = processLauncher.waitAndRead(out, err, monitor);
+
+ return new Results(exit, out.toString(), err.toString());
+ }
+
+ /**
+ * Create and launch a process, read its streams into memory, and wait for it to finish.
+ * @param processLauncherFactory factory for creating processes
+ * @param cmdLine the command line, may not be <code>null</code>
+ * @return results of process launch (if launch succeeded)
+ * @throws ESboxException if launch failed
+ */
+ public static Results launchAndReadStandardStreams(IProcessLauncherFactory processLauncherFactory,
+ List<String> cmdLine) throws ESboxException {
+ return launchAndReadStandardStreams(processLauncherFactory, null, null, cmdLine, null);
+ }
+
+ /**
+ * Add the http_proxy and no_proxy variables to an environment block, if necessary.
+ * Use this when a command is known to need network access.
+ * @param env incoming environment, or <code>null</code>
+ * @return updated environment (possibly same as 'env' if not <code>null</code>), or <code>null</code> if
+ * env was <code>null</code> and no changes were made
+ */
+ @SuppressWarnings("restriction")
+ public static Properties defineProxyVariables(Properties env) {
+ // wow, completely internal information!
+ IProxyService proxyService = org.eclipse.ui.internal.net.Activator.getDefault().getProxyService();
+ if (proxyService != null && proxyService.isProxiesEnabled()) {
+ String[] noProxies = proxyService.getNonProxiedHosts();
+ IProxyData data = proxyService.getProxyData(IProxyData.HTTP_PROXY_TYPE);
+ if (data != null) {
+ StringBuilder noProxy = new StringBuilder();
+ boolean first = true;
+ for (String noP : noProxies) {
+ if (first)
+ first = false;
+ else
+ noProxy.append(',');
+ noProxy.append(noP);
+ }
+ String address = data.getHost();
+ int port = data.getPort();
+
+ String url = "http://" + address + ":" + port;
+ if (env == null)
+ env = new Properties();
+ env.put(HTTP_PROXY, url);
+ if (noProxy != null) {
+ env.put(NO_PROXY, noProxy.toString());
+ }
+ }
+ } else {
+ // proxy not enabled, but let's leave any http_proxy variable in
+ // place in the environment, in case user manually defined it
+ //env.put(HTTP_PROXY, "");
+ }
+ return env;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessRunnerCreator.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessRunnerCreator.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessRunnerCreator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.process;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class ProcessRunnerCreator {
+
+ /**
+ * Create a process with the given ProcessLauncherParameters, and launch the
+ * process under the SDK environment.
+ * <p>
+ * Handle sending its output to a console if directed by the
+ * ProcessLauncherParameters. The process is left running asynchronously.
+ *
+ * @param processLauncherFactory
+ * the factory which creates an IProcessLauncher
+ * @param sdkTarget
+ * the target to run under, for console reporting
+ * @param parameters launch parameters; may be {@link ProcessRunnerParameters}
+ * @return running Process
+ * @throws ESboxException
+ * if something failed
+ */
+ public static Process createAndLaunchProcess(
+ IProcessLauncherFactory processLauncherFactory,
+ ISDKTarget sdkTarget,
+ ProcessLauncherParameters parameters) throws ESboxException {
+ IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(
+ processLauncherFactory, parameters);
+ launcher.usePTY(true);
+ Process process = launcher.createProcess();
+
+ if (parameters instanceof ProcessRunnerParameters) {
+ ProcessRunnerParameters runnerParameters = (ProcessRunnerParameters) parameters;
+ if (runnerParameters.isSendToConsole()) {
+ // print all output to console
+ new StreamMonitor(process.getInputStream(), sdkTarget,
+ runnerParameters.isBrandNew(), runnerParameters.getConsoleName(), process);
+ // print all errors to console
+ new StreamMonitor(process.getErrorStream(), sdkTarget,
+ runnerParameters.isBrandNew(), runnerParameters.getConsoleName(), null);
+ }
+ }
+
+ return process;
+ }
+
+ /**
+ * Create a process with the given ProcessLauncherParameters, and launch the
+ * process under the SDK environment.
+ * <p>
+ * Handle sending its output to a console if directed by the
+ * ProcessLauncherParameters. The process is left running asynchronously.
+ *
+ * @param sdkTarget
+ * the target to run under
+ * @param parameters parameters launch parameters; may be {@link ProcessRunnerParameters}
+ * @return running Process
+ * @throws ESboxException
+ * if something failed
+ */
+ public static Process createAndLaunchProcess(
+ ISDKTarget sdkTarget,
+ ProcessLauncherParameters parameters) throws ESboxException {
+ return createAndLaunchProcess(sdkTarget.getProcessLauncherFactory(), sdkTarget, parameters);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessRunnerParameters.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessRunnerParameters.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ProcessRunnerParameters.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (INdT) - initial API and implementation
+ * Ed Swartz (Nokia) - refactoring
+ * Ling Wang (Nokia) - refactoring
+ *******************************************************************************/
+
+package org.maemo.esbox.core.process;
+
+import org.eclipse.core.runtime.IPath;
+
+import java.util.List;
+import java.util.Properties;
+
+
+/**
+ * This extends the parameters passed for a process launch with the
+ * behavior desired for the process itself.
+ */
+public class ProcessRunnerParameters extends ProcessLauncherParameters {
+ /** if true, send output to the console */
+ private boolean sendToConsole = false;
+
+ /** if sendToConsole==true, then this is the console name */
+ private String consoleName = null;
+
+ /** if sendToConsole==true, then create a new console */
+ private boolean brandNew = false;
+
+ public ProcessRunnerParameters(IPath wdInSb, List<String> cmdLine,
+ Properties env) {
+ super(wdInSb, cmdLine, env);
+ }
+
+ public ProcessRunnerParameters() {
+ super();
+ }
+
+
+
+ public boolean isSendToConsole() {
+ return sendToConsole;
+ }
+
+ public String getConsoleName() {
+ return consoleName;
+ }
+
+ public boolean isBrandNew() {
+ return brandNew;
+ }
+
+ public void setSendToConsole(boolean sendToConsole) {
+ this.sendToConsole = sendToConsole;
+ }
+
+ public void setConsoleName(String consoleName) {
+ this.consoleName = consoleName;
+ }
+
+ public void setBrandNew(boolean brandNew) {
+ this.brandNew = brandNew;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ShellTemplateSubstitutor.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ShellTemplateSubstitutor.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/ShellTemplateSubstitutor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.process;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+
+
+/**
+ * This will handle substituting a map of variables into a string,
+ * handling quote-escaping variables at deeper levels of quoting.
+ * <p>
+ * e.g.: /scratchbox/login -d ${DIR} -c "./run.sh ${{COMMAND}} \"${{{ARGS}}}\""
+ * <p>
+ * This substitutes ${DIR} by identity, ${{COMMAND}} with one level
+ * of escaping, and ${{{ARGS}}} with two levels of escaping.
+ * <p>
+ * We do this rather than implementing a full shell parser, but it
+ * assumes the client (or user, if he can edit this command string)
+ * to understand this convention.
+ * @author eswartz
+ *
+ */
+public class ShellTemplateSubstitutor {
+
+ private Map<String, String> variables;
+
+ public ShellTemplateSubstitutor() {
+ variables = new HashMap<String, String>();
+ }
+
+ /** Define a variable.
+ * @param key the name to search in the source (no ${...})
+ * @param value the value to replace; <code>null</code> is the same as "" */
+ public void define(String key, String value) {
+ if (key == null)
+ throw new IllegalArgumentException();
+
+ variables.put(key, value != null ? value : "");
+ }
+
+ /** Substitute the variables in the template, at the
+ * various levels of escaping.
+ * @param template
+ * @return expanded string
+ */
+ public String substitute(String template) {
+ // replace vars like ${DIRECTORY} with initial values
+ StringBuilder open = new StringBuilder("${");
+ StringBuilder close = new StringBuilder("}");
+ int escapeLevel = 0;
+
+ // this escapeLevel check is an escape hatch for the case where a template
+ // specifies missing variables, without entering an infinite loop or wasting
+ // time scanning after every pass for lingering unexpanded variables.
+ while (escapeLevel < 8) {
+ // replace the first round
+ for (Map.Entry<String, String> entry : variables.entrySet()) {
+ String keyPattern = open + entry.getKey() + close;
+
+ // note: we use #replace and not #replaceAll since that has unwanted
+ // effects on the replacement string
+ do {
+ String updated = template.replace(keyPattern, entry.getValue());
+ if (updated.equals(template))
+ break;
+ template = updated;
+ } while (true);
+ }
+ // if we still have escapes, then further escape all the variables and
+ // look for the next level of nesting ${{ARGS}}, etc.
+ if (template.contains("${")) {
+ for (Map.Entry<String, String> entry : variables.entrySet()) {
+ entry.setValue(CommandLineArguments.escape(entry.getValue()));
+ }
+ open.append('{');
+ close.append('}');
+ escapeLevel++;
+ } else {
+ break;
+ }
+ }
+
+ return template;
+
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/StreamMonitor.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/StreamMonitor.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/process/StreamMonitor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.core.process;
+
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxMessageConsole;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+import java.io.*;
+
+/**
+ * This class implements an stream monitor, which observes an input stream
+ * and prints the lines from the stream to a message console.
+ */
+public class StreamMonitor implements Runnable {
+
+ // stream to monitor.
+ private InputStream input;
+
+ private String consoleName;
+
+ // byte array for readin data
+ private byte[] buffer;
+
+ private boolean isStdErr;
+
+ private IStreamLineMonitor monitor;
+
+ private MessageConsole console;
+
+ private Process process;
+
+
+ /**
+ * Constructor.
+ * @param stream the input stream to be monitored.
+ * @param brandNew true, if the message console must be new; false, otherwise.
+ * @param name the name of the message console.
+ * @param process the process to watch, or <code>null</code>
+ */
+ public StreamMonitor(InputStream stream, MessageConsole console,
+ boolean isStdErr,
+ IStreamLineMonitor monitor, Process process) {
+ this.consoleName = console.getName();
+ this.console = console;
+
+ init(stream, console, isStdErr, monitor, process);
+ }
+
+ /**
+ * Constructor.
+ * @param stream the input stream to be monitored.
+ * @param sdkTarget TODO
+ * @param brandNew true, if the message console must be new; false, otherwise.
+ * @param name the name of the message console.
+ * @param process the process to watch, or <code>null</code>
+ */
+ public StreamMonitor(InputStream stream, ISDKTarget sdkTarget, boolean brandNew, String name, Process process) {
+ // console stream
+ this.consoleName = name;
+ this.console = CorePlugin.getDefault().getConsole(brandNew, sdkTarget, consoleName);
+
+ init(stream, console, false, null, process);
+ }
+
+ private void init(InputStream stream, MessageConsole console,
+ boolean isStdErr, IStreamLineMonitor monitor, Process process) {
+ this.input = new BufferedInputStream(stream);
+ this.isStdErr = isStdErr;
+ this.monitor = monitor;
+ this.process = process;
+
+ // call function run()
+ new Thread(this).start();
+ }
+
+ /**
+ * Create a message console from the constructor parameters and
+ * print ever data from the input stream in message console.
+ */
+ public void run() {
+ try {
+ buffer = new byte[1000];
+
+ // print input strem to console
+ int len;
+ while ((len = input.read(buffer)) >= 0) {
+
+ String line = new String(buffer, 0, len);
+
+ if (monitor != null) {
+ // split into lines
+
+ // TODO: this assumes lines are emitted all in one chunk;
+ // may need extra buffering or handling if not
+ String[] lines = line.split("(\r\n|\r|\n)");
+ for (String aLine : lines) {
+ monitor.handleLine(aLine, isStdErr);
+ }
+ }
+
+ printToConsole(line);
+ }
+ } catch (IOException e) {
+ // either from reading the input or writing to the console
+ } finally {
+ try {
+ // close streams
+ input.close();
+ } catch (IOException e2) {
+ }
+ // Should allow clean exit when process shuts down
+ }
+
+ // TODO: better encapsulate this logic instead of passing a process here
+ if (process != null) {
+ try {
+ process.waitFor();
+ if (console instanceof ESboxMessageConsole) {
+ synchronized (console) {
+ String name = console.getName();
+ String prefix = "<terminated> ";
+ if (!name.startsWith(prefix)) {
+ ((ESboxMessageConsole) console).updateName(prefix + name);
+ }
+ }
+ }
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+
+ /**
+ * @param line
+ */
+ private void printToConsole(String line) {
+ // Make sure the console is displayed (in case the console view is closed).
+ console.activate();
+ // print to given console, always making a new message stream, because
+ // the console view itself can close this stream at any time it wants
+ console.newMessageStream().print(line);
+ }
+
+ public MessageConsole getConsole() {
+ return console;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/IPreferenceProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/IPreferenceProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/IPreferenceProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.sdk;
+
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+
+/**
+ * This interface abstracts the way preferences are accessed.
+ * @author eswartz
+ *
+ */
+public interface IPreferenceProvider {
+ /**
+ * Get a preference value. The key is searched in the global
+ * scope of preferences. The variable value is returned with
+ * all ${...} variables substituted.
+ * @param key the key to look up
+ * @return setting for preference, never <code>null</code>
+ */
+ String getPreferenceValue(ESboxPreferenceConstants key);
+}
+
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDK.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDK.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDK.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.sdk;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+
+
+/**
+ * This interface encapsulates access to an ESbox-supported SDK.
+ * <p>
+ * This abstracts access to the way the filesystem in a host and
+ * an SDK may interact.
+ * <p>
+ * This interface now implements the IAdaptable interface. See org.maemo.esbox.*.adapters packages
+ * for testable adapters.
+ * @author eswartz
+ *
+ */
+public interface ISDK extends IPreferenceProvider, IAdaptable {
+ /**
+ * Get the root of the SDK, which may host multiple targets.
+ *
+ * @return a full filesystem path, never null
+ */
+ IPath getSDKRoot();
+
+ /**
+ * Get the name of the SDK, used to identify it
+ * @return a String naming the SDK
+ */
+ String getName();
+
+ /**
+ * Get the name of the SDK for display
+ * @return a String naming the SDK for human readable labels
+ */
+ String getDisplayName();
+
+ /**
+ * Get the version of the SDK being targeted
+ * @return a String naming the target version
+ */
+ String getVersion();
+
+ /**
+ * Get the known targets for the SDK.
+ * @return array, never <code>null</code>
+ */
+ ISDKTarget[] getSDKTargets();
+
+ /**
+ * Get the array of target names for the SDK.
+ * @return array, never <code>null</code>
+ */
+ String[] getSDKTargetNames();
+
+ /**
+ * Find an SDK target with the given name
+ * @param name target name
+ * @return ISDK or <code>null</code>
+ */
+ ISDKTarget findSDKTarget(String name);
+
+ /**
+ * Refresh the SDK when we think or know it has changed.
+ * Updates the ISDKTarget list. Any existing handles to these
+ * become invalid.
+ */
+ void refresh();
+
+ /**
+ * Get the factory for creating process launchers to
+ * run programs in the context of the SDK's host.
+ * @return the process launcher factory for programs outside the SDK
+ */
+ IProcessLauncherFactory getMachineProcessLauncherFactory();
+
+ /**
+ * Get the machine hosting this SDK
+ * @return IMachine
+ */
+ IMachine getMachine();
+
+ /**
+ * Get the machine's file system access
+ * @return IFileSystemAccess, never <code>null</code>
+ */
+ IFileSystemAccess getMachineFileSystemAccess();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKPlatform.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKPlatform.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKPlatform.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.sdk;
+
+/**
+ * Get the platorm for the SDK. This roughly translates to a version
+ * of an SDK, like Gregale, Bora, Chinook.<p>
+ * (Unlike previous ESbox releases, this is NOT the processor architecture.)
+ * @author eswartz
+ *
+ */
+public interface ISDKPlatform {
+ static String NAME_UNKNOWN = "unknown";
+ static String VERSION_UNKNOWN = "0.0";
+
+ /**
+ * Get the platform name.
+ * @return String
+ */
+ String getName();
+
+ /**
+ * Get the platform version.
+ * @return String
+ */
+ String getVersion();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.sdk;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.util.List;
+
+/**
+ * Implementors of the extension point "sdk_provider" must implement
+ * this interface.
+ * @author eswartz
+ *
+ */
+public interface ISDKProvider {
+ public static String SDK_PROVIDER_EXTENSION_ID = Activator.PLUGIN_ID + ".sdk_provider";
+
+ /**
+ * Get the SDKs for this provider.
+ * @return list of SDKs, never <code>null</code>
+ */
+ List<ISDK> createSDKs() throws ESboxException;
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKTarget.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKTarget.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/ISDKTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.sdk;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.core.machine.IFileSystemMapping;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+
+
+/**
+ * This interface encapsulates access to a particular target
+ * in an ESbox-supported SDK. It is usually associated with a build
+ * machine but may also exist to represent the "host" target on
+ * a given machine.
+ * <p>
+ * This abstracts access to the way the filesystem in a host and
+ * an SDK may interact and the way processes are launched under
+ * the SDK.
+ * <p>
+ * In this interface, "host" refers to the machine running Eclipse.
+ * <p>
+ * This interface now implements the IAdaptable interface. See org.maemo.esbox.*.adapters packages
+ * for testable adapters.
+ * @author eswartz
+ *
+ */
+public interface ISDKTarget extends Comparable<ISDKTarget>, IPreferenceProvider, IAdaptable {
+ /**
+ * Get the owning SDK.
+ * @return ISDK, never <code>null</code>
+ */
+ ISDK getSDK();
+
+ /**
+ * Get the root of the SDK, which may host multiple targets.
+ *
+ * @return a full filesystem path, never <code>null</code>
+ * @see ISDK#getSDKRoot()
+ */
+ IPath getSDKRoot();
+
+ /**
+ * Get the root of the SDK target, inside the SDK. This does not
+ * necessarily correspond to the way host and target paths are
+ * converted.
+ * @see #getName()
+ * @return a full filesystem path, never <code>null</code>
+ */
+ IPath getSDKTargetRoot();
+
+ /**
+ * Get the displayable name of the target, incorporating the name,
+ * platform, and version.
+ * @return String
+ */
+ String getDisplayName();
+
+ /**
+ * Get the installed target name (maybe not human-readable)
+ * @return the target name
+ */
+ String getName();
+
+ /**
+ * Get the platform for the target (i.e. different variants
+ * of maemo).
+ * @return ISDKPlatform
+ */
+ ISDKPlatform getPlatform();
+
+ /**
+ * Get the architecture for the target.
+ * @return String
+ */
+ String getArchitecture();
+
+ /**
+ * Convert a full filesystem path on the local host to a SDK target relative path
+ * on the SDK machine.
+ * <p>
+ * Note: there's no guarantee that {@link #convertTargetToHostPath(IPath)} and this
+ * method's results are one-to-one.
+ * @param hostPath an absolute path
+ * @return a new IPath, never <code>null</code>
+ * @throws ESboxException if path is not visible inside SDK
+ */
+ IPath convertHostToTargetPath(IPath hostPath) throws ESboxException;
+
+ /**
+ * Convert an SDK target relative path on the SDK machine to a full filesystem path
+ * on the local host.
+ * <p>
+ * This will attempt to find a path which is a likely match, seeing
+ * if that exists, and then perform an exhaustive search if that check fails.
+ * <p>
+ * Note: there's no guarantee that {@link #convertHostToTargetPath(IPath)} and this
+ * method's results are one-to-one.
+ * @param sdkPath an absolute path
+ * @return a new IPath, never <code>null</code>
+ * @throws ESboxException if errors occurred trying to resolve the path
+ * @see #convertTargetToHostPath(IPath, boolean)
+ */
+ IPath convertTargetToHostPath(IPath sdkPath) throws ESboxException;
+
+ /**
+ * Convert an SDK target relative path on the SDK machine to a full filesystem path
+ * on the local host.
+ * <p>
+ * This may be an expensive operation if 'forceLookup' is true or the
+ * nominal file constructed by appending the path to the SDK target root
+ * doesn't exist, where a more exhaustive search -- usually involving
+ * launching a process -- will determine how the path really maps.
+ * <p>
+ * Note: there's no guarantee that {@link #convertHostToTargetPath(IPath)} and this
+ * method's results are one-to-one.
+ * @param sdkPath an absolute path
+ * @param forceResolve if true, always do the exhaustive search, ignoring any
+ * nominal path and always asking the target for the mapping
+ * @return a new IPath, never <code>null</code>
+ * @throws ESboxException if errors occurred trying to resolve the path
+ */
+ IPath convertTargetToHostPath(IPath sdkPath, boolean forceResolve) throws ESboxException;
+
+
+ /**
+ * Get the factory for creating process launchers to run programs in the context of the SDK.
+ * @return the process launcher factory for programs inside the SDK, never <code>null</code>
+ */
+ IProcessLauncherFactory getProcessLauncherFactory();
+
+ /**
+ * Get the factory for creating process launchers to
+ * run programs in the context of the machine hosting the SDK.
+ * @return the process launcher factory for programs outside the SDK, never <code>null</code>
+ */
+ IProcessLauncherFactory getMachineProcessLauncherFactory();
+
+ /**
+ * Get the filesystem access for files in the machine that hosts the SDK target.
+ * For instance, the root directory would refer to the machine's root. Where Eclipse
+ * and the build system are the same, this is a pass-through to the local filesystem.
+ * @return IFileSystemAccess, never <code>null</code>
+ */
+ IFileSystemAccess getMachineFileSystemAccess();
+
+ /**
+ * Get the filesystem access for files in the context of the SDK target.
+ * For instance, the root directory would refer to the SDK target's rootstrap.
+ * @return IFileSystemAccess, never <code>null</code>
+ */
+ IFileSystemAccess getTargetFileSystemAccess();
+
+ /**
+ * Get the filesystem mapping, for how files in the Eclipse host map to files on
+ * the build machine.
+ * <p>
+ * For systems where the machine running Eclipse is the same as build machine,
+ * this is an identity mapping.
+ * @return IFileSystemMapping, never <code>null</code>
+ */
+ IFileSystemMapping getHostToMachineFileSystemMapping();
+
+ /**
+ * Get the filesystem mapping, for how files in the SDK host map to files in the SDK target.
+ * For instance, how to map the SDK target rootstrap to a location on the SDK host.
+ * This does not convert across machines.
+ * @return IFileSystemMapping, never <code>null</code>
+ */
+ IFileSystemMapping getMachineToSDKTargetFileSystemMapping();
+
+ /**
+ * Get the filesystem mapping, for how files in the host map to files in the SDK target.
+ * This combines the mapping from the Eclipse machine to the build machine, and then
+ * to the SDK target filesystem.
+ * <p>
+ * For instance, this is used to map the user's project directory to a location in the SDK target.
+ * @return IFileSystemMapping, never <code>null</code>
+ */
+ IFileSystemMapping getFileSystemMapping();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/SDKFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/SDKFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/sdk/SDKFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.sdk;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.core.JobUtils;
+import org.maemo.esbox.internal.api.core.sdk.SDKFactoryRefreshJob;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.util.*;
+
+/**
+ * The SDK factory manages the SDKs known to the IDE.
+ * @author eswartz
+ *
+ */
+public class SDKFactory {
+ public static String SDK_CLASS = "class";
+
+ private static SDKFactory sdkFactory;
+
+ /**
+ * Get the single instance of the SDKFactory for this invocation
+ */
+ public static SDKFactory getInstance() {
+ if (sdkFactory == null) {
+ sdkFactory = new SDKFactory();
+ }
+ return sdkFactory;
+ }
+
+ private ArrayList<ISDK> sdks;
+
+ private List<ISDKProvider> sdkProviders;
+
+ public SDKFactory() {
+ // gather providers early; tests or clients may still
+ // add providers before SDKs are populated
+ sdkProviders = gatherSDKProviders();
+
+ // this list is populated before access
+ sdks = null;
+ }
+
+ /**
+ * Get access to the SDK provider list, for test purposes.
+ * @return modifiable list
+ */
+ public synchronized List<ISDKProvider> getSDKProviders() {
+ // anticipating modification, clear the cached SDK list
+ sdks = null;
+ return sdkProviders;
+ }
+
+ /**
+ * Get the SDKs, detecting them if necessary.
+ * @return list of SDKs, never <code>null</code>
+ */
+ public synchronized List<ISDK> getSDKs() {
+ if (sdks == null) {
+ refresh(new NullProgressMonitor());
+ }
+ return sdks;
+ }
+
+ /**
+ * @param nullProgressMonitor
+ */
+ public synchronized void refresh(IProgressMonitor monitor) {
+ SDKFactoryRefreshJob job = new SDKFactoryRefreshJob(sdkProviders);
+ JobUtils.waitForRunnable(job, monitor, "Refreshing SDKs...");
+ sdks = job.getSDKs();
+ }
+
+ /**
+ * Iterate the extensions implementing SDK providers and
+ * instatiate them.
+ * @return list of providers, never <code>null</code>
+ */
+ private List<ISDKProvider> gatherSDKProviders() {
+ List<ISDKProvider> providers = new ArrayList<ISDKProvider>();
+ if (!Platform.isRunning())
+ return providers;
+
+ ErrorLogger logger = Activator.getErrorLogger();
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(
+ ISDKProvider.SDK_PROVIDER_EXTENSION_ID).getExtensions();
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+ try {
+ ISDKProvider provider;
+ provider = (ISDKProvider) config.createExecutableExtension(SDK_CLASS);
+ providers.add(provider);
+ } catch (CoreException e2) {
+ logger.logError(null, e2);
+ continue;
+ }
+ }
+ }
+
+ return providers;
+ }
+
+ /**
+ * Get an array of all the SDK targets known to the IDE
+ * @return array of ISDKTarget, never null
+ */
+ public ISDKTarget[] getAllSDKTargets() {
+ List<ISDKTarget> targets = new ArrayList<ISDKTarget>();
+ for (ISDK sdk : getSDKs()) {
+ targets.addAll(Arrays.asList(sdk.getSDKTargets()));
+ }
+ return (ISDKTarget[]) targets.toArray(new ISDKTarget[targets.size()]);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ESboxToolEngine.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ESboxToolEngine.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ESboxToolEngine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tool;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ *
+ */
+public class ESboxToolEngine {
+
+ public static String TOOLS_EXTENSION_ID = Activator.PLUGIN_ID + ".tool";
+
+ private static ESboxToolEngine singleton = null;
+
+ private List<ITool> tools;
+
+ /**
+ *
+ */
+ private ESboxToolEngine() {
+ initTools();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static synchronized ESboxToolEngine getInstance() {
+ if (singleton == null)
+ singleton = new ESboxToolEngine();
+ return singleton;
+ }
+
+ /**
+ *
+ */
+ private void initTools() {
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(TOOLS_EXTENSION_ID).getExtensions();
+ String toolName = null;
+ String id = null;
+
+ tools = new ArrayList<ITool>();
+
+ for(int i=0; i<extensions.length; i++) {
+
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ ITool tool = null;
+ IConfigurationElement config = configElements[j];
+ toolName = config.getAttribute("name");
+ id = config.getAttribute("id");
+
+ IConfigurationElement[] provider = config.getChildren("provider");
+ IConfigurationElement[] params = config.getChildren("param");
+
+ IToolProvider toolProvider = null;
+ try {
+ toolProvider = (IToolProvider) provider[0].createExecutableExtension("class");
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ tool = new Tool(toolName,id,toolProvider);
+
+ for (int k=0; k < params.length; k++) {
+ String paramName, description, value;
+ paramName = params[k].getAttribute("name");
+ description = params[k].getAttribute("description");
+ value = params[k].getAttribute("value");
+ IToolParam param = new ToolParam(paramName, description, value);
+ tool.addParam(param);
+ }
+ tools.add(tool);
+ }
+
+
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ public List<ITool> getTools() {
+ return tools;
+ }
+
+ /**
+ *
+ * @param name
+ * @return
+ */
+ public ITool[] getTool(String name) {
+ List<ITool> result = new ArrayList<ITool>();
+
+ for (ITool tool : tools) {
+ if (name.equals(tool.getName()))
+ result.add(tool);
+ }
+
+ return result.toArray(new ITool[0]);
+ }
+
+
+}
+
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ITool.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ITool.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ITool.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tool;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface ITool {
+
+ public List<IToolParam> getParams();
+
+ public boolean addParam(IToolParam param);
+
+ public IToolProvider getProvider();
+
+ public String getName();
+
+ public String getId();
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolListener.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolListener.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolListener.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tool;
+
+import java.util.EventListener;
+
+/**
+ *
+ */
+public interface IToolListener extends EventListener {
+
+
+ public void toolExecuted(ToolEvent event);
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolParam.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolParam.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolParam.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tool;
+
+/**
+ *
+ */
+public interface IToolParam {
+
+ public String getName();
+
+ public String getDescription();
+
+ public String getValue();
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tool;
+
+
+/**
+ *
+ */
+public interface IToolProvider {
+
+ public IToolRunner getRunner();
+
+ public boolean isInstalled();
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolRunner.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolRunner.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/IToolRunner.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tool;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.ProcessRunnerParameters;
+
+
+/**
+ *
+ */
+public interface IToolRunner {
+ /** Generate the launch details for the tool */
+ public ProcessRunnerParameters createProcessRunnerParameters() throws ESboxException;
+
+ /** Handle launched process */
+ public void trackProcess(Process process) throws ESboxException;
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/Tool.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/Tool.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/Tool.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tool;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author raul
+ *
+ */
+public class Tool implements ITool {
+
+ private String name;
+
+ private String id;
+
+ private IToolProvider provider;
+
+ private List<IToolParam> params;
+
+ public Tool(String name, String id, IToolProvider provider) {
+ this.name = name;
+ this.id = id;
+ this.provider = provider;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.ITool#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.ITool#getParams()
+ */
+ public List<IToolParam> getParams() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.ITool#getProvider()
+ */
+ public IToolProvider getProvider() {
+ return provider;
+ }
+
+ public boolean addParam(IToolParam param) {
+ if (params == null) {
+ params = new ArrayList<IToolParam>();
+ }
+ return params.add(param);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.ITool#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( !this.getClass().equals(obj.getClass()) )
+ return false;
+ ITool tool = (ITool)obj;
+ return name.equals(tool.getName()) && id.equals(tool.getId());
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ToolEvent.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ToolEvent.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ToolEvent.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tool;
+
+import java.util.EventObject;
+
+/**
+ *
+ */
+public class ToolEvent extends EventObject {
+
+ public ToolEvent(Object source) {
+ super(source);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ToolParam.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ToolParam.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/tool/ToolParam.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tool;
+
+
+/**
+ * @author raul
+ *
+ */
+public class ToolParam implements IToolParam {
+
+ private String description;
+
+ private String name;
+
+ private String value;
+
+ public ToolParam(String name, String description, String value) {
+ this.name = name;
+ this.description = description;
+ this.value = value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.IToolParam#getDescription()
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.IToolParam#getName()
+ */
+ public String getName() {
+ // TODO Auto-generated method stub
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.tool.IToolParam#getValue()
+ */
+ public String getValue() {
+ // TODO Auto-generated method stub
+ return value;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( !this.getClass().equals(obj.getClass()) )
+ return false;
+ IToolParam param = (IToolParam)obj;
+ return name.equals(param.getName());
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/EFSXMLFileStorage.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/EFSXMLFileStorage.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/EFSXMLFileStorage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.xml;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.runtime.CoreException;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+
+/**
+ * Implementation of XML storage in a file accessed by EFS.
+ * @author eswartz
+ *
+ */
+public class EFSXMLFileStorage extends XMLStorageBase {
+ private URI uri;
+
+ public EFSXMLFileStorage(URI uri) {
+ this.uri = uri;
+ }
+
+ /**
+ * Get the storage URI.
+ * @return URI for EFS
+ */
+ public URI getURI() {
+ return uri;
+ }
+
+ /**
+ * @param uri the uri to set
+ */
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.XMLStorageBase#getStorageInputStream()
+ */
+ @Override
+ protected InputStream getStorageInputStream() throws CoreException {
+ return EFS.getStore(getURI()).openInputStream(0, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.XMLStorageBase#getStorageOutputStream()
+ */
+ @Override
+ protected OutputStream getStorageOutputStream() throws CoreException {
+ return EFS.getStore(getURI()).openOutputStream(0, null);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/ResourceXMLFileStorage.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/ResourceXMLFileStorage.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/ResourceXMLFileStorage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.xml;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+
+import java.io.*;
+
+/**
+ * Implementation of XML storage in a file in the workspace.
+ * @author eswartz
+ *
+ */
+public class ResourceXMLFileStorage extends XMLStorageBase {
+ private IFile file;
+
+ public ResourceXMLFileStorage(IFile file) {
+ this.file = file;
+ }
+
+ /**
+ * Get the IFile.
+ * @return IFile
+ */
+ public IFile getFile() {
+ return file;
+ }
+
+ /**
+ * @param file the file to set
+ */
+ public void setFile(IFile file) {
+ this.file = file;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.XMLStorageBase#getStorageInputStream()
+ */
+ @Override
+ protected InputStream getStorageInputStream() throws CoreException {
+ return getFile().getContents();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.XMLStorageBase#getStorageOutputStream()
+ */
+ @Override
+ protected OutputStream getStorageOutputStream() throws CoreException {
+ final ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+ return new OutputStream() {
+
+ @Override
+ public void write(int ch) throws IOException {
+ os.write(ch);
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#close()
+ */
+ @Override
+ public void close() throws IOException {
+ IFile file = getFile();
+ InputStream contents = new ByteArrayInputStream(os.toByteArray());
+ try {
+ if (file.exists())
+ file.setContents(contents, true, true, null);
+ else
+ file.create(contents, true, null);
+ } catch (CoreException e) {
+ throw (IOException) new IOException().initCause(e);
+ }
+ super.close();
+ }
+ };
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/XMLStorageBase.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/XMLStorageBase.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/XMLStorageBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,168 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.xml;
+
+import org.eclipse.core.runtime.CoreException;
+import org.maemo.esbox.internal.core.Activator;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import java.io.*;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+/**
+ * This class implements a simple persistent storage layer around XML. Subclasses must specify
+ * how the storage is read/written.
+ * <p>
+ * This class is not thread-safe.
+ * @author eswartz
+ *
+ */
+public abstract class XMLStorageBase {
+
+ private boolean dirty;
+ private Document document;
+ private Element documentElement;
+
+ public XMLStorageBase() {
+ dirty = false;
+ document = null;
+ documentElement = null;
+ }
+
+ /**
+ * Get the stream for the existing content
+ * @return InputStream (will be closed by caller)
+ * @throws CoreException if storage does not exist or cannot be read
+ */
+ abstract protected InputStream getStorageInputStream() throws CoreException;
+
+ /**
+ * Get the stream to write the new content
+ * @return OutputStream (will be closed by caller)
+ * @throws CoreException if storage cannot be created
+ */
+ abstract protected OutputStream getStorageOutputStream() throws CoreException;
+
+ /**
+ * Create an empty document.
+ * @throws CoreException if document could not be created (fatal!)
+ */
+ public void create(String documentElementName) throws CoreException {
+ document = null;
+ documentElement = null;
+ // not existing
+ try {
+ document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+ } catch (ParserConfigurationException e2) {
+ throw new CoreException(Activator.createErrorStatus("Failed to create XML document", e2));
+ }
+
+ documentElement = document.createElement(documentElementName);
+ document.appendChild(documentElement);
+ dirty = true;
+ }
+
+ /**
+ * Load the document.
+ * @throws CoreException if document could not be loade
+ */
+ public void load(String documentElementName) throws CoreException {
+ try {
+ Document newDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
+ getStorageInputStream());
+
+ document = newDocument;
+ documentElement = document.getDocumentElement();
+ dirty = false;
+ } catch (Exception e) {
+ throw new CoreException(Activator.createErrorStatus("Failed to load XML storage", e));
+ }
+ }
+
+ protected CoreException saveException(Exception e) {
+ return new CoreException(Activator.createErrorStatus("Failed to persist XML storage", e));
+ }
+
+ /**
+ * Save the storage to XML.
+ * @throws CoreException
+ */
+ public void save() throws CoreException {
+ if (document == null)
+ return;
+
+ TransformerFactory factory = TransformerFactory.newInstance();
+ Transformer transformer = null;
+ try {
+ transformer = factory.newTransformer();
+ } catch (TransformerConfigurationException e) {
+ throw saveException(e);
+ }
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+
+ OutputStream output = getStorageOutputStream();
+
+ DOMSource source = new DOMSource(document);
+ StreamResult outputTarget = new StreamResult(output);
+ try {
+ transformer.transform(source, outputTarget);
+ } catch (TransformerException e) {
+ throw saveException(e);
+ }
+
+ try {
+ output.close();
+ dirty = false;
+ } catch (IOException e) {
+ throw saveException(e);
+ }
+ }
+
+ /**
+ * Tell whether the document has any changes. This is set true by this
+ * class if the document was created anew due a failure to load from storage,
+ * or reset when the storage is loaded or saved successfully.
+ * @return true if dirty
+ */
+ public boolean isDirty() {
+ return dirty;
+ }
+
+ /**
+ * Set the dirty flag.
+ */
+ public void setDirty(boolean anyChanges) {
+ this.dirty = anyChanges;
+ }
+
+ /**
+ *
+ */
+ public Element getDocumentElement() {
+ return documentElement;
+ }
+
+ /**
+ * Get the document
+ * @return
+ */
+ public Document getDocument() {
+ return document;
+ }
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/XMLUtils.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/XMLUtils.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/core/xml/XMLUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.xml;
+
+import org.w3c.dom.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Utility functions for dealing with XML.
+ * @author eswartz
+ *
+ */
+public class XMLUtils {
+
+ /**
+ * Get the elements with the given name.
+ * @param name
+ * @return array, never <code>null</code>
+ */
+ public static Element[] getChildElementsNamed(Element element, String name) {
+ NodeList nodeList = element.getChildNodes();
+ List<Element> elements = new ArrayList<Element>(nodeList.getLength());
+ if (nodeList != null) {
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+ if (!(node instanceof Element) || !name.equals(node.getNodeName()))
+ continue;
+ elements.add((Element) node);
+ }
+ }
+ return (Element[]) elements.toArray(new Element[elements.size()]);
+ }
+
+ /**
+ * Find or create a child element with the given name
+ * @param element
+ * @param name
+ * @return new or existing element
+ */
+ public static Element findOrCreateChildElement(Document document, Element element, String name) {
+ Element[] elements = getChildElementsNamed(element, name);
+ Element kid;
+ if (elements.length > 0) {
+ kid = elements[0];
+ } else {
+ kid = document.createElement(name);
+ element.appendChild(kid);
+ }
+ return kid;
+ }
+
+ /**
+ * Set or remove text for an element.
+ * @param element
+ * @param text the text to set or <code>null</code> to remove
+ */
+ public static void setText(Element element, String text) {
+ element.setTextContent(text);
+ }
+
+ /**
+ * Get the text for an element, which is considered the first Text child element.
+ * @param element
+ * @returns the text or <code>null</code>
+ */
+ public static String getText(Element element) {
+ NodeList nodeList = element.getChildNodes();
+ if (nodeList.getLength() > 0) {
+ if (nodeList.item(0) instanceof Text) {
+ return nodeList.item(0).getTextContent();
+ }
+ }
+ return null;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/BaseProcessLauncherFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/BaseProcessLauncherFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/BaseProcessLauncherFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.core;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.env.*;
+import org.maemo.esbox.core.process.*;
+
+import java.util.*;
+
+public abstract class BaseProcessLauncherFactory implements IProcessLauncherFactory {
+
+ private boolean isWin32;
+
+ public BaseProcessLauncherFactory(boolean isWin32) {
+ this.isWin32 = isWin32;
+ }
+
+ /** Implement to provide the standard environment.
+ * @return property map (may be null or singleton) */
+ abstract protected Properties readStandardEnvironment();
+
+ public Properties getStandardEnvironment() {
+ Properties standardEnv = readStandardEnvironment();
+ Properties copy = new Properties();
+ if (standardEnv != null)
+ copy.putAll(standardEnv);
+ return copy;
+ }
+
+ /**
+ * Implement for the actual process launcher implementation
+ * @param workingDirectory
+ * @param cmdLine cmdline array, may be modified
+ * @param environment environment, may be modified
+ */
+ protected abstract IProcessLauncher doCreateProcessLaunchHandler(IPath workingDirectory,
+ List<String> cmdLine, Properties environment);
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncherFactory#createProcessLaunchHandler(org.eclipse.core.runtime.IPath, java.util.List, java.util.Properties, org.eclipse.cdt.utils.pty.PTY)
+ */
+ public IProcessLauncher createProcessLaunchHandler(IPath workingDirectory,
+ List<String> cmdLine, Properties environment) {
+ // if PATH is changed, we must wrap the command in a shell so the new PATH
+ // will be used to search for any binaries referenced in the command
+
+ // XXX: move logic out
+ List<String> cmdLineCopy;
+ if (environment != null && environment.containsKey("PATH") && !isWin32) {
+ cmdLineCopy = CommandLineArguments.wrapScriptCommandLineForShell(cmdLine);
+ } else {
+ cmdLineCopy = new ArrayList<String>(cmdLine);
+ }
+ return doCreateProcessLaunchHandler(workingDirectory,
+ cmdLineCopy,
+ EnvironmentProperties.copyProperties(environment));
+ }
+
+ /**
+ * Either merge user supplied variables into standardEnv, or set the
+ * contents of standardEnv from those variables, based on the disposition
+ * of the ESbox environment preferences.
+ * <p>
+ * Pick variables only slated for a particular machine based on a prefix.
+ *
+ * @param standardEnv environment block updated
+ * @param systemEnv environment for system
+ */
+ public void mergeOrSetUserVariables(String machinePrefix, Properties standardEnv, Map<String, String> systemEnv) {
+ EnvironmentVariableManager manager = EnvironmentVariableManager.getInstance();
+ IEnvironmentVariableBlock envBlock = manager.getGlobalEnvironmentBlock();
+
+ if (/* TODO: append? && */ systemEnv != null) {
+ standardEnv.putAll(systemEnv);
+ }
+
+ for (IEnvironmentVariable variable : envBlock.getVariables()) {
+ String name = variable.getName();
+ int idx = name.indexOf('$');
+ if (idx >= 0) {
+ if (machinePrefix == null || !name.substring(0, idx).equals(machinePrefix))
+ continue;
+ else
+ name = name.substring(machinePrefix.length() + 1);
+ }
+
+ if (variable.getValue() != null) {
+ standardEnv.put(name, envBlock.expandString(variable.getValue(),
+ manager.getStandardVariableProvider()));
+ } else {
+ standardEnv.remove(name);
+ }
+ }
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/HostProcessLauncher.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/HostProcessLauncher.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/HostProcessLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.core;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.BaseProcessLauncher;
+
+import java.util.*;
+
+/**
+ * Standard process launcher for running programs on the host
+ * @author eswartz
+ *
+ */
+public class HostProcessLauncher extends BaseProcessLauncher {
+
+ public HostProcessLauncher(IPath workingDirectory,
+ List<String> cmdLine, Properties environment) {
+ super(cmdLine,
+ environment,
+ workingDirectory,
+ CorePlugin.getDefault().getCorePreferenceProvider());
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoPrefix()
+ */
+ @Override
+ protected String getLaunchInfoPrefix() {
+ return "";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoStandardEnvironment()
+ */
+ @Override
+ protected Map<String, String> getLaunchInfoStandardEnvironment() {
+ return System.getenv();
+ }
+
+ @Override
+ protected void setupForLaunch() throws ESboxException {
+ // nothing special
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#doCreateProcess()
+ */
+ @Override
+ protected Process doCreateProcess() throws Exception {
+ Process process;
+
+ ProcessBuilder builder = new ProcessBuilder(getLaunchCommandArguments());
+ if (getLaunchEnvironment() != null) {
+ builder.environment().clear();
+ for (Map.Entry<Object, Object> entry : getLaunchEnvironment().entrySet()) {
+ builder.environment().put(entry.getKey().toString(), entry.getValue().toString());
+ }
+ }
+ if (getLaunchCurrentWorkingDirectory() != null) {
+ builder.directory(getLaunchCurrentWorkingDirectory().toFile());
+ }
+ builder.redirectErrorStream(false);
+ process = builder.start();
+
+ return process;
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/AlwaysOnMachineController.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/AlwaysOnMachineController.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/AlwaysOnMachineController.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.machine.MachineException;
+
+/**
+ * This is a machine which is always known to be running -- perhaps it's the host
+ * or a virtual (in-process) machine. For this, we assume that if this
+ * Java code is running at all, that it is always alive, started, and cannot be stopped.
+ * @author eswartz
+ *
+ */
+public class AlwaysOnMachineController extends BaseMachineController {
+
+
+ /**
+ * @param machine
+ */
+ public AlwaysOnMachineController() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doProbeMachine()
+ */
+ @Override
+ protected IStatus doProbeMachine(IProgressMonitor monitor) {
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doStartMachine()
+ */
+ @Override
+ protected IStatus doStartMachine(IProgressMonitor monitor) throws MachineException {
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doStopMachine()
+ */
+ @Override
+ protected IStatus doStopMachine(IProgressMonitor monitor) throws MachineException {
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doAskUserToRepairMachine(org.eclipse.swt.widgets.Shell, org.eclipse.core.runtime.IStatus)
+ */
+ @Override
+ protected Result doAskUserToRepairMachine(Shell shell, IStatus status) {
+ // shouldn't get here
+ return Result.ABORT;
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/BaseMachineController.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/BaseMachineController.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/BaseMachineController.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import com.nokia.cpp.internal.api.utils.core.IListenerFiring;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.JobUtils;
+import org.maemo.esbox.core.JobUtils.IJob;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.text.MessageFormat;
+
+/**
+ * This the basic implementation of a machine.
+ * @author eswartz
+ *
+ */
+public abstract class BaseMachineController extends com.nokia.cpp.internal.api.utils.core.ListenerList<IMachineControllerListener> implements IMachineController {
+
+ public BaseMachineController() {
+ }
+
+ /** Implement to query the status of a machine.<p>
+ * This will be called on the UI thread, so the implementation should
+ * be responsive (use {@link Display#readAndDispatch()} when waiting).<p>
+ * The status returned generally reflects the state:
+ * <p>
+ * OK means the machine is ready to go.<br>
+ * WARNING means the machine is in a state where it is running
+ * but not (yet) ready to go.<br>
+ * ERROR means the machine is not usable until started.
+ * @param monitor the monitor, which is already begun and initialized for unknown length of time
+ */
+ protected abstract IStatus doProbeMachine(IProgressMonitor monitor);
+
+ /** Implement to (re-)start a machine in any state.
+ * This will be called on the UI thread, so the implementation should
+ * be responsive (use {@link Display#readAndDispatch()} when waiting)<p>
+ * Machine must be in an ok state afterwards.
+ * @param monitor the monitor, which is already begun and initialized for unknown length of time
+ * @return status
+ */
+ protected abstract IStatus doStartMachine(IProgressMonitor monitor) throws MachineException;
+
+ /** Implement to (re-)stop a machine in any state.
+ * This will be called on the UI thread, so the implementation should
+ * be responsive (use {@link Display#readAndDispatch()} when waiting)<p>
+ * Machine should be in an error state afterwards.
+ * @param monitor the monitor, which is already begun and initialized for unknown length of time
+ * @return status
+ * @throws MachineException if this cannot be done
+ */
+ protected abstract IStatus doStopMachine(IProgressMonitor monitor) throws MachineException;
+
+ /**
+ * Implement to query the user to manage a machine in a bad state.
+ * This will be called on the UI thread.
+ * @param shell
+ * @param status a failing status
+ * @return Result
+ */
+ protected abstract Result doAskUserToRepairMachine(Shell shell, IStatus status);
+
+ interface IStatusRunnable {
+ IStatus run();
+ }
+
+
+ public IStatus probeMachine(IMachine machine, IProgressMonitor monitor) {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ try {
+ monitor.beginTask(MessageFormat.format("Probing {0}", machine.getName()), IProgressMonitor.UNKNOWN);
+ return doProbeMachine(monitor);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ public IStatus acquireMachine(IMachine machine, IProgressMonitor monitor) {
+ if (Display.getCurrent() == null)
+ throw new IllegalStateException("This must be called from the UI thread");
+
+ final String msg = MessageFormat.format("Accessing {0}", machine.getName());
+
+ final IStatus[] statuses = { null };
+ IJob runnable = new IJob() {
+
+ public IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ try {
+ IStatus status = doProbeMachine(monitor);
+ if (!status.isOK()) {
+ try {
+ status = doStartMachine(monitor);
+ } catch (MachineException e) {
+ status = Activator.createErrorStatus(null, e);
+ }
+ }
+ statuses[0] = status;
+ } finally {
+ if (statuses[0] == null)
+ statuses[0] = Status.CANCEL_STATUS;
+ monitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ JobUtils.waitForRunnable(runnable, monitor, msg);
+ /*
+ TimeTriggeredProgressMonitorDialog dialog = new TimeTriggeredProgressMonitorDialog(null, 1000);
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+
+ monitor.beginTask(MessageFormat.format("Acquiring {0}", machine.getName()), IProgressMonitor.UNKNOWN);
+ try {
+ IStatus status = doProbeMachine(monitor);
+ if (!status.isOK()) {
+ try {
+ status = doStartMachine(monitor);
+ } catch (MachineException e) {
+ status = CoreActivator.createErrorStatus(null, e);
+ }
+ }
+ statuses[0] = status;
+ } finally {
+ monitor.done();
+ }
+ }
+
+ });
+ } catch (InvocationTargetException e) {
+ statuses[0] = CoreActivator.createErrorStatus("Cannot acquire machine", e);
+ } catch (InterruptedException e) {
+ statuses[0] = Status.CANCEL_STATUS;
+ }
+ */
+ return statuses[0];
+ }
+
+
+
+ public IStatus releaseMachine(IMachine machine, IProgressMonitor monitor) {
+ if (Display.getCurrent() == null)
+ throw new IllegalStateException("This must be called from the UI thread");
+
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ final IStatus[] statuses = { null };
+
+ final String msg = MessageFormat.format("Terminating machine", machine.getName());
+ IJob runnable = new IJob() {
+
+ public IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ try {
+ try {
+ statuses[0] = doStopMachine(monitor);
+ } catch (MachineException e) {
+ statuses[0] = Activator.createErrorStatus(null, e);
+ }
+ } finally {
+ if (statuses[0] == null)
+ statuses[0] = Status.CANCEL_STATUS;
+ monitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+
+ JobUtils.waitForRunnable(runnable, monitor, msg);
+
+ return statuses[0];
+ }
+
+ protected void fireMachineStateChanged() {
+ fireListeners(new IListenerFiring<IMachineControllerListener>() {
+
+ public void fire(IMachineControllerListener listener) {
+ listener.machineStateChanged(BaseMachineController.this);
+ }
+
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachineController#askUserToRepairMachine(org.maemo.esbox.core.machine.IMachine, org.eclipse.swt.widgets.Shell, org.eclipse.core.runtime.IStatus)
+ */
+ public Result askUserToRepairMachine(IMachine machine, Shell shell,
+ IStatus status) {
+ return doAskUserToRepairMachine(shell, status);
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/FileSystemMapping.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/FileSystemMapping.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/FileSystemMapping.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,269 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import com.nokia.cpp.internal.api.utils.core.*;
+import com.nokia.cpp.internal.api.utils.core.ListenerList;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.HostUtils;
+import org.maemo.esbox.core.machine.IFileSystemMappingListener;
+import org.maemo.esbox.core.machine.IPathCanonicalizer;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * Implementation of IFileSystemMapping.
+ * @author eswartz
+ *
+ */
+public class FileSystemMapping extends ListenerList<IFileSystemMappingListener> implements IFileSystemMappingImpl {
+
+ private static final IPath ROOT = new Path("/");
+ private static final IPath[] EMPTY = new IPath[0];
+ private ArrayList<Pair<IPath, IPath>> mappings;
+ private IPathCanonicalizer hostPathCanonicalizer;
+ private IPathCanonicalizer targetPathCanonicalizer;
+
+ /** Canonicalizer for local paths*/
+ public static IPathCanonicalizer localCaseInsensitiveCanonicalizer = new IPathCanonicalizer() {
+
+ public IPath getCanonicalPath(IPath path) {
+ File file = path.toFile();
+ try {
+ file = file.getCanonicalFile();
+ } catch (IOException e) {
+ // ignore
+ }
+ return new Path(file.getAbsolutePath().toLowerCase());
+ }
+ };
+
+ /** Canonicalizer for local paths */
+ public static IPathCanonicalizer localCaseSensitiveCanonicalizer = new IPathCanonicalizer() {
+
+ public IPath getCanonicalPath(IPath path) {
+ File file = path.toFile();
+ try {
+ file = file.getCanonicalFile();
+ } catch (IOException e) {
+ // ignore
+ }
+ return new Path(file.getAbsolutePath());
+ }
+ };
+
+ /** Canonicalizer for remote paths where we can't (easily) verify the file's canonical path */
+ public static IPathCanonicalizer remoteCaseInsensitiveCanonicalizer = new IPathCanonicalizer() {
+
+ public IPath getCanonicalPath(IPath path) {
+ return new Path(path.toPortableString().toLowerCase());
+ }
+ };
+ /** Canonicalizer for remote paths where we can't (easily) verify the file's canonical path */
+ public static IPathCanonicalizer remoteCaseSensitiveCanonicalizer = new IPathCanonicalizer() {
+
+ public IPath getCanonicalPath(IPath path) {
+ return path;
+ }
+ };
+
+ public static IPathCanonicalizer getHostCanonicalizer() {
+ if (Platform.getOS().equals(Platform.OS_WIN32))
+ return localCaseInsensitiveCanonicalizer;
+ else
+ return localCaseSensitiveCanonicalizer;
+ }
+
+ public static IPathCanonicalizer getMachineCanonicalizer(boolean caseSensitive) {
+ if (caseSensitive)
+ return remoteCaseSensitiveCanonicalizer;
+ else
+ return remoteCaseInsensitiveCanonicalizer;
+ }
+
+
+
+ /**
+ * Sort by path lengths, so that longer paths come first.
+ * @author eswartz
+ *
+ */
+ public static class PathPairComparator implements Comparator<Pair<IPath, IPath>> {
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(Pair<IPath, IPath> o1, Pair<IPath, IPath> o2) {
+ int segDiff;
+ IPath o1host = o1.first;
+ IPath o2host = o2.first;
+
+ if (o1host.getDevice() != null && o2host.getDevice() != null) {
+ segDiff = o1host.getDevice().compareTo(o2host.getDevice());
+ if (segDiff != 0)
+ return segDiff;
+ } else if (o1host.getDevice() != null && o2host.getDevice() == null) {
+ return -1;
+ } else if (o1host.getDevice() == null && o2host.getDevice() != null) {
+ return 1;
+ }
+
+ segDiff = o1host.segmentCount() - o2host.segmentCount();
+ if (segDiff != 0)
+ return -segDiff; // longer paths first
+
+ for (int i = 0; i < o1host.segmentCount(); i++) {
+ String seg1 = o1host.segment(i);
+ String seg2 = o2host.segment(i);
+ segDiff = seg1.compareTo(seg2);
+ if (segDiff != 0)
+ return segDiff;
+ }
+ return 0;
+ }
+
+ }
+
+ /**
+ * Create an identity mapping for the host. This maps all paths
+ * to themselves.
+ */
+ public FileSystemMapping() {
+ this(getHostCanonicalizer(), getHostCanonicalizer());
+ }
+
+ /**
+ * Create a mapping object with the given path canonicalizer implementations.
+ * This maps all paths to themselves by default.
+ */
+ public FileSystemMapping(IPathCanonicalizer hostPathCanonicalizer,
+ IPathCanonicalizer targetPathCanonicalizer) {
+ this.mappings = new ArrayList<Pair<IPath, IPath>>();
+ initializeIdentityMappings();
+ this.hostPathCanonicalizer = hostPathCanonicalizer;
+ this.targetPathCanonicalizer = targetPathCanonicalizer;
+ }
+
+ private void initializeIdentityMappings() {
+ mappings.add(new Pair<IPath, IPath>(ROOT, ROOT));
+ if (HostUtils.isWindows()) {
+ for (char ch = 'a'; ch <= 'z'; ch++) {
+ IPath drive = new Path(ch + ":/");
+ mappings.add(new Pair<IPath, IPath>(drive, drive));
+ }
+ }
+ }
+
+ public synchronized List<Pair<IPath, IPath>> getHostToTargetRootMappings() {
+ return new ArrayList<Pair<IPath,IPath>>(mappings);
+ }
+
+ public synchronized void setHostToTargetRootMappings(List<Pair<IPath, IPath>> mappingsList) {
+ this.mappings = new ArrayList<Pair<IPath,IPath>>();
+ for (Pair<IPath, IPath> mapping : mappingsList) {
+ Pair<IPath, IPath> canonicalMapping = new Pair<IPath, IPath>(
+ hostPathCanonicalizer.getCanonicalPath(mapping.first),
+ targetPathCanonicalizer.getCanonicalPath(mapping.second));
+ mappings.add(canonicalMapping);
+ }
+
+ Collections.sort(mappings, new PathPairComparator());
+
+ fireListeners(new IListenerFiring<IFileSystemMappingListener>() {
+
+ public void fire(IFileSystemMappingListener listener) {
+ listener.mappingsChanged(FileSystemMapping.this);
+ }
+ });
+ }
+
+ public synchronized IPath convertHostToTargetPath(IPath hostPath) {
+ IPath[] matches = convertHostToTargetPaths(hostPath);
+ if (matches.length == 0)
+ return null;
+
+ return matches[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemMapping#convertHostToTargetPaths(org.eclipse.core.runtime.IPath)
+ */
+ public IPath[] convertHostToTargetPaths(IPath hostPath) {
+ IPath candidate = null;
+ Set<IPath> candidates = null;
+ hostPath = hostPathCanonicalizer.getCanonicalPath(hostPath);
+ for (Pair<IPath, IPath> mapping : mappings) {
+ if (mapping.first.isPrefixOf(hostPath)) {
+ IPath common = hostPath.removeFirstSegments(mapping.first.segmentCount());
+ IPath target = mapping.second.append(common);
+ if (candidate == null) {
+ candidate = target;
+ } else if (candidates == null) {
+ candidates = new HashSet<IPath>();
+ candidates.add(candidate);
+ candidates.add(target);
+ } else {
+ candidates.add(target);
+ }
+ }
+ }
+ if (candidate == null)
+ return EMPTY;
+ else if (candidates == null)
+ return new IPath[] { candidate };
+ else {
+ // return array in increasing length order (shorter path is more likely the one
+ // that #convertHostToTargetPath() will want)
+ IPath[] pathArray = (IPath[]) candidates.toArray(new IPath[candidates.size()]);
+ Arrays.sort(pathArray, 0, pathArray.length, new Comparator<IPath>() {
+
+ public int compare(IPath o1, IPath o2) {
+ int sdiff = o1.segmentCount() - o2.segmentCount();
+ if (sdiff != 0)
+ return sdiff;
+ return o1.toString().compareTo(o2.toString());
+ }
+
+ });
+ return pathArray;
+ }
+ }
+
+ public synchronized IPath convertTargetToHostPath(IPath remotePath) {
+ remotePath = targetPathCanonicalizer.getCanonicalPath(remotePath);
+ for (Pair<IPath, IPath> mapping : mappings) {
+ if (mapping.second.isPrefixOf(remotePath)) {
+ IPath common = remotePath.removeFirstSegments(mapping.second.segmentCount());
+ IPath host = mapping.first.append(common);
+ return host;
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemMappingImpl#getHostPathCanonicalizer()
+ */
+ public IPathCanonicalizer getHostPathCanonicalizer() {
+ return hostPathCanonicalizer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemMapping#getTargetPathCanonicalizer()
+ */
+ public IPathCanonicalizer getTargetPathCanonicalizer() {
+ return targetPathCanonicalizer;
+ }
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostFileSystemAccess.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostFileSystemAccess.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostFileSystemAccess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.eclipse.core.filesystem.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.net.URI;
+
+/**
+ * Access the host's filesystem.
+ * @author eswartz
+ *
+ */
+public class HostFileSystemAccess implements IFileSystemAccess {
+
+ private IFileSystem fileSystem;
+
+ /**
+ *
+ */
+ public HostFileSystemAccess() {
+ try {
+ fileSystem = EFS.getFileSystem("file");
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Cannot initialize EFS!", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemAccess#getFileStore(org.eclipse.core.runtime.IPath)
+ */
+ public IFileStore getFileStore(IPath machinePath) {
+ return fileSystem.getStore(machinePath);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemAccess#getFileSystem()
+ */
+ public IFileSystem getFileSystem() {
+ return fileSystem;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemAccess#getURIForPath(org.eclipse.core.runtime.IPath)
+ */
+ public URI getURIForPath(IPath path) {
+ return URI.create("file://" + path.toPortableString());
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostMachineBackend.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostMachineBackend.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostMachineBackend.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.process.HostProcessLauncherFactory;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+
+import java.net.URI;
+import java.util.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class HostMachineBackend extends Machine implements ILocalMachine {
+
+ /**
+ * @param os
+ * @param machineController
+ */
+ public HostMachineBackend(String os, IMachineController machineController) {
+ super("Host Machine", os, machineController);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getEnvironmentVariablePrefix()
+ */
+ public String getEnvironmentVariablePrefix() {
+ return "HOST";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#isAlive()
+ */
+ public boolean isAlive() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getUsername()
+ */
+ public String getUserName() {
+ String name = System.getProperty("user.name");
+ return name != null ? name : "user";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getUserHome()
+ */
+ public IPath getUserHome() {
+ String home = System.getProperty("user.home");
+ if (home == null)
+ return new Path(".");
+ return new Path(home);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getURI()
+ */
+ public URI getURI() {
+ return URI.create("file://localhost");
+ }
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachineBackend#getFileSystemAccess()
+ */
+ public IFileSystemAccess getFileSystemAccess() {
+ return new HostFileSystemAccess();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachineBackend#getFileSystemMapping()
+ */
+ public IFileSystemMapping getFileSystemMapping() {
+ return new FileSystemMapping();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getProcessLauncherFactory()
+ */
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return new HostProcessLauncherFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#createProcess(org.eclipse.core.runtime.IPath, java.util.List, java.util.Properties, org.eclipse.cdt.utils.pty.PTY)
+ */
+ public Process createProcess(IPath workingDirectory,
+ List<String> commandLine, Properties environment, boolean usePty)
+ throws Exception {
+ Process process;
+
+ ProcessBuilder builder = new ProcessBuilder(commandLine);
+ if (environment != null) {
+ builder.environment().clear();
+ for (Map.Entry<Object, Object> entry : environment.entrySet()) {
+ builder.environment().put(entry.getKey().toString(), entry.getValue().toString());
+ }
+ }
+ if (workingDirectory != null) {
+ builder.directory(workingDirectory.toFile());
+ }
+ builder.redirectErrorStream(false);
+ process = builder.start();
+
+ return process;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getStandardEnvironment()
+ */
+ public Map<String, String> getStandardEnvironment() {
+ return System.getenv();
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostUnixMachine.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostUnixMachine.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostUnixMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.core.machine.IBuildMachine;
+import org.maemo.esbox.core.machine.IProcessLister;
+
+/**
+ * This is a machine for a Linux host.
+ * @author eswartz
+ *
+ */
+public class HostUnixMachine extends HostMachineBackend implements IBuildMachine {
+
+ /**
+ *
+ */
+ public HostUnixMachine() {
+ super(Platform.getOS(), new AlwaysOnMachineController());
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IBuildMachine#canBuildFor(java.lang.String)
+ */
+ public boolean canBuildFor(String os) {
+ return os.equals(Platform.getOS());
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachineBackend#getProcessLister()
+ */
+ public IProcessLister getProcessLister() {
+ return new UnixProcessLister(getProcessLauncherFactory());
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostWindowsMachine.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostWindowsMachine.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/HostWindowsMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.core.machine.IProcessLister;
+
+/**
+ * @author eswartz
+ *
+ */
+public class HostWindowsMachine extends HostMachineBackend implements
+ IMachineImpl {
+
+ /**
+ * @param id
+ * @param name
+ * @param os
+ * @param machineController
+ */
+ public HostWindowsMachine() {
+ super(Platform.OS_WIN32, new AlwaysOnMachineController());
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachineBackend#getProcessLister()
+ */
+ public IProcessLister getProcessLister() {
+ return new Win32ProcessLister(this);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IBuildMachineImpl.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IBuildMachineImpl.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IBuildMachineImpl.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.maemo.esbox.core.machine.IBuildMachine;
+
+/**
+ * @author eswartz
+ *
+ */
+public interface IBuildMachineImpl extends IBuildMachine, IMachineImpl {
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IFileSystemAccessImpl.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IFileSystemAccessImpl.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IFileSystemAccessImpl.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.eclipse.core.filesystem.IFileSystem;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+
+/**
+ * @author eswartz
+ *
+ */
+public interface IFileSystemAccessImpl extends IFileSystemAccess {
+
+ /** Get the EFS filesystem underpinning the IFileSystemAccess. */
+ IFileSystem getFileSystem();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IFileSystemMappingImpl.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IFileSystemMappingImpl.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IFileSystemMappingImpl.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import com.nokia.cpp.internal.api.utils.core.IListener;
+import com.nokia.cpp.internal.api.utils.core.Pair;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.machine.IFileSystemMapping;
+import org.maemo.esbox.core.machine.IFileSystemMappingListener;
+
+import java.util.List;
+
+/**
+ * This interface allows changes to the mapping of paths over a shared filesystem.
+ * @author eswartz
+ *
+ */
+public interface IFileSystemMappingImpl extends IListener<IFileSystemMappingListener>, IFileSystemMapping{
+ /**
+ * Get the root mappings as a set of host to target mappings, in order
+ * from shallowest to deepest path. This may contain duplicate keys.
+ * @return a copy of the mappings
+ */
+ List<Pair<IPath, IPath>> getHostToTargetRootMappings();
+
+ /**
+ * Set the root mappings as a set of host to target mappings.
+ * The receiver ensures the paths are canonical and sorted before committing.
+ * @param mappings new mappings
+ */
+ void setHostToTargetRootMappings(List<Pair<IPath, IPath>> mappings);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IMachineImpl.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IMachineImpl.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IMachineImpl.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.IMachineController;
+
+/**
+ * @author eswartz
+ *
+ */
+public interface IMachineImpl extends IMachine {
+
+ IMachineController getMachineController();
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IStreamWrapper.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IStreamWrapper.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IStreamWrapper.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.eclipse.core.runtime.IPath;
+
+import java.io.InputStream;
+import java.util.Properties;
+
+/**
+ * This interface may be implemented and passed to {@link SSHProcess#SSHProcess(SSHConfiguration, List, Properties, IPath, PTY, IStreamWrapper)}
+ * to override the handling of the streams provided by the SSH exec channel.
+ * @author eswartz
+ *
+ */
+public interface IStreamWrapper {
+ /** Get the wrapped stdout stream */
+ InputStream getInputStream();
+ /** Get the wrapped stderr stream */
+ InputStream getErrorStream();
+ /** Detect whether the streams are considered closed before the input streams themselves indicate this */
+ boolean isClosed();
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IStreamWrapperFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IStreamWrapperFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/IStreamWrapperFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import java.io.InputStream;
+
+/**
+ * Create a stream wrapper for the given streams.
+ * @author eswartz
+ *
+ */
+public interface IStreamWrapperFactory {
+ IStreamWrapper createStreamWrapper(InputStream in, InputStream err);
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/Machine.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/Machine.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/Machine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.maemo.esbox.core.machine.IMachineController;
+
+
+/**
+ * This represents the user-visible side of a machine.
+ * @author eswartz
+ *
+ */
+public abstract class Machine implements IMachineImpl {
+
+ private IMachineController machineController;
+ private final String name;
+ private final String os;
+
+ public Machine(String name, String os, IMachineController machineController) {
+ this.name = name;
+ this.os = os;
+ this.machineController = machineController;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getOS()
+ */
+ public String getOS() {
+ return os;
+ }
+
+ public IMachineController getMachineController() {
+ return machineController;
+ }
+
+ /**
+ * @param machineController the machineController to set
+ */
+ public void setMachineController(IMachineController machineController) {
+ this.machineController = machineController;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MachineControllerProbingJob.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MachineControllerProbingJob.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MachineControllerProbingJob.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.IMachineController;
+
+/**
+ * This job periodically probes the state of a machine
+ * to test whether it's alive. It does not change the state of the machine.
+ * @author eswartz
+ *
+ */
+public class MachineControllerProbingJob extends Job {
+ private IStatus status;
+ private final IMachineController machineController;
+ private int probeDelay;
+ private final IMachine machine;
+
+ /**
+ * @param name
+ */
+ public MachineControllerProbingJob(IMachine machine, IMachineController machineController, int probeDelay) {
+ super("Periodic machine probe");
+ this.machine = machine;
+ this.machineController = machineController;
+ this.probeDelay = probeDelay;
+ setUser(false);
+ setSystem(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ monitor.beginTask("Probing machine...", IProgressMonitor.UNKNOWN);
+ while (true) {
+ // don't return machine status as Job status since this throws up dialogs and
+ // clogs the error log
+
+ probeStatus(monitor);
+ monitor.worked(1);
+
+ try {
+ Thread.sleep(probeDelay);
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+
+ /**
+ *
+ */
+ public IStatus probeStatus(IProgressMonitor monitor) {
+ IStatus status = machineController.probeMachine(machine, monitor);
+
+ synchronized (this) {
+ this.status = status;
+ }
+
+ return status;
+ }
+
+ /**
+ * Get the last status of the machine.
+ * @return status, or <code>null</code> if no probe has happened yet
+ */
+ public synchronized IStatus getStatus() {
+ return status;
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MachineProbingJob.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MachineProbingJob.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MachineProbingJob.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+
+/**
+ * This job periodically probes the state of a machine
+ * to test whether it's alive. It does not change the state of the machine.
+ * @author eswartz
+ *
+ */
+public class MachineProbingJob extends Job {
+ private IStatus status;
+ private final IMachineImpl machine;
+ private int probeDelay;
+
+ /**
+ * @param name
+ */
+ public MachineProbingJob(IMachineImpl machine, int probeDelay) {
+ super("Periodic machine probe");
+ this.machine = machine;
+ this.probeDelay = probeDelay;
+ setUser(false);
+ setSystem(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ monitor.beginTask("Probing machine...", IProgressMonitor.UNKNOWN);
+ while (true) {
+ // don't return machine status as Job status since this throws up dialogs and
+ // clogs the error log
+
+ probeStatus(monitor);
+ monitor.worked(1);
+
+ try {
+ Thread.sleep(probeDelay);
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+
+ /**
+ *
+ */
+ public IStatus probeStatus(IProgressMonitor monitor) {
+ IStatus status = machine.getMachineController().probeMachine(
+ machine, monitor);
+
+ synchronized (this) {
+ this.status = status;
+ }
+
+ return status;
+ }
+
+ /**
+ * Get the last status of the machine.
+ * @return status, or <code>null</code> if no probe has happened yet
+ */
+ public synchronized IStatus getStatus() {
+ return status;
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MappingException.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MappingException.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/MappingException.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+/**
+ * @author eswartz
+ *
+ */
+public class MappingException extends Exception {
+ public MappingException(String string) {
+ super(string);
+ }
+ public MappingException(String string, Throwable cause) {
+ super(string, cause);
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/StockSharedFilesystemProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/StockSharedFilesystemProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/StockSharedFilesystemProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.machine.ISharedFilesystemProvider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This implementation provides the system default or user preferences for
+ * shared filesystems on a Linux remote machine with a given user.
+ * XXX: Currently these paths are hardcoded and require manual setup.
+ * @author eswartz
+ *
+ */
+public class StockSharedFilesystemProvider implements ISharedFilesystemProvider {
+
+ private final String userName;
+ /**
+ *
+ */
+ public StockSharedFilesystemProvider(String userName) {
+ this.userName = userName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.ISharedFilesystemProvider#getSharedFolders()
+ */
+ public Map<IPath, IPath> getSharedFolders() {
+ Map<IPath, IPath> map = new HashMap<IPath, IPath>();
+ map.put(new Path("c:/sources/shared"),
+ new Path("/home/" + userName + "/shared"));
+ map.put(new Path("c:/sources/shared"),
+ new Path("/scratchbox/users/" + userName + "/home/" + userName + "/shared"));
+ map.put(new Path("s:/"),
+ new Path("/scratchbox"));
+ //map.put(new Path("c:/sources/shared_home"),
+ // new Path("/home/" + userName));
+ return map;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/UnixProcessLister.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/UnixProcessLister.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/UnixProcessLister.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author eswartz
+ *
+ */
+public class UnixProcessLister implements IProcessLister {
+
+ private IProcessLauncherFactory processLauncherFactory;
+ private Pattern psAxPattern =
+ // ..pid.. ..TIME... command
+ Pattern.compile("(\\d+).*\\d:\\d\\d\\s(.+)");
+ public UnixProcessLister(IProcessLauncherFactory factory) {
+ this.processLauncherFactory = factory;
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IProcessLister#getProcesses(testrse.IProcessFilter)
+ */
+ public List<IProcess> getProcesses(IProcessFilter filter) {
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ processLauncherFactory,
+ "ps axwwww");
+
+ List<IProcess> results = new ArrayList<IProcess>();
+ Process process;
+ try {
+ process = processLauncher.createProcess();
+
+ BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()));
+
+ String line;
+
+ while( (line = input.readLine()) != null ) {
+ Matcher matcher = psAxPattern.matcher(line.trim());
+ if (matcher.matches()) {
+ IProcess processEntry = createProcess(matcher);
+ if (filter == null || filter.filter(processEntry)) {
+ results.add(processEntry);
+ }
+ }
+ }
+ } catch (Exception e) {
+ Activator.getErrorLogger().logError("Failure scanning processes", e);
+ }
+
+ return results;
+ }
+
+ /**
+ * Create a process using info in psDashEPattern
+ * @param matcher
+ * @return
+ */
+ private IProcess createProcess(Matcher matcher) {
+ int pid = Integer.parseInt(matcher.group(1));
+ String cmdLine = matcher.group(2);
+ return new UnixProcess(processLauncherFactory, pid, cmdLine);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/Win32ProcessLister.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/Win32ProcessLister.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/machine/Win32ProcessLister.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.machine;
+
+import org.maemo.esbox.core.machine.*;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * TODO: this is a stub implementation
+ * @author eswartz
+ *
+ */
+public class Win32ProcessLister implements IProcessLister {
+
+ /**
+ * @param hostWindowsMachine
+ */
+ public Win32ProcessLister(IMachine machine) {
+ // TODO Auto-generated constructor stub
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IProcessLister#getProcesses(org.maemo.esbox.core.machine.IProcessFilter)
+ */
+ public List<IProcess> getProcesses(IProcessFilter filter) {
+ return Collections.emptyList();
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDK.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDK.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDK.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.core.sdk;
+
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Base implementation of an SDK
+ * @author eswartz
+ *
+ */
+public abstract class BaseSDK implements ISDK {
+
+ private String version;
+ private String name;
+ protected List<ISDKTarget> targets;
+ private IMachine machine;
+
+ public BaseSDK(IMachine machine, String version, String name) {
+ this.machine = machine;
+ this.version = version;
+ this.name = name;
+ this.targets = new ArrayList<ISDKTarget>();
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDK#getDisplayName()
+ */
+ public String getDisplayName() {
+ String theName = getName();
+ if (!(machine instanceof ILocalMachine)) {
+ theName += MessageFormat.format(" @ {0}",
+ machine.getURI());
+ }
+ return theName;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result +
+ ((version == null) ? 0 : version.hashCode()) +
+ ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final BaseSDK other = (BaseSDK) obj;
+ if (version == null) {
+ if (other.version != null)
+ return false;
+ } else if (!version.equals(other.version))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return getName() + " " + getVersion() + " (" + getSDKRoot() + ")";
+ }
+
+ public ISDKTarget[] getSDKTargets() {
+ return (ISDKTarget[]) targets.toArray(new ISDKTarget[targets.size()]);
+ }
+
+ public String[] getSDKTargetNames() {
+ String[] names = new String[targets.size()];
+ for (int i = 0; i < names.length; i++)
+ names[i] = targets.get(i).getName();
+ return names;
+ }
+
+ public ISDKTarget findSDKTarget(String name) {
+ for (ISDKTarget target : targets) {
+ if (target.getName().equals(name))
+ return target;
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDK#getHostProcessLauncherFactory()
+ */
+ public IProcessLauncherFactory getMachineProcessLauncherFactory() {
+ return machine.getProcessLauncherFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDK#getMachine()
+ */
+ public IMachine getMachine() {
+ return machine;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDK#getFileSystemAccess()
+ */
+ public IFileSystemAccess getMachineFileSystemAccess() {
+ return machine.getFileSystemAccess();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapterClass) {
+ // force loading the adapter -- we're doing this in order to avoid into
+ // Eclipse's bizarre performance hack of ignoring extensions
+ // until you explicitly activate a plugin.
+
+ //return Platform.getAdapterManager().getAdapter(this, adapterClass);
+
+ Object adapter = null;
+ IAdapterManager adapterManager = Platform.getAdapterManager();
+ if (adapterManager.hasAdapter(this, adapterClass.getName())) {
+ adapter = adapterManager.loadAdapter(this, adapterClass.getName());
+ }
+ return adapter;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDKPlatform.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDKPlatform.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDKPlatform.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.core.sdk;
+
+import org.maemo.esbox.core.sdk.ISDKPlatform;
+
+
+/**
+ * @author eswartz
+ *
+ */
+public class BaseSDKPlatform implements ISDKPlatform {
+
+ private String name;
+ private String version;
+
+ /**
+ *
+ */
+ public BaseSDKPlatform(String name, String version) {
+ this.name = name;
+ this.version = version;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKPlatform#getName()
+ */
+ public String getName() {
+ return name;
+ }
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKPlatform#getVersion()
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((version == null) ? 0 : version.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final BaseSDKPlatform other = (BaseSDKPlatform) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (version == null) {
+ if (other.version != null)
+ return false;
+ } else if (!version.equals(other.version))
+ return false;
+ return true;
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDKTarget.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDKTarget.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/BaseSDKTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,239 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.core.sdk;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.core.machine.IFileSystemMapping;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.api.core.machine.IFileSystemMappingImpl;
+
+import java.text.MessageFormat;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class BaseSDKTarget implements ISDKTarget {
+
+ private ISDK sdk;
+ private String name;
+ private String architecture;
+ private ISDKPlatform platform;
+ private IFileSystemMapping fileSystemMapping;
+ private SDKTargetConvertingFileSystemAccess sdkTargetFileSystemAccess;
+ private IFileSystemMappingImpl targetFileSystemMapping;
+
+ /**
+ * Constructor.
+ * @param version the version of Maemo.
+ * @param name the name of SDK version.
+ */
+ public BaseSDKTarget(ISDK sdk, ISDKPlatform platform, String architecture, String name) {
+ if (sdk == null)
+ throw new IllegalArgumentException();
+ if (platform == null)
+ throw new IllegalArgumentException();
+ if (architecture == null)
+ throw new IllegalArgumentException();
+ if (name == null)
+ throw new IllegalArgumentException();
+ this.sdk = sdk;
+ this.platform = platform;
+ this.architecture = architecture;
+ this.name = name;
+ }
+
+ protected void init(IFileSystemMappingImpl targetFileSystemMapping
+ ) {
+ this.targetFileSystemMapping = targetFileSystemMapping;
+ this.fileSystemMapping = new SDKTargetConvertingFileSystemMapping(
+ targetFileSystemMapping,
+ sdk.getMachine().getFileSystemMapping());
+ this.sdkTargetFileSystemAccess = new SDKTargetConvertingFileSystemAccess(this);
+ }
+
+ public ISDKPlatform getPlatform() {
+ return platform;
+ }
+
+ public String getArchitecture() {
+ return architecture;
+ }
+
+ public ISDK getSDK() {
+ return sdk;
+ }
+
+ public IPath getSDKRoot() {
+ return sdk.getSDKRoot();
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDisplayName() {
+ String base;
+ if (!name.toLowerCase().contains(platform.getName().toLowerCase())) {
+ base = MessageFormat.format("{0} ({1} version {2})",
+ name,
+ platform.getName(), platform.getVersion());
+ } else {
+ base = MessageFormat.format("{0} (version {1})",
+ name,
+ platform.getVersion());
+ }
+ return base;
+ }
+
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((sdk == null) ? 0 : sdk.hashCode())
+ + ((platform == null) ? 0 : platform.hashCode())
+ + ((architecture == null) ? 0 : architecture.hashCode())
+ + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final BaseSDKTarget other = (BaseSDKTarget) obj;
+ if (sdk == null) {
+ if (other.sdk != null)
+ return false;
+ } else if (!sdk.equals(other.sdk))
+ return false;
+ if (platform == null) {
+ if (other.platform != null)
+ return false;
+ } else if (!platform.equals(other.platform))
+ return false;
+ if (architecture == null) {
+ if (other.architecture != null)
+ return false;
+ } else if (!architecture.equals(other.architecture))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return getSDK().getName() + " [" + getName() + "]";
+ }
+
+ public int compareTo(ISDKTarget o) {
+ return name.compareTo(o.getName());
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getHostProcessLauncherFactory()
+ */
+ public IProcessLauncherFactory getMachineProcessLauncherFactory() {
+ return sdk.getMachine().getProcessLauncherFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getHostFileSystemAccess()
+ */
+ public IFileSystemAccess getMachineFileSystemAccess() {
+ return sdk.getMachineFileSystemAccess();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getFileSystemAccess()
+ */
+ public IFileSystemAccess getTargetFileSystemAccess() {
+ return sdkTargetFileSystemAccess;
+ }
+
+ public IFileSystemMapping getHostToMachineFileSystemMapping() {
+ return sdk.getMachine().getFileSystemMapping();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getFileSystemMapping()
+ */
+ public IFileSystemMapping getFileSystemMapping() {
+ return fileSystemMapping;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getMachineFileSystemMapping()
+ */
+ public IFileSystemMapping getMachineToSDKTargetFileSystemMapping() {
+ return targetFileSystemMapping;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#convertHostToTargetPath(org.eclipse.core.runtime.IPath)
+ */
+ public IPath convertHostToTargetPath(IPath hostPath) throws ESboxException {
+ IPath targetPath = getFileSystemMapping().convertHostToTargetPath(hostPath);
+ if (targetPath == null)
+ throw new ESboxException("The host path '" + hostPath + "' is not visible in target " + this);
+ return targetPath;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#convertTargetToHostPath(org.eclipse.core.runtime.IPath, boolean)
+ */
+ public IPath convertTargetToHostPath(IPath sdkPath, boolean forceResolve)
+ throws ESboxException {
+ IPath hostPath = getFileSystemMapping().convertTargetToHostPath(sdkPath);
+ if (hostPath == null)
+ throw new ESboxException("The target path '" + sdkPath + "' is not visible in host " + this);
+ return hostPath;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#convertTargetToHostPath(org.eclipse.core.runtime.IPath)
+ */
+ public IPath convertTargetToHostPath(IPath sdkPath) throws ESboxException {
+ return convertTargetToHostPath(sdkPath, true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapterClass) {
+ // force loading the adapter -- we're doing this in order to avoid into
+ // Eclipse's bizarre performance hack of ignoring extensions
+ // until you explicitly activate a plugin.
+
+ //return Platform.getAdapterManager().getAdapter(this, adapterClass);
+
+ Object adapter = null;
+ IAdapterManager adapterManager = Platform.getAdapterManager();
+ if (adapterManager.hasAdapter(this, adapterClass.getName())) {
+ adapter = adapterManager.loadAdapter(this, adapterClass.getName());
+ }
+ return adapter;
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/HostSDK.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/HostSDK.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/HostSDK.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.machine.IMachine;
+
+/**
+ * This represents an SDK for the host Linux system
+ * @author eswartz
+ *
+ */
+public class HostSDK extends BaseSDK {
+
+ private static IPath rootPath = new Path("/");
+
+ public HostSDK(IMachine machine, String version, String name) {
+ super(machine, version, name);
+ targets.add(new HostSDKTarget(this));
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDK#getPreferenceValue(org.maemo.esbox.core.ESboxPreferenceConstants)
+ */
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return "";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDK#getSDKRoot()
+ */
+ public IPath getSDKRoot() {
+ return rootPath;
+ }
+
+ public void refresh() {
+
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/HostSDKTarget.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/HostSDKTarget.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/HostSDKTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.core.sdk;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.api.core.machine.FileSystemMapping;
+
+/**
+ * Basic SDK target for the host machine (likely only meaningful in Linux)
+ * @author eswartz
+ *
+ */
+public class HostSDKTarget extends BaseSDKTarget implements ISDKTarget {
+
+ public HostSDKTarget(ISDK sdk) {
+ super(sdk,
+ new BaseSDKPlatform(Platform.getOS(), ISDKPlatform.VERSION_UNKNOWN),
+ Platform.getOSArch(), "default");
+ init(new FileSystemMapping()
+ //, new AptPackageManager(this)
+ );
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getProcessLauncherFactory()
+ */
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return getSDK().getMachineProcessLauncherFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getSDKTargetRoot()
+ */
+ public IPath getSDKTargetRoot() {
+ return new Path("/");
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.IPreferenceProvider#getPreferenceValue(org.maemo.esbox.core.ESboxPreferenceConstants)
+ */
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return getSDK().getPreferenceValue(key);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKFactoryRefreshJob.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKFactoryRefreshJob.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKFactoryRefreshJob.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.core.sdk;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.core.JobUtils.IJob;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKProvider;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Refresh SDKs, which is a long-running operation. If the virtual build machine is
+ * not alive, it returns immediately with a cancel status.
+ * @author eswartz
+ *
+ */
+public class SDKFactoryRefreshJob extends Job implements IJob {
+
+ private ArrayList<ISDK> sdks;
+ private final List<ISDKProvider> sdkProviders;
+
+ /**
+ * @param sdkProviders
+ * @param name
+ */
+ public SDKFactoryRefreshJob(List<ISDKProvider> sdkProviders) {
+ super("Scanning SDKs...");
+ this.sdkProviders = sdkProviders;
+ setUser(false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ if (!refresh(monitor))
+ return Status.CANCEL_STATUS;
+ return Status.OK_STATUS;
+ }
+
+ public boolean refresh(IProgressMonitor monitor) {
+ ErrorLogger logger = Activator.getErrorLogger();
+ monitor.beginTask("Scanning...", sdkProviders.size() + 1);
+ this.sdks = new ArrayList<ISDK>();
+
+ if (monitor.isCanceled())
+ return false;
+
+ // make sure machines are alive first
+ IMachine[] buildMachines = MachineRegistry.getInstance().getBuildMachines();
+ for (IMachine machine : buildMachines) {
+ if (machine != null && !machine.isAlive()) {
+ MachineManager.getInstance().acquireMachine(machine, new SubProgressMonitor(monitor, 1));
+ }
+ }
+
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return false;
+
+ for (ISDKProvider provider : sdkProviders) {
+ try {
+ List<ISDK> sdks = provider.createSDKs();
+ this.sdks.addAll(sdks);
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return false;
+ } catch (ESboxException e) {
+ logger.logError("Failed to scan SDKs for " + provider, e);
+ }
+ }
+
+ monitor.done();
+ return true;
+ }
+
+ /**
+ * @return
+ */
+ public ArrayList<ISDK> getSDKs() {
+ return sdks;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKTargetConvertingFileSystemAccess.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKTargetConvertingFileSystemAccess.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKTargetConvertingFileSystemAccess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.internal.api.core.sdk;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.core.Activator;
+
+import java.net.URI;
+
+/**
+ * This wrapper converts references to a filesystem from the viewpoint of the SDK target.
+ * For instance, /home/user would convert to /scratchbox/users/user/home/user for an sbox1 target.
+ * The files visible through this accessor are files visible to the SDK target.
+ * <p>
+ * This does <b>not</b> depend on any visibility between the Eclipse host machine and the SDK machine.
+ * @author eswartz
+ *
+ */
+public class SDKTargetConvertingFileSystemAccess implements IFileSystemAccess {
+
+ private final ISDKTarget target;
+
+ /**
+ * @param baseSDKTarget
+ */
+ public SDKTargetConvertingFileSystemAccess(ISDKTarget target) {
+ this.target = target;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemAccess#getFileStore(org.eclipse.core.runtime.IPath)
+ */
+ public IFileStore getFileStore(IPath path) {
+ IPath machinePath;
+ machinePath = target.getMachineToSDKTargetFileSystemMapping().convertTargetToHostPath(path);
+ if (machinePath != null)
+ return target.getMachineFileSystemAccess().getFileStore(machinePath);
+ Activator.getErrorLogger().logError("Cannot get SDK target file store for " + path, null);
+ return EFS.getNullFileSystem().getStore(path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemAccess#getURIForPath(org.eclipse.core.runtime.IPath)
+ */
+ public URI getURIForPath(IPath path) {
+ IPath machinePath;
+ machinePath = target.getMachineToSDKTargetFileSystemMapping().convertTargetToHostPath(path);
+ if (machinePath != null)
+ return target.getMachineFileSystemAccess().getURIForPath(machinePath);
+
+ Activator.getErrorLogger().logError("Cannot get SDK target file store for " + path, null);
+ return EFS.getNullFileSystem().getStore(path).toURI();
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKTargetConvertingFileSystemMapping.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKTargetConvertingFileSystemMapping.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/api/core/sdk/SDKTargetConvertingFileSystemMapping.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,109 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.internal.api.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.machine.IFileSystemMapping;
+import org.maemo.esbox.core.machine.IPathCanonicalizer;
+
+import java.util.*;
+
+/**
+ * This mapping converts Eclipse host paths to the given SDK target.
+ * Typically this maps the user workspace and the shared SDK.
+ * @author eswartz
+ *
+ */
+public class SDKTargetConvertingFileSystemMapping implements IFileSystemMapping {
+
+ private static final IPath[] EMPTY = new IPath[0];
+ private final IFileSystemMapping sdkFileSystemMapping;
+ private final IFileSystemMapping machineFileSystemMapping;
+ private IPathCanonicalizer hostPathCanonicalizer;
+ private IPathCanonicalizer targetPathCanonicalizer;
+
+ /**
+ * @param machineFileSystemMapping
+ */
+ public SDKTargetConvertingFileSystemMapping(
+ IFileSystemMapping sdkFileSystemMapping,
+ IFileSystemMapping machineFileSystemMapping) {
+ hostPathCanonicalizer = sdkFileSystemMapping.getHostPathCanonicalizer();
+ targetPathCanonicalizer = machineFileSystemMapping.getTargetPathCanonicalizer();
+ this.sdkFileSystemMapping = sdkFileSystemMapping;
+ this.machineFileSystemMapping = machineFileSystemMapping;
+
+ }
+
+ public IPathCanonicalizer getHostPathCanonicalizer() {
+ return hostPathCanonicalizer;
+ }
+
+ public IPathCanonicalizer getTargetPathCanonicalizer() {
+ return targetPathCanonicalizer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.FileSystemMapping#convertHostToTargetPath(org.eclipse.core.runtime.IPath)
+ */
+ public synchronized IPath convertHostToTargetPath(IPath hostPath) {
+ IPath[] targetPaths = convertHostToTargetPaths(hostPath);
+ if (targetPaths.length == 0)
+ return null;
+ return targetPaths[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemMapping#convertHostToTargetPaths(org.eclipse.core.runtime.IPath)
+ */
+ public IPath[] convertHostToTargetPaths(IPath hostPath) {
+ IPath[] machinePaths = machineFileSystemMapping.convertHostToTargetPaths(hostPath);
+ IPath candidate = null;
+ Set<IPath> candidates = null;
+ for (IPath machinePath : machinePaths) {
+ IPath[] targetPaths = sdkFileSystemMapping.convertHostToTargetPaths(machinePath);
+ for (IPath targetPath : targetPaths) {
+ if (candidate == null) {
+ candidate = targetPath;
+ } else if (candidates == null) {
+ candidates = new HashSet<IPath>();
+ candidates.add(candidate);
+ candidates.add(targetPath);
+ } else {
+ candidates.add(targetPath);
+ }
+ }
+ }
+ if (candidate == null)
+ return EMPTY;
+ else if (candidates == null)
+ return new IPath[] { candidate };
+ else {
+ // return array in increasing length order (shorter path is more likely the one
+ // that #convertHostToTargetPath() will want)
+ IPath[] pathArray = (IPath[]) candidates.toArray(new IPath[candidates.size()]);
+ Arrays.sort(pathArray, 0, pathArray.length, new Comparator<IPath>() {
+
+ public int compare(IPath o1, IPath o2) {
+ int sdiff = o1.segmentCount() - o2.segmentCount();
+ if (sdiff != 0)
+ return sdiff;
+ return o1.toString().compareTo(o2.toString());
+ }
+
+ });
+ return pathArray;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.FileSystemMapping#convertTargetToHostPath(org.eclipse.core.runtime.IPath)
+ */
+ public synchronized IPath convertTargetToHostPath(IPath remotePath) {
+ IPath machinePath = sdkFileSystemMapping.convertTargetToHostPath(remotePath);
+ if (machinePath == null)
+ return null;
+ return machineFileSystemMapping.convertTargetToHostPath(machinePath);
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/Activator.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/Activator.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,217 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.core;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.env.EnvironmentVariableManager;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ // The message console
+ private ESboxMessageConsole console;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ CorePlugin.getDefault().setContext(context);
+ // initialize common environment early
+ EnvironmentVariableManager.getInstance().startup();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ if (getDefault() == null) {
+ // If the default instance is not yet initialized,
+ // return a static identifier. This identifier must
+ // match the plugin id defined in plugin.xml
+ return PLUGIN_ID;
+ }
+ return getDefault().getBundle().getSymbolicName();
+ }
+
+
+ /**
+ * Convenience method to return a build console which just prints messages and parses errors.
+ * @param brandNew if true, always create a new console, else append to the last one with the same name
+ * @param sdkTarget the SDK target associated, or <code>null</code>
+ * @param name the name of the console.
+ * @return a console with the given name.
+ */
+ public ESboxMessageConsole getConsole(boolean brandNew, ISDKTarget sdkTarget, String name) {
+ if (!PlatformUI.isWorkbenchRunning())
+ return null;
+
+ if (brandNew == true || console == null) {
+
+ String prefix = "ESbox Console";
+ if (sdkTarget != null) {
+ prefix += " - " + sdkTarget.getName();
+ }
+
+ String consoleName = prefix;
+ if (name != null) {
+ consoleName += " - " + name;
+ }
+
+ // remove any consoles for this target when allocating a new one
+ // TODO: reconcile this behavior against the "brandNew" flag
+ org.eclipse.ui.console.IConsole[] existing = ConsolePlugin.getDefault()
+ .getConsoleManager().getConsoles();
+
+ for (int i = 0; i < existing.length; i++) {
+ if (existing[i].getName().indexOf(/*prefix*/ consoleName) != -1) {
+ ConsolePlugin.getDefault().getConsoleManager()
+ .removeConsoles(new org.eclipse.ui.console.IConsole[] { existing[i] });
+ }
+ }
+
+ console = new ESboxMessageConsole(consoleName, null);
+
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(
+ new org.eclipse.ui.console.IConsole[] { console });
+ }
+
+ ConsolePlugin.getDefault().getConsoleManager().showConsoleView(console);
+
+ return console;
+
+ }
+
+ /**
+ * Return the error logger instance of Core plug-in.
+ *
+ * @return the error logger instance of Core plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (Activator.getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/ESboxPreferenceInitializer.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/ESboxPreferenceInitializer.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/ESboxPreferenceInitializer.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.core;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.maemo.esbox.core.*;
+
+import java.io.InputStream;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Initialize a set of important values defined in files esbox_common.xml, sbox_version_1.0.xml, and sbox_version_2.0.xml
+ */
+public class ESboxPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ public static final String SBOX_CONF_FILE_COMMON = "./conf/esbox_common.xml";
+ public static final String SBOX_CONF_FILE_VERSION_1_0 = "./conf/sbox_version_1.0.xml";
+ public static final String SBOX_CONF_FILE_VERSION_2_0 = "./conf/sbox_version_2.0.xml";
+ // bump whenever preferences change enough to warrant reinitializing them from scratch
+ private static final int PREFS_VERSION_MAJOR = 16;
+ // bump whenever new preferences added and we want to merge the preferences
+ private static final int PREFS_VERSION_MINOR = 22;
+
+ /**
+ * Construct an preference initializer for ESbox.
+ */
+ public ESboxPreferenceInitializer() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ public void initializeDefaultPreferences() {
+ IPreferenceStore preferenceStore = CorePlugin.getDefault()
+ .getPreferenceStore();
+
+ String prefsMajorVersionStr = preferenceStore.getString(
+ ESboxPreferenceConstants.VERSION_PREFS_MAJOR.toString());
+ String prefsMinorVersionStr = preferenceStore.getString(
+ ESboxPreferenceConstants.VERSION_PREFS_MINOR.toString());
+ int prefsMajorVersion = 0;
+ int prefsMinorVersion = 0;
+ try {
+ prefsMajorVersion = Integer.parseInt(prefsMajorVersionStr);
+ } catch (NumberFormatException e) {
+ // old ESbox
+ }
+ try {
+ prefsMinorVersion = Integer.parseInt(prefsMinorVersionStr);
+ } catch (NumberFormatException e) {
+ // old ESbox
+ }
+
+ if (prefsMajorVersion < PREFS_VERSION_MAJOR
+ || prefsMinorVersion < PREFS_VERSION_MINOR) { // the plug-in was not used before or is from an older version
+ Properties commonProperties = readDefaultProperties(
+ SBOX_CONF_FILE_COMMON);
+ Properties sbox1Properties = readDefaultProperties(
+ SBOX_CONF_FILE_VERSION_1_0);
+ Properties sbox2Properties = readDefaultProperties(
+ SBOX_CONF_FILE_VERSION_2_0);
+ Properties sboxProperties = new Properties();
+
+ // adjust any environment-dependent defaults
+ String hostEnvKey;
+ if (HostUtils.isWindows())
+ hostEnvKey = "DISPLAY_X_COMMAND_WIN32";
+ else
+ hostEnvKey = "DISPLAY_X_COMMAND_UNIX";
+ commonProperties.put("DISPLAY_X_COMMAND", commonProperties.getProperty(hostEnvKey));
+ commonProperties.remove(hostEnvKey);
+
+ sboxProperties.putAll(commonProperties);
+ sboxProperties.putAll(sbox1Properties);
+ sboxProperties.putAll(sbox2Properties);
+
+ Preferences pluginPreferences = Activator.getDefault().getPluginPreferences();
+
+ // retrieve existing settings if version didn't change
+ Properties existing = new Properties();
+ if (prefsMajorVersion >= PREFS_VERSION_MAJOR) {
+ String[] names = pluginPreferences.propertyNames();
+ for (String name : names) {
+ existing.put(name, pluginPreferences.getString(name));
+ }
+ }
+
+ // update versions
+ sboxProperties.setProperty(ESboxPreferenceConstants.VERSION_PREFS_MAJOR.toString(), "" + PREFS_VERSION_MAJOR);
+ sboxProperties.setProperty(ESboxPreferenceConstants.VERSION_PREFS_MINOR.toString(), "" + PREFS_VERSION_MINOR);
+
+ // now set defaults to match. We leave any ${...} variables in place!
+ for (Map.Entry<Object, Object> entry : sboxProperties.entrySet()) {
+ String key = entry.getKey().toString();
+ pluginPreferences.setDefault(key, entry.getValue().toString());
+ }
+
+ // restore any customized settings
+ for (Map.Entry<Object, Object> entry : existing.entrySet()) {
+ String key = entry.getKey().toString();
+ pluginPreferences.setValue(key, entry.getValue().toString());
+ }
+ }
+ }
+
+ public static Properties readDefaultProperties(String confFile) {
+ // workspace data was changed
+ Properties sboxProperties = new Properties();
+ try {
+ InputStream inputStream = Activator.getPluginRelativeInputStream(confFile);
+ try {
+ sboxProperties.loadFromXML(inputStream);
+ } finally {
+ inputStream.close();
+ }
+ } catch (Exception e) {
+ Activator.getErrorLogger().logAndShowError("Failed to read default preferences", e);
+ }
+ return sboxProperties;
+ }
+}
Added: trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/cpp/Define.java
===================================================================
--- trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/cpp/Define.java (rev 0)
+++ trunk/common/org.maemo.esbox.core/src/org/maemo/esbox/internal/core/cpp/Define.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.core.cpp;
+
+import org.maemo.esbox.core.cpp.IDefine;
+
+public class Define implements IDefine {
+
+ private final String macroName;
+ private final String[] macroArgs;
+ private final String expansion;
+
+ public Define(String macroName, String[] macroArgs, String expansion) {
+ if (macroName == null)
+ throw new IllegalArgumentException();
+ this.macroName = macroName;
+ this.macroArgs = macroArgs;
+ this.expansion = expansion != null ? expansion : "1"; //$NON-NLS-1$
+ }
+
+ public String[] getArgumentNames() {
+ return macroArgs;
+ }
+
+ public String getExpansion() {
+ return expansion;
+ }
+
+ public String getName() {
+ return macroName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.cpp.IDefine#getPrototype()
+ */
+ public String getPrototype() {
+ StringBuilder builder = new StringBuilder();
+ builder.append(macroName);
+ if (macroArgs != null) {
+ builder.append('(');
+ boolean first = true;
+ for (String arg : macroArgs) {
+ if (first)
+ first = false;
+ else
+ builder.append(',');
+ builder.append(arg);
+ }
+ builder.append(')');
+ }
+ return builder.toString();
+ }
+}
Property changes on: trunk/common/org.maemo.esbox.core-feature
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.core-feature/.project
===================================================================
--- trunk/common/org.maemo.esbox.core-feature/.project (rev 0)
+++ trunk/common/org.maemo.esbox.core-feature/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.core-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.core-feature/TODO.txt
===================================================================
--- trunk/common/org.maemo.esbox.core-feature/TODO.txt (rev 0)
+++ trunk/common/org.maemo.esbox.core-feature/TODO.txt 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3 @@
+
+This currently includes the help plugin, but that's really
+a product plugin, not a core plugin or other feature plugin.
Added: trunk/common/org.maemo.esbox.core-feature/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.core-feature/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.core-feature/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3 @@
+bin.includes = feature.xml,\
+ license.html,\
+ licenses/
Added: trunk/common/org.maemo.esbox.core-feature/feature.xml
===================================================================
--- trunk/common/org.maemo.esbox.core-feature/feature.xml (rev 0)
+++ trunk/common/org.maemo.esbox.core-feature/feature.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.maemo.esbox.core"
+ label="ESbox Core Feature"
+ version="1.5.0.qualifier"
+ provider-name="INdT / Nokia">
+
+ <description>
+ Core components for the ESbox environment. This provides an
+abstraction for SDKs, SDK targets, process launching, filesystem
+access, analysis engines, and machines, in order to support a development
+environment that abstracts away differences between local, sandbox,
+virtual machines, remote machines, and device hosts and targets.
+ </description>
+
+ <copyright>
+ Copyright (c) 2007-2008 INdT, (c) 2007-2008 Nokia. All rights reserved.
+ </copyright>
+
+ <license url="http://www.eclipse.org/legal/epl-v10.html">
+ For legal terms, see the Eclipse Public License.
+ </license>
+
+ <url>
+ <update label="Update Site for ESbox project" url="http://esbox.garage.maemo.org/update"/>
+ </url>
+
+ <requires>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.ui.console"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.core.net"/>
+ <import plugin="org.eclipse.ui.net"/>
+ <import plugin="org.eclipse.core.filesystem" version="1.2.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.jface.text" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="com.nokia.cpp.utils.core" version="1.0.0" match="greaterOrEqual"/>
+ <import plugin="com.nokia.cpp.utils.ui" version="1.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.debug.ui" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.project.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.ui" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.resources" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.expressions" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui.ide" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.jsch.core" version="1.1.100" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.jsch.ui" version="1.1.100" match="greaterOrEqual"/>
+ <import plugin="com.jcraft.jsch" version="0.1.37" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.launch" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.analysis" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.analysis.ui" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.ssh" version="1.5.0" match="greaterOrEqual"/>
+ </requires>
+
+ <plugin
+ id="org.maemo.esbox.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.launch"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.project.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.project.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.ssh"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.analysis"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.analysis.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.analysis.launch"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.help"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+</feature>
Added: trunk/common/org.maemo.esbox.core-feature/license.html
===================================================================
--- trunk/common/org.maemo.esbox.core-feature/license.html (rev 0)
+++ trunk/common/org.maemo.esbox.core-feature/license.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+<html>
+<head>
+<title>ESbox License</title>
+</head>
+
+<body>
+<h2>ESbox Software User Agreement</h2>
+<p>16<sup>th</sup> April, 2008</p>
+
+<h3>ESbox</h3>
+
+<p>ESbox is licensed under the terms of the <a href="licenses/epl-v10.html">Eclipse Public License v1.0</a>.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>ESbox has a set of open source templates to help the development of applications. Such templates are distributed
+under <a href="licenses/COPYING.LESSER">LGPL license.</a></p>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THIS CONTENT.</p>
+
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.core-feature/licenses/COPYING
===================================================================
--- trunk/common/org.maemo.esbox.core-feature/licenses/COPYING (rev 0)
+++ trunk/common/org.maemo.esbox.core-feature/licenses/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/common/org.maemo.esbox.core-feature/licenses/COPYING.LESSER
===================================================================
--- trunk/common/org.maemo.esbox.core-feature/licenses/COPYING.LESSER (rev 0)
+++ trunk/common/org.maemo.esbox.core-feature/licenses/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/common/org.maemo.esbox.core-feature/licenses/epl-v10.html
===================================================================
--- trunk/common/org.maemo.esbox.core-feature/licenses/epl-v10.html (rev 0)
+++ trunk/common/org.maemo.esbox.core-feature/licenses/epl-v10.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ at font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+ at page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
Property changes on: trunk/common/org.maemo.esbox.core.tests
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.core.tests/.classpath
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/.classpath (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/org.maemo.esbox.core.tests/.project
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/.project (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.core.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.core.tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:56:35 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/org.maemo.esbox.core.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Core Feature Tests Plug-in
+Bundle-SymbolicName: org.maemo.esbox.core.tests
+Bundle-Version: 1.5.0.qualifier
+Bundle-CoreActivator: org.maemo.esbox.core.tests.noexport.TestActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.junit4;bundle-version="4.3.1",
+ org.eclipse.core.resources;bundle-version="3.4.0",
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.ssh;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.core.tests,
+ org.maemo.esbox.core.tests.core
+Bundle-Activator: org.maemo.esbox.internal.core.tests.TestActivator
Added: trunk/common/org.maemo.esbox.core.tests/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ data/
Added: trunk/common/org.maemo.esbox.core.tests/data/dumbData.dat
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/data/dumbData.dat (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/data/dumbData.dat 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,253 @@
+[2008-07-07 23:01:06 17829] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/dbus-daemon /usr/bin/dbus-daemon --system"
+[2008-07-07 23:01:06 17841] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/dbus-daemon /usr/bin/dbus-daemon --session --print-address=2"
+[2008-07-07 23:01:08 17853] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/maemo-launcher /usr/bin/maemo-launcher --daemon --send-app-died --booster gtk"
+[2008-07-07 23:01:12 17853] rc: 0 time: 4.062828
+[2008-07-07 23:01:12 17857] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/maemo-launcher/defender /usr/lib/maemo-launcher/defender 17856"
+[2008-07-07 23:01:12 17857] rc: 11 time: 0.015420
+[2008-07-07 23:01:12 17870] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/sapwood/sapwood-server /usr/lib/sapwood/sapwood-server"
+[2008-07-07 23:01:13 17883] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/matchbox-window-manager /usr/bin/matchbox-window-manager -theme default -use_titlebar yes -use_desktop_mode plain -use_lowlight no -use_cursor yes -use_dialog_mode static -use_super_modal yes"
+[2008-07-07 23:01:13 17897] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/clipboard-manager /usr/bin/clipboard-manager"
+[2008-07-07 23:01:13 17912] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-input-method /usr/bin/hildon-input-method"
+[2008-07-07 23:01:13 17930] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-desktop /usr/bin/hildon-desktop"
+[2008-07-07 23:01:14 17937] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/gconf2/gconfd-2 /usr/lib/gconf2/gconfd-2"
+[2008-07-07 23:01:20 17946] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-07 23:01:20 17946] rc: 0 time: 0.165247
+[2008-07-07 23:01:21 17949] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-07 23:01:21 17949] rc: 0 time: 0.018289
+[2008-07-07 23:01:23 17958] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-background-manager /usr/bin/hildon-background-manager"
+[2008-07-07 23:01:23 17958] rc: 0 time: 0.585510
+[2008-07-07 23:01:23 17960] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/bin/pidof pidof osso_startup_greeting"
+[2008-07-07 23:01:23 17960] rc: 1 time: 0.046808
+[2008-07-07 23:22:23 18725] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-07 23:22:23 18725] rc: 0 time: 0.011010
+[2008-07-07 23:24:22 18849] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-07 23:24:22 18849] rc: 0 time: 0.027738
+[2008-07-07 23:24:41 18856] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-07 23:24:41 18856] rc: 0 time: 0.016500
+[2008-07-07 23:25:28 18866] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-07 23:25:29 18866] rc: 0 time: 0.108570
+[2008-07-10 05:11:04 14216] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:11:04 14216] rc: 0 time: 0.147021
+[2008-07-10 05:11:24 14518] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:11:24 14518] rc: 0 time: 0.010826
+[2008-07-10 05:12:17 14744] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:12:17 14744] rc: 0 time: 0.010291
+[2008-07-10 05:14:17 14857] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:14:17 14857] rc: 0 time: 0.033528
+[2008-07-10 05:14:18 14863] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:14:18 14863] rc: 0 time: 0.061378
+[2008-07-10 05:14:19 14869] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:14:19 14869] rc: 0 time: 0.084922
+[2008-07-10 05:22:02 15326] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:22:02 15326] rc: 0 time: 0.012590
+[2008-07-10 05:22:07 15332] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:22:07 15332] rc: 0 time: 0.013909
+[2008-07-10 05:34:19 15974] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:34:19 15974] rc: 0 time: 0.070948
+[2008-07-10 05:34:44 16071] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:34:44 16071] rc: 0 time: 0.048466
+[2008-07-10 05:34:51 16285] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:34:51 16285] rc: 0 time: 0.012728
+[2008-07-10 05:35:48 16593] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:35:48 16593] rc: 0 time: 0.011081
+[2008-07-10 05:37:36 16903] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:37:36 16903] rc: 0 time: 0.014589
+[2008-07-10 05:38:07 16992] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:38:07 16992] rc: 0 time: 0.009935
+[2008-07-10 05:38:09 17001] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:38:09 17001] rc: 0 time: 0.010221
+[2008-07-10 05:38:09 17004] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:38:09 17004] rc: 0 time: 0.014513
+[2008-07-10 05:38:10 17010] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:38:10 17010] rc: 0 time: 0.119420
+[2008-07-10 05:38:11 17016] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:38:11 17016] rc: 0 time: 0.019741
+[2008-07-10 05:39:08 17638] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:39:08 17638] rc: 0 time: 0.042266
+[2008-07-10 05:39:14 17641] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:39:14 17641] rc: 0 time: 0.010997
+[2008-07-10 05:41:32 18523] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:41:32 18523] rc: 0 time: 0.010169
+[2008-07-10 05:41:47 18613] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:41:47 18613] rc: 0 time: 0.028879
+[2008-07-10 05:41:57 18827] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:41:57 18827] rc: 0 time: 0.016547
+[2008-07-10 05:42:06 18924] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:42:06 18924] rc: 0 time: 0.015389
+[2008-07-10 05:42:10 18929] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:42:10 18929] rc: 0 time: 0.030156
+[2008-07-10 05:42:11 18933] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:42:11 18933] rc: 0 time: 0.068367
+[2008-07-10 05:44:02 19257] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:44:02 19257] rc: 0 time: 0.010430
+[2008-07-10 05:44:08 19264] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:44:08 19264] rc: 0 time: 0.021694
+[2008-07-10 05:45:27 20196] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:45:27 20196] rc: 0 time: 0.031797
+[2008-07-10 05:45:38 20411] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:45:38 20411] rc: 0 time: 0.011968
+[2008-07-10 05:46:35 20504] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:46:35 20504] rc: 0 time: 0.010192
+[2008-07-10 05:46:36 20510] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:46:36 20510] rc: 0 time: 0.031100
+[2008-07-10 05:47:46 20838] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:47:46 20838] rc: 0 time: 0.042461
+[2008-07-10 05:47:55 20847] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:47:55 20847] rc: 0 time: 0.016095
+[2008-07-10 05:50:02 17937] rc: 1 time: 197328.520719
+[2008-07-10 05:50:24 21613] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/dbus-daemon /usr/bin/dbus-daemon --session --print-address=2"
+[2008-07-10 05:50:24 21603] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/dbus-daemon /usr/bin/dbus-daemon --system"
+[2008-07-10 05:50:26 21625] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/maemo-launcher /usr/bin/maemo-launcher --daemon --send-app-died --booster gtk"
+[2008-07-10 05:50:27 21625] rc: 0 time: 0.953035
+[2008-07-10 05:50:27 21629] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/maemo-launcher/defender /usr/lib/maemo-launcher/defender 21628"
+[2008-07-10 05:50:27 21629] rc: 11 time: 0.006986
+[2008-07-10 05:50:27 21640] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/sapwood/sapwood-server /usr/lib/sapwood/sapwood-server"
+[2008-07-10 05:50:27 21651] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/matchbox-window-manager /usr/bin/matchbox-window-manager -theme default -use_titlebar yes -use_desktop_mode plain -use_lowlight no -use_cursor yes -use_dialog_mode static -use_super_modal yes"
+[2008-07-10 05:50:27 21662] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/clipboard-manager /usr/bin/clipboard-manager"
+[2008-07-10 05:50:27 21674] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-input-method /usr/bin/hildon-input-method"
+[2008-07-10 05:50:27 21682] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/gconf2/gconfd-2 /usr/lib/gconf2/gconfd-2"
+[2008-07-10 05:50:28 21693] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-desktop /usr/bin/hildon-desktop"
+[2008-07-10 05:50:29 21700] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:50:29 21700] rc: 0 time: 0.012133
+[2008-07-10 05:50:30 21703] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:50:30 21703] rc: 0 time: 0.067427
+[2008-07-10 05:50:33 21706] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-background-manager /usr/bin/hildon-background-manager"
+[2008-07-10 05:50:33 21706] rc: 0 time: 0.685203
+[2008-07-10 05:50:33 21708] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/bin/pidof pidof osso_startup_greeting"
+[2008-07-10 05:50:33 21708] rc: 1 time: 0.085293
+[2008-07-10 05:51:04 22055] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/dbus-daemon /usr/bin/dbus-daemon --system"
+[2008-07-10 05:51:04 22066] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/dbus-daemon /usr/bin/dbus-daemon --session --print-address=2"
+[2008-07-10 05:51:06 22077] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/maemo-launcher /usr/bin/maemo-launcher --daemon --send-app-died --booster gtk"
+[2008-07-10 05:51:07 22077] rc: 0 time: 0.496707
+[2008-07-10 05:51:07 22081] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/maemo-launcher/defender /usr/lib/maemo-launcher/defender 22080"
+[2008-07-10 05:51:07 22081] rc: 11 time: 0.008000
+[2008-07-10 05:51:07 22092] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/sapwood/sapwood-server /usr/lib/sapwood/sapwood-server"
+[2008-07-10 05:51:07 22103] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/matchbox-window-manager /usr/bin/matchbox-window-manager -theme default -use_titlebar yes -use_desktop_mode plain -use_lowlight no -use_cursor yes -use_dialog_mode static -use_super_modal yes"
+[2008-07-10 05:51:07 22114] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/clipboard-manager /usr/bin/clipboard-manager"
+[2008-07-10 05:51:07 22103] rc: 1 time: 0.072737
+[2008-07-10 05:51:07 22114] rc: 1 time: 0.041263
+[2008-07-10 05:51:07 22092] rc: 250 time: 0.137626
+[2008-07-10 05:51:07 22126] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-input-method /usr/bin/hildon-input-method"
+[2008-07-10 05:51:07 22142] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-desktop /usr/bin/hildon-desktop"
+[2008-07-10 05:51:07 22149] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/gconf2/gconfd-2 /usr/lib/gconf2/gconfd-2"
+[2008-07-10 05:51:08 22152] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:51:08 22152] rc: 0 time: 0.011412
+[2008-07-10 05:51:08 22155] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:51:08 22155] rc: 0 time: 0.009976
+[2008-07-10 05:51:09 22158] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-background-manager /usr/bin/hildon-background-manager"
+[2008-07-10 05:51:10 22160] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/bin/pidof pidof osso_startup_greeting"
+[2008-07-10 05:51:10 22158] rc: 0 time: 0.785077
+[2008-07-10 05:51:10 22160] rc: 1 time: 0.052933
+[2008-07-10 05:51:32 21682] rc: 0 time: 64.740451
+[2008-07-10 05:51:32 22149] rc: 0 time: 25.006400
+[2008-07-10 05:52:29 22448] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu" cmd: "/usr/bin/dbus-daemon /usr/bin/dbus-daemon --system"
+[2008-07-10 05:52:30 22459] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu" cmd: "/usr/bin/dbus-daemon /usr/bin/dbus-daemon --session --print-address=2"
+[2008-07-10 05:52:32 22470] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/maemo-launcher /usr/bin/maemo-launcher --daemon --send-app-died --booster gtk"
+[2008-07-10 05:52:32 22470] rc: 0 time: 0.474598
+[2008-07-10 05:52:32 22474] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/maemo-launcher/defender /usr/lib/maemo-launcher/defender 22473"
+[2008-07-10 05:52:32 22474] rc: 11 time: 0.007280
+[2008-07-10 05:52:32 22485] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu" cmd: "/usr/lib/sapwood/sapwood-server /usr/lib/sapwood/sapwood-server"
+[2008-07-10 05:52:32 22496] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu" cmd: "/usr/bin/matchbox-window-manager /usr/bin/matchbox-window-manager -theme default -use_titlebar yes -use_desktop_mode plain -use_lowlight no -use_cursor yes -use_dialog_mode static -use_super_modal yes"
+[2008-07-10 05:52:33 22507] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu" cmd: "/usr/bin/clipboard-manager /usr/bin/clipboard-manager"
+[2008-07-10 05:52:33 22511] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu" cmd: "/usr/lib/gconf2/gconfd-2 /usr/lib/gconf2/gconfd-2"
+[2008-07-10 05:52:33 22522] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu" cmd: "/usr/bin/hildon-input-method /usr/bin/hildon-input-method"
+[2008-07-10 05:52:33 22538] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu" cmd: "/usr/bin/hildon-desktop /usr/bin/hildon-desktop"
+[2008-07-10 05:52:33 22543] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:52:33 22543] rc: 0 time: 0.012941
+[2008-07-10 05:52:34 22546] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:52:34 22546] rc: 0 time: 0.027420
+[2008-07-10 05:52:35 22553] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu" cmd: "/usr/bin/hildon-background-manager /usr/bin/hildon-background-manager"
+[2008-07-10 05:52:36 22553] rc: 0 time: 0.441655
+[2008-07-10 05:52:36 22555] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/bin/pidof pidof osso_startup_greeting"
+[2008-07-10 05:52:36 22555] rc: 1 time: 0.039928
+[2008-07-10 05:53:21 22511] rc: 1 time: 48.043127
+[2008-07-10 05:56:14 22915] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/dbus-daemon /usr/bin/dbus-daemon --system"
+[2008-07-10 05:56:14 22926] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/dbus-daemon /usr/bin/dbus-daemon --session --print-address=2"
+[2008-07-10 05:56:16 22937] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/maemo-launcher /usr/bin/maemo-launcher --daemon --send-app-died --booster gtk"
+[2008-07-10 05:56:17 22937] rc: 0 time: 0.510497
+[2008-07-10 05:56:17 22941] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/maemo-launcher/defender /usr/lib/maemo-launcher/defender 22940"
+[2008-07-10 05:56:17 22941] rc: 11 time: 0.008601
+[2008-07-10 05:56:17 22952] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/sapwood/sapwood-server /usr/lib/sapwood/sapwood-server"
+[2008-07-10 05:56:17 22963] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/matchbox-window-manager /usr/bin/matchbox-window-manager -theme default -use_titlebar yes -use_desktop_mode plain -use_lowlight no -use_cursor yes -use_dialog_mode static -use_super_modal yes"
+[2008-07-10 05:56:17 22974] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/clipboard-manager /usr/bin/clipboard-manager"
+[2008-07-10 05:56:17 22980] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/lib/gconf2/gconfd-2 /usr/lib/gconf2/gconfd-2"
+[2008-07-10 05:56:17 22989] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-input-method /usr/bin/hildon-input-method"
+[2008-07-10 05:56:17 23005] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-desktop /usr/bin/hildon-desktop"
+[2008-07-10 05:56:18 23012] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:56:18 23012] rc: 0 time: 0.047614
+[2008-07-10 05:56:19 23015] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 05:56:19 23015] rc: 0 time: 0.010371
+[2008-07-10 05:56:20 23018] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/hildon-background-manager /usr/bin/hildon-background-manager"
+[2008-07-10 05:56:20 23020] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/bin/pidof pidof osso_startup_greeting"
+[2008-07-10 05:56:20 23018] rc: 0 time: 0.566177
+[2008-07-10 05:56:21 23020] rc: 1 time: 0.053200
+[2008-07-10 06:00:30 23570] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:00:30 23570] rc: 0 time: 0.031776
+[2008-07-10 06:03:03 23701] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:03:03 23701] rc: 0 time: 0.014554
+[2008-07-10 06:03:06 23704] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:03:06 23704] rc: 0 time: 0.037708
+[2008-07-10 06:03:07 23715] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:03:07 23715] rc: 0 time: 0.020200
+[2008-07-10 06:09:02 24820] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:09:02 24820] rc: 0 time: 0.012576
+[2008-07-10 06:09:09 24830] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:09:09 24830] rc: 0 time: 0.016821
+[2008-07-10 06:14:47 26295] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:14:47 26295] rc: 0 time: 0.011828
+[2008-07-10 06:14:56 26385] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:14:56 26385] rc: 0 time: 0.029043
+[2008-07-10 06:17:53 26653] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:17:53 26653] rc: 0 time: 0.022381
+[2008-07-10 06:18:11 26757] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:18:11 26757] rc: 0 time: 0.015507
+[2008-07-10 06:18:15 26760] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:18:15 26760] rc: 0 time: 0.014326
+[2008-07-10 06:18:16 26766] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:18:16 26766] rc: 0 time: 0.024808
+[2008-07-10 06:53:52 27844] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:53:52 27844] rc: 0 time: 0.117675
+[2008-07-10 06:54:40 27900] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:54:40 27900] rc: 0 time: 0.018029
+[2008-07-10 06:59:44 28306] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 06:59:44 28306] rc: 0 time: 0.030356
+[2008-07-10 07:00:22 28411] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 07:00:22 28411] rc: 0 time: 0.048184
+[2008-07-10 07:00:48 28417] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 07:00:48 28417] rc: 0 time: 0.012005
+[2008-07-10 07:00:49 28420] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 07:00:49 28420] rc: 0 time: 0.020003
+[2008-07-10 07:01:43 29035] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 07:01:43 29035] rc: 0 time: 0.049121
+[2008-07-10 07:01:47 29041] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 07:01:47 29041] rc: 0 time: 0.037290
+[2008-07-10 17:41:56 30652] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 17:41:56 30652] rc: 0 time: 0.175308
+[2008-07-10 17:41:59 30655] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 17:41:59 30655] rc: 0 time: 0.010074
+[2008-07-10 17:42:38 30963] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 17:42:38 30963] rc: 0 time: 0.012811
+[2008-07-10 17:42:41 30966] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 17:42:41 30966] rc: 0 time: 0.016502
+[2008-07-10 17:50:37 31625] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 17:50:37 31625] rc: 0 time: 0.011824
+[2008-07-10 17:50:40 31628] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-10 17:50:40 31628] rc: 0 time: 0.017628
+[2008-07-11 22:12:52 7057] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu/workspace/cpphelloworld2" cmd: "/home/ubuntu/workspace/cpphelloworld2/src/helloworld /home/ubuntu/workspace/cpphelloworld2/src/helloworld"
+[2008-07-11 22:13:17 7064] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-11 22:13:17 7064] rc: 0 time: 0.043050
+[2008-07-11 22:13:18 7057] rc: 241 time: 26.679089
+[2008-07-11 22:13:20 7067] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-11 22:13:20 7067] rc: 0 time: 0.024531
+[2008-07-11 22:13:36 7205] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu/workspace/cpphelloworld2" cmd: "/home/ubuntu/workspace/cpphelloworld2/src/helloworld /home/ubuntu/workspace/cpphelloworld2/src/helloworld"
+[2008-07-11 22:13:37 7208] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-11 22:13:37 7208] rc: 0 time: 0.025107
+[2008-07-11 22:13:41 7205] rc: 241 time: 4.577191
+[2008-07-11 22:13:41 7211] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-11 22:13:41 7211] rc: 0 time: 0.009539
+[2008-07-11 22:14:06 7354] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/home/ubuntu/workspace/cpphelloworld2" cmd: "/home/ubuntu/workspace/cpphelloworld2/src/helloworld /home/ubuntu/workspace/cpphelloworld2/src/helloworld"
+[2008-07-11 22:14:07 7357] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-11 22:14:07 7357] rc: 0 time: 0.075502
+[2008-07-11 22:14:32 7354] rc: 0 time: 25.403755
+[2008-07-11 22:14:32 7366] method: "/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2" pwd: "/" cmd: "/usr/bin/esd /usr/bin/esd -promiscuous -nobeeps -spawnfd 13"
+[2008-07-11 22:14:32 7366] rc: 0 time: 0.050567
Added: trunk/common/org.maemo.esbox.core.tests/data/projects/standalone-project/.esbox_settings
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/data/projects/standalone-project/.esbox_settings (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/data/projects/standalone-project/.esbox_settings 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<settings>
+ <configs currentConfig="Scratchbox 1~CHINOOK_ARMEL">
+ <config id="Scratchbox 1~CHINOOK_X86" name="my x86 target"
+ sdkName="Scratchbox 1" targetName="CHINOOK_X86"
+ executionEnvironment="gtk" />
+ <config id="Scratchbox 1~CHINOOK_ARMEL" name="my arm target"
+ sdkName="Scratchbox 1" targetName="CHINOOK_ARMEL"
+ executionEnvironment="maemo" />
+ </configs>
+</settings>
Added: trunk/common/org.maemo.esbox.core.tests/data/projects/standalone-project/.project
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/data/projects/standalone-project/.project (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/data/projects/standalone-project/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>gtkhelloworldcproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.maemo.esbox.project.core.esboxAutotoolsBuilder</name>
+ <arguments/>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/MockSDK.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/MockSDK.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/MockSDK.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.tests;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.internal.api.core.sdk.BaseSDK;
+
+/**
+ * @author eswartz
+ *
+ */
+public class MockSDK extends BaseSDK implements ISDK {
+
+ /**
+ * @param machine
+ * @param version
+ * @param name
+ */
+ public MockSDK(IMachine machine, String version, String name) {
+ super(machine, version, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDK#getSDKRoot()
+ */
+ public IPath getSDKRoot() {
+ return Path.ROOT;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDK#refresh()
+ */
+ public void refresh() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.IPreferenceProvider#getPreferenceValue(org.maemo.esbox.core.ESboxPreferenceConstants)
+ */
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return "";
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/MockSDKTarget.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/MockSDKTarget.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/MockSDKTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.tests;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.api.core.sdk.BaseSDKTarget;
+
+/**
+ * @author eswartz
+ *
+ */
+public class MockSDKTarget extends BaseSDKTarget implements ISDKTarget {
+
+ /**
+ * @param sdk
+ * @param platform
+ * @param architecture
+ * @param name
+ */
+ public MockSDKTarget(ISDK sdk, ISDKPlatform platform, String architecture,
+ String name) {
+ super(sdk, platform, architecture, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getProcessLauncherFactory()
+ */
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getSDKTargetRoot()
+ */
+ public IPath getSDKTargetRoot() {
+ return Path.ROOT;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.IPreferenceProvider#getPreferenceValue(org.maemo.esbox.core.ESboxPreferenceConstants)
+ */
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return "";
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/TestUtils.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/TestUtils.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/TestUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,435 @@
+package org.maemo.esbox.core.tests;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.*;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.core.sdk.SDKFactory;
+import org.osgi.framework.Bundle;
+
+import java.io.*;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * Utilities for test.
+ */
+/**
+ * @author LWang.
+ *
+ */
+public class TestUtils {
+
+ /************* Utility methods **********************/
+
+ public static String[] getFileNamesInFolder(final String folderName, final String fileExtention) {
+ File folder = new File(folderName);
+
+ String[] files = folder.list(new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ return name.endsWith(fileExtention);
+ }
+
+ });
+
+ return files;
+ }
+
+ public static String[] getFileFullNamesInFolder(final String folderName, final String fileExtention) {
+ String[] files = getFileNamesInFolder(folderName, fileExtention);
+
+ for (int i=0; i < files.length; i++) {
+ files[i] = folderName + "/" + files[i];
+ }
+
+ return files;
+ }
+
+ public static void copyFile(String src, String dst) throws CoreException {
+ EFS.getLocalFileSystem().getStore(new Path(src)).
+ copy(EFS.getLocalFileSystem().getStore(new Path(dst)), 0, null);
+ }
+
+ public static void unzipFile(File zipFile, String targetPath) throws Exception
+ {
+ IProcessLauncherFactory processLauncherFactory = new HostProcessLauncherFactory();
+
+ List<String> cmdLine = new ArrayList<String>();
+
+ // unzip zipFile -d targetPath
+ cmdLine.add("unzip");
+
+ cmdLine.add("-o"); // overwrite files WITHOUT prompting
+ cmdLine.add(zipFile.getAbsolutePath());
+ cmdLine.add("-d");
+ cmdLine.add(targetPath);
+
+ IProcessLauncher processLauncher = processLauncherFactory.createProcessLaunchHandler(
+ null, // workingDir
+ cmdLine,
+ null // env
+ );
+
+ Process process = processLauncher.createProcess();
+
+ if (process != null)
+ process.waitFor();
+ }
+
+ /**
+ * Import a project from the given folder directly into the workspace.
+ * You probably want to copy the project somewhere first if you're making
+ * changes!
+ * @param projectName
+ * @param containingFolder
+ * @return
+ * @throws FileNotFoundException
+ * @throws CoreException
+ */
+ public static IProject importProject(String projectName, File containingFolder) throws FileNotFoundException, CoreException {
+ if (! isProjectDirectory(containingFolder))
+ throw new FileNotFoundException("No .project file in " + containingFolder); // .project file not found
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+
+ File projectFile = new File(containingFolder, ".project");
+ IPath path = new Path(projectFile.getPath());
+ IProjectDescription description = workspace.loadProjectDescription(path);
+ IProject newProjectHandle = root.getProject(projectName != null ? projectName : description.getName());
+ newProjectHandle.create(description, null);
+ newProjectHandle.open(null);
+ return newProjectHandle;
+ }
+
+ public static IProject importProject(File containingFolder) throws FileNotFoundException, CoreException {
+ return importProject(null, containingFolder);
+ }
+
+ /**
+ * Copy a project from contentsPath in the plugin thisPlugin into the path destPath
+ * and import it into the workspace as a project named name.
+ * @param thisPlugin
+ * @param contentsPath
+ * @param name
+ * @param destPath
+ * @return
+ * @throws Exception
+ */
+ public static IProject copyAndImportProject(String thisPlugin, String contentsPath, String name, IPath destPath) throws Exception {
+ final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ TestUtils.deleteProject(project);
+
+ File srcFile = TestUtils.projectRelativeFile(thisPlugin, contentsPath);
+ File destFile = destPath.toFile();
+ TestUtils.delTree(destFile);
+ destFile.mkdirs();
+ TestUtils.copyTree(srcFile, destFile, null);
+ destFile = new File(destFile, srcFile.getName());
+
+ return TestUtils.importProject(name, destFile);
+ }
+
+ /**
+ * Return true if the given directory seems to be an Eclipse project directory
+ */
+ public static boolean isProjectDirectory(File projectFolder) {
+ boolean result = false;
+ if (projectFolder.isDirectory()) {
+ File projectFile = new File(projectFolder, ".project");
+ result = projectFile.exists();
+ }
+ return result;
+ }
+
+ /**
+ * Shows a perspective based on its id.
+ * @param perspectiveID - the id of the perspective to show
+ * @throws Exception - any exception is propagated to the caller.
+ */
+ public static void showPerspective(final String perspectiveID) throws Exception {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ IWorkbenchWindow window = wb.getActiveWorkbenchWindow();
+ if (window != null && window.getShell() != null && !window.getShell().isDisposed()) {
+ try {
+ wb.showPerspective(perspectiveID, window);
+ } catch (WorkbenchException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ });
+ }
+
+
+ /** Copy files or directories from 'from' to 'to'.
+ *
+ * Recursively descends if 'from' is a directory.
+ * Creates 'from' tail directory in 'to', e.g.:
+ * from = c:/foo/bar
+ * to = c:/temp
+ *
+ * -->
+ *
+ * c:/temp/bar
+ *
+ * @param from
+ * @param to
+ * @param filter the filename filter, or null
+ */
+ public static void copyTree(File from, File to, FileFilter filter) throws IOException {
+ File[] children;
+
+ if (!from.exists()) {
+ throw new IOException ("Source of copy \'" + from.getName() + "\' doesn't exist");
+ }
+
+ if (to.getCanonicalPath().equals(from.getCanonicalPath())) {
+ throw new IOException ("\'" + from.getName() + "\' cannot copy to itself");
+ }
+
+ if (from.isDirectory()) {
+ children = from.listFiles(filter);
+ // just like cp command, if target exist, make a new folder into
+ // the target, copy content into the target folder
+ if (to.exists()) {
+ if (to.isFile()) {
+ throw new IOException("Cannot overwrite non-directory \'" + to.getName() + "\' with directory " + from.getName());
+ }
+ // copy into new directory name grafted after the existing one
+ to = new File(to, from.getName());
+ copyTree(from, to, filter);
+ return;
+ } else {
+ // copy into new directory name
+ to.mkdir();
+ for (int i = 0; i < children.length; i++) {
+ File curto = new File(to, children[i].getName());
+
+ copyTree(children[i], curto, filter);
+ }
+ return;
+ }
+ }
+ else {
+ if (to.isDirectory()) {
+ to = new File (to, from.getName());
+ }
+ copyFile(from, to);
+ return;
+ }
+
+ }
+
+ /** Copy files or directories from 'from' to 'to'.
+ *
+ * Recursively descends if 'from' is a directory.
+ * Does not create 'from' tail directory in 'to', e.g.:
+ * from = c:/foo/bar contains a,b,c
+ * to = c:/temp
+ *
+ * -->
+ *
+ * c:/temp/a
+ * c:/temp/b
+ * c:/temp/c
+ *
+ * @param from
+ * @param to
+ * @param filter the filename filter, or null
+ */
+ public static void copyTreeNoParent(File from, File to, FileFilter filter) throws IOException {
+ File[] files;
+
+ if (!from.isDirectory())
+ throw new IllegalArgumentException();
+
+ files = from.listFiles(filter);
+ to.mkdirs();
+
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory()) {
+ //File curto = new File(to, files[i].getName());
+ //curto.mkdirs();
+ copyTree(files[i], to, filter);
+ }
+ else {
+ File curto = new File(to, files[i].getName());
+ copyFile(files[i], curto);
+ }
+ }
+
+ }
+
+ /**
+ * Copy from an input stream to a file
+ *
+ * @param in
+ * @param to
+ * @throws IOException
+ */
+ public static void copyFile(InputStream in, File to) throws IOException {
+ FileOutputStream out = new FileOutputStream(to);
+ int len;
+ byte[] buffer = new byte[4096];
+ while ((len = in.read(buffer)) != -1) {
+ out.write(buffer, 0, len);
+ }
+ out.close();
+ in.close();
+ }
+
+ /** Copy a single file from 'from' to 'to'
+ *
+ * @param from
+ * @param to
+ * @throws IOException
+ */
+ public static void copyFile(File from, File to) throws IOException {
+ FileInputStream in = new FileInputStream(from);
+ copyFile(in, to);
+ }
+
+
+ public static IPath getKnownSBVisibleWorkspacePath() {
+ for (ISDKTarget sdkTarget : SDKFactory.getInstance().getAllSDKTargets()) {
+ IPath projectPath = sdkTarget.getSDKRoot().append(sdkTarget.getSDK().getMachine().getUserHome()).append("workspace");
+ if (sdkTarget.getFileSystemMapping().convertHostToTargetPath(projectPath) == null) {
+ projectPath = new Path("c:/sources/shared/workspace");
+ if (sdkTarget.getFileSystemMapping().convertHostToTargetPath(projectPath) == null)
+ TestCase.fail("Cannot find a path existing on the build machine");
+ }
+ return projectPath;
+ }
+ TestCase.fail("Cannot find a path existing on the build machine");
+ return null;
+ }
+
+ /** Delete a directory tree recursively.
+ * <p>
+ * Does not delete file.
+ * @param file start point for deletion -- not itself deleted
+ */
+ public static void delTree(File file) {
+ File[] files = file.listFiles();
+ if (files != null) {
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory()) {
+ delTree(files[i]);
+ }
+ }
+ }
+ files = file.listFiles();
+ if (files != null) {
+ for (int i = 0; i < files.length; i++) {
+ files[i].delete();
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public static void disableAutobuild() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription desc = workspace.getDescription();
+ desc.setAutoBuilding(false);
+ workspace.setDescription(desc);
+
+ }
+
+ /**
+ * Get location of a plugin.
+ *
+ * @return
+ * @throws IOException
+ */
+ public static String getPluginPath(Bundle bundle) throws IOException {
+ if (bundle == null)
+ return null;
+ if (bundle == null)
+ return null;
+ URL url = FileLocator.find(bundle, new Path("."), null);
+ if (url == null)
+ TestCase.fail("could not find URL for bundle: " + bundle);
+ url = FileLocator.resolve(url);
+ TestCase.assertEquals("file", url.getProtocol());
+
+ return url.getPath();
+ }
+
+ /**
+ * Load a file relative to a plugin in the running workbench
+ *
+ * @param file
+ * @return File
+ * @throws IOException
+ */
+ public static File pluginRelativeFile(Bundle bundle, String fileName) throws IOException {
+ String bundlePath = getPluginPath(bundle);
+
+ if (bundlePath == null)
+ return null;
+
+ File file = new File(bundlePath, fileName);
+ try {
+ file = file.getCanonicalFile();
+ } catch (IOException e) {
+
+ }
+ return file;
+ }
+
+ /**
+ * Find a file relative to the project. Works if running
+ * in the workbench or standalone.
+ * @param file the relative path (from the project) to the file
+ * @return File
+ */
+ public static File projectRelativeFile(String projectId, String file) throws Exception {
+ File f;
+ if (!Platform.isRunning()) {
+ // get file relative to CWD (i.e. this project)
+ f = new File(file, ".." + File.separator + projectId);
+ f = f.getCanonicalFile();
+ } else {
+ // get file relative to running plugin (still this project)
+ f = pluginRelativeFile(CorePlugin.getBundle(projectId), file);
+ }
+ if (f == null)
+ TestCase.fail("Cannot find file " + file + " relative to project");
+ return f;
+ }
+
+ /**
+ * @param project
+ */
+ public static void deleteProject(final IProject project) throws Exception {
+ if (project.exists()) {
+ WorkspaceJob job = new WorkspaceJob("deleting project") {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ project.delete(true, null);
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ job.schedule();
+ job.join();
+ }
+
+ }
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/BaseTest.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/BaseTest.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/BaseTest.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,55 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.core.tests.core;
+
+import org.eclipse.core.runtime.IStatus;
+import org.maemo.esbox.core.ErrorLogger.Listener;
+import org.maemo.esbox.core.machine.IMachine;
+
+import junit.framework.TestCase;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class BaseTest extends TestCase implements Listener {
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ //CoreActivator.getErrorLogger().addListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ //CoreActivator.getErrorLogger().removeListener(this);
+ super.tearDown();
+ }
+ protected static void assertStdTextEquals(String exp, String actual) {
+ exp = exp.replaceAll("\r\n|\r|\n", "\n");
+ actual = actual.replaceAll("\r\n|\r|\n", "\n");
+ assertEquals(exp, actual);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.ErrorLogger.Listener#statusLogged(org.eclipse.core.runtime.IStatus)
+ */
+ public void statusLogged(IStatus status) {
+ System.out.println(status);
+ }
+
+
+ protected boolean validateMachine(IMachine machine) {
+ if (machine.isAlive()) return true;
+ System.out.println("ERROR: " + machine + " is not alive");
+ return false;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestCommandLineArguments.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestCommandLineArguments.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestCommandLineArguments.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tests.core;
+
+import org.junit.Test;
+import org.maemo.esbox.core.process.CommandLineArguments;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * This tests the TestCommandLineArguments class, which is used to properly
+ * handle argument quoting/parsing in constructing command lines.
+ * @author eswartz
+ *
+ */
+public class TestCommandLineArguments extends TestCase {
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testConstructFromCmdLine1() throws Exception {
+ List<String> args = CommandLineArguments.createFromCommandLine("ls");
+ assertEquals(1, args.size());
+ assertEquals("ls", args.get(0));
+ assertEquals("ls", CommandLineArguments.toString(args));
+ }
+ @Test
+ public void testConstructFromCmdLine2() throws Exception {
+ List<String> args = CommandLineArguments.createFromCommandLine("ls -l *.c");
+ assertEquals(3, args.size());
+ assertEquals("ls", args.get(0));
+ assertEquals("-l", args.get(1));
+ assertEquals("*.c", args.get(2));
+ assertEquals("ls -l *.c", CommandLineArguments.toString(args));
+ }
+ @Test
+ public void testConstructFromCmdLineWQuoting1() throws Exception {
+ List<String> args = CommandLineArguments.createFromCommandLine("ls -l \"my program\"");
+ assertEquals(3, args.size());
+ assertEquals("ls", args.get(0));
+ assertEquals("-l", args.get(1));
+ assertEquals("my program", args.get(2));
+ assertEquals("ls -l \"my program\"", CommandLineArguments.toString(args));
+ }
+ @Test
+ public void testConstructFromCmdLineWQuoting1b() throws Exception {
+ List<String> args = CommandLineArguments.createFromCommandLine("ls -l \"my program\" -a");
+ assertEquals(4, args.size());
+ assertEquals("ls", args.get(0));
+ assertEquals("-l", args.get(1));
+ assertEquals("my program", args.get(2));
+ assertEquals("-a", args.get(3));
+ assertEquals("ls -l \"my program\" -a", CommandLineArguments.toString(args));
+ }
+ @Test
+ public void testConstructFromCmdLineWQuoting2() throws Exception {
+ List<String> args = CommandLineArguments.createFromCommandLine("/bin/sh -c 'bash -i -c ls'");
+ assertEquals(3, args.size());
+ assertEquals("/bin/sh", args.get(0));
+ assertEquals("-c", args.get(1));
+ assertEquals("bash -i -c ls", args.get(2));
+ assertEquals("/bin/sh -c \"bash -i -c ls\"", CommandLineArguments.toString(args));
+ }
+ @Test
+ public void testConstructFromCmdLineWQuoting2b() throws Exception {
+ List<String> args = CommandLineArguments.createFromCommandLine("/bin/sh -c 'bash -i -c \"ls -la\"'");
+ assertEquals(3, args.size());
+ assertEquals("/bin/sh", args.get(0));
+ assertEquals("-c", args.get(1));
+ assertEquals("bash -i -c \"ls -la\"", args.get(2));
+ assertEquals("/bin/sh -c \"bash -i -c \\\"ls -la\\\"\"", CommandLineArguments.toString(args));
+ }
+ @Test
+ public void testConstructFromCmdLineWQuoting2c() throws Exception {
+ // note: from esbox 1.3.1, incorrect since nested quotes are not escaped
+ List<String> args = CommandLineArguments.createFromCommandLine("/bin/sh -c \"bash -i -c \"ls -la\"\"");
+ assertEquals(4, args.size());
+ assertEquals("/bin/sh", args.get(0));
+ assertEquals("-c", args.get(1));
+ assertEquals("bash -i -c ls", args.get(2));
+ assertEquals("-la", args.get(3));
+ }
+
+ @Test
+ public void testConstructFromCmdLineWEscapes() throws Exception {
+ /// /scratchbox/login -d ${RUN_SCRIPT_DIRECTORY} "./run.sh ${DIRECTORY} ${EXPORTS} \\\"${COMMAND} ${ARGS}\\\""
+ List<String> args = CommandLineArguments.createFromCommandLine("/scratchbox/login -d DIR \"./run.sh DIR EXP \\\\\\\"ls -la\\\\\\\"\"");
+ assertEquals(4, args.size());
+ assertEquals("/scratchbox/login", args.get(0));
+ assertEquals("-d", args.get(1));
+ assertEquals("DIR", args.get(2));
+ assertEquals("./run.sh DIR EXP \\\"ls -la\\\"", args.get(3));
+ assertEquals("/scratchbox/login -d DIR \"./run.sh DIR EXP \\\\\\\"ls -la\\\\\\\"\"", CommandLineArguments.toString(args));
+ }
+ @Test
+ public void testConstructFromCmdLineWEscapes2() throws Exception {
+ List<String> args = CommandLineArguments.createFromCommandLine(
+ "echo -e \"stdout1\\\\nstdout2\" ;");
+ assertEquals(4, args.size());
+ assertEquals("stdout1\\nstdout2", args.get(2));
+ assertEquals("echo -e stdout1\\nstdout2 ;", CommandLineArguments.toCommandLine(args));
+ }
+
+ @Test
+ public void testConstructFromArgs() throws Exception {
+ List<String> args = CommandLineArguments.createFromVarArgs("/scratchbox/login", "-d", ".", "ls");
+ assertEquals(4, args.size());
+ assertEquals("/scratchbox/login", args.get(0));
+ assertEquals("-d", args.get(1));
+ assertEquals(".", args.get(2));
+ assertEquals("ls", args.get(3));
+ }
+ @Test
+ public void testConstructFromArgs2() throws Exception {
+ List<String> args = CommandLineArguments.createFromVarArgs();
+ assertEquals(0, args.size());
+ }
+ @Test
+ public void testConstructFromArgs3() throws Exception {
+ List<String> args = CommandLineArguments.createFromVarArgs("ls -la *.c");
+ assertEquals(1, args.size());
+ assertEquals("ls -la *.c", args.get(0));
+ }
+
+ @Test
+ public void testToStringEscapes() throws Exception {
+ List<String> args = CommandLineArguments.createFromVarArgs("ls", "-l", "my file");
+ assertEquals("ls -l \"my file\"", CommandLineArguments.toString(args));
+
+ args = CommandLineArguments.createFromVarArgs("ls", "-l", "bar*");
+ assertEquals("ls -l bar*", CommandLineArguments.toString(args));
+
+ args = CommandLineArguments.createFromVarArgs("echo", "`find . -name \"*.h\"`");
+ assertEquals("echo `find . -name \"*.h\"`", CommandLineArguments.toString(args));
+
+ }
+
+ /** Test that toString() with separators works. */
+ @Test
+ public void testToStringSep() throws Exception {
+ List<String> args = CommandLineArguments.createFromCommandLine("ls -l *.c");
+ assertEquals("ls -l *.c", CommandLineArguments.toString(args));
+ assertEquals("ls -l *.c", CommandLineArguments.toString(args, " ", false));
+ assertEquals("ls -l *.c", CommandLineArguments.toString(args, " ", true));
+ assertEquals("ls*-l**.c", CommandLineArguments.toString(args, "*", false));
+ assertEquals("ls*-l*\"*.c\"", CommandLineArguments.toString(args, "*", true));
+ }
+
+ @Test
+ public void testToStringSep2() throws Exception {
+ List<String> args = new ArrayList<String>();
+ args.add("PATH=$PATH");
+ args.add("CWD=/home/ubuntu/workspace");
+ args.add("PATHSEP=,");
+ assertEquals("PATH=$PATH,CWD=/home/ubuntu/workspace,PATHSEP=,", CommandLineArguments.toString(args, ",", false));
+ assertEquals("PATH=$PATH,CWD=/home/ubuntu/workspace,\"PATHSEP=,\"", CommandLineArguments.toString(args, ",", true));
+ }
+
+ @Test
+ public void testEscape() throws Exception {
+ assertEquals("this is \\\"my file\\\"",
+ CommandLineArguments.escape("this is \"my file\""));
+ }
+
+ @Test
+ public void testSpaces() throws Exception {
+ String cmdLine = "foo bar baz";
+ List<String> args = CommandLineArguments.createFromCommandLine(cmdLine);
+ assertEquals(3, args.size());
+ assertEquals("bar", args.get(1));
+ assertEquals("baz", args.get(2));
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestEnvironmentProperties.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestEnvironmentProperties.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestEnvironmentProperties.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tests.core;
+
+import org.junit.Test;
+import org.maemo.esbox.core.process.EnvironmentProperties;
+
+import java.util.List;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+/**
+ * This tests the TestCommandLineArguments class, which is used to properly
+ * handle argument quoting/parsing in constructing command lines.
+ * @author eswartz
+ *
+ */
+public class TestEnvironmentProperties extends TestCase {
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testConstructFromEnvp1() throws Exception {
+ Properties env = EnvironmentProperties.createFromEnvp(null);
+ assertNotNull(env);
+ assertEquals(0, env.size());
+ }
+ @Test
+ public void testConstructFromEnvp2() throws Exception {
+ Properties env = EnvironmentProperties.createFromEnvp(
+ new String[0]);
+ assertNotNull(env);
+ assertEquals(0, env.size());
+ }
+ @Test
+ public void testConstructFromEnvp3() throws Exception {
+ Properties env = EnvironmentProperties.createFromEnvp(
+ new String[] { "FOO=3", "BAR" });
+ assertNotNull(env);
+ assertEquals(2, env.size());
+ assertEquals("3", env.get("FOO"));
+ assertEquals("", env.get("BAR"));
+ }
+ @Test
+ public void testToEnvpArray1() throws Exception {
+ String[] envp = EnvironmentProperties.createEnvp(null, false);
+ assertNotNull(envp);
+ assertEquals(0, envp.length);
+ }
+ @Test
+ public void testToEnvpArray2() throws Exception {
+ Properties env = new Properties();
+ String[] envp = EnvironmentProperties.createEnvp(env, false);
+ assertNotNull(envp);
+ assertEquals(0, envp.length);
+ }
+ @Test
+ public void testToEnvpArray3() throws Exception {
+ Properties env = new Properties();
+ env.put("FOO", "");
+ env.put("BAR", "3");
+ String[] envp = EnvironmentProperties.createEnvp(env, false);
+ assertNotNull(envp);
+ assertEquals(2, envp.length);
+ assertTrue(envp[0].equals("FOO") || envp[1].equals("FOO"));
+ assertTrue(envp[0].equals("BAR=3") || envp[1].equals("BAR=3"));
+ }
+ @Test
+ public void testToEnvpArray4() throws Exception {
+ Properties env = new Properties();
+ env.put("FOO", "");
+ env.put("BAR", "3");
+ String[] envp = EnvironmentProperties.createEnvp(env, true);
+ assertNotNull(envp);
+ assertEquals(2, envp.length);
+ assertTrue(envp[0].equals("BAR=3"));
+ assertTrue(envp[1].equals("FOO"));
+ }
+
+
+ @Test
+ public void testToEnvpList1() throws Exception {
+ List<String> envp = EnvironmentProperties.createEnvpList(null, false);
+ assertNotNull(envp);
+ assertEquals(0, envp.size());
+ }
+ @Test
+ public void testToEnvpList2() throws Exception {
+ Properties env = new Properties();
+ List<String> envp = EnvironmentProperties.createEnvpList(env, false);
+ assertNotNull(envp);
+ assertEquals(0, envp.size());
+ }
+ @Test
+ public void testToEnvpList3() throws Exception {
+ Properties env = new Properties();
+ env.put("FOO", "");
+ env.put("BAR", "3");
+ List<String> envp = EnvironmentProperties.createEnvpList(env, false);
+ assertNotNull(envp);
+ assertEquals(2, envp.size());
+ assertTrue(envp.get(0).equals("FOO") || envp.get(1).equals("FOO"));
+ assertTrue(envp.get(0).equals("BAR=3") || envp.get(1).equals("BAR=3"));
+ }
+ @Test
+ public void testToEnvpList4() throws Exception {
+ Properties env = new Properties();
+ env.put("FOO", "");
+ env.put("BAR", "3");
+ List<String> envp = EnvironmentProperties.createEnvpList(env, true);
+ assertNotNull(envp);
+ assertEquals(2, envp.size());
+ assertTrue(envp.get(0).equals("BAR=3"));
+ assertTrue(envp.get(1).equals("FOO"));
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestEnvironmentVariables.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestEnvironmentVariables.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestEnvironmentVariables.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.tests.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.maemo.esbox.core.env.*;
+
+/**
+ * Test the environment manager and implementations
+ * @author eswartz
+ *
+ */
+public class TestEnvironmentVariables {
+
+ private EnvironmentVariableManager manager = EnvironmentVariableManager.getInstance();
+
+ @Test
+ public void testBasic() throws Exception {
+ manager.startup();
+ assertNotNull(manager.getGlobalEnvironmentBlock());
+ assertTrue(manager.getGlobalEnvironmentBlock().getVariables().length > 0);
+ }
+
+ @Test
+ public void testExpand() throws Exception {
+ IEnvironmentVariableBlock block = new EnvironmentVariableBlock();
+ manager.getGlobalEnvironmentBlock().copyTo(block);
+ IEnvironmentVariable var = block.getVariable("HOST$DISPLAY");
+ assertNotNull(var);
+ String val = var.getValue();
+ if (val == null) {
+ var = new EnvironmentVariable("HOST$DISPLAY", ":2");
+ }
+ String exp = block.expand(var, manager.getStandardVariableProvider());
+ assertEquals(exp, block.expandString(val, manager.getStandardVariableProvider()));
+
+ // test recursive expansion
+ block.define("EXTRA", "123");
+ block.define("BAZZ", "--${EXTRA}--");
+
+ exp = block.expandString("My ${BAZZ} stuff", manager.getStandardVariableProvider());
+ assertEquals("My --123-- stuff", exp);
+
+ // null values
+ block.define("VAL", null);
+ exp = block.expandString("12${VAL}34", manager.getStandardVariableProvider());
+ assertEquals("1234", exp);
+
+ // non infinite!
+ block.define("VAL", "2");
+ block.define("EXTRA", "${EXTRA}${EXTRA} ${VAL}...");
+ exp = block.expandString("${EXTRA}...", manager.getStandardVariableProvider());
+ assertEquals("${EXTRA}${EXTRA} 2......", exp);
+ }
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestFileSystemMapping.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestFileSystemMapping.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestFileSystemMapping.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,229 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.core.tests.core;
+
+import com.nokia.cpp.internal.api.utils.core.Pair;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.HostUtils;
+import org.maemo.esbox.core.machine.IPathCanonicalizer;
+import org.maemo.esbox.internal.api.core.machine.FileSystemMapping;
+import org.maemo.esbox.internal.api.core.machine.IFileSystemMappingImpl;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+
+/**
+ * @author eswartz
+ *
+ */
+public class TestFileSystemMapping extends TestCase {
+ private IPathCanonicalizer nullCanonicalizer;
+ private IPathCanonicalizer winCanonicalizer;
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ nullCanonicalizer = new IPathCanonicalizer() {
+
+ public IPath getCanonicalPath(IPath path) {
+ return path;
+ }
+
+ };
+ winCanonicalizer = new IPathCanonicalizer() {
+
+ public IPath getCanonicalPath(IPath path) {
+ return new Path(path.toOSString().toLowerCase());
+ }
+
+ };
+ }
+
+ public void testNull() throws Exception {
+ IFileSystemMappingImpl mapping = new FileSystemMapping(nullCanonicalizer, nullCanonicalizer);
+ List<Pair<IPath, IPath>> mappings = mapping.getHostToTargetRootMappings();
+ assertNotNull(mappings);
+ mappings.clear();
+ mapping.setHostToTargetRootMappings(mappings);
+
+ assertNull(mapping.convertHostToTargetPath(new Path("c:/")));
+ assertNull(mapping.convertHostToTargetPath(new Path("/")));
+ assertNull(mapping.convertHostToTargetPath(new Path("d:/house/party")));
+ assertNull(mapping.convertTargetToHostPath(new Path("c:/")));
+ assertNull(mapping.convertTargetToHostPath(new Path("/")));
+ assertNull(mapping.convertTargetToHostPath(new Path("d:/house/party")));
+ }
+
+ public void testIdentity() throws Exception {
+ IFileSystemMappingImpl mapping = new FileSystemMapping(nullCanonicalizer, nullCanonicalizer);
+
+ // the default mappings are identity
+ List<Pair<IPath, IPath>> mappings = mapping.getHostToTargetRootMappings();
+ assertNotNull(mappings);
+
+ if (HostUtils.isWindows()) {
+ assertEquals(new Path("c:/"), mapping.convertHostToTargetPath(new Path("c:/")));
+ assertEquals(new Path("c:/foo/bar"), mapping.convertHostToTargetPath(new Path("c:/foo/bar")));
+ assertEquals(new Path("d:/house/party"), mapping.convertHostToTargetPath(new Path("d:/house/party")));
+ assertEquals(new Path("c:/"), mapping.convertTargetToHostPath(new Path("c:/")));
+ assertEquals(new Path("d:/house/party"), mapping.convertTargetToHostPath(new Path("d:/house/party")));
+ }
+ assertEquals(new Path("/"), mapping.convertHostToTargetPath(new Path("/")));
+ assertEquals(new Path("/"), mapping.convertTargetToHostPath(new Path("/")));
+ }
+
+ public void testSwap() throws Exception {
+ IFileSystemMappingImpl mapping = new FileSystemMapping(nullCanonicalizer, nullCanonicalizer);
+
+ List<Pair<IPath, IPath>> mappings = mapping.getHostToTargetRootMappings();
+ assertNotNull(mappings);
+ mappings.clear();
+ mappings.add(new Pair<IPath, IPath>(new Path("c:/"), new Path("d:/")));
+ mappings.add(new Pair<IPath, IPath>(new Path("d:/"), new Path("c:/")));
+ mapping.setHostToTargetRootMappings(mappings);
+
+ mappings = mapping.getHostToTargetRootMappings();
+ assertNotNull(mappings);
+ assertEquals(2, mappings.size());
+
+ assertEquals(new Path("d:/"), mapping.convertHostToTargetPath(new Path("c:/")));
+ assertEquals(new Path("d:/foo/bar"), mapping.convertHostToTargetPath(new Path("c:/foo/bar")));
+ assertNull(mapping.convertHostToTargetPath(new Path("/")));
+ assertEquals(new Path("c:/house/party"), mapping.convertHostToTargetPath(new Path("d:/house/party")));
+
+ assertEquals(new Path("d:/"), mapping.convertTargetToHostPath(new Path("c:/")));
+ assertEquals(new Path("d:/foo/bar"), mapping.convertTargetToHostPath(new Path("c:/foo/bar")));
+ assertNull(mapping.convertTargetToHostPath(new Path("/")));
+ assertEquals(new Path("c:/house/party"), mapping.convertTargetToHostPath(new Path("d:/house/party")));
+ }
+
+ public void testShare() throws Exception {
+ IFileSystemMappingImpl mapping = new FileSystemMapping(nullCanonicalizer, nullCanonicalizer);
+
+ List<Pair<IPath, IPath>> mappings = mapping.getHostToTargetRootMappings();
+ assertNotNull(mappings);
+ mappings.clear();
+ mappings.add(new Pair<IPath, IPath>(new Path("c:/sources/shared"), new Path("/home/user/shared")));
+ mapping.setHostToTargetRootMappings(mappings);
+
+ mappings = mapping.getHostToTargetRootMappings();
+ assertNotNull(mappings);
+ assertEquals(1, mappings.size());
+
+ assertNull(mapping.convertHostToTargetPath(new Path("c:/")));
+ assertEquals(new Path("/home/user/shared"), mapping.convertHostToTargetPath(new Path("c:/sources/shared")));
+ assertEquals(new Path("/home/user/shared/project/file.c"), mapping.convertHostToTargetPath(new Path("c:/sources/shared/project/file.c")));
+ assertNull(mapping.convertHostToTargetPath(new Path("/")));
+
+ assertEquals(new Path("c:/sources/shared"), mapping.convertTargetToHostPath(new Path("/home/user/shared")));
+ assertEquals(new Path("c:/sources/shared/project/file.c"), mapping.convertTargetToHostPath(new Path("/home/user/shared/project/file.c")));
+ assertNull(mapping.convertTargetToHostPath(new Path("c:/sources/shared/project/file.c")));
+ assertNull(mapping.convertTargetToHostPath(new Path("/")));
+
+ }
+
+ public void testScratchbox() throws Exception {
+ IFileSystemMappingImpl mapping = new FileSystemMapping(nullCanonicalizer, nullCanonicalizer);
+
+ List<Pair<IPath, IPath>> mappings = mapping.getHostToTargetRootMappings();
+ assertNotNull(mappings);
+ mappings.clear();
+ mappings.add(new Pair<IPath, IPath>(new Path("/scratchbox/users/user/"),
+ new Path("/")));
+ mappings.add(new Pair<IPath, IPath>(new Path("/scratchbox/users/user/scratchbox"),
+ new Path("/scratchbox")));
+ mappings.add(new Pair<IPath, IPath>(new Path("/scratchbox/users/user/targets/CHINOOK_ARMEL/usr"),
+ new Path("/usr")));
+ mappings.add(new Pair<IPath, IPath>(new Path("/scratchbox/users/user/targets/CHINOOK_ARMEL/bin"),
+ new Path("/bin")));
+ mapping.setHostToTargetRootMappings(mappings);
+
+ assertNull(mapping.convertHostToTargetPath(new Path("c:/scratchbox/users/user/")));
+
+ assertEquals(new Path("/"), mapping.convertHostToTargetPath(new Path("/scratchbox/users/user")));
+ assertEquals(new Path("/scratchbox/login"),
+ mapping.convertHostToTargetPath(new Path("/scratchbox/users/user/scratchbox/login")));
+ assertEquals(new Path("/tmp/foo.c"),
+ mapping.convertHostToTargetPath(new Path("/scratchbox/users/user/tmp/foo.c")));
+ assertEquals(new Path("/usr/lib/libc.so.6"),
+ mapping.convertHostToTargetPath(new Path("/scratchbox/users/user/targets/CHINOOK_ARMEL/usr/lib/libc.so.6")));
+ assertNull(mapping.convertHostToTargetPath(new Path("/home/user/mystuff.c")));
+
+ assertEquals(new Path("/scratchbox/users/user/home/user/shared"),
+ mapping.convertTargetToHostPath(new Path("/home/user/shared")));
+ assertEquals(new Path("/scratchbox/users/user/targets/CHINOOK_ARMEL/usr/include"),
+ mapping.convertTargetToHostPath(new Path("/usr/include")));
+ assertEquals(new Path("/scratchbox/users/user/targets/CHINOOK_ARMEL/usr/lib"),
+ mapping.convertTargetToHostPath(new Path("/usr/lib")));
+ assertEquals(new Path("/scratchbox/users/user/tmp"),
+ mapping.convertTargetToHostPath(new Path("/tmp")));
+
+ if (HostUtils.isWindows())
+ assertNull(mapping.convertTargetToHostPath(new Path("c:/sources/shared/project/file.c")));
+
+ assertEquals(new Path("/scratchbox/users/user/"),
+ mapping.convertTargetToHostPath(new Path("/")));
+
+ }
+
+ public void testNonCanonical() throws Exception {
+
+ IFileSystemMappingImpl mapping = new FileSystemMapping(nullCanonicalizer, nullCanonicalizer);
+
+ List<Pair<IPath, IPath>> mappings = mapping.getHostToTargetRootMappings();
+ assertNotNull(mappings);
+ mappings.clear();
+ mappings.add(new Pair<IPath, IPath>(new Path("c:/SOURCES/SHARED"),
+ new Path("/home/user/shared")));
+ mapping.setHostToTargetRootMappings(mappings);
+
+ assertNull(mapping.convertHostToTargetPath(new Path("c:/sources/shared/myfile.c")));
+
+ mapping = new FileSystemMapping(winCanonicalizer, nullCanonicalizer);
+
+ mappings = mapping.getHostToTargetRootMappings();
+ mappings.clear();
+ mappings.add(new Pair<IPath, IPath>(new Path("c:/SOURCES/SHARED"),
+ new Path("/home/user/shared")));
+ mapping.setHostToTargetRootMappings(mappings);
+
+ assertEquals(new Path("/home/user/shared/myfile.c"),
+ mapping.convertHostToTargetPath(new Path("c:/SOurces/shARed/myfile.c")));
+
+ assertEquals(new Path("c:/sources/shared/myfile.c"),
+ mapping.convertTargetToHostPath(new Path("/home/user/shared/myfile.c")));
+
+ }
+
+ public void testMultipleMapping() throws Exception {
+ IFileSystemMappingImpl mapping = new FileSystemMapping(nullCanonicalizer, nullCanonicalizer);
+
+ List<Pair<IPath, IPath>> mappings = mapping.getHostToTargetRootMappings();
+ assertNotNull(mappings);
+ mappings.clear();
+ mappings.add(new Pair<IPath, IPath>(new Path("c:/sources/shared"),
+ new Path("/home/user/shared")));
+ mappings.add(new Pair<IPath, IPath>(new Path("c:/sources/shared"),
+ new Path("/scratchbox/users/user/home/user/shared")));
+ mapping.setHostToTargetRootMappings(mappings);
+
+ IPath[] targets = mapping.convertHostToTargetPaths(new Path("/"));
+ assertNotNull(targets);
+ assertEquals(0, targets.length);
+
+ targets = mapping.convertHostToTargetPaths(new Path("c:/sources/shared/foo.c"));
+ assertEquals(2, targets.length);
+ // sorted by length
+ assertEquals(new Path("/home/user/shared/foo.c"), targets[0]);
+ assertEquals(new Path("/scratchbox/users/user/home/user/shared/foo.c"), targets[1]);
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestMountWalker.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestMountWalker.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestMountWalker.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.tests.core;
+
+import org.maemo.esbox.internal.ssh.MountWalker;
+import org.maemo.esbox.ssh.IMountVisitor;
+
+import java.io.ByteArrayInputStream;
+
+import junit.framework.TestCase;
+
+
+/**
+ * @author eswartz
+ *
+ */
+public class TestMountWalker extends TestCase {
+ String stdText = "rootfs / rootfs rw 0 0\r\n" +
+ "none /sys sysfs rw,nosuid,nodev,noexec 0 0\r\n" +
+ "none /proc proc rw,nosuid,nodev,noexec 0 0\r\n" +
+ "udev /dev tmpfs rw 0 0\r\n" +
+ "fusectl /sys/fs/fuse/connections fusectl rw 0 0\r\n" +
+ "/dev/disk/by-uuid/32f7c52d-c65b-4943-91f6-0e9075f69811 / ext3 rw,noatime,data=ordered 0 0\r\n" +
+ "/dev/disk/by-uuid/32f7c52d-c65b-4943-91f6-0e9075f69811 /dev/.static/dev ext3 rw,data=ordered 0 0\r\n" +
+ "tmpfs /var/run tmpfs rw,nosuid,nodev,noexec 0 0\r\n" +
+ "tmpfs /var/lock tmpfs rw,nosuid,nodev,noexec 0 0\r\n" +
+ "tmpfs /dev/shm tmpfs rw 0 0\r\n" +
+ "devpts /dev/pts devpts rw 0 0\r\n" +
+ "tmpfs /var/run tmpfs rw,nosuid,nodev,noexec 0 0\r\n" +
+ "tmpfs /var/lock tmpfs rw,nosuid,nodev,noexec 0 0\r\n" +
+ "/dev/sdb1 /data ext3 rw,data=ordered 0 0\r\n" +
+ "/dev/sdb1 /opt ext3 rw,data=ordered 0 0\r\n" +
+ "/dev/sdb1 /scratchbox ext3 rw,data=ordered 0 0\r\n" +
+ "/dev/sdb1 /home ext3 rw,data=ordered 0 0\r\n" +
+ "securityfs /sys/kernel/security securityfs rw 0 0\r\n" +
+ "none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0\r\n" +
+ "/dev/sdb1 /scratchbox/users/devel/scratchbox ext3 rw,data=ordered 0 0\r\n" +
+ "/dev/disk/by-uuid/32f7c52d-c65b-4943-91f6-0e9075f69811 /scratchbox/users/devel/tmp ext3 rw,noatime,data=ordered 0 0\r\n" +
+ "none /scratchbox/users/devel/proc proc rw,nosuid,nodev,noexec 0 0\r\n" +
+ "udev /scratchbox/users/devel/dev tmpfs rw 0 0\r\n" +
+ "devpts /scratchbox/users/devel/dev/pts devpts rw 0 0\r\n" +
+ "tmpfs /scratchbox/users/devel/dev/shm tmpfs rw 0 0\r\n" +
+ "none /scratchbox/users/devel/sys sysfs rw,nosuid,nodev,noexec 0 0\r\n" +
+ "//10.0.2.2/shared /home/devel/shared smbfs rw,nosuid,nodev,uid=1000,gid=1000,mounted_uid=1000,file_mode=0755,dir_mode=0755 0 0\r\n" +
+ "//10.0.2.2/shared /scratchbox/users/devel/home/devel/shared smbfs rw,nosuid,nodev,uid=1000,gid=1000,mounted_uid=1000,file_mode=0755,dir_mode=0755 0 0\r\n"
+ ;
+
+ public void testMountWalker() throws Exception {
+ MountWalker walker = new MountWalker();
+
+ final int[] matches = {0};
+ walker.accept(new ByteArrayInputStream(stdText.getBytes()),
+ new IMountVisitor() {
+
+ public boolean handleMount(String device, String point,
+ String fsType, String options) {
+ if (fsType.equals("binfmt_misc"))
+ matches[0]++; // 1
+ if (device.equals("/dev/sdb1"))
+ matches[0]++; // 5
+ if (point.equals("/home/devel/shared"))
+ matches[0]++; // 1
+ if (options.equals("rw"))
+ matches[0]++; // 10 total
+
+ if (matches[0] == 17)
+ return false;
+ return true;
+ }
+
+ });
+
+ assertEquals(17, matches[0]);
+ }
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSDKProviderFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSDKProviderFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSDKProviderFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tests.core;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.junit.Test;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.api.core.sdk.BaseSDK;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * @author eswartz
+ *
+ */
+public class TestSDKProviderFactory extends TestCase {
+
+ static class BogusSDK extends BaseSDK {
+
+ public BogusSDK(String version, String name) {
+ super(null, version, name);
+ }
+
+ public IPath convertFilesystemPathToSDK(IPath fsPath) {
+ return null;
+ }
+
+ public IPath convertSDKPathToFilesystem(IPath sdkPath) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getPreferenceValue(String category,
+ ESboxPreferenceConstants key) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IPath getSDKRoot() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void refresh() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDK#getHostProcessLauncherFactory()
+ */
+ public IProcessLauncherFactory getMachineProcessLauncherFactory() {
+ return null;
+ }
+
+ }
+ static class BogusSDKProvider implements ISDKProvider {
+
+ public List<ISDK> createSDKs() throws ESboxException {
+ List<ISDK> sdks = new ArrayList<ISDK>();
+ sdks.add(new BogusSDK("3.0.0", "Bogus"));
+ return sdks;
+ }
+
+ }
+ @Test
+ public void testSDKProvider() throws Exception {
+ SDKFactory factory = SDKFactory.getInstance();
+ assertSame(factory, SDKFactory.getInstance());
+
+ List<ISDKProvider> providers = factory.getSDKProviders();
+ assertNotNull(providers);
+
+ // use the test API to add an SDK provider outside the extension point mechanism
+ BogusSDKProvider bogusSDKProvider = new BogusSDKProvider();
+ providers.add(bogusSDKProvider);
+
+ // make sure it generates the expected ISDK
+ List<ISDK> sdks = factory.getSDKs();
+ assertNotNull(sdks);
+ assertTrue(sdks.size() >= 1);
+
+ ISDK bogusSDK = null;
+ for (ISDK sdk : sdks) {
+ if (sdk instanceof BogusSDK) {
+ bogusSDK = sdk;
+ break;
+ }
+ }
+ assertNotNull(bogusSDK);
+
+ // refreshing does not destroy providers
+ factory.refresh(new NullProgressMonitor());
+ assertSame(factory, SDKFactory.getInstance());
+
+ providers = factory.getSDKProviders();
+ assertNotNull(providers);
+
+ assertTrue(providers.contains(bogusSDKProvider));
+
+ // make sure we regenerate the SDK object on refresh
+ sdks = factory.getSDKs();
+ assertTrue(sdks.size() >= 1);
+
+ boolean found = false;
+ for (ISDK sdk : sdks) {
+ if (sdk instanceof BogusSDK) {
+ found = true;
+ assertNotSame(sdk, bogusSDK);
+ break;
+ }
+ }
+ assertTrue(found);
+
+ }
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSSHFileSystem.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSSHFileSystem.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSSHFileSystem.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,711 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.core.tests.core;
+
+import org.eclipse.core.filesystem.*;
+import org.eclipse.core.filesystem.provider.FileInfo;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Display;
+import org.maemo.esbox.core.HostUtils;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineManager;
+import org.maemo.esbox.core.machine.MachineRegistry;
+import org.maemo.esbox.internal.api.ssh.DeviceSSHLinuxMachine;
+import org.maemo.esbox.internal.core.tests.TestActivator;
+import org.maemo.esbox.internal.ssh.QemuMachine;
+import org.maemo.esbox.internal.ssh.StockQemuConfiguration;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+
+
+/**
+ * Test the implementation of an EFS filesystem over SSH
+ * @author eswartz
+ *
+ */
+public class TestSSHFileSystem extends BaseTest {
+
+ static protected IMachine machine = null;
+ static protected IFileSystem fileSystem;
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ if (machine == null) {
+
+ machine = createMachine();
+ IStatus s = MachineManager.getInstance().acquireMachine(machine, null);
+ if (! s.isOK())
+ fail("Machine \"" + machine.getURI() + "\" is not responsive: " + s);
+
+ fileSystem = EFS.getFileSystem("ssh");
+ }
+ }
+
+ protected IMachine createMachine() {
+ /*
+ SSHConfiguration configuration = ;
+ machine = DeviceMachineFactory.createSSHMachine("ascvs01",
+ new SSHConfiguration("172.18.79.25", "lwang", 3),
+ null);
+*/
+ if (HostUtils.isWindows())
+ return new QemuMachine(new StockQemuConfiguration());
+ else
+ return new DeviceSSHLinuxMachine("home",
+ new SSHConfiguration("127.0.0.1",
+ MachineRegistry.getInstance().getLocalMachine().getUserName(), 3),
+ null);
+ }
+
+ public void testRoot() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore store = getFileStore(new Path("/"));
+ assertNotNull(store);
+ IFileStore store2 = getFileStore(new Path("/"));
+ assertNotNull(store2);
+ assertEquals(store, store2);
+ }
+
+ public void testStoreHandles() throws Exception {
+ if (cannotRunTest()) return;
+ // any should give a handle, even if not existing
+ IFileStore store = getFileStore(new Path("/foo/bar/baz"));
+ assertNotNull(store);
+ IFileStore store2 = getFileStore(new Path("/tmp"));
+ assertNotNull(store2);
+
+ }
+
+ public void testFileInfo() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore store;
+ IFileInfo fileInfo = null;
+
+ // a real file: we assume that if busybox exists, it's not a symlink, but the others might be
+ for (String attempt : new String[] { "/bin/busybox", "/bin/ash", "/bin/bash", "/bin/dash", }) {
+ store = getFileStore(new Path(attempt));
+ assertNotNull(store);
+ fileInfo = store.fetchInfo();
+ assertNotNull(fileInfo);
+ if (fileInfo.exists())
+ break;
+ }
+ if (!fileInfo.exists())
+ fail("Could not find any useful shell to test");
+ assertFalse(fileInfo.isDirectory());
+ assertTrue(fileInfo.getLength() > 32000);
+ assertEquals(false, fileInfo.getAttribute(EFS.ATTRIBUTE_SYMLINK));
+ boolean readOnlyFlag = fileInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY);
+ assertTrue(fileInfo.getLastModified() > (long)0x10000000);
+
+ // this is a symlink
+ store = getFileStore(new Path("/bin/sh"));
+ assertNotNull(store);
+ fileInfo = store.fetchInfo();
+ assertNotNull(fileInfo);
+ assertTrue(fileInfo.exists());
+ assertFalse(fileInfo.isDirectory());
+ // it's a symlink but IFileStore transparently reports link info
+ assertTrue(fileInfo.getLength() > 32000);
+
+ assertTrue(fileInfo.getAttribute(EFS.ATTRIBUTE_SYMLINK));
+ assertTrue("dash".equals(fileInfo.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET))
+ || "bash".equals(fileInfo.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET))
+ || "busybox".equals(fileInfo.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET))); // for maemo device.
+
+ // it's a symlink but IFileStore transparently reports link info
+ assertEquals(readOnlyFlag, fileInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY));
+
+
+ }
+
+ public void testDirFileInfo() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore store = getFileStore(new Path("/tmp"));
+ assertNotNull(store);
+ IFileInfo fileInfo = store.fetchInfo();
+ assertNotNull(fileInfo);
+ assertTrue(fileInfo.exists());
+ assertTrue(fileInfo.isDirectory());
+ assertEquals(EFS.NONE, fileInfo.getLength());
+ assertEquals(false, fileInfo.getAttribute(EFS.ATTRIBUTE_SYMLINK));
+ assertNull(fileInfo.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET));
+ }
+
+ public void testDirListing() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore dirStore = getFileStore(new Path("/bin"));
+ assertNotNull(dirStore);
+ String[] names = dirStore.childNames(EFS.NONE, new NullProgressMonitor());
+ assertNotNull(names);
+ for (String name : names) {
+ assertNotNull(name);
+ assertFalse(name.contains("/"));
+ }
+
+ IFileInfo[] infos = dirStore.childInfos(EFS.NONE, new NullProgressMonitor());
+ assertNotNull(infos);
+
+ IFileStore[] stores = dirStore.childStores(EFS.NONE, new NullProgressMonitor());
+ assertNotNull(stores);
+
+ assertEquals(names.length, infos.length);
+ assertEquals(names.length, stores.length);
+
+ // be sure these are all sensible
+ for (String name : names) {
+ assertFalse(name.equals(".") || name.equals(".."));
+ assertFalse(name.contains("/"));
+ }
+
+ for (IFileInfo info : infos) {
+ assertFalse(info.getName().equals(".") || info.getName().equals(".."));
+ assertFalse(info.getName().contains("/"));
+ assertTrue(info.exists());
+ }
+
+ for (IFileStore store : stores) {
+ assertFalse(store.getName().contains("/"));
+ assertTrue(store.toString(), dirStore.isParentOf(store));
+ assertTrue(store.toURI().getPath().equals("/bin/" + store.getName()));
+
+ IFileStore realStore = fileSystem.getStore(store.toURI());
+ assertEquals(store, realStore);
+ }
+ }
+
+ public void testCreateFile() throws Exception {
+ if (cannotRunTest()) return;
+ // ensure it's not there, and no error if not existing
+ IFileStore store = getFileStore(new Path("/tmp/file_0.txt"));
+ store.delete(EFS.NONE, new NullProgressMonitor());
+
+ final String string = "Hi there!\n";
+ IFileInfo info;
+
+ // write once
+ OutputStream stream = store.openOutputStream(EFS.NONE, new NullProgressMonitor());
+
+ // creating stream should create file
+ info = store.fetchInfo();
+ assertTrue(info.exists());
+ assertEquals(0, info.getLength());
+
+ stream.write(string.getBytes());
+
+ // for our purposes, we assume no buffering on raw stream, but we can't ensure
+ // the SFTP communications are synchronous
+ info = store.fetchInfo();
+ assertTrue(info.exists());
+ //assertEquals(string.length(), info.getLength());
+
+ stream.close();
+
+ // two channels open at once; may have
+ Thread.sleep(500);
+ info = store.fetchInfo();
+ assertTrue(info.exists());
+ assertEquals(string.length(), info.getLength());
+
+ // rewrite now
+ stream = store.openOutputStream(EFS.OVERWRITE, new NullProgressMonitor());
+
+ info = store.fetchInfo();
+ assertTrue(info.exists());
+ assertEquals(0, info.getLength());
+
+ stream.write((string + string).getBytes());
+ stream.close();
+
+ // two channels operating, can't be sure they're synced?
+ Thread.sleep(500);
+ info = store.fetchInfo();
+ assertTrue(info.exists());
+ assertEquals(string.length() * 2, info.getLength());
+
+ }
+
+ public void testDirOps1() throws Exception {
+ if (cannotRunTest()) return;
+ // ensure we can create dir
+ IFileStore store = getFileStore(new Path("/tmp/inside"));
+ store.mkdir(EFS.SHALLOW, new NullProgressMonitor());
+ // no error recreating
+ store.mkdir(EFS.SHALLOW, new NullProgressMonitor());
+
+ // but not tree
+ store = getFileStore(new Path("/tmp/inside/but/not/this/far"));
+ try {
+ store.mkdir(EFS.SHALLOW, new NullProgressMonitor());
+ fail();
+ } catch (CoreException e) {
+ }
+
+ // ensure we can delete dir
+ store = getFileStore(new Path("/tmp/inside"));
+ store.delete(EFS.NONE, new NullProgressMonitor());
+
+ // but not the parent!
+ store = getFileStore(new Path("/tmp"));
+ assertTrue(store.fetchInfo().exists());
+
+ }
+
+
+ /**
+ * @throws CoreException
+ * @throws IOException
+ */
+ public void testDirOps2() throws CoreException, IOException {
+ if (cannotRunTest()) return;
+ IFileInfo info;
+ IFileStore store;
+ // ensure we can create tree
+ store = getFileStore(new Path("/tmp/subdir/moresub/embedded"));
+ store.mkdir(EFS.NONE, new NullProgressMonitor());
+
+ info = store.fetchInfo();
+ assertTrue(info.exists());
+ assertTrue(store.getParent().fetchInfo().exists());
+ assertTrue(store.getParent().getParent().fetchInfo().exists());
+
+ // ensure we can make file there
+ IFileStore file = store.getChild("temp.txt");
+ OutputStream os = file.openOutputStream(EFS.NONE, null);
+ os.write("goofy".getBytes());
+ os.close();
+
+ assertTrue(file.fetchInfo().exists());
+
+ // ensure we can delete tree
+ IFileStore parent = getFileStore(new Path("/tmp/subdir"));
+ parent.delete(EFS.NONE, new NullProgressMonitor());
+
+ info = parent.fetchInfo();
+ assertFalse(info.exists());
+ assertFalse(store.getParent().fetchInfo().exists());
+ assertFalse(store.getParent().getParent().fetchInfo().exists());
+ }
+
+ public void testPutInfo() throws Exception {
+ if (cannotRunTest()) return;
+ // touch the file and get it in a standard state
+ IFileStore store = getFileStore(new Path("/tmp/testfile.txt"));
+ store.delete(EFS.NONE, null);
+ store.openOutputStream(EFS.OVERWRITE, null).close();
+
+ FileInfo info = new FileInfo(store.getName());
+ info.setLastModified(10000);
+ store.putInfo(info, EFS.SET_LAST_MODIFIED, null);
+
+ IFileInfo newInfo = store.fetchInfo();
+ assertEquals(10000, newInfo.getLastModified());
+ assertFalse(newInfo.getAttribute(EFS.ATTRIBUTE_EXECUTABLE));
+ assertFalse(newInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY));
+
+ info = new FileInfo(store.getName());
+ info.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, true);
+ info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true);
+ store.putInfo(info, EFS.SET_ATTRIBUTES, null);
+
+ newInfo = store.fetchInfo();
+ assertTrue(newInfo.getAttribute(EFS.ATTRIBUTE_EXECUTABLE));
+ assertTrue(newInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY));
+
+ store.delete(EFS.NONE, null);
+
+ }
+
+ interface IPopulateStore {
+ void populate(IFileStore store) throws Exception;
+ void validate(IFileStore store) throws Exception;
+ }
+
+
+ IPopulateStore createFile = new IPopulateStore() {
+
+ public void populate(IFileStore store) throws Exception {
+ store.openOutputStream(EFS.OVERWRITE, null).close();
+ }
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.tests.core.TestSSHFileSystem.IPopulateStore#validate(org.eclipse.core.filesystem.IFileStore)
+ */
+ public void validate(IFileStore arg0) throws Exception {
+
+ }
+
+ };
+
+ public void testMoveFileSameDir() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore from = getFileStore(new Path("/tmp/testfile.txt"));
+ from.openOutputStream(EFS.OVERWRITE, null).close();
+
+ IFileStore to = getFileStore(new Path("/tmp/renamed.txt"));
+ doMoveTest(from, to, createFile);
+ }
+
+
+ public void testMoveFileDifferentDirSameFS() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore from = getFileStore(new Path("/tmp/testfile.txt"));
+
+
+ IFileStore dir = getFileStore(new Path("/tmp/newdir"));
+ dir.mkdir(EFS.NONE, null);
+
+ IFileStore to = dir.getChild("renamed.txt");
+
+ doMoveTest(from, to, createFile);
+ }
+
+
+ public void testMoveFileDifferentDirDifferentMount() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore from = getFileStore(new Path("/tmp/testfile.txt"));
+ from.openOutputStream(EFS.OVERWRITE, null).close();
+
+ IFileStore dir = getFileStore(machine.getUserHome().append("/newdir"));
+ dir.mkdir(EFS.NONE, null);
+
+ IFileStore to = dir.getChild("renamed.txt");
+ doMoveTest(from, to, createFile);
+
+ }
+
+ public void testMoveFileDifferentDirDifferentFS1() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore from = getFileStore(new Path("/tmp/testfile.txt"));
+ from.openOutputStream(EFS.OVERWRITE, null).close();
+
+ IFileStore dir = EFS.getLocalFileSystem().getStore(HostUtils.getTemporaryPath().append("newdir"));
+ dir.mkdir(EFS.NONE, null);
+
+ IFileStore to = dir.getChild("renamed.txt");
+ doMoveTest(from, to, createFile);
+
+ }
+
+ public void testMoveFileDifferentDirDifferentFS2() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore from = EFS.getLocalFileSystem().getStore(HostUtils.getTemporaryPath().append("testfile2.txt"));
+ from.openOutputStream(EFS.OVERWRITE, null).close();
+
+ IFileStore dir = getFileStore(new Path("/tmp/newdir2"));
+ dir.mkdir(EFS.NONE, null);
+
+ IFileStore to = dir.getChild("renamed.txt");
+ doMoveTest(from, to, createFile);
+
+ }
+
+ /**
+ * @param from
+ * @param to
+ * @param populateStore how to set up 'from' and validate 'to'
+ * @throws CoreException
+ * @throws IOException
+ */
+ private void doMoveTest(IFileStore from, IFileStore to, IPopulateStore populateStore)
+ throws Exception {
+ populateStore.populate(from);
+
+ IFileInfo fromInfo = from.fetchInfo();
+ if (!to.equals(from))
+ to.delete(EFS.NONE, null);
+
+ // move w/o overwrite
+ if (!to.equals(from)) {
+ from.move(to, EFS.NONE, null);
+ } else {
+ try {
+ from.move(to, EFS.NONE, null);
+ fail("expected failure trying to overwrite same file");
+ } catch (CoreException e) {
+
+ }
+ }
+
+ if (!to.equals(from))
+ assertFalse(from.fetchInfo().exists());
+ IFileInfo toInfo = to.fetchInfo();
+ assertTrue(toInfo.exists());
+
+ // be sure the mod dates aren't messed up across filesystems
+ // (the API is in milliseconds since the epoch, while UNIX uses seconds)
+ toInfo.setLastModified(fromInfo.getLastModified());
+ to.putInfo(toInfo, EFS.SET_LAST_MODIFIED, null);
+
+ toInfo = to.fetchInfo();
+ assertTrue(toInfo.exists());
+ // may have up to a second of mismatch due to differing precisions
+ if (Math.abs(toInfo.getLastModified() - fromInfo.getLastModified()) > 1000) {
+ fail("Last modified times got messed up: from " + fromInfo.getLastModified() + " to " + toInfo.getLastModified());
+ }
+
+ // recreate host
+ populateStore.populate(from);
+
+ // move w/o overwrite
+ try {
+ from.move(to, EFS.NONE, null);
+ fail("expected failure trying to overwrite existing file");
+ } catch (CoreException e) {
+
+ }
+
+ // move w/overwrite
+ if (!to.equals(from)) {
+ from.move(to, EFS.OVERWRITE, null);
+ assertFalse(from.fetchInfo().exists());
+ } else {
+ try {
+ from.move(to, EFS.NONE, null);
+ fail("expected failure trying to overwrite same file");
+ } catch (CoreException e) {
+
+ }
+ }
+
+ }
+
+ IPopulateStore createDir = new IPopulateStore() {
+
+ public void populate(IFileStore dir) throws Exception {
+ dir.mkdir(EFS.NONE, null);
+ IFileStore from = dir.getChild("test.txt");
+ from.openOutputStream(EFS.OVERWRITE, null).close();
+ }
+
+ public void validate(IFileStore store) throws Exception {
+ assertTrue(store.getChild("test.txt").fetchInfo().exists());
+ }
+
+ };
+
+ public void testMoveDirSameFS() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore fromDir = getFileStore(new Path("/tmp/testdir"));
+
+ IFileStore to = getFileStore(new Path("/tmp/todir"));
+
+ doMoveTest(fromDir, to, createDir);
+ }
+
+ public void testMoveDirSameDir() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore fromDir = getFileStore(new Path("/tmp/testdir"));
+
+ IFileStore to = getFileStore(new Path("/tmp/testdir"));
+
+ doMoveTest(fromDir, to, createDir);
+ }
+
+ public void testMoveDirDifferentMount() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore fromDir = getFileStore(machine.getUserHome().append("testdir"));
+
+ IFileStore to = getFileStore(new Path("/tmp/todir"));
+
+ doMoveTest(fromDir, to, createDir);
+ }
+
+ public void testMoveDirDifferentFS1() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore fromDir = getFileStore(machine.getUserHome().append("testdir2"));
+
+ IFileStore to = EFS.getLocalFileSystem().getStore(HostUtils.getTemporaryPath().append("todir"));
+
+ doMoveTest(fromDir, to, createDir);
+ }
+
+ public void testMoveDirDifferentFS2() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore fromDir = EFS.getLocalFileSystem().getStore(HostUtils.getTemporaryPath().append("testdir2"));
+
+ IFileStore to = getFileStore(new Path("/tmp/todir2"));
+
+ doMoveTest(fromDir, to, createDir);
+ }
+
+ private void iterateDirectories(int level, IFileStore store, IProgressMonitor monitor) throws CoreException {
+ monitor.worked(1);
+ if (monitor.isCanceled() || level >= 3)
+ return;
+ monitor.subTask(store.toString());
+ IFileStore[] kids = store.childStores(EFS.NONE, monitor);
+ for (IFileStore kid : kids) {
+ iterateDirectories(level + 1, kid, monitor);
+ }
+ }
+
+ public void testCopySameFile() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore from = getFileStore(new Path("/tmp/testfile.txt"));
+ from.openOutputStream(EFS.OVERWRITE, null).close();
+ IFileStore to = getFileStore(new Path("/tmp/testfile.txt"));
+ doCopyTest(from, to, null, true);
+
+ }
+ public void testCopyDifferentDir() throws Exception {
+ if (cannotRunTest()) return;
+ //IFileStore from = getFileStore(new Path("/bin"));
+ IFileStore from = getFileStore(new Path("/usr/lib/dpkg"));
+ IFileStore to = getFileStore(new Path("/tmp/foo/bar/baz"));
+ doCopyTest(from, to, "enoent", true);
+
+ }
+
+ public void testCopySameDir() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore from = getFileStore(new Path("/tmp/fromdir"));
+ from.mkdir(EFS.NONE, null);
+ from.getChild("foo").openOutputStream(EFS.OVERWRITE, null).close();
+
+ IFileStore to = getFileStore(new Path("/tmp/fromdir"));
+ doCopyTest(from, to, "foo", true);
+
+ }
+ public void testCopyRemoteToLocal() throws Exception {
+ if (cannotRunTest()) return;
+ IFileStore from = getFileStore(new Path("/usr/lib/dpkg"));
+ IFileStore to = EFS.getLocalFileSystem().getStore(HostUtils.getTemporaryPath().append("foo/bar/baz"));
+ to.delete(EFS.NONE, null);
+ doCopyTest(from, to, "enoent", true);
+ }
+
+ public void testCopyLocalToRemote() throws Exception {
+ if (cannotRunTest()) return;
+ File testFile = null;
+ try {
+ testFile = TestActivator.pluginRelativeFile("data/dumbData.dat");
+ if (testFile == null || !testFile.exists())
+ testFile = null;
+ } catch (IOException e) {
+ }
+ if (testFile == null) {
+ fail("Cannot find test data file: data/dumbData.dat");
+ }
+
+ IFileStore from = EFS.getLocalFileSystem().getStore(testFile.toURI());
+ IFileStore to = getFileStore(new Path("/tmp/dumbData.dat"));
+ doCopyTest(from, to, null, false);
+ }
+
+ /**
+ * @param from
+ * @param to
+ * @param knownFile if non-null, copying directories, and this file is expected to exist in destination
+ * @param deleteAfterCopy delete copied content from destination ?
+ * @throws CoreException
+ */
+ protected void doCopyTest(IFileStore from, IFileStore to, String knownFile, boolean deleteAfterCopy)
+ throws CoreException {
+
+ if (knownFile != null)
+ to.mkdir(EFS.NONE, null);
+
+ from.copy(to, EFS.OVERWRITE, null);
+
+ assertTrue(to.fetchInfo().exists());
+
+ IFileStore store = null;
+ if (knownFile != null) {
+ store = to.getChild(knownFile);
+ assertNotNull(store);
+ IFileInfo toInfo = store.fetchInfo();
+ assertNotNull(toInfo);
+ assertTrue(toInfo.exists());
+
+ // be sure the mod dates aren't messed up across filesystems
+ // (the API is in milliseconds since the epoch, while UNIX uses seconds)
+ IFileInfo fromInfo = from.fetchInfo();
+ toInfo.setLastModified(fromInfo.getLastModified());
+ to.putInfo(toInfo, EFS.SET_LAST_MODIFIED, null);
+
+ toInfo = to.fetchInfo();
+ assertTrue(toInfo.exists());
+ // may have up to a second of mismatch due to differing precisions
+ if (Math.abs(toInfo.getLastModified() - fromInfo.getLastModified()) > 1000) {
+ fail("Last modified times got messed up: from " + fromInfo.getLastModified() + " to " + toInfo.getLastModified());
+ }
+ }
+
+ IFileInfo[] fromChildren = from.childInfos(EFS.NONE, null);
+ IFileInfo[] toChildren = to.childInfos(EFS.NONE, null);
+ assertEquals(fromChildren.length, toChildren.length);
+
+ if (from.fetchInfo().isDirectory()) { // directory
+ // Size of children should be the same.
+ int fromSum = 0, toSum = 0;
+ for (IFileInfo f : fromChildren)
+ if (!f.isDirectory())
+ fromSum += f.getLength();
+ for (IFileInfo f : toChildren)
+ if (!f.isDirectory())
+ toSum += f.getLength();
+
+ assertEquals(fromSum, toSum);
+ }
+ else {
+ // file size should be the same
+ assertEquals(from.toString(), from.fetchInfo().getLength(), to.fetchInfo().getLength());
+ }
+
+ if (deleteAfterCopy) {
+ to.delete(EFS.NONE, null);
+
+ if (store != null)
+ assertFalse(store.fetchInfo().exists());
+ }
+ else if (store != null)
+ assertTrue(store.fetchInfo().exists());
+ }
+
+ public void testTiming() throws Exception {
+ if (cannotRunTest()) return;
+ Display.getDefault();
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
+ dialog.run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ monitor.beginTask("Scanning directories", IProgressMonitor.UNKNOWN);
+ IFileStore store = getFileStore(new Path("/"));
+ try {
+ iterateDirectories(0, store, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ monitor.done();
+ }
+ });
+
+
+ }
+
+ /**
+ * Try not to fall over ourselves on a non-Windows host
+ * @return
+ */
+ protected boolean cannotRunTest() {
+ return !validateMachine(machine);
+ }
+
+ /**
+ * @param path
+ * @return
+ */
+ protected IFileStore getFileStore(IPath path) {
+ return fileSystem.getStore(machine.getFileSystemAccess().getURIForPath(path));
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSSHProcess.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSSHProcess.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestSSHProcess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,211 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.core.tests.core;
+
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.Policy;
+import org.maemo.esbox.core.machine.MachineManager;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.internal.ssh.*;
+import org.maemo.esbox.ssh.*;
+
+import java.io.*;
+import java.util.List;
+import java.util.Properties;
+
+
+/**
+ * @author eswartz
+ *
+ */
+public class TestSSHProcess extends BaseTest {
+
+ private SSHConfiguration sshConfiguration;
+ private QemuMachine machine;
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ machine = new QemuMachine(new StockQemuConfiguration());
+ MachineManager.getInstance().acquireMachine(machine, null);
+ sshConfiguration = new StockQemuConfiguration().getSSHConfiguration();
+ sshConfiguration.setUserPassword("qatest");
+ }
+ public void testSimple() throws Exception {
+ if (!validateMachine(machine)) return;
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine("ls -m");
+ Process process = new SSHProcess(sshConfiguration,
+ cmdLine,
+ null,
+ null,
+ null);
+ try {
+ process.exitValue();
+ fail();
+ } catch (IllegalThreadStateException e) {
+
+ }
+
+ // this variant waits for the process to finish before consuming output
+ //
+ // this is unsafe in normal cases!
+ int exit = process.waitFor();
+
+ InputStream is = process.getInputStream();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ int ch;
+ while ((ch = is.read()) != -1)
+ out.write(ch);
+ is = process.getErrorStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ while ((ch = is.read()) != -1)
+ err.write(ch);
+ System.out.println("out:\n" + out + "\n\nerr:\n"+ err);
+ assertEquals(0, exit);
+
+ }
+
+ public void testEnvVars() throws Exception {
+ if (!validateMachine(machine)) return;
+ List<String> cmdLine = CommandLineArguments.wrapScriptCommandLineForShell(
+ CommandLineArguments.createFromCommandLine("echo $CC,$LD/ '\\\\$'W00#b= la"));
+ Properties env = new Properties();
+ env.put("CC", "gcc");
+ env.put("LD", "1 2 3");
+
+ Process process = new SSHProcess(sshConfiguration,
+ cmdLine,
+ env,
+ null,
+ null);
+ int exit = process.waitFor();
+
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ InputStream is = process.getErrorStream();
+ int ch;
+ while ((ch = is.read()) != -1)
+ err.write(ch);
+ assertEquals("", err.toString());
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ is = process.getInputStream();
+ while ((ch = is.read()) != -1)
+ out.write(ch);
+ assertStdTextEquals("gcc,1 2 3/ $W00#b= la\n", out.toString());
+
+ assertEquals(0, exit);
+
+ }
+ public void testBigBuffer() throws Exception {
+ if (!validateMachine(machine)) return;
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine("ls -lR /proc");
+ final Process process = new SSHProcess(sshConfiguration,
+ cmdLine,
+ null,
+ null,
+ null);
+
+ // this variant needs to consume output synchronously
+ Thread outReader = new Thread(new Runnable() {
+
+ public void run() {
+ InputStream is = process.getInputStream();
+ int outTotal = 0;
+ int ch;
+ try {
+ while ((ch = is.read()) != -1) {
+ System.out.write(ch);
+ outTotal++;
+ }
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ Policy.close(is);
+ System.out.println("outTotal: " + outTotal);
+ assertTrue(outTotal > 20000); // lots of processes
+ }
+
+ });
+ Thread errReader = new Thread(new Runnable() {
+
+ public void run() {
+ InputStream is = process.getErrorStream();
+ int errTotal = 0;
+ int ch;
+ try {
+ while ((ch = is.read()) != -1) {
+ System.err.write(ch);
+ errTotal++;
+ }
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ Policy.close(is);
+ System.out.println("errTotal: " + errTotal);
+ assertTrue(errTotal > 1000); // some root files
+ }
+
+ });
+
+ // this will deadlock
+ final int[] exits = { -1 };
+ Thread exitThread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ exits[0] = process.waitFor();
+ } catch (InterruptedException e) {
+ }
+ }
+
+ };
+ exitThread.start();
+
+ // won't finish
+ exitThread.join(3000);
+
+ exitThread.interrupt();
+ assertEquals(-1, exits[0]);
+
+ // now consume input
+ outReader.start();
+ errReader.start();
+
+ // this will terminate
+ int exit = process.waitFor();
+ assertEquals(2, exit);
+
+ // keep reading so char counts are checked and process is destroyed
+ outReader.join();
+ errReader.join();
+
+ }
+
+ public void testWeirdTerminator() throws Exception {
+ if (!validateMachine(machine)) return;
+
+ // these sb2 commands have a gdb packet terminator sequence with buggy qemu versions
+
+ // this uses an arm binary, which invokes qemu and reveals the bug
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine("sb2 -Qx -m emulate -t chinook40_armel ls / . /not/here");
+ SSHProcessLauncher launcher = new SSHProcessLauncher(sshConfiguration,
+ cmdLine,
+ null,
+ null,
+ CorePlugin.getDefault().getCorePreferenceProvider());
+ launcher.setStreamWrapperFactory(new BuggySB2QEMUStreamWrapperFactory());
+
+ launcher.createProcess();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ launcher.waitAndRead(out, err);
+
+ assertTrue(out.size() > 0);
+ assertTrue(err.size() > 0);
+
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestShellTemplateSubstitutor.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestShellTemplateSubstitutor.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestShellTemplateSubstitutor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tests.core;
+
+import org.junit.Test;
+import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
+
+import junit.framework.TestCase;
+
+/**
+ * Test the ShellTemplateSubstitutor class, which allows us to replace
+ * ${..} variables in an arbitrary command line string, with various levels
+ * of escaping while quoting, e.g. ${{...}} and ${{{...}}}.
+ * @author eswartz
+ *
+ */
+public class TestShellTemplateSubstitutor extends TestCase {
+
+ @Test
+ public void testSimple() throws Exception {
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ assertEquals("simple", substitutor.substitute("simple"));
+ }
+
+ @Test
+ public void testSingle() throws Exception {
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("VAR", "value");
+ assertEquals("value", substitutor.substitute("${VAR}"));
+ }
+
+ @Test
+ public void testDouble() throws Exception {
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("VAR", "value");
+ assertEquals("value value", substitutor.substitute("${VAR} ${VAR}"));
+ }
+
+ @Test
+ public void testMissing() throws Exception {
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("VAR", "value");
+ assertEquals("value ${OTHER}", substitutor.substitute("${VAR} ${OTHER}"));
+ }
+
+ @Test
+ public void testQuoting1() throws Exception {
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("COMMAND", "ls -l *.c");
+ assertEquals("/bin/sh -c \"ls -l *.c\"",
+ substitutor.substitute("/bin/sh -c \"${{COMMAND}}\""));
+ }
+
+ @Test
+ public void testQuoting2() throws Exception {
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("DIR", "/tmp");
+ substitutor.define("COMMAND", "ls -l \"my file\"");
+ assertEquals("/bin/sh -d /tmp -c \"ls -l \\\"my file\\\"\"",
+ substitutor.substitute("/bin/sh -d ${DIR} -c \"${{COMMAND}}\""));
+ }
+ @Test
+ public void testQuoting3() throws Exception {
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("RUNDIR", "/home/ubuntu");
+ substitutor.define("DIR", "/tmp");
+ substitutor.define("COMMAND", "ls");
+ substitutor.define("ARGS", "-l \"my file\"");
+ String expected = "/scratchbox/login -d /home/ubuntu -c \"./run.sh /tmp \\\"ls -l \\\\\\\"my file\\\\\\\"\\\"\"";
+ System.out.println(expected);
+ assertEquals(expected,
+ substitutor.substitute("/scratchbox/login -d ${RUNDIR} -c \"./run.sh ${{DIR}} \\\"${{{COMMAND}}} ${{{ARGS}}}\\\"\""));
+ }
+ @Test
+ public void testQuoting4() throws Exception {
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("EXPORTS", "A=a b c,B=larry's");
+ substitutor.define("COMMAND", "echo");
+ assertEquals("echo \"A=a b c,B=larry\\'s\" \\\"A=a b c,B=larry\\\\\\'s\\\"",
+ substitutor.substitute("${COMMAND} \"${{EXPORTS}}\" \\\"${{{EXPORTS}}}\\\""));
+ }
+
+ @Test
+ public void testNull1() throws Exception {
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("EXPORTS", null);
+ try {
+ substitutor.define(null, "foo");
+ fail();
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ assertEquals("${COMMAND} \"\" \\\"\\\"",
+ substitutor.substitute("${COMMAND} \"${{EXPORTS}}\" \\\"${{{EXPORTS}}}\\\""));
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestTemplateFilter.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestTemplateFilter.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestTemplateFilter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,217 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.tests.core;
+
+import org.junit.Test;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineRegistry;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.core.tests.MockSDK;
+import org.maemo.esbox.core.tests.MockSDKTarget;
+import org.maemo.esbox.internal.api.core.sdk.BaseSDKPlatform;
+import org.maemo.esbox.project.core.ESboxTemplateFilter;
+
+import java.util.*;
+import java.util.regex.Pattern;
+
+import junit.framework.TestCase;
+
+
+/**
+ * @author eswartz
+ *
+ */
+public class TestTemplateFilter extends TestCase {
+
+ private static IMachine hostMachine = MachineRegistry.getInstance().getLocalMachine();
+ private static ISDK mockSDK = new MockSDK(hostMachine, "1.0", "mock SDK");
+ private static ISDKPlatform chinook_platform = new BaseSDKPlatform(
+ "chinook", "4.0");
+ private static ISDKPlatform diablo_platform = new BaseSDKPlatform(
+ "diablo", "4.1");
+ private static ISDKTarget[] sdkTargets = {
+ new MockSDKTarget(mockSDK,
+ chinook_platform,
+ "x86",
+ "chinook_x86"),
+ new MockSDKTarget(mockSDK,
+ chinook_platform,
+ "armel",
+ "chinook_armel"),
+ new MockSDKTarget(mockSDK,
+ diablo_platform,
+ "x86",
+ "diablo_x86"),
+ new MockSDKTarget(mockSDK,
+ diablo_platform,
+ "armel",
+ "diablo_armel"),
+
+ };
+
+ @Test
+ public void testAllPatternMatchAll() throws Exception {
+ List<ISDKTarget> targets;
+ targets = new ArrayList<ISDKTarget>();
+
+ // empty matches a.*
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(targets, ".*", true));
+
+ // single matches .*
+ if (sdkTargets.length > 0) {
+ targets.add(sdkTargets[0]);
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(targets, ".*", true));
+ }
+
+ // all matches .*
+ targets = Arrays.asList(sdkTargets);
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(targets, ".*", true));
+
+ }
+
+ @Test
+ public void testAllPatternMatchAny() throws Exception {
+ List<ISDKTarget> targets;
+ targets = new ArrayList<ISDKTarget>();
+
+ // empty matches a.*
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(targets, ".*", false));
+
+ // single matches .*
+ if (sdkTargets.length > 0) {
+ targets.add(sdkTargets[0]);
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(targets, ".*", false));
+ }
+
+ // all matches .*
+ targets = Arrays.asList(sdkTargets);
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(targets, ".*", false));
+
+ }
+
+ @Test
+ public void testSpecificPatternMatchAll() throws Exception {
+ List<ISDKTarget> targets;
+ targets = new ArrayList<ISDKTarget>();
+
+ if (sdkTargets.length == 0)
+ return;
+
+ targets.add(sdkTargets[0]);
+
+ // identity
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, sdkTargets[0].getPlatform().getName(), true));
+
+ // non-identity
+ assertFalse(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, "never-match", true));
+
+ targets = Arrays.asList(sdkTargets);
+ assertFalse(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, sdkTargets[0].getPlatform().getName(), true));
+ }
+
+ @Test
+ public void testSpecificPatternMatchAny() throws Exception {
+ List<ISDKTarget> targets;
+ targets = new ArrayList<ISDKTarget>();
+
+ if (sdkTargets.length == 0)
+ return;
+
+ targets.add(sdkTargets[0]);
+
+ // identity
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, sdkTargets[0].getPlatform().getName(), false));
+
+ // non-identity
+ assertFalse(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, "never-match", false));
+
+ // if the target is included, the others shouldn't make this fail
+ targets = Arrays.asList(sdkTargets);
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, sdkTargets[0].getPlatform().getName(), false));
+
+ // explicitly fail to match a valid SDK
+ targets = Arrays.asList(sdkTargets);
+ assertFalse(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, "never-match", false));
+
+ }
+
+ @Test
+ public void testMultiPatternMatchAll() throws Exception {
+ List<ISDKTarget> targets;
+ targets = new ArrayList<ISDKTarget>();
+
+ if (sdkTargets.length == 0)
+ return;
+
+ String pattern = "";
+ for (ISDKTarget target : sdkTargets) {
+ if (pattern.length() > 0)
+ pattern += '|';
+
+ pattern += Pattern.quote(target.getPlatform().getName());
+ }
+
+ // empty
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, pattern, true));
+
+ targets.add(sdkTargets[0]);
+
+ // one
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, pattern, true));
+
+ // all
+ targets = Arrays.asList(sdkTargets);
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, pattern, true));
+ }
+
+ @Test
+ public void testMultiPatternMatchAny() throws Exception {
+ List<ISDKTarget> targets;
+ targets = new ArrayList<ISDKTarget>();
+
+ if (sdkTargets.length == 0)
+ return;
+
+ String pattern = "";
+ for (ISDKTarget target : sdkTargets) {
+ if (pattern.length() > 0)
+ pattern += '|';
+
+ pattern += Pattern.quote(target.getPlatform().getName());
+ }
+
+ // empty
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, pattern, false));
+
+ targets.add(sdkTargets[0]);
+
+ // one
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, pattern, false));
+
+ // all
+ targets = Arrays.asList(sdkTargets);
+ assertTrue(ESboxTemplateFilter.getInstance().passesFilter(
+ targets, pattern, false));
+ }
+
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestXMLStorage.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestXMLStorage.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/core/TestXMLStorage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.tests.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import com.nokia.cpp.internal.api.utils.core.FileUtils;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.runtime.CoreException;
+import org.junit.Test;
+import org.maemo.esbox.core.HostUtils;
+import org.maemo.esbox.core.env.*;
+import org.maemo.esbox.core.xml.EFSXMLFileStorage;
+import org.maemo.esbox.core.xml.XMLUtils;
+import org.w3c.dom.Element;
+
+import java.net.URI;
+
+/**
+ * Test the XMLStorageBase and implementations
+ * @author eswartz
+ *
+ */
+public class TestXMLStorage {
+
+ private URI uri = URIUtil.toURI(HostUtils.getTemporaryPath().append("test.xml"));
+
+ @Test
+ public void testNonExistent() throws Exception {
+ EFS.getStore(uri).delete(0, null);
+
+ EFSXMLFileStorage storage = new EFSXMLFileStorage(uri);
+ try {
+ storage.load("root");
+ fail("file should not exist");
+ } catch (CoreException e) {
+ }
+
+ assertNull(storage.getDocument());
+ assertNull(storage.getDocumentElement());
+ }
+
+ @Test
+ public void testCreate() throws Exception {
+ EFSXMLFileStorage storage = new EFSXMLFileStorage(uri);
+
+ assertNull(storage.getDocument());
+ assertNull(storage.getDocumentElement());
+
+ storage.create("root");
+
+ Element doc = storage.getDocumentElement();
+ assertNotNull(doc);
+ assertEquals("root", doc.getNodeName());
+
+ }
+
+ @Test
+ public void testWrite() throws Exception {
+ EFSXMLFileStorage storage = new EFSXMLFileStorage(uri);
+ storage.create("root");
+
+ Element doc = storage.getDocumentElement();
+ doc.setAttribute("foo", "bar");
+ XMLUtils.setText(doc, "la dee dah");
+
+ Element kid = storage.getDocument().createElement("kid");
+ kid.setAttribute("foo", "baz");
+ XMLUtils.setText(kid, null);
+ doc.appendChild(kid);
+
+ assertEquals(1, XMLUtils.getChildElementsNamed(doc, "kid").length);
+
+ storage.save();
+
+ char[] textChs = FileUtils.readFileContents(URIUtil.toPath(uri).toFile(), null);
+ String text = new String(textChs);
+ // this appears randomly
+ text = text.replace(" standalone=\"no\"","");
+ assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?> " +
+ "<root foo=\"bar\">la dee dah" +
+ "<kid foo=\"baz\"/> " +
+ "</root> ",
+ text.replaceAll("\\s+", " "));
+
+ doc = storage.getDocumentElement();
+ assertNotNull(doc);
+ // be sure save doesn't destroy
+ assertEquals("root", doc.getNodeName());
+ assertEquals("bar", doc.getAttribute("foo"));
+ assertEquals(1, XMLUtils.getChildElementsNamed(doc, "kid").length);
+
+ }
+
+ @Test
+ public void testLoad() throws Exception {
+ String text = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
+ "<root foo=\"bar\">la dee dah\n" +
+ "<kid foo=\"baz\"/>\n" +
+ "<kid>bart</kid>\n" +
+ "</root>\n";
+
+ FileUtils.writeFileContents(URIUtil.toPath(uri).toFile(), text.toCharArray(), null);
+
+ EFSXMLFileStorage storage = new EFSXMLFileStorage(uri);
+ storage.load("root");
+
+ assertNotNull(storage.getDocument());
+ assertNotNull(storage.getDocumentElement());
+
+ Element root = storage.getDocumentElement();
+ assertEquals("root", root.getNodeName());
+ assertEquals("bar", root.getAttribute("foo"));
+ assertEquals("la dee dah\n", XMLUtils.getText(root));
+
+ Element[] kids = XMLUtils.getChildElementsNamed(root, "kid");
+ assertEquals(2, kids.length);
+
+ assertEquals("baz", kids[0].getAttribute("foo"));
+ assertNull(XMLUtils.getText(kids[0]));
+ assertEquals("bart", XMLUtils.getText(kids[1]));
+ }
+
+ @Test
+ public void testEnvironmentStorage() throws Exception {
+ EFS.getStore(uri).delete(0, null);
+ EnvironmentXMLStorage storage = new EnvironmentXMLStorage(uri);
+ try {
+ storage.load();
+ fail("was deleted");
+ } catch (CoreException e) {
+ }
+ storage.create();
+
+ IEnvironmentVariableBlock block = new EnvironmentVariableBlock();
+ storage.readEnvironmentBlock(block, null);
+ IEnvironmentVariable[] vars = block.getVariables();
+ assertEquals(0, vars.length);
+
+ block.define("FOO", "bar");
+ block.define("BAR", null);
+
+ storage.writeEnvironmentBlock(block, null);
+
+ IEnvironmentVariableBlock catblock = new EnvironmentVariableBlock();
+ storage.readEnvironmentBlock(block, "mycat");
+ IEnvironmentVariable[] catvars = catblock.getVariables();
+ assertEquals(0, vars.length);
+
+ catblock.define("SUB1", "bzzzzt");
+ catblock.define("SUB2", null);
+
+ storage.writeEnvironmentBlock(catblock, "mycat");
+
+ storage.save();
+
+ char[] textChs = FileUtils.readFileContents(URIUtil.toPath(uri).toFile(), null);
+ String text = new String(textChs);
+ // this appears randomly
+ text = text.replace(" standalone=\"no\"","");
+ assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?> " +
+ "<environment> " +
+ "<variable name=\"FOO\">bar</variable> " +
+ "<variable name=\"BAR\" undefine=\"true\"/> " +
+ "<category name=\"mycat\"> "+
+ "<variable name=\"SUB1\">bzzzzt</variable> "+
+ "<variable name=\"SUB2\" undefine=\"true\"/> "+
+ "</category> " +
+ "</environment> ",
+ text.replaceAll("\\s+", " "));
+
+ storage.load();
+
+ block = new EnvironmentVariableBlock();
+ storage.readEnvironmentBlock(block, null);
+ vars = block.getVariables();
+ assertEquals(2, vars.length); // don't get sub-nodes called 'variable'!
+ assertEquals("FOO",vars[0].getName());
+ assertEquals("bar", vars[0].getValue());
+ assertEquals("BAR", vars[1].getName());
+ assertEquals(null, vars[1].getValue());
+
+ catblock = new EnvironmentVariableBlock();
+ storage.readEnvironmentBlock(catblock, "mycat");
+ catvars = catblock.getVariables();
+ assertEquals(2, catvars.length);
+ assertEquals("SUB1",catvars[0].getName());
+ assertEquals("bzzzzt", catvars[0].getValue());
+ assertEquals("SUB2", catvars[1].getName());
+ assertEquals(null, catvars[1].getValue());
+
+ }
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/project/TestStandaloneProject.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/project/TestStandaloneProject.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/core/tests/project/TestStandaloneProject.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.core.tests.project;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.junit.Before;
+import org.junit.Test;
+import org.maemo.esbox.core.HostUtils;
+import org.maemo.esbox.core.IPersistentPropertyAccess;
+import org.maemo.esbox.core.tests.TestUtils;
+import org.maemo.esbox.internal.core.tests.TestActivator;
+import org.maemo.esbox.project.core.*;
+
+
+/**
+ * Test the basic standalone project implementation. This is the basis of a
+ * Python project, for instance.
+ * @author eswartz
+ *
+ */
+public class TestStandaloneProject {
+ static class StandaloneBuildConfiguration extends ESboxBuildConfigurationBase {
+ public StandaloneBuildConfiguration(IESboxProjectHandle projectHandle,
+ ESboxBuildConfigurationParameters parameters) {
+ super(projectHandle, parameters);
+ }
+
+ public StandaloneBuildConfiguration(
+ StandaloneProjectHandle standaloneProjectHandle, String id,
+ String name, IPersistentPropertyAccess access) {
+ super(standaloneProjectHandle, id, name, access);
+ }
+
+ }
+ static class StandaloneProjectHandle extends ESboxStandaloneProjectHandleBase {
+ public StandaloneProjectHandle(IProject project) {
+ super(project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ESboxStandaloneProjectHandleBase#doCreateBuildConfiguration(org.maemo.esbox.project.core.ESboxBuildConfigurationParameters)
+ */
+ @Override
+ protected ESboxBuildConfigurationBase doCreateBuildConfiguration(
+ ESboxBuildConfigurationParameters parameters) {
+ return new StandaloneBuildConfiguration(this, parameters);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ESboxStandaloneProjectHandleBase#doLoadBuildConfiguration(java.lang.String, java.lang.String, org.maemo.esbox.core.IPersistentPropertyAccess)
+ */
+ @Override
+ protected ESboxBuildConfigurationBase doLoadBuildConfiguration(String id,
+ String name, IPersistentPropertyAccess access) {
+ return new StandaloneBuildConfiguration(this, id, name, access);
+ }
+
+
+ }
+ private static final String PROJECT_NAME = "standalone-project";
+ private IProject project;
+
+ @Before
+ public void setUp() throws Exception {
+ TestUtils.disableAutobuild();
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+ TestUtils.deleteProject(project);
+ }
+
+ @Test
+ public void testEmptyProject() throws Exception {
+ project.create(null);
+ IESboxProjectHandle handle = new StandaloneProjectHandle(project);
+
+ // should not crash creating from empty project
+ assertNull(handle.getCurrentConfiguration());
+ IESboxBuildConfiguration[] configs = handle.getBuildConfigurations();
+ assertNotNull(configs);
+ assertEquals(0, configs.length);
+
+ try {
+ handle.save(null);
+ fail("should fail due to no build configs");
+ } catch (CoreException e) {
+ // good
+ }
+ }
+
+ @Test
+ public void testCreateProject() throws Exception {
+ project.create(null);
+ project.open(null);
+ IESboxProjectHandle handle = new StandaloneProjectHandle(project);
+
+
+ // make a build config
+ ESboxBuildConfigurationParameters params =
+ new ESboxBuildConfigurationParameters("my config", "CHINOOK_ARMEL", "Scratchbox 1");
+ IESboxBuildConfiguration config = handle.createBuildConfiguration(params);
+
+ // config should be added and default
+ IESboxBuildConfiguration[] configs = handle.getBuildConfigurations();
+ assertEquals(1, configs.length);
+ assertEquals(config, handle.getCurrentConfiguration());
+ assertEquals(config, configs[0]);
+
+ // should save successfully
+ handle.save(null);
+
+ // should still have build config
+ configs = handle.getBuildConfigurations();
+ assertEquals(1, configs.length);
+ assertEquals(config, handle.getCurrentConfiguration());
+ assertEquals(config, configs[0]);
+
+ // reload
+ handle = new StandaloneProjectHandle(project);
+ // should still have build config
+ configs = handle.getBuildConfigurations();
+ assertEquals(1, configs.length);
+ assertEquals(config, handle.getCurrentConfiguration());
+ assertEquals(config, configs[0]);
+
+ }
+
+ @Test
+ public void testLoadProject() throws Exception {
+ project = TestUtils.copyAndImportProject(
+ TestActivator.PLUGIN_ID,
+ "data/projects/standalone-project",
+ PROJECT_NAME,
+ HostUtils.getTemporaryPath().append("projects"));
+
+ IESboxProjectHandle handle = new StandaloneProjectHandle(project);
+
+ // should be two configs
+ IESboxBuildConfiguration[] configs = handle.getBuildConfigurations();
+ assertEquals(2, configs.length);
+ IESboxBuildConfiguration config = configs[0];
+ assertEquals("Scratchbox 1~CHINOOK_X86", config.getId());
+ assertEquals("my x86 target", config.getName());
+ assertEquals("gtk", config.getExecutionEnvironmentId());
+ assertEquals("Scratchbox 1", config.getSDKName());
+ assertEquals("CHINOOK_X86", config.getSDKTargetName());
+
+ config = configs[1];
+ assertEquals("Scratchbox 1~CHINOOK_ARMEL", config.getId());
+ assertEquals("my arm target", config.getName());
+ assertEquals("maemo", config.getExecutionEnvironmentId());
+ assertEquals("Scratchbox 1", config.getSDKName());
+ assertEquals("CHINOOK_ARMEL", config.getSDKTargetName());
+
+ assertEquals(config, handle.getCurrentConfiguration());
+ }
+
+ @Test
+ public void testAddRemove() throws Exception {
+ project = TestUtils.copyAndImportProject(
+ TestActivator.PLUGIN_ID,
+ "data/projects/standalone-project",
+ PROJECT_NAME,
+ HostUtils.getTemporaryPath().append("projects"));
+
+ IESboxProjectHandle handle = new StandaloneProjectHandle(project);
+
+ try {
+ handle.setCurrentConfiguration(null);
+ fail("cannot set null current config");
+ } catch (CoreException e) {
+ // ok
+ }
+
+ // allowed
+ IESboxBuildConfiguration currentConfig = handle.getCurrentConfiguration();
+ handle.removeBuildConfiguration(currentConfig);
+
+ assertNotNull(handle.getCurrentConfiguration());
+ IESboxBuildConfiguration[] configs = handle.getBuildConfigurations();
+ assertEquals(1, configs.length);
+
+ assertEquals(configs[0], handle.getCurrentConfiguration());
+
+ // allowed to remove last
+ handle.removeBuildConfiguration(handle.getCurrentConfiguration());
+
+ configs = handle.getBuildConfigurations();
+ assertEquals(0, configs.length);
+
+ // allowed to make new config from deleted config
+ ESboxBuildConfigurationParameters params = new ESboxBuildConfigurationParameters(
+ "my new target", null);
+
+ IESboxBuildConfiguration config = handle.createBuildConfiguration(params, currentConfig);
+ assertNotNull(config);
+
+ configs = handle.getBuildConfigurations();
+ assertEquals(1, configs.length);
+ assertEquals(config, configs[0]);
+ assertEquals(config, handle.getCurrentConfiguration());
+
+ handle.save(null);
+
+ }
+}
Added: trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/internal/core/tests/TestActivator.java
===================================================================
--- trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/internal/core/tests/TestActivator.java (rev 0)
+++ trunk/common/org.maemo.esbox.core.tests/src/org/maemo/esbox/internal/core/tests/TestActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,127 @@
+package org.maemo.esbox.internal.core.tests;
+
+import org.eclipse.core.runtime.*;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TestActivator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.core.tests";
+
+ // The shared instance
+ private static TestActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public TestActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static TestActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Get location of this plugin.
+ *
+ * @return
+ * @throws IOException
+ */
+ public static String getPluginPath() throws IOException {
+ if (!Platform.isRunning()) {
+ // get file relative to CWD (i.e. this project)
+ File f = new File(".");
+ f = f.getCanonicalFile();
+ return f.getAbsolutePath();
+ } else {
+
+ if (getDefault() == null)
+ return null;
+ Bundle bundle = getDefault().getBundle();
+ if (bundle == null)
+ return null;
+ URL url = FileLocator.find(bundle, new Path("."), null);
+ if (url == null)
+ TestCase.fail("could not find URL for bundle: " + bundle);
+ url = FileLocator.resolve(url);
+ TestCase.assertEquals("file", url.getProtocol());
+
+ return url.getPath();
+ }
+ }
+ /**
+ * Load a file relative to this plugin in the running workbench
+ *
+ * @param file
+ * @return File
+ * @throws IOException
+ */
+ public static File pluginRelativeFile(String fileName) throws IOException {
+ String bundlePath = getPluginPath();
+
+ if (bundlePath == null)
+ return null;
+
+ File file = new File(bundlePath, fileName);
+ try {
+ file = file.getCanonicalFile();
+ } catch (IOException e) {
+
+ }
+ return file;
+ }
+
+ /**
+ * Find a file relative to the project. Works if running
+ * in the workbench or standalone.
+ * @param file the relative path (from the project) to the file
+ * @return File
+ */
+ public static File projectRelativeFile(String file) throws Exception {
+ File f;
+ if (!Platform.isRunning()) {
+ // get file relative to CWD (i.e. this project)
+ f = new File(file);
+ f = f.getCanonicalFile();
+ } else {
+ // get file relative to running plugin (still this project)
+ f = pluginRelativeFile(file);
+ }
+ if (f == null)
+ TestCase.fail("Cannot find file " + file + " relative to project");
+ return f;
+ }
+}
Property changes on: trunk/common/org.maemo.esbox.help
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.help/.project
===================================================================
--- trunk/common/org.maemo.esbox.help/.project (rev 0)
+++ trunk/common/org.maemo.esbox.help/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.help</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.help/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.help/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.maemo.esbox.help/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Help Plug-in
+Bundle-SymbolicName: org.maemo.esbox.help;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: INdT / Nokia
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: trunk/common/org.maemo.esbox.help/about.html
===================================================================
--- trunk/common/org.maemo.esbox.help/about.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/about.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+<h3>About This Content</h3>
+
+<h3>ESbox</h3>
+
+<p><a href="http://esbox.garage.maemo.org/" target="_blank">ESbox</a>
+is an Eclipse plug-in that helps programmers to develop applications for
+maemo platform on Scratchbox Apophis. It supports C/C++ and Python programming
+languages. Maemo 4.x SDKs (and later) will be supported.
+</p>
+
+<h3>License</h3>
+
+<p>See <a href="about_files/epl-v10.html">Eclipse Public License Version 1.0 ("EPL")</a>.
+</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>ESbox has a set of open source templates to help the development of applications. Such templates are distributed
+under <a href="about_files/COPYING.LESSER">LGPL license.</a></p>
+
+<address> © Copyright 2007-2008 INdT. All rights reserved. </address>
Added: trunk/common/org.maemo.esbox.help/about_files/epl-v10.html
===================================================================
--- trunk/common/org.maemo.esbox.help/about_files/epl-v10.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/about_files/epl-v10.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ at font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+ at page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.help/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.help/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,8 @@
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ html/,\
+ *.xml,\
+ about.html,\
+ about_files/
Added: trunk/common/org.maemo.esbox.help/html/concepts/DebianPackage.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/concepts/DebianPackage.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/concepts/DebianPackage.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Debian package management</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+<h2 class="style1">Debian package management</h2>
+
+<p>Maemo uses the Debian package management system for installing and managing
+application packages and their dependencies. For end-user the actual package
+management is invisible and the application installation and removal in the Internet
+Tablet is done by the Application Manager. The Debian package management system uses
+packages which consists of application binaries, optional libraries, meta data
+describing the package, dependencies to other packages and optional pre-install and
+post-install scripts. Packaging the applications is done with standard Debian
+packaging tools.</p>
+
+<p>After creating the Debian package (creation is identical to the desktop Linux
+environment) the application is ready to be installed on the Internet Tablet.
+The Application is either copied to the device and installed using Application manager,
+or by placing the package into the package repository (essentially a web or FTP site
+containing application packages) and creating a single-click install-file. The
+single-click install-file eliminates the need for user to manually configure
+repositories into the Application manager, providing an easy-to-use way for end-user
+to install the application.</p>
+ <p>
+ See <a href="http://www.debian.org/doc/FAQ/ch-pkg_basics.en.html">this page</a> for details about Debian packaging.
+</p>
+
+<h3>Related Topic</h3>
+<p><a href="../tasks/DebianPackage.html">Creating Debian Package</a></p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/concepts/LocalDebugging.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/concepts/LocalDebugging.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/concepts/LocalDebugging.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Local Debugging</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1">Local Debugging</h2>
+
+<p>The debugger has a client/server design so that it can be used to debug programs that run
+locally (on the same workstation as the debugger) or remotely (on another computer on the
+network). Local debugging is the simplest and most common kind of debugging.
+After you have finished editing and building your program, you can launch the program on
+your workstation using the launch configuration dialog. Select the <strong>Run > Open Debug Dialog...</strong> menu item on the workbench. Launching the program in this way will establish a connection
+between the debugger client and the program that you are launching. You may then use
+breakpoints, stepping, or expression evaluations to debug your program.</p>
+<p> </p>
+<p><img src="../images/pref_images/debug_config.png" alt="debug configuration" width="854" height="674"></p>
+<p> </p>
+<h3>Related Topics</h3>
+<p><a href="../gettingstarted/DebuggingCMaemoApplications.html">Debugging a C/C++ Maemo Application</a> </p>
+<p><a href="LocalLaunching.html">Local Launching</a> </p>
+<p><a href="RemoteDebugging.html">Remote Debugging</a> </p>
+<p><a href="RemoteLaunching.html">Remote Launching</a> </p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/concepts/LocalLaunching.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/concepts/LocalLaunching.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/concepts/LocalLaunching.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Local Launching</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1">Local Launching</h2>
+
+<p>To create a local launching configuration:</p>
+
+ <ol>
+ <li>
+ In the C/C++ Projects view, select a project listed in the Project Explorer view.</li>
+ <li>Select <strong>Run > Open Run Dialog</strong>...</li>
+ <li>In the list of Configurations in the column along the leftside, select Maemo Local Application.</li>
+ <li><img src="../images/pref_images/new.png" alt="New configuration" width="18" height="18">Click the New launch configuration button. The name of the new project is displayed in the Configurations box. The default name is the name of the project.</li>
+ <li>Select the Main tab.</li>
+ <li>Do the following:</li>
+
+<ul>
+ <li>In the Name box, type a descriptive name for this new launch configuration.</li>
+ <li>In the Project box, type the name of the project containing the application that you want to run.</li>
+ <li>In the C/C++ Application box, type the name of the executable that you want to run.</li>
+ </div></li></p>
+</ul>
+</ol>
+ </p>
+
+
+ <p><img src="../images/pref_images/localapp.png" alt="local application configuration" width="854" height="674"></p>
+ <h3> </h3>
+ <h3>Related Topics</h3>
+ <p><a href="../gettingstarted/RunningCProject.html">Running a C/C++ Maemo Project</a></p>
+ <p><a href="LocalDebugging.html">Local Debugging</a> </p>
+ <p><a href="RemoteLaunching.html">Remote Launching</a> </p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/concepts/MaemoBuilder.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/concepts/MaemoBuilder.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/concepts/MaemoBuilder.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Maemo Builder</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+<h2 class="style1">Maemo Builder</h2>
+
+<p>Scratchbox provides a sandbox build environment which offers a controlled set of tools
+and utilities needed for cross-compilation. It is an environment in which it is easy to assure
+that the intended versions of libraries, headers and other similar files are used during the build.
+Most of the higher level software built using GNU Autotools do not cross-compile well in their as-is
+form. Scratchbox solves this problem by allowing the small test programs to run transparently either
+using an emulator or through sbrsh protocol between Scratchbox and the actual target device. In practice,
+software configuration and building using Scratchbox is quite identical to how it's done for the desktop.</p>
+
+<p>Scratchbox has been designed to allow multiple application developers to work simultaneously on a
+single host machine. Each developer has his private user account, and all configuration is
+developer-specific.</p>
+
+<p> The files created are specific to the platform defined
+as the current Scratchbox TARGET. The binaries are generated by running the targets of the makefile. The commands to generate the
+binaries are performed inside Scratchbox.</p>
+
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/concepts/MaemoProjects.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/concepts/MaemoProjects.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/concepts/MaemoProjects.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Maemo Projects</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+<h2 class="style1">Maemo Projects</h2>
+<p>Maemo is an open development platform for applications and technology innovations for handheld devices.
+It was developed by Nokia as part of its development process for the Nokia Internet Tablet devices and
+subsequently open sourced and offered to the community. It brings to developers an easy to use development
+environment and a new optimized end user interface customized for handheld screen size and usage.</p>
+
+<p>Maemo platform is composed of mainstream Linux and open source software widely deployed in the most
+popular Linux distributions. At its core is Hildon Application framework, which is based on GNOME technology.
+GNOME provides an intuitive and attractive PC desktop for end-users based on Linux, and a powerful framework
+for building applications that integrate into the rest of the PC desktop. Maemo adapts this widely deployed
+desktop technology to handheld devices with extensions and modifications to evolve a user interface framework
+more suited for handheld category devices. The development platform is targeted towards open source developers
+and innovation houses developing applications and new technologies for Linux based Internet connected handheld
+devices.</p>
+
+<p>Some exciting new tools and features are lined up for future releases of maemo. For example, support
+for using UI builder tool with Hildon widgets, a better development environment update feature, the ability
+to create custom rootstraps by end developers, IDE/Scratchbox integration, better support for multimedia
+application development on x86, etc. The developer community is strongly encouraged to contribute and work
+together to define the direction and roadmap of maemo.</p>
+
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/concepts/ProfilingApplications.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/concepts/ProfilingApplications.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/concepts/ProfilingApplications.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Profiling Applications</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+<h2 class="style1">Profiling Applications</h2>
+
+<p>Application profiling is one of the most valuable techniques available for
+programmers to get out of the world of premature optimization, and back into reality.
+By simply profiling an application, it becomes immediately apparent where the
+overwhelming memory and CPU burdens exist, and allows you to quickly squash them.
+ESbox provides support for <a href="http://www.valgrind.org/">Valgrind</a>
+memory profiler and <a href="http://oprofile.sourceforge.net/news/">OProfile</a>
+system-wide profiler for both C/C++ and Python Projects.</p>
+
+<h3 class="style1">Valgrind</h3>
+<p>Valgrind is an Open Source suite of tools for debugging and profiling Linux programs.
+It works only on x86 (and PPC) and is a powerful and easy to use tool that can save
+you a lot of debugging time.</p>
+
+<p>Because Valgrind works by simulating the x86 processor and instrumenting the binaries
+on the fly, it can control the program execution completely. On the downside it makes
+program execution 10-300 times slower than normal, depending on the used Valgrind
+tools (massif is the fastest, callgrind the slowest) and can take a huge amount of
+memory.</p>
+
+<h3 class="style1">OProfile</h3>
+
+<p>OProfile is a system-wide profiler for Linux systems, capable of profiling all
+running code at low overhead. OProfile is released under the GNU GPL.</p>
+
+<p>It consists of a kernel driver and a daemon for collecting sample data, and several
+post-profiling tools for turning data into information.</p>
+
+<p>OProfile leverages the hardware performance counters of the CPU to enable profiling
+of a wide variety of interesting statistics, which can also be used for basic
+time-spent profiling. All code is profiled: hardware and software interrupt handlers,
+kernel modules, the kernel, shared libraries, and applications.</p>
+<p> </p>
+<h3>Related Topic</h3>
+<p><a href="../gettingstarted/ProfilingMaemoApplications.html">Profiling Maemo Applications</a> </p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/concepts/RemoteDebugging.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/concepts/RemoteDebugging.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/concepts/RemoteDebugging.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Remote Debugging</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1">Remote Debugging a Maemo C/C++ Application</h2>
+
+<p>In order to debug your application, you must use executables compiled for debugging.
+These executables contain additional debug information that lets the debugger make direct
+associations between the source code and binaries generated from that original source.
+This is particularly useful when you are developing a program for a device that cannot host
+the development platform. The CDT debugger uses GDB as the underlying debug engine.
+It translates each user interface action into a sequence of GDB commands and processes
+the output from GDB to display the current state of the program being debugged.
+GDB offers extensive facilities for tracing and altering the execution of computer
+programs and a 'remote' mode often used when debugging embedded systems.
+Remote operation is when GDB runs on one machine and the program being debugged
+runs on another. GDB can communicate to the remote 'stub' which understands GDB
+protocol via TCP/IP.</p>
+
+<h4 class="style1">ESbox gdbserver Debugger on Device</h4>
+<p>Select <strong>Run > Open Debug Dialog...</strong> and select the Debugger tab. In the Connection tab inside the debug dialog's Debugger tab you can choose ESbox gdbserver Debugger on Device.
+You must also select the connection type.</p>
+<li>For TCP you must first set the Host name or IP address and Port number.</li>
+<p><img src="../images/debug.jpg" alt="esbox_debug" width="994" height="728"></p>
+<p>If necessary you can provide shared libraries.</p>
+<p> </p>
+<p><img src="../images/pref_images/debugtab_shlibtab.png" alt="shared libraries" width="652" height="497"> </p>
+<p> </p>
+<p>In the Debugger tab's Main tab, for ESbox gdbserver Debugger on Device or ESbox gdbserver Local Debugger, you can specify the GDB debugger command, GDB command file, and Verbose console mode.</p>
+<p>If Verbose console mode is checked, then GDB MI commands and their output are logged. This could be useful for troubleshooting the debugger.</p>
+<p> </p>
+<p><img src="../images/pref_images/debugtab_maintab.png" alt="main" width="642" height="452"></p>
+<h3>Related Topics</h3>
+<p><a href="../gettingstarted/DebuggingCMaemoApplications.html">Debugging a C/C++ Maemo Application</a> </p>
+<p><a href="RemoteLaunching.html">Remote Launching</a> </p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/concepts/RemoteLaunching.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/concepts/RemoteLaunching.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/concepts/RemoteLaunching.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Remote Launching</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1">Remote Launching a Maemo C/C++ Application </h2>
+
+<p>To create a remote launch configuration:
+
+<ol>
+ <li>In the C/C++ Projects view, select a project in the Project Explorer view.</li>
+ <li>Select <strong>Run > Open Run Dialog...</strong></li>
+ <li>In the list of Configurations in the left column, select Maemo Remote Application.</li>
+ <li><img src="../images/pref_images/new.png" alt="new configuration" width="18" height="18">Click the New launch configuration button. The name of the new project is displayed in the Configurations box. The default name is the name of the project.</li>
+ <li>Select the Main tab.</li>
+ <li>Do the following:</li>
+
+<ul>
+ <li>In the Name box, type a descriptive name for this new launch configuration.</li>
+ <li>In the Project box, type the name of the project containing the application that you want to run.</li>
+ <li>In the C/C++ Application box, type the name of the executable that you want to run.</li>
+</ul>
+</p>
+</ol>
+<p><img src="../images/pref_images/remoteapp.png" alt="remote app config" width="975" height="628"></p>
+<p> </p>
+<h3>Related Topics</h3>
+<p><a href="RemoteDebugging.html">Remote Debugging</a> </p>
+<p><a href="LocalLaunching.html">Local Launching</a> </p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/concepts/Sbrsh.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/concepts/Sbrsh.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/concepts/Sbrsh.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Sbrsh</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+<h2 class="style1">Sbrsh</h2>
+
+<p>The Scratchbox Remote Shell is a remote command execution system similar to rsh and
+ ssh. It is designed with slow devices and Scratchbox's special requirements in mind.
+ It supports common types of program execution (including terminal emulation), but it
+ is optimized for non-interactive usage. The communication happens on a TCP/IP
+ connection and is not encrypted. Sbrsh is meant to be used only on trusted networks,
+such as a company's LAN or an USB network between a PC and a handheld device.</p>
+<p>The server (sbrshd) is run on a device having the same CPU architecture as the
+compilation target that is being used in Scratchbox. It executes the commands issued
+by the client (sbrsh) inside a "sandbox" that is created by mounting network
+filesystems (typically exported by the host that runs the client) and binding local
+directories (such as /dev).</p>
+
+<p>Sbrshd contains support functionality that makes network-transparent fakeroot
+sessions possible. Due to this sbrshd requires fakeroot header files to compile.</p>
+
+<p>Sbrsh is an alternative to QEMU for implementing the CPU-transparency feature of
+Scratchbox. It runs the configure scripts' test programs on a remote device with the
+CPU architecture used by the cross-compilation toolchain; typically the device that
+you are developing software for. Some build systems also benefit from it when they
+attempt to execute a target binary which is used to generate data files.
+Running programs on an actual target device is more reliable than emulating a
+specific device because emulators might not support all required features or
+there might not be an appropriate emulator available at all.</p>
+<h3>Related Topics</h3>
+<p><a href="../gettingstarted/SettingsSbrshConfiguration.html">Setting Sbrsh Preferences</a></p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/concepts/ScratchboxTarget.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/concepts/ScratchboxTarget.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/concepts/ScratchboxTarget.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Scratchbox Target</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+<h2 class="style1">Scratchbox Target</h2>
+
+<p>Scratchbox defines different environments by creating and using TARGETS.
+The user defines which compiler, devkits, etc. will be part of the environment.
+The process of creating a new target is performed in Scratchbox with the aid of
+a text interface. ESbox provides a GUI wizard to help you create a
+Scratchbox TARGET. The Scratchbox TARGETS available are also listed and the programmer
+can delete a TARGET or define the current TARGET of the Scratchbox environment.
+Each target is a separate environment that has a selected toolchain, target
+CPU and file system, and can use only one in each maemo project.
+In Scratchbox you can have multiple TARGETS which means that you can compile
+programs for many different architectures and settings.
+The HOST target is used for compiling programs that are used inside Scratchbox.</p>
+<p> </p>
+<h3>Related Topics</h3>
+<p><a href="../gettingstarted/SettingPreferences.html#sbox1">ScratchBox 1 Preference Settings</a></p>
+<p><a href="../gettingstarted/SettingPreferences.html#sbox2">ScratchBox 2 Preference Settings</a></p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/concepts/StringExternalization.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/concepts/StringExternalization.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/concepts/StringExternalization.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>String Externalization</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+<h2 class="style1">String Externalization</h2>
+
+<p>The ESbox tools help you develop applications that can be run on international
+platforms. Localization, or externalization, is an important part of global software distribution and opens up new
+markets around the world. Externalization is the process of converting software user interfaces to
+a userâs local culture. For the most part, localization involves converting text
+strings into the language of the local culture, but it can also involve time, date,
+and number formats, for example. On maemo localization is based on a standard gettext package, and all the
+necessary tools are included in scratchbox.</p>
+
+<p>The Externalize Strings wizard allows you to refactor a compilation unit
+such that strings used in the compilation unit can be translated to
+different languages.</p>
+<p> </p>
+<h3>Related Topic</h3>
+<p><a href="../gettingstarted/ExternalizeString.html">Extracting Strings</a> </p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/BasicTutorial.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/BasicTutorial.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/BasicTutorial.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Basic Tutorial</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+<h2 class="style1">Basic Tutorial</h2>
+<p>Shows step by step how to create a ESbox project.</p>
+<ul>
+
+<li><strong><a href="CreatingAMaemoProject.html">
+Creating a new C/C++ Maemo project
+</a></strong></li>
+
+<li><strong><a href="CreatingProjectTemplates.html">
+Creating a Maemo project with templates
+</a></strong></li>
+
+<li><strong><a href="CreatingPythonProject.html">
+Creating a Python Project
+</a></strong></li></ul>
+
+<p>Now with ESbox project created, Let's compile.</p><ul>
+
+<li><strong><a href="CompilingCMaemoProject.html">
+Compiling a C/C++ Maemo Project
+</a></strong></li></ul>
+
+<p>Finally, running projects.</p><ul>
+
+<li><a href="RunningCProject.html"><STRONG>
+Running C/C++ Maemo Project
+</STRONG></a></li>
+<li><strong><a href="RunningPythonProject.html">
+Running Python Maemo Project
+</a></strong></li></ul>
+
+<p>Debugging projects.</p><ul>
+<li><a href="DebuggingCMaemoApplications.html"><STRONG>
+Debugging C/C++ Maemo Project
+</STRONG></a></li>
+<li><strong><a href="DebuggingPythonMaemoApplications.html">
+Debugging Python Maemo Project
+</a></strong></li></ul>
+
+<p>Analysis of Performance.</p><ul>
+<li><strong><a href="ProfilingMaemoApplications.html">
+Profiling C/C++ application
+</a></strong></li></ul>
+
+<p>Helping extraction of strings.</p><ul>
+<li><strong><a href="ExternalizeString.html">
+Externalize string on C/C++ application.
+</a></strong></li></ul>
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/CompilingCMaemoProject.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/CompilingCMaemoProject.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/CompilingCMaemoProject.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Compiling an ESbox C/C++ Project</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+<body>
+
+<h2 class="style1">Compiling a C/C++ Maemo Project</h2>
+
+<p>When an Automake C/C++ Maemo Project is created, it is automatically compiled.</p>
+<p>If you created a Makefile C/C++ Maemo Project, you need to provide a makefile.</p>
+
+<p>When you build a project, output from make is displayed in the Console view.
+Makefile actions are displayed in the Make Targets view.</p>
+
+
+For more information about creating a make target <a href="../tasks/CreateMakeTarget.html">click here</a>.
+<p></p>
+<p>To build your C/C++ Maemo Project:</p>
+
+<ul>
+
+ <li> In the Project Explorer or C/C++ view, select a project.</li>
+ <li> Right click on a project and select Build Application (context menu varies depending upon which view is active)</li>
+ <li> Options include generating a configure script, run your configure script (same as ./configure) or build your project.</li>
+ <p></p>
+ <img src="../images/build.jpg" alt="build" width="549" height="670">
+
+ <p></p>
+ <li> The screenshot below shows the effect of clicking Build All. The Console view displays the output of the make utility.</li>
+ <p></p>
+ <img src="../images/build1.jpg" alt="build1" width="1036" height="768">
+</ul>
+
+<p> </p>
+
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/ConfigurationTutorial.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/ConfigurationTutorial.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/ConfigurationTutorial.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Project Configuration Tutorial</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+
+
+<h3>Project Configuration Tutorial</h3>
+
+<p></p>
+<ul>
+<li><strong><a href="SettingPreferences.html">
+Setting Preferences
+</a></strong></li>
+<li><strong><a href="SettingsSbrshConfiguration.html">
+Setting Sbrsh Options
+</a></strong></li></ul>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingAMaemoProject.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingAMaemoProject.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingAMaemoProject.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Creating a new C/C++ Maemo project</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+<body>
+
+<h2 class="style1">Creating a new C/C++ Maemo project</h2>
+
+<p>The following steps describe how to create a project that contains your source code and related files.
+A project has an associated builder that can incrementally compile source
+files as they are changed.</p>
+
+<p>Once you have installed the ESbox plug-in into your Eclipse IDE,
+ you will be ready to create and work with a C/C++ Maemo project.</p>
+
+<p>To create a new C/C++ Maemo project:</p>
+ <ol>
+ <li>Select <strong>File > New > C/C++ Maemo Project</strong> from the main menu bar to open the New Project wizard.</li>
+ <p>Depending on which view is currently active, you may have to select <strong>Project...</strong> then expand the <strong>C</strong> folder and select <strong><em>M</em> C/C++ Maemo Project</strong>.</p>
+ <p><img src="../images/esbox0.jpg" alt="esbox0" width="600" height="368"></p>
+ <li>In the Template Project Type window, select a project template and click Next. You can choose an empty project in the Simple group. Select a template to display related information in the bottom information box. Check the "Filter templates based on enabled SDKs" box to only display templates based on installed and enabled SDKs. </li>
+ <p><img src="../images/esbox1.jpg" alt="esbox1" width="525" height="850"></p>
+ <li>In the Project Configuration Dialog, type your project name in the Project name field. You can use the default workspace location to store the new project or uncheck the "Use default location" option to browse to a different folder. Select a build target for the project. To show all installed build targets unrelated to the selected template, uncheck the "Filter build targets based on selected template" option. </li>
+ <p><img src="../images/esbox2.jpg" alt="esbox2" width="525" height="556"></p>
+ <li>Click <STRONG>Next</STRONG> to display the Basic Settings dialog.</li>
+
+ <p><img src="../images/esbox3.jpg" alt="esbox3" width="525" height="483"></p>
+ <li>Click <STRONG>Finish</STRONG> to create project. If the C/C++ perspective is not currently set as the default, you are prompted to associate the project with the C/C++ perspective. Click Yes.</li>
+
+ <p><img src="../images/esbox4.jpg" alt="create project" width="524" height="482"></p>
+
+ <li>The Console output will display information related to the project creation and suggest ways to fix any errors.</li>
+
+ <p><img src="../images/esbox5.jpg" alt="console" width="772" height="251"></p>
+ </ol>
+
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingProjectTemplates.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingProjectTemplates.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingProjectTemplates.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Creating a Maemo project with templates</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+<body>
+
+<h2 class="style1">Creating a Hello World Application</h2>
+
+<p>In this tutorial, you will use the CDT to create a simple 'Hello World' application.
+This tutorial describes the process of creating a new C/C++ Maemo project where the
+build is automatically managed by the CDT.</p>
+
+<p>To create a hello world project:</p>
+ <ol>
+ <li>Select <strong>File > New > Project...</strong> from the main menu bar to open the New Project wizard.</li>
+ <p><img src="../images/newproject.png" alt="new project" width="667" height="330"></p>
+
+ <li>In the New Project dialog, select the folder with the name C, click C/C++ Maemo Project and click Next to start the new C/C++ maemo project wizard.</li>
+ <p><img src="../images/newproject1.png" alt="new"></p>
+ <li>Select the Hello World project and click Next. Additional information for each project template is displayed in the information box. </li>
+ <p><img src="../images/newproject2.png" alt="new" width="559" height="718"></p>
+ <li>In the Project name field, enter a name for the project and select an installed build target.</li>
+
+ <p><img src="../images/newproject3.png" alt="target"></p>
+ <li>Next, you can specify the basic properties for the new project,
+ such as your name and version.</li>
+ <p><img src="../images/newproject4.png" alt="new" width="559" height="447"></p>
+ <li>Click <STRONG>Finish</STRONG>. If the C/C++ perspective is not currently set as the default, you are prompted to display the C/C++ perspective. Click Yes.</li>
+ </ol>
+
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingPythonProject.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingPythonProject.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/CreatingPythonProject.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Creating a Python Project</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+<body>
+
+<h2 class="style1">Creating a Python Project</h2>
+
+<p>To create a Python Maemo project:</p>
+ <ol>
+ <li>Select <strong>File > New > Project...</strong> from the main menu bar to open the New Project wizard.</li>
+ <li>In the New Project, select the folder with the name Pydev, click Python Maemo Project and click Next to start the project wizard.</li>
+ <p><img src="../images/newpythonproject.png" alt="python" width="525" height="500"></p>
+ <li>On this page, type your project name in the Project name field.</li>
+ <li> Choose a python template in Project types.</li>
+ <li>Choose a platform target and SDK.</li>
+ <p><img src="../images/newpythonproject1.png" alt="python1" width="621" height="532"></p>
+ <p> </p>
+ <li> Click <STRONG>Next</STRONG> to set basic settings.</li>
+ <p> </p>
+ <p><img src="../images/newpythonproject2.png" alt="basic" width="621" height="532"></p>
+ <li> Click <STRONG>Finish</STRONG>.</li>
+ <li> You are prompted to associate this project with the Pydev perspective. Click Yes, if desired.</li>
+ <p><img src="../images/python9.jpg" alt="python9"></p>
+ </ol>
+
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/DebuggingCMaemoApplications.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/DebuggingCMaemoApplications.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/DebuggingCMaemoApplications.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Debugging C/C++ Maemo Project</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+<body>
+
+<h2 class="style1">Debugging a C/C++ Maemo Application</h2>
+
+In oder to debug a C/C++ application, it is necessary that you compile the application using GCC debugger flags (e.g,
+-g). If you want to use remote debugging, it is necessary to configure Sbrsh (see <a href="SettingsSbrshConfiguration.html">Setting Sbrsh Configuration</a>) You can also set
+breakpoints in the code. Just right-click on the left-side editor
+margin and add a breakpoint.
+<p><img src="../images/debug9.jpg" width="824" height="526"></p>
+
+<p></p>
+
+<p>ESbox has 3 different types of debuggers:</p>
+<ul>
+ <li>ESbox GDB Debugger</li>
+ <li>ESbox
+ gdbserver Debugger on Device</li>
+ <li>ESbox gdbserver Local Debugger</li>
+</ul>
+<p> </p>
+<p>Select <strong>Run > Open Run Dialog...</strong> or <strong>Run > Open Debug Dialog...</strong> and select the Debugger tab for a local or remote run or debug configuration you have created.</p>
+<p><img src="../images/pref_images/debugtab_maintab.png" alt="Debug tab" width="642" height="452"></p>
+<p> </p>
+<p>The debugger types are selected from a dropdown list in the Debugger tab of the Run or Debug dialog.</p>
+<p> </p>
+<p><img src="../images/pref_images/debugtab_debuggerlist.png" alt="debuggers" width="651" height="415"></p>
+<p> </p>
+<p> ESbox
+ GDB Debugger is designed to be used in Scratchbox targets that use
+ compilers for X86 architecture.</p>
+<p>ESbox gdbserver Debugger
+ on Device is used to debug applications that are running on the Internet
+ Tablet.</p>
+<p>ESbox gdbserver Local Debugger is designed to be used in Scratchbox targets that use
+ compilers for the ARM architecture.</p>
+<p>To debug your C/C++ Maemo Project:</p>
+
+<ul><li>In the C/C++ Projects view, select a project.</li>
+ <li>Right click on the application and select <strong>Debug As > Maemo Local Application</strong>.</li>
+ <p></p>
+ <p><img src="../images/debug10.jpg" width="743" height="721"><br>
+ </p>
+ <p></p>
+ <li>The Debug perspective is opened and various information about your application is shown: memory map, registers,
+ variables, etc. The programmer can also follow the control flow of the
+ application.</li>
+ <p></p>
+ <p><img src="../images/debug5.jpg" width="1036" height="768"></p>
+
+</ul>
+<p> </p>
+<h3>Related Topic</h3>
+<p><a href="../concepts/RemoteDebugging.html">Remote Debugging</a> </p>
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/DebuggingPythonMaemoApplications.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/DebuggingPythonMaemoApplications.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/DebuggingPythonMaemoApplications.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Debugging Python Maemo Projectl</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+
+<h2 class="style1">Debugging a Python Maemo Application</h2>
+
+<div style="margin-left: 2em; margin-right: 2em; background-color: #ffff80; border: solid #999 1px; padding: 5px;">
+ <p>
+ <span style="font-weight: bold;">NOTE</span>: In order to successfully run Python applications under the ARMEL emulator,
+ you need a better version of the qemu-arm-0.8.2-sb2 emulator than is shipped by default in scratchbox (as of this writing).
+ </p><p>
+ The stock emulator does not implement all the system calls needed for Python, which will result in a lot of errors
+ about 'sem_post' and 'sem_wait' not being implemented and possibly segfaults in the emulator.</p>
+ <p>If your scratchbox has the 'qemu-arm-cvs-m' CPU transparency method (available in the cputransp devkit 1.0.6+), use that.
+ </p>Otherwise, you can manually build it.
+Consult <a href="http://qemu-arm-eabi.wiki.sourceforge.net/">this</a> for details.</p>
+</div>
+
+
+<p>Before debugging a Python maemo application, the programmer can set
+breakpoints in the code. Right-click on the left-side editor
+margin and add a breakpoint, as shown in the following screenshot.</p>
+
+<br>
+
+<img src="../images/debug7.jpg" width="1024" height="560"></p>
+<p></p>
+
+<p>To debug:</p>
+<ul>
+ <p></p>
+
+ <li> In the Pydev Package Explorer view, select a project.</li>
+ <li> Right click on the python script and select <strong>Debug As > Python Maemo Local Application </strong>or select <strong>Python Maemo Remote Application</strong>; as appropriate.</li>
+
+ <p><img src="../images/debug8.jpg" width="799" height="709"></p>
+ <p> </p>
+
+ <li> The Debug perspective is opened and various information about your application is shown: variables, breakpoints, etc. The programmer can also follow the control flow of the application.</li>
+ <p><img src="../images/debug6.jpg"></p>
+</ul>
+ <h3>Related Topics</h3>
+ <p><a href="SettingsSbrshConfiguration.html">Setting Sbrsh Preferences</a></p>
+ <p><a href="SettingPreferences.html">Setting Preferences</a> </p>
+ <p> </p>
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/ExternalizeString.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/ExternalizeString.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/ExternalizeString.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Externalize string on C/C++ application</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1">Extracting Strings</h2>
+
+
+<p>The Externalize Strings wizard allows you to refactor a compilation unit
+such that strings used in the compilation unit can be translated to different languages.
+</p>
+<p>To externalize strings:</p>
+ <ol>
+ <li>Select a project and right-click to display the popup menu and select <strong>Source > Externalize String</strong>.</li>
+ <p><img src="../images/externalize01.jpg" alt="Externalize String"></p>
+ <li>Select the file that should be externalized.</li>
+ <p><img src="../images/externalize02.jpg" alt="File that should be externalized"></p>
+ <li>A Wizard will appear showing strings that will be externalized. You can define the name of the output file, msgstr, and msgid.</li>
+ <p><img src="../images/externalize03.jpg" alt="Externalize Wizard"></p>
+ <li>Click Finish.</li>
+</ol>
+
+<p>A couple of files will be generated (<strong>POTFILE.in</strong> and <strong>outputName.po</strong>) which will be placed in the <strong>YourProject/po/</strong> directory.</p>
+<ul>
+ <li>POTFILES.in contains the list of source code files that will be localized.</li>
+ <li> outputName.po includes translated text.</li>
+</ul>
+
+<p>The Console view may output some warnings which usually are not serious, but should be checked.</p>
+
+<p><b>For example:</b></p>
+<p>In your source code, you probably have many strings, which eventually are shown in the user interface. For example:</p>
+
+<p><b>hildon_app_set_title ( app, "MaemoPad" );</b></p>
+
+<p>To make your strings localizable, you need to wrap the strings you want translated in gettext("String") calls. In practice, writing gettext() for every string is tedious. The common practice is to set the following #define.</p>
+
+<p><b>#define _(String) gettext (String)</b></p>
+
+<p>Thus the i18n version of the example would be:</p>
+
+<p><b>hildon_app_set_title ( app, _("MaemoPad") );</b></p>
+
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/Introduction.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/Introduction.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/Introduction.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Introduction</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+<h2 class="style1">Introduction</h2>
+
+<h4 class="style1">Scratchbox</h4>
+<ul>
+<p>
+Scratchbox is a cross-compilation toolkit designed to make embedded
+Linux application development easier.
+It also provides a full set of tools to integrate and
+cross-compile an entire Linux distribution.</p>
+</ul>
+
+<h4 align="left" class="style1">Toolchain</h4>
+<ul><p align="left" class="style1">Compilers, linkers and tools for a specific target.</p>
+</ul>
+<h4 align="left" class="style1">Target</h4>
+<ul>
+ <p>
+ The active toolchain and configuration currently used. A target uses a selected toolchain and contains a filesystem to use, and a related configuration. You can have multiple targets, even if they all use the same toolchains. This makes it easy to try something different, or start a parallel target to test things from scratch. Examples of targets are CHINOOK_ARMEL and CHINOOK_X86.</p>
+</ul>
+
+<h4 align="left" class="style1">Platform</h4>
+<ul>
+<p>
+Describes some sort of framework, either in hardware or software,
+which allows software to run.
+The maemo platform is built on desktop open source components and provides developers
+with a powerful and easy-to-use development, build, and test environment. It is aimed
+at enabling applications and innovative technology for mobile handheld devices.
+</p>
+</ul>
+
+<h4 align="left" class="style1">SDK</h4>
+<ul>
+<p>
+SDK is typically a set of development tools that allows a software engineer
+to create applications for a specific software framework or something similar.
+The maemo SDK contains the tools needed to create and port integrated applications,
+replicating the Internet Tablet environment in your PC.
+<p><b>SDK releases for maemo</b></p>
+<p>
+OS2008 for N800 & N810 developers
+<ul>
+ <li>Latest stable: maemo 4.0.1 Chinook</li>
+</ul>
+</p>
+<p>
+OS2007 for N800 developers
+<ul>
+ <li>Latest stable: maemo 3.x Bora</li>
+</ul>
+</p>
+<p>Nokia 770 developers
+<ul>
+ <li>Latest: maemo 2.2 Gregale</li>
+</ul>
+</p>
+
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/ProfilingMaemoApplications.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/ProfilingMaemoApplications.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/ProfilingMaemoApplications.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Profiling C/C++ application</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1">Profiling Maemo Applications</h2>
+
+<p><span style="font-weight: bold;"></span>Profiling is one of the most
+important techniques available for programmers to discover problems in applications. By profiling an application,
+it becomes immediately apparent where the overwhelming memory and CPU
+burdens exist, and allows you to quickly squash them. ESbox provides
+support for <a href="http://www.valgrind.org/">Valgrind</a> memory profiler and <a href="http://oprofile.sourceforge.net/news/">OProfile</a> system-wide profiler for both C/C++ and Python Projects.</p>
+
+<h3>Using Valgrind</h3>
+<p>Valgrind is a framework to build dynamic analyses tools. You can
+use Valgrind to profile your applications. It detects memory management
+(memory leaks, use of uninitialised memory, etc.) and thread bugs.
+However, Valgrind is only supported on X86/Linux, AMD64/Linux,
+PPC32/Linux and PPC64/Linux. To run Valgrind, you have to
+select an X86 Scratchbox target with the tool properly installed.</p>
+
+<p>To run Valgrind, right-click on the application (binary for C/C++
+projects or the Python script for Python projects) and select <strong>Run As > Valgrind Memory Profiler</strong>.</p>
+<br>
+<br>
+<img src="../images/profiling0.jpg" width="789" height="743"><br>
+</h2>
+<p> </p>
+<p>The Valgrind tool runs your application on the X86 target and the result is
+ shown in the Valgrind view. All problems found by Valgrind are shown as a
+ tree: problem as parent nodes and details of the problems as children
+ nodes.</p>
+<p> </p>
+<img src="../images/profiling1.jpg"><br>
+
+<p> </p>
+<h3>Using OProfile</h3>
+<p>OProfile is a system-wide profiler for Linux systems and
+can profile all running code. It consists of a kernel driver and a daemon for collecting sample data,
+and several post-profiling tools for turning data into information. OProfile is
+supported for ARM/Linux. It's executed on the Internet Tablet in order to
+obtain a high quality of profiling information. ESbox uses ssh to
+remotely execute OProfile and collect profiling information. So, it's
+necessary to properly install the application (OProfile installation
+information can be found <a href="http://maemo.org/development/tools/doc/chinook/oprofile/">here</a>. ).</p>
+
+<p>To run OProfile, in the Project View right-click on the project or application
+(binary for C/C++ projects or the Python script for Python projects) and select
+<strong>Run As > OProfile Profiler</strong>. An OProfile launch configuration will be
+automatically created for you and will be launched. If you want to create or edit a launch
+configuration for Oprofile yourself, please see
+<a href="../tasks/CreateOprofileconfig.html">Creating a OProfile Run Launch Configuration</a>.</p>
+
+<br>
+<img src="../images/profiling6.jpg" width="764" height="633">
+<br>
+<p> </p>
+<p>After OProfile starts, ESbox launches your application on the device.
+ Then a dialog will pop up letting you decide when to stop profiling data collecting.
+ After you click OK on the dialog, OProfile data collecting will
+ stop and the profiling result will be shown in the OProfile View.</p>
+<br>
+<img src="../images/profiling4.jpg">
+<br>
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/RunningCProject.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/RunningCProject.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/RunningCProject.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Running C/C++ Maemo Project</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1">Running C/C++ Maemo Project</h2>
+
+
+<p>You may launch your programs from the workbench. The programs may be launched in either run mode or debug mode.
+</p>
+<p>In run mode, the program executes, but the execution may not be suspended or examined.</p>
+
+<p>To create a run configuration:</p>
+
+
+
+<ol>
+ <li> In the C/C++ Maemo Projects view, select a project.</li>
+ <li> Click <strong>Run As > Open Run Dialog</strong>.</li>
+ <li> In the Configurations box, select Maemo Local Application or Maemo Remote Application.</li>
+ <li> <img src="../images/pref_images/new.png" alt="new" width="18" height="18">Click the New button. The name of the new project is displayed in the Configurations box located on the leftside of window. The default name is the name of the project.</li>
+ <li> Click the Main tab.</li>
+ <p><img src="../images/run_main.png" alt="Main" width="855" height="640"></p>
+ <li>Do the following:
+ <ul>
+ <li>In the Name box, type a descriptive name for this launch configuration.</li>
+ <li>In the Project box, type the name of the project containing the application that you want to run.</li>
+ <li>In the C/C++ Application box, type the name of the executable that you want to run.</li>
+ </ul>
+ </li>
+
+<p>Make sure that the right target has been chosen.</p>
+ <li>Select the project in Project Explorer, right-click and select <strong>Properties. </strong>Then select <strong>ESbox Build Target</strong>.</li>
+ <li>Select the correct build target for this project, which is used to cross-compile and run your application.</li>
+ <p><img src="../images/pref_images/installed_targets.png" alt="targets" width="772" height="558"></p>
+
+ <p>For more information about targets <a href="../tasks/CreateNewTarget.html">click here</a>.</p>
+
+ <li>Click on X button to start the X server and viewer.</li>
+ <li>Click on Maemo (M) button.</li>
+</ol>
+
+<p>Now with everything set up, select <strong>Run as > Maemo Local Application</strong> or <strong>Maemo Remote Application</strong>; as appropriate.</p>
+
+<p><img src="../images/run1.jpg" alt="run2" width="782" height="701"></p>
+<p> </p>
+<h3>Related Topics</h3>
+<p><a href="SettingsSbrshConfiguration.html">Setting Sbrsh Preferences</a></p>
+<p><a href="DebuggingCMaemoApplications.html">Debugging a C/C++ Maemo Project</a></p>
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/RunningPythonProject.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/RunningPythonProject.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/RunningPythonProject.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Running Python Maemo Project</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1">Running Python Maemo Project</h2>
+
+
+<div style="margin-left: 2em; margin-right: 2em; background-color: #ffff80; border: solid #999 1px; padding: 5px;">
+ <p>
+ <span style="font-weight: bold;">NOTE</span>: In order to successfully run Python applications under the ARMEL emulator,
+ you need a better version of the qemu-arm-0.8.2-sb2 emulator than is shipped by default in scratchbox (as of this writing).
+ </p><p>
+ The stock emulator does not implement all the system calls needed for Python, which will result in a lot of errors
+ about 'sem_post' and 'sem_wait' not being implemented and possibly segfaults in the emulator.</p>
+ <p>If your scratchbox has the 'qemu-arm-cvs-m' CPU transparency method (available in the cputransp devkit 1.0.6+), use that.
+ </p>Otherwise, you can manually build it.
+Consult <a href="http://qemu-arm-eabi.wiki.sourceforge.net/">this</a> for details.</p>
+</div>
+
+<p>To run the file you can:</p>
+
+<ol>
+ <li>Click on X button to start the X server and viewer.</li>
+
+ <li>Click on Maemo (M) button.</li>
+
+ <li>In the Pydev Projects view, select a project.</li>
+ <li>Select <strong>Run As > Python Maemo Local Application</strong> or <strong>Run As > Python Maemo Remote Application</strong>; as desired.</li>
+ <p><img src="../images/python3.jpg" alt="python3" width="798" height="687"></p>
+</ol>
+
+<p><span style="font-weight: bold;">NOTE</span>: You can only run files that are in your project.</p>
+
+<p>After the first run, if you select Ctrl+F11, the last file ran is re-run.</p>
+<p> </p>
+<h3>Related Topics</h3>
+<p><a href="SettingsSbrshConfiguration.html">Setting Sbrsh Preferences</a></p>
+<p><a href="SettingPreferences.html">Setting Preferences</a> </p>
+<p> </p>
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/SettingPreferences.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/SettingPreferences.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/SettingPreferences.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Setting Preferences</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+
+<h1 class="style1">Setting Preferences</h1>
+<p>
+The first thing a user should do is set the preferences for using Scratchbox, since the rest
+of the functionality of the plug-ins depends on these settings. Once the Eclipse IDE is
+running with the plug-ins, the preferences may be set by selecting <strong>Window > Preferences...</strong> and expanding the ESbox group.</p>
+
+
+<p>
+The ESbox page allows you to define the syntax used to invoke commands inside Scratchbox (this varies between Scratchbox versions) and the root directory of
+the user's sandbox environment.</p>
+
+<p></p>
+<img src="../images/preferences.jpg" alt="preferences1" width="900" height="558"><br>
+<br>
+
+
+<p> </p>
+<h2><a name="env"></a>Environment</h2>
+<p>The <strong>Environment</strong> page allows you to define Scratchbox environment variables. Click the New button to specify the variable Name and Value. Inside that dialog you can click Variables to select from a list of build variables. </p>
+<p> </p>
+<p><img src="../images/pref_images/env.png" alt="environment" width="736" height="558"></p>
+<p><img src="../images/variables.png" alt="variables" width="392" height="601"></p>
+<p> </p>
+<p> </p>
+<h2><a name="gaz"></a>Gazpacho</h2>
+<p>The <strong>Gazpacho</strong> page gets its name from the common graphical user interface editor Gazpacho. Gazpacho
+ is an advanced gui editor. You can specify to "Use xhost command to start Gazpacho in Maemo" and enter a command for starting Xhost.</p>
+<p></p>
+<p><img src="../images/pref_images/gazpacho.png" alt="Gazpacho" width="737" height="559"><br>
+ <br>
+</p>
+<h2><a name="int"></a>Installed Targets</h2>
+<p>The Installed Targets page allows you to add or remove scratchbox targets. Click New to launch a wizard that guides you through the steps to add a target.</p>
+<p><strong>CAUTION:</strong> If you select an existing target and click <strong>Remove</strong>, the complete installation of the SDK will be removed from your filesystem.</p>
+<p> </p>
+<p><img src="../images/pref_images/targets.png" alt="installed targets" width="690" height="558"></p>
+<p> </p>
+<blockquote>
+ <h3><a name="newtarget"></a>Creating a New Target</h3>
+ <p>Click the <strong>New</strong> button to launch a wizard for creating a new target. If both scratchbox1 and scratchbox2 are installed, then a dialog will appear requesting you to choose which version of scratchbox to use for the new target. </p>
+ <p><img src="../images/pref_images/new_target.png" alt="define target" width="542" height="185"></p>
+ <h4> </h4>
+ <h4>Scratchbox 1 Wizard</h4>
+ <p>If you choose scratchbox 1, the following wizard dialogs will appear.</p>
+ <p>Enter a name for the new target and select Next. </p>
+ <p><img src="../images/pref_images/new_target_sb1_1.png" alt="target name" width="480" height="421"></p>
+ <p> </p>
+ <p>Select a compiler for the new target and select Next. </p>
+ <p><img src="../images/pref_images/new_target_sb1_2.png" alt="compiler" width="480" height="421"></p>
+ <p> </p>
+ <p>Select a devkit and click Next. </p>
+ <p><img src="../images/pref_images/new_target_sb1_3.png" alt="Devkit" width="480" height="421"></p>
+ <p> </p>
+ <p>Select a CPU-transparency method and click Next.</p>
+ <p>The recommended setting for the CPU transparency method is "qemu-arm-0.8.2-sb2". The sbrsh method should be manually configured to take advantage of sshfs.More information is located at: http://maemo-sdk.garage.maemo.org/sbrsh-sshfs.html.</p>
+ <p><img src="../images/pref_images/new_target_sb1_4.png" alt="cpu" width="480" height="421"></p>
+ <p> </p>
+ <p>If <strong>sbrsh</strong> is selected in the CPU-transparency method dialog, additional dialogs are provided to enter the target and host addresses.</p>
+ <p>Enter the Target Device Address. </p>
+ <p><img src="../images/pref_images/new_target_sb1_5.png" alt="target address" width="529" height="421"></p>
+ <p> </p>
+ <p>Enter the hostname or ip address and click Finish. </p>
+ <p><img src="../images/pref_images/new_target_sb1_6.png" alt="hostname" width="529" height="421"></p>
+ <p> </p>
+ <h4>Scratchbox 2 Wizard </h4>
+ <p>If you choose scratchbox 2 for a new target, the following wizard dialogs will appear.</p>
+ <p>Select a rootstrap and click Finish or select Custom target and click Next if you are creating a new target.</p>
+ <p>The named rootstrap entries that appear in this dialog are fetched over the web, so if it fails, go to <strong>Window > Preferences > General > Network Connections</strong> and configure the HTTP proxy if needed.</p>
+ <p>Check <strong>Show existing targets</strong> to display rootstraps with names matching existing targets. This is the only way to reinstall a target.</p>
+ <p>The <strong>Use host's build tools</strong> option determines whether the maemo-rootstrap tool command option <strong>--host-tools</strong> is passed when creating a rootstrap. If checked, the rootstrap is configured to use the host versions of autotools, bison, flex, docbook, etc. instead of standard versions (c.f. devkits in scratchbox 1). It is recommended to leave this option unchecked and invoke <strong>maemo-tools</strong> to install official build tools.</p>
+ <p><img src="../images/pref_images/new_target_sb2_1.png" alt="rootstrap" width="550" height="433"></p>
+ <p> </p>
+ <p><span class="notetitle">Note:</span> The following pages only appear if Custom target is selected in the previous step. </p>
+ <p>Enter a name for the new target and select Next.</p>
+ <p><img src="../images/pref_images/new_target_sb2_2.png" alt="target name" width="550" height="433"></p>
+ <p> </p>
+ <p>Select a compiler and click Next. </p>
+ <p><img src="../images/pref_images/new_target_sb2_3.png" alt="compiler" width="550" height="433"></p>
+ <p> </p>
+ <p>Select a CPU-transparency method and click Next. </p>
+ <p><img src="../images/pref_images/new_target_sb2_4.png" alt="sb4" width="550" height="433"></p>
+ <p> </p>
+ <p>If <strong>sbrsh</strong> is selected in the CPU-transparency method dialog, additional dialogs are provided to enter the target and host addresses.</p>
+ <p>Enter the Target Device Address.</p>
+ <p><img src="../images/pref_images/new_target_sb1_5.png" alt="target address" width="529" height="421"></p>
+ <p> </p>
+ <p>Enter the hostname or ip address and click Finish. </p>
+ <p><img src="../images/pref_images/new_target_sb1_6.png" alt="hostname" width="529" height="421"></p>
+ <p> </p>
+</blockquote>
+<h2><a name="sbox1"></a>Scratchbox 1</h2>
+<p>Define your sandbox root directory and command template for Scratchbox 1. </p>
+<p><img src="../images/pref_images/sbox1.png" alt="sbox1" width="832" height="472"></p>
+<p> </p>
+<h2><a name="sbox2"></a>Scratchbox 2</h2>
+<p>Define your mapping mode, level of messages that you want logged, and command template for Scratchbox 2.</p>
+<p><img src="../images/pref_images/sbox2.png" alt="sbox2" width="832" height="472"></p>
+<p> </p>
+<h2><a name="ssh"></a>SSH</h2>
+<p>Use the SSH page to configure secure shell settings for communicating with a device.</p>
+<p><img src="../images/pref_images/ssh.png" alt="ssh" width="864" height="473"></p>
+<p> </p>
+<h2><a name="xsr"></a>X Server</h2>
+<p>The X Server page contains commands for starting the X Server.</p>
+<p><img src="../images/pref_images/xserver.png" alt="xserver" width="996" height="473"></p>
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/gettingstarted/SettingsSbrshConfiguration.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/gettingstarted/SettingsSbrshConfiguration.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/gettingstarted/SettingsSbrshConfiguration.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,92 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Setting Sbrsh Configuration</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+
+
+<h2 class="style1">Setting Sbrsh preferences</h2>
+
+
+<p>To use Sbrsh (Scratchbox Remote Shell) to run or debug a C/C++ or Python Maemo application remotely on a device, sbrsh settings can be configured in a new Run or Debug remote launch configuration.
+Select a project in the Project Explorer and select <strong>Run > Open Run Dialog... </strong>or<strong> Run > Open Debug Dialog... </strong> to display the Run or Debug configuration page. Create a new or select an existing Maemo Remote Application then select the Download tab. Select Mount via SBRSH in the Download Method dropdown list.</p>
+<p> </p>
+<h3>SBRSH Client Configuration Method: Automatic (screenshot from Python related project) </h3>
+<p><img src="../images/pref_images/sbrsh_download.png" alt="sbrsh download" width="871" height="616"><br>
+ <br>
+</p>
+<table width="770" border="1" cellspacing="3" cellpadding="3">
+ <caption>
+ SBRSH Automatic Settings
+ </caption>
+ <tr>
+ <th width="281" scope="col">Setting</th>
+ <th width="462" scope="col">Description</th>
+ </tr>
+ <tr>
+ <td>SBRSH Client Configuration Method: Automatic </td>
+ <td>SBRSH configuration file and mount points are automatically created. The configuration file is created under the current project folder for each launch configuration associated with the project. The mount point is the path where the binaries will be copied and executed. Sbrsh mounts the mount point. The mount point (target binary path) will be determined by checking which SBRSH mount for the current SBRSH target has the host folder that contains the debugged program. The debugger will invoke the sbrsh command to launch the application or gdbserver on the device.</td>
+ </tr>
+ <tr>
+ <td>Host PC Name or IP:</td>
+ <td>Enter name or IP address of the host PC connecting the host and the device (where the physical connection may be USB, Bluetooth or IR). Default IP address is 192.168.2.14. Note that a name entered should be resolvable in the /etc/hosts file on the device.</td>
+ </tr>
+ <tr>
+ <td>Target Device Name or IP:</td>
+ <td>Enter name or IP address of target device. Default value is 192.168.2.15. Note that a name entered should be resolvable in the /etc/hosts file on the host.</td>
+ </tr>
+ <tr>
+ <td>View Configuration... </td>
+ <td>This button allows you to view the content of the auto-generated SBRSH configuration file when a valid host name/IP and target name/IP are entered. The default location of the sbrsh configuration file is in /home/<em>USER</em>/.sbrsh) and the sbrsh executable file is assumed to be in /usr/bin/sbrsh or /home/USER/sbrsh.</td>
+ </tr>
+</table>
+<p><img src="../images/pref_images/sbrsh_viewer.png" alt="viewer" width="537" height="550"></p>
+<p> </p>
+<p> </p>
+<h3>SBRSH Client Configuration Method: Custom (screenshot from C/C++ related project) </h3>
+<p><img src="../images/pref_images/sbrsh_download_custom.png" alt="sbrsh custom" width="680" height="472"></p>
+<p> </p>
+<table width="770" border="1" cellspacing="3" cellpadding="3">
+ <caption>
+ SBRSH Custom Settings
+ </caption>
+ <tr>
+ <th width="281" scope="col">Setting</th>
+ <th width="462" scope="col">Description</th>
+ </tr>
+ <tr>
+ <td>SBRSH Client Configuration Method: Custom </td>
+ <td>If you are familiar with defining sbrsh settings, this method allows you to create or modify a configuration file.</td>
+ </tr>
+ <tr>
+ <td>Configuration File:</td>
+ <td>Enter or browse to the path of your sbrsh configuration file. Default value is $HOME/.sbrsh.</td>
+ </tr>
+ <tr>
+ <td>Current SBRSH Target:</td>
+ <td>A SBRSH Target combo box lists all targets in the configuration file. If there are two or more targets, you will need to select which one for the debugger to target.</td>
+ </tr>
+ <tr>
+ <td>Browse...</td>
+ <td>Click to browse to a configuration file.</td>
+ </tr>
+ <tr>
+ <td>Edit...</td>
+ <td>Click to open an editor dialog allowing you to view, create and modify contents of a configuration file. Click the Example button inside the Editor dialog to view an example of a configuration file that shows example mount points between the host and the target device.</td>
+ </tr>
+</table>
+<p> </p>
+<p><img src="../images/pref_images/sbrsh_edit.png" alt="edit dialog" width="732" height="772"></p>
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/help.css
===================================================================
--- trunk/common/org.maemo.esbox.help/html/help.css (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/help.css 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,51 @@
+/* following font face declarations need to be removed for DBCS */
+
+
+body, h1, h2, h3, h4, p, table, td, caption, th, ul, ol, dl, li, dd, dt {font-family: Arial, sans-serif; color: #000000}
+pre { font-family: Courier, monospace}
+
+/* end font face declarations */
+
+/* following font size declarations should be OK for DBCS */
+body, h1, h2, h3, h4, p, table, td, caption, th, ul, ol, dl, li, dd, dt {font-size: 10pt; }
+pre { font-size: 10pt}
+
+/* end font size declarations */
+
+body { background: #FFFFFF}
+h1 { font-size: 18pt; margin-top: 5; margin-bottom: 1 }
+h2 { font-size: 14pt; margin-top: 25; margin-bottom: 10 }
+h3 { font-size: 11pt; margin-top: 20; margin-bottom: 3 }
+h4 { font-size: 10pt; margin-top: 20; margin-bottom: 3; font-style: italic }
+p { font-size: 10pt; margin-top: 10; margin-bottom: 10 }
+pre { margin-left: 6; font-size: 9pt }
+
+a:link { color: #006699 }
+a:visited { color: #996699 }
+a:hover { color: #006699 }
+
+ul { margin-top: 0; margin-bottom: 10 }
+li { margin-top: 6; margin-bottom: 6 }
+li p { margin-top: 15; margin-bottom: 15 }
+ol { margin-top: 0; margin-bottom: 10 }
+dl { margin-top: 0; margin-bottom: 10 }
+dt { margin-top: 0; margin-bottom: 0; font-weight: bold }
+dd { margin-top: 0; margin-bottom: 0 }
+strong { font-weight: bold}
+em { font-style: italic}
+var { font-style: italic}
+div.revision { border-left-style: solid; border-left-width: thin;
+ border-left-color: #7B68EE; padding-left:5 }
+th { font-weight: bold }
+
+/* Mike Behm's addition to the style sheet */
+.userinput { font-family: monospace; }
+.guitab, .important, .guibutton, .selectblue, .guimenu, .guilabel,
+.notetitle {
+ color: #000000;
+ font-family: helvetica, arial, sans-serif;
+ font-weight: bold;
+ }
+div.linux {display:none;}
+.firsterm {font-style:italic;}
+
Added: trunk/common/org.maemo.esbox.help/html/images/build.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/build.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/build1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/build1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debian.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debian.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debian1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debian1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debian2.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debian2.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debug.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debug.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debug1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debug1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debug10.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debug10.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debug2.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debug2.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debug3.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debug3.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debug4.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debug4.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debug5.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debug5.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debug6.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debug6.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debug7.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debug7.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debug8.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debug8.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/debug9.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/debug9.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/esbox0.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/esbox0.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/esbox1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/esbox1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/esbox2.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/esbox2.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/esbox3.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/esbox3.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/esbox4.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/esbox4.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/esbox5.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/esbox5.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/externalize01.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/externalize01.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/externalize02.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/externalize02.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/externalize03.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/externalize03.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/green_fade_left_68_165_28.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/green_fade_left_68_165_28.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/maketarget.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/maketarget.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/maketarget0.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/maketarget0.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/maketarget1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/maketarget1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/newproject.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/newproject.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/newproject1.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/newproject1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/newproject2.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/newproject2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/newproject3.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/newproject3.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/newproject4.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/newproject4.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/newpythonproject.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/newpythonproject.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/newpythonproject1.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/newpythonproject1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/newpythonproject2.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/newpythonproject2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus_arg.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus_arg.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus_dwnld.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus_dwnld.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus_env.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/oprofile_cplusplus_env.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/oprofile_python_arg.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/oprofile_python_arg.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/debug_config.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/debug_config.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_connectionserial.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_connectionserial.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_connectiontcp.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_connectiontcp.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_debuggerlist.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_debuggerlist.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_maintab.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_maintab.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_shlibtab.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/debugtab_shlibtab.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/env.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/env.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/gazpacho.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/gazpacho.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/installed_targets.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/installed_targets.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/localapp.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/localapp.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_1.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_2.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_3.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_3.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_4.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_4.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_5.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_5.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_6.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb1_6.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_1.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_2.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_3.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_3.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_4.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/new_target_sb2_4.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/remoteapp.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/remoteapp.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbox1.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbox1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbox2.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbox2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_download.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_download.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_download_custom.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_download_custom.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_edit.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_edit.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_viewer.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/sbrsh_viewer.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/ssh.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/ssh.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/targets.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/targets.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/pref_images/xserver.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/pref_images/xserver.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/preferences.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/preferences.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/preferences1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/preferences1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/preferences2.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/preferences2.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/profiling0.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/profiling0.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/profiling1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/profiling1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/profiling2.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/profiling2.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/profiling3.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/profiling3.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/profiling4.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/profiling4.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/profiling5.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/profiling5.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/profiling6.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/profiling6.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/python.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/python.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/python1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/python1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/python3.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/python3.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/python9.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/python9.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/run.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/run.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/run1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/run1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/run2.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/run2.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/run_args.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/run_args.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/run_common.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/run_common.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/run_debug.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/run_debug.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/run_env.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/run_env.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/run_main.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/run_main.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/run_source.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/run_source.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/sbrsh0.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/sbrsh0.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/sbrsh1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/sbrsh1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/sbrsh2.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/sbrsh2.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/sbrsh3.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/sbrsh3.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/target.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/target.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/target0.1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/target0.1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/target0.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/target0.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/target1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/target1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/target1a.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/target1a.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/target2.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/target2.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/target3.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/target3.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/target4.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/target4.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/target5.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/target5.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/target6.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/target6.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/target7.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/target7.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/template.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/template.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/template1.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/template1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/images/variables.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.help/html/images/variables.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.help/html/legal.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/legal.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/legal.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Legal</title>
+ <link rel="stylesheet" type="text/css" href="help.css">
+</head>
+
+<body>
+<h2 class="style1">Notices</h2>
+<p></p>
+<p>Copyright © 2007-2008 INdT, © 2007-2008 Nokia. All rights reserved.</p>
+<p></p>
+<p>Nokia and maemo are trademarks or registered trademarks of Nokia Corporation. Other product and company names mentioned herein may be trademarks or trade names of their respective owners.
+</p>
+<p></p>
+<h2>Licenses</h2>
+<p></p>
+<p>This User's Guide has been licensed under <a href="../about_files/epl-v10.html">Eclipse Public License Version 1.0 ("EPL")</a>.</p>
+<p></p>
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/reference/FAQ.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/reference/FAQ.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/reference/FAQ.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,215 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Frequently-Asked Questions: ESbox</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+<h1>FAQ</h1>
+
+<![CDATA[=========================================================]]>
+
+<div class="h2"><!-- no 'id' or 'title' attribute for TOC -->
+<h2>Table of Contents</h2>
+
+<h4>General questions:</h4>
+<p></p>
+<ul>
+ <li><a href="#what">What is the ESbox?</a></li>
+ <li><a href="#licensed">How is the ESbox licensed?</a></li>
+ <li><a href="#organized">How is the ESbox Project organized?</a></li>
+ <li><a href="#releases">How do I find out about future releases of the ESbox?</a></li>
+ <li><a href="#support">Which operating systems does the ESbox support?</a></li>
+ <li><a href="#ask">How do I ask questions?</li>
+ <li><a href="#bug">How do I report a bug or request a feature?</a></li>
+</ul>
+
+<h4> </h4>
+<h4>Download and Installation:</h4>
+<p></p>
+<ul>
+ <li><a href="#howtos">Are there complete HowTos for setting up the ESbox?</a></li>
+ <li><a href="#build">Which ESbox build should I download?</a></li>
+ <li><a href="#uninstall">How do I uninstall ESbox?</a></li>
+</ul>
+
+
+<![CDATA[=========================================================]]>
+
+<hr/>
+
+<![CDATA[-----------------------------------------------------------]]>
+
+<div class="h2" id="general-questions" title="general-questions">
+<h2>General questions:</h2>
+
+<div class="h3" id="what" title="what">
+<h3>What is the ESbox?</h3>
+
+<p>
+ESbox is an extension of the CDT plug-in, strongly integrated with Scratchbox,
+reducing time and effort for configuration, and increasing the productivity for
+Linux-based embedded systems development. It supports C/C++ and Python programming
+languages. Maemo 4.x SDKs will be supported.
+
+<p>ESbox offers a middle layer between Scratchbox and the programmer, which eliminates the use of command line and archaic text editors.</p>
+
+</div>
+
+<![CDATA[-----------------------------------------------------------]]>
+
+
+<div class="h3" id="licensed" title="licensed">
+<h3>How is the ESbox licensed?</h3>
+
+<p>
+This software is produced by the ESbox team combined with third party
+software developed from other Open Source Projects. This software has been
+licensed under <a href="../about_files/epl-v10.html">Eclipse Public License
+Version 1.0 ("EPL")</a>.</p>
+
+</div>
+
+<![CDATA[-----------------------------------------------------------]]>
+
+
+<div class="h3" id="organized" title="organized">
+<h3>How is the ESbox Project organized?</h3>
+
+<p>
+Both Eclipse and Scratchbox run over
+Linux. ESbox has two modules: the framework, which calls Scratchbox services and
+manipulate the streams of the processes properly; and the plug-in, which changes data
+with framework, requests Scratchbox services, displays information from Scratchbox
+to the programmer and implements features for helping editing, launching and
+debugging. Tools which use Scratchbox, like Maemo, can also be plugged into ESbox.
+</p>
+<p></p>
+</div>
+
+<![CDATA[-----------------------------------------------------------]]>
+
+
+<div class="h3" id="releases" title="releases">
+<h3>How do I find out about future releases of ESbox?</h3>
+
+<p>
+To find out about futures releases see:
+<a href="https://garage.maemo.org/forum/forum.php?forum_id=2291">Futures releases</a>
+</p>
+
+</div>
+
+<![CDATA[-----------------------------------------------------------]]>
+
+
+<div class="h3" id="support" title="support">
+<h3>Which operating systems does ESbox support?</h3>
+
+<p>
+The ESbox plug-in runs on the Linux open source operating system. Linux is open source
+software, which is freely available; however, the full distribution of Linux
+along with technical support and training are available for a fee from vendors
+such as Red Hat Software and Caldera. Due to its stability, Linux has gained
+popularity with ISPs as the OS for hosting Web servers.</p>
+
+</div>
+
+<![CDATA[-----------------------------------------------------------]]>
+
+<div class="h3" id="ask" title="ask">
+<h3>How do I ask questions?</h3>
+
+<p>
+The <a href="https://garage.maemo.org/">garage.maemo</a> website provides some mailing
+<a href="https://garage.maemo.org/mail/?group_id=192">lists</a>. Choose a list
+to browse, search, and post messages. Keep in mind that these newsgroups are public,
+so do not include any confidential information in your questions. You should
+also read "How to ask questions the smart way" by Eric Raymond before participating
+in the newsgroups.
+
+</p>
+
+</div>
+
+<![CDATA[-----------------------------------------------------------]]>
+
+
+<div class="h3" id="bug" title="bug">
+<h3>How do I report a bug or request a feature?</h3>
+
+<p>
+Before entering a bug report, you should search to see if someone else
+has already entered a bug report similar to yours. If you find a bug report
+that outlines the problem you are seeing, you can simply annotate it with your
+comments to let the developers know that you have also hit the bug. Also you
+can add yourself to the <a href="https://garage.maemo.org/tracker/?func=browse&group_id=192&atid=1420">ESbox list</a>
+of the bug so that you will be notified when the status of the bug changes or
+someone adds comments.</p>
+
+
+</div>
+
+</div>
+
+<div class="h2" id="download" title="download">
+<h2>Download and Installation:</h2>
+
+<![CDATA[-----------------------------------------------------------]]>
+
+<div class="h3" id="howtos" title="howtos">
+<h3>Are there complete HowTos for setting up the ESbox?</h3>
+
+<p>
+Yes.
+</p>
+
+<div class="h3" id="build" title="build">
+<h3>Which ESbox build should I download? </h3>
+
+<p>
+First of all to use the ESbox plugin, you need:
+<ul>
+ <li>Linux with SSH Client</li>
+ <li>Maemo SDK</li>
+ <li>Sun version of Java</li>
+ <li>Eclipse SDK 3.3.1.1</li>
+ <li>Eclipse CDT 4.0.2</li>
+ <li>PyDev >= 1.3.7</li>
+ <li>Python interpreter configured</li>
+ <li>Sbrsh (Scratchbox Remote Shell)</li>
+</ul>
+</p>
+
+<p>With all set up, you are able to get the latest version of the ESbox plugin.</p>
+
+<div class="h3" id="uninstall" title="uninstall">
+<h3>How do I uninstall ESbox?</h3>
+
+<p>
+Removing plugins from Eclipse is easy, so no particular uninstaller is needed.
+You can browse and manage your configuration from the Product Configuration dialog.
+Open the Product Configuration dialog by clicking Help > Software Updates >
+Manage Configuration.
+
+<ul>
+ <li>Disabling a feature: select the feature and click Disable in the right pane of
+ the dialog. This option is available only when the feature is currently enabled,
+ and the feature is either an optional feature or a root feature (not included
+ by other features).</li>
+ <li>Enabling a feature: First, ensure Show Disabled Features is turned on in the
+ tool bar. Then, select a disabled optional or root feature and click Enable in
+ the right pane of the dialog.</li>
+ <li>Uninstalling a feature: features that you have installed using the update
+ manager can be uninstalled, provided they are already disabled, or that they are
+ optional or root features. If the feature is disabled, make sure Show Disabled
+ Features is turned on in the tool bar. Select the feature and click Uninstall in
+ the right page of the dialog.</li>
+</p>
+
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/reference/Glossary.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/reference/Glossary.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/reference/Glossary.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Glossary</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+</head>
+
+<body>
+<h2 class="style1">Glossary</h2>
+
+<ul>
+<p><b>ARMEL:</b>
+A name that, for example, Debian uses for the little endian ARM EABI (ABI for the ARM architecture).</p>
+
+<p><b>devkit:</b>
+Part of the maemo SDK that contains software development tools. The SDK contains multiple devkits e.g. doctools devkit.</p>
+
+<p><b>GTK+ (GUI ToolKit+):</b>
+A library of object-oriented graphical interface elements (widgets) for developing X Window applications.</p>
+
+<p><b>Hildon:</b>
+Application framework used in the maemo platform. Developed by Nokia and based on GNOME/GTK+ technologies, currently in the process of becoming an upstream project in <a href="http://www.gnome.org/">gnome.org</a>.</p>
+
+<p><b>Hildon Desktop:</b>
+The main user interface component of the maemo release Chinook, rewrite of maemo desktop.</p>
+
+<p><b>Internet Tablet:</b>
+Product category for Internet optimized mobile devices with touchscreen. The term was coined by Nokia but is being used more widely to include other devices.</p>
+
+<p><b>Linux:</b>
+Strictly speaking, Linux is the kernel of a Unix-like operating system, though the word is more commonly used to describe the whole Linux operating system, consisting of a kernel, application programs and utilities.</p>
+
+<p><b>maemo:</b>
+Software platform for mobile devices developed by Nokia, based on GNU/Linux and GNOME/GTK+ technologies. It includes proprietary components to make it work on the Nokia Internet Tablets.</p>
+
+<p><b>maemo.org:</b>
+Developer community web site maintained by Nokia, main point of reference for open source and third party developers in general.
+
+<p><b>maemo desktop:</b>
+version of main user interface component of the maemo release Bora.</p>
+
+<p><b>maemo-af-desktop:</b>
+Same as maemo desktop.</p>
+
+<p><b>maemo SDK:</b>
+Software Development Kit to create and port applications to the maemo platform using a PC.</p>
+
+<p><b>Nokia Internet Tablet OS:</b>
+maemo platform + proprietary applications packaged to an official device image provided by Nokia.</p>
+
+<p><b>OSSO:</b>
+Open Source Software Operations, Nokia organization developing and integrating software for Internet Tablets.</p>
+
+<p><b>rootstrap:</b>
+Part of the SDK that contains selected software components from rootfs. Rootstrap is the root file system of a target inside Scratchbox.</p>
+
+<p><b>Sardine:</b>
+An experimental distribution based on Hildon for maemo, primarily of interest for developers who wish to test "bleeding edge" features that are being developed for future releases of maemo.</p>
+
+<p><b>toolchain:</b>
+Part of the SDK that contains ARM cross compilation tools like compiler and linker.</p>
+
+<p><b>Widget</b>
+Element of a graphical user interface (GUI) that displays information or provides a way for a user to interact with the application. Examples of widgets: buttons, menus, scrollbars, forms, etc.</p>
+<ul>
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/tasks/CreateMakeTarget.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/tasks/CreateMakeTarget.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/tasks/CreateMakeTarget.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Create Make Target</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1">Creating a Make Target</h2>
+
+
+<p>To create a make target:</p>
+
+
+<ol>
+ <li>Open the Make Targets view (<strong>Window > Show View > Make Targets</strong>).</li>
+ <li>Right click on a project and select <b>Add Make Target</b>.</li>
+ <p> </p>
+ <p><img src="../images/maketarget.jpg" alt="maketarget" width="900" height="632"></p>
+ <p> </p>
+ <li>Enter the Target name and build options and click Create.</li>
+ <p> </p>
+ <p><img src="../images/maketarget0.png" alt="create make target" width="336" height="431"></p>
+ <p> </p>
+ <p><img src="../images/maketarget1.jpg" alt="maketarget1"></p>
+</ol>
+
+
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/tasks/CreateNewTarget.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/tasks/CreateNewTarget.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/tasks/CreateNewTarget.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Create new Target</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1" align="left">Create new Target</h2>
+
+<p align="left">Follow these steps to create a new Target:</p>
+
+<ol>
+ <li>One method is to select a project in the Project Explorer then right-click and select Properties.</li>
+ <p> </p>
+ <p><img src="../images/target.jpg" alt="target" width="448" height="721"></p>
+ <p> </p>
+ <li>Select ESbox Build Target and click on <strong>Configure global ESbox Targets...</strong></li>
+ <p> </p>
+ <p><img src="../images/target1a.png" alt="create target" width="680" height="559"></p>
+ <p> </p>
+ <li>Then, click on New to present a wizard to help create a new target.</li>
+ <p> </p>
+ <p><img src="../images/target0.1.jpg" alt="target0.1" width="709" height="453"></p>
+ <p> </p>
+ <li>First, you need to specify a name for the target.</li>
+ <p> </p>
+ <p><img src="../images/target0.jpg" alt="target0" width="488" height="428"></p>
+ <p> </p>
+ <li>Next the wizard will prompt for which toolchain to use to compile programs.</li>
+ <p> </p>
+ <p><img src="../images/target1.jpg" alt="target1" width="444" height="401"></p>
+ <p> </p>
+ <li>You can also select optional development tools.</li>
+ <p> </p>
+ <p><img src="../images/target2.jpg" alt="target2" width="466" height="461"></p>
+ <p> </p>
+ <li>After selecting a development kit the CPU-transparency method is chosen.</li>
+ <p> </p>
+ <p><img src="../images/target3.jpg" alt="target3" width="466" height="461"></p>
+ <p> </p>
+ <li>If you choose SBRSH as the CPU-transparency method a wizard will help you configure it.</li>
+ <li>First you need to specify the hostname or IP-address of the target device.</li>
+ <p> </p>
+ <p><img src="../images/target5.jpg" alt="target5" width="510" height="366"></p>
+ <p> </p>
+ <li>The next dialog shows the default hostname of your host. It is used to mount the NFS filesystems on the target device, so you may need to change it to an address that is known to the device.</li>
+ <p> </p>
+ <p><img src="../images/target6.jpg" alt="target6" width="510" height="366"></p>
+ <p> </p>
+ <li>After entering hostname in previous dialog, click Finish. You can add yourself to sbrshd's access list if you have root access.</li>
+ <p> </p>
+ <p><img src="../images/target7.jpg" alt="target7" width="542" height="205"></p>
+ <p> </p>
+ <li>Everything is now ready and you can activate the target.</li>
+</ol>
+
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/tasks/CreateOprofileconfig.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/tasks/CreateOprofileconfig.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/tasks/CreateOprofileconfig.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Create OProfile launch configuration</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1">Creating a OProfile Launch Configuration</h2>
+
+
+<p>To create a launch configuration for the OProfile Profiler:</p>
+
+
+<ol>
+ <li>Select a project in the Project Explorer or C/C++ Projects view and Select <strong>Run > Open Run Dialog...</strong></li>
+ <li>Select OProfile Profiler in the left column (either C++ or Python, as appropriate).</li>
+ <li>Click the New button <img src="../images/pref_images/new.png" alt="new" width="18" height="18"> to create a new launch configuration.</li>
+ <p> </p>
+ <p><img src="../images/oprofile_cplusplus.png" alt="oprofile main" width="861" height="640"></p>
+ <p> </p>
+ <li>A default launch configuration name will appear in the Name field. You can change the name or accept the default. The project and application binary (for C++) or script (for Python) will be detected and filled in.</li>
+ <li>Select the Arguments tab to specify program arguments that an application uses and the working directory for a run configuration.</li>
+ <p><strong>Remote OProfile Profiler Arguments Tab for C++ Project </strong></p>
+ <p><img src="../images/oprofile_cplusplus_arg.png" alt="oprofile arguments" width="491" height="355"></p>
+ <p> </p>
+ <dl>
+<table width="580" fgcolor="#DDD" border="1" cellpadding="2" cellspacing="0" >
+<tr ><th>Component</th><th>Description</th></tr>
+<tr><td width="30%"><dt>Program arguments</dt></td><td>Specifies the arguments that are passed on the command line.</td></tr>
+<tr><td><dt>Variables...</dt></td><td>Select variables by name to include in the program arguments list.</td></tr>
+<tr><td><dt>Working directory</dt></td><td>Specifies the run configuration working directory.</td></tr>
+<tr><td><dt>Use default</dt></td><td>Check to specify the local directory or uncheck to specify a different workspace, a file system location, or variable.</td></tr>
+<tr><td><dt>Workspace...</dt></td><td>Specifies the path of, or browse to, a workspace relative working directory.</td></tr>
+<tr><td><dt>File System...</dt></td><td>Specifies the path of, or browse to, a file system directory.</td></tr>
+<tr><td><dt>Variables...</dt></td><td>Select variables by name to include in the working directory.</td></tr>
+</table>
+</dl>
+<p> </p>
+<p><strong>OProfile Profiler Arguments Tab for Python Project</strong></p>
+<p><img src="../images/oprofile_python_arg.png" alt="python arguments" width="571" height="364"></p>
+<p> </p>
+
+<li>Select the Environment tab
+
+to set environment variables and values to use when an application runs. Currently, no special environment variables are recognized by OProfile.
+ <p><img src="../images/oprofile_cplusplus_env.png" alt="environment" width="644" height="365"></p>
+
+<p> </p>
+<dl>
+<table width="580" fgcolor="#DDD" border="1" cellpadding="2" cellspacing="0" >
+<tr ><th>Component</th><th>Description</th></tr>
+<tr><td width="30%"><dt>Variable</dt></td><td>Displays the name of environment variables.</td></tr>
+<tr><td><dt>Value</dt></td><td>Displays the value of environment variables.</td></tr>
+<tr><td><dt>New</dt></td><td>Creates a new environment variable.</td></tr>
+<tr><td><dt>Select...</dt></td><td>Select one or more environment variables to set.</td></tr>
+<tr><td><dt>Edit</dt></td><td>Modifies the name and value of an environment variable.</td></tr>
+<tr><td><dt>Remove</dt></td><td>Removes selected environment variables from the list.</td></tr>
+<tr><td><dt>Append environment to native environment</dt></td><td>Append the environment variables shown to the current native environment.</td></tr>
+<tr><td><dt>Replace native environment with specified environment</dt></td><td>Replaces the current native environment with the specified environment set shown.</td></tr>
+</table>
+</dl>
+<p> </p>
+<li>Select the Download tab to specify the method of file transfer to the device. For the Copy via SSH download method, add and enable files to be downloaded to the target device. Click <a href="../gettingstarted/SettingsSbrshConfiguration.html">here</a> for Mount via SBRSH information.
+ <p><img src="../images/oprofile_cplusplus_dwnld.png" alt="download" width="643" height="364"></p>
+<p> </p>
+</ol>
+
+
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/tasks/DebianPackage.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/tasks/DebianPackage.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/tasks/DebianPackage.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,99 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Debian Package Management</title>
+ <link rel="stylesheet" type="text/css" href="../help.css">
+ <style type="text/css">
+<!--
+.style1 {font-weight: bold}
+-->
+ </style>
+</head>
+
+<body>
+<h2 class="style1">Debian Package Management</h2>
+
+<p>
+Debian package is one of the most easy and common methods used
+to deploy software (especially for Debian distributions). ESbox provides
+features to easily generate, deploy and install .deb packages for your
+application (C/C++ or Python) on an Internet Tablet. ESbox uses ssh to
+deploy and install your .deb package onto the Internet Tablet, so, it's
+necessary to properly configure ssh in the <strong>ESbox > SSH</strong> preferences.
+
+<div style="margin-left: 2em; margin-right: 2em; background-color: #ffff80; border: solid #999 1px; padding: 5px;">
+<span style="font-weight: bold;">NOTE</span>: You have to create a "debian" directory under your project and maintain all the
+ necessary files in order to create or deploy packages.</p>
+ <p>
+The "Hildon GUI Project" template is initialized with such files.
+</p>
+ <p>
+ See <a href="http://www.debian.org/doc/FAQ/ch-pkg_basics.en.html">this page</a> for details about Debian packaging.
+</p>
+</div>
+
+
+<h4 class="style1">Create Debian Package</h4>
+
+<p>
+You can create Debian packages for the Internet Tablet Application
+Manager. This provides an easy way to import user applications to the Internet Tablet.
+To execute the Create Debian Package command:</p>
+
+<ol>
+
+ <li>Select Debian Package in the popup menu.</li>
+
+ <li>Click on <strong>Create Debian Package</strong>.
+
+ <p>
+<img src="../images/debian.jpg" alt="Debian Package menu" width="731" height="571" />
+ </p>
+ </li>
+
+ <li>The package will be built, with results reported to the Console.</li>
+
+</ol>
+
+<h4 class="style1"><br>
+</h4>
+<h4 class="style1">Deploy and Install Debian Package</h4>
+
+<p>ESbox allows you to deploy and install the .deb package generated.</p>
+ <p>You may choose to create the package in this step, or [re-]install a previously generated package.</p>
+
+ <p>To install your application on the Internet Tablet:</p>
+
+<ol>
+
+ <li>Go to Debian Package on a project's context menu.</li>
+
+ <li>Click on <strong>Install Debian Package on Device</strong>.</li>
+
+
+ <p>This item opens the dialog with name of the project, the last known or guessed package location, and the device address.</p>
+
+ <p><img src="../images/debian1.jpg" alt="debian3"></p>
+
+ <li>Click on <b>Browse...</b> to select a package if you haven't deployed it before, or type in the path to the package
+ if you're planning to build it for the first time in this step.
+ <p>(In the future, ESbox should be able to determine the package name on its own.)
+ </p>
+ </li>
+ <li>Check <b>Create Debian Package</b> to build the package.</li>
+ <li>Check <b>Install package on device</b> to install the package. When enabled, the <b>Device Address</b> field is enabled.</li>
+
+ <li>Click <b>Finish</b>.</li>
+ <li>If your device has not authenticated with the host for password-less login, then your SSH client will ask you for the password
+ for the "User" in the <strong>ESbox > SSH</strong> preference page as it copies the package, and then the password for
+ the device's "root" account to install the package:
+ <p><img alt="password prompt" src="../images/debian2.jpg"></p>
+ </li>
+
+ <li>The results of the operation are reported in the Console.</li>
+</ol>
+</body>
+</html>
Added: trunk/common/org.maemo.esbox.help/html/tips.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/tips.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/tips.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Tips and tricks</title>
+ <link rel="stylesheet" type="text/css" href="help.css">
+</head>
+
+<body>
+<h2>Tips and Tricks</h2>
+
+<h3>Editing source</h3>
+
+Content Assist provides you with a list of suggested completions for partially entered strings. In the Java editor press <b>Ctrl+Space</b> or invoke <b>Edit > Content Assist</b>.
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/html/toc.html
===================================================================
--- trunk/common/org.maemo.esbox.help/html/toc.html (rev 0)
+++ trunk/common/org.maemo.esbox.help/html/toc.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html lang="en">
+<head>
+ <meta name="copyright" content="Copyright (c) INdT 2007-2008. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+ <meta http-equiv="Content-Language" content="en-us">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Table of Contents</title>
+ <link rel="stylesheet" type="text/css" href="help.css">
+</head>
+
+<body>
+<h2 class="style1">The ESbox Project User's Guide</h2>
+ESbox is an Eclipse plug-in that helps programmers to develop applications for the Maemo platform on Scratchbox Apophis. It supports C/C++ and Python programming languages. Maemo 4.x SDKs (and later) will be supported.
+<p> </p>
+<p> </p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.help/plugin.xml
===================================================================
--- trunk/common/org.maemo.esbox.help/plugin.xml (rev 0)
+++ trunk/common/org.maemo.esbox.help/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.help.toc">
+
+ <toc file="toc.xml"
+ primary="true">
+ </toc>
+ <toc file="tocconcepts.xml">
+ </toc>
+ <toc file="tocgettingstarted.xml">
+ </toc>
+ <toc file="toctasks.xml">
+ </toc>
+ <toc file="tocreference.xml">
+ </toc>
+
+ </extension>
+</plugin>
Added: trunk/common/org.maemo.esbox.help/toc.xml
===================================================================
--- trunk/common/org.maemo.esbox.help/toc.xml (rev 0)
+++ trunk/common/org.maemo.esbox.help/toc.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+ <toc label="ESbox User Guide" topic="html/toc.html">
+ <topic label="Getting Started">
+ <anchor id="gettingstarted"/>
+ </topic>
+
+ <topic label="Concepts">
+ <anchor id="concepts"/>
+ </topic>
+
+ <topic label="Tasks">
+ <anchor id="tasks"/>
+ </topic>
+
+ <topic label="Reference">
+ <anchor id="reference"/>
+ </topic>
+
+ <topic label="Legal" href="html/legal.html"/>
+
+</toc>
Added: trunk/common/org.maemo.esbox.help/tocconcepts.xml
===================================================================
--- trunk/common/org.maemo.esbox.help/tocconcepts.xml (rev 0)
+++ trunk/common/org.maemo.esbox.help/tocconcepts.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Concepts" link_to="toc.xml#concepts">
+ <topic label="Maemo Projects" href="html/concepts/MaemoProjects.html">
+ </topic>
+ <topic label="Maemo Builder" href="html/concepts/MaemoBuilder.html">
+ </topic>
+ <topic label="String Externalization" href="html/concepts/StringExternalization.html">
+ </topic>
+ <topic label="Scratchbox Target" href="html/concepts/ScratchboxTarget.html">
+ </topic>
+ <topic label="Sbrsh" href="html/concepts/Sbrsh.html">
+ </topic>
+ <topic label="Debian Package Management" href="html/concepts/DebianPackage.html">
+ </topic>
+ <topic label="Profiling Applications" href="html/concepts/ProfilingApplications.html">
+ </topic>
+
+</toc>
Added: trunk/common/org.maemo.esbox.help/tocgettingstarted.xml
===================================================================
--- trunk/common/org.maemo.esbox.help/tocgettingstarted.xml (rev 0)
+++ trunk/common/org.maemo.esbox.help/tocgettingstarted.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Getting Started" link_to="toc.xml#gettingstarted">
+ <topic label="Introduction" href="html/gettingstarted/Introduction.html" />
+ <topic label="Basic Tutorial" href="html/gettingstarted/BasicTutorial.html">
+ <topic label="Creating your first ESbox C/C++ Project" href="html/gettingstarted/CreatingAMaemoProject.html">
+ </topic>
+ <topic label="Creating your first ESbox Python Project" href="html/gettingstarted/CreatingPythonProject.html">
+ </topic>
+ <topic label="Creating a Maemo project with templates" href="html/gettingstarted/CreatingProjectTemplates.html">
+ </topic>
+ <topic label="Compiling an ESbox C/C++ Project" href="html/gettingstarted/CompilingCMaemoProject.html">
+ </topic>
+ <topic label="Launching an ESbox C/C++ Application" href="html/gettingstarted/RunningCProject.html">
+ </topic>
+ <topic label="Launching an ESbox Python Application" href="html/gettingstarted/RunningPythonProject.html">
+ </topic>
+ <topic label="Debugging an ESbox C/C++ Application" href="html/gettingstarted/DebuggingCMaemoApplications.html">
+ </topic>
+ <topic label="Debugging an ESbox Python Application" href="html/gettingstarted/DebuggingPythonMaemoApplications.html">
+ </topic>
+ <topic label="Extraction of Strings" href="html/gettingstarted/ExternalizeString.html">
+ </topic>
+ <topic label="Profiling ESbox Projects" href="html/gettingstarted/ProfilingMaemoApplications.html">
+ </topic>
+ </topic>
+
+ <topic label="Project Configuration Tutorial" href="html/gettingstarted/ConfigurationTutorial.html">
+ <topic label="Setting Preferences" href="html/gettingstarted/SettingPreferences.html">
+ <topic label="Environment" href="html/gettingstarted/SettingPreferences.html#env"/>
+ <topic label="Gazpacho" href="html/gettingstarted/SettingPreferences.html#gaz"/>
+ <topic label="Installed Targets" href="html/gettingstarted/SettingPreferences.html#int">
+ <topic label="Creating a New Target" href="html/gettingstarted/SettingPreferences.html#newtarget">
+ </topic>
+ </topic>
+ <topic label="Scratchbox 1" href="html/gettingstarted/SettingPreferences.html#sbox1"/>
+ <topic label="Scratchbox 2" href="html/gettingstarted/SettingPreferences.html#sbox2"/>
+ <topic label="SSH" href="html/gettingstarted/SettingPreferences.html#ssh"/>
+ <topic label="X Server" href="html/gettingstarted/SettingPreferences.html#xsr"/>
+ </topic>
+ <topic label="Setting sbrsh Configuration" href="html/gettingstarted/SettingsSbrshConfiguration.html">
+ </topic>
+ </topic>
+</toc>
Added: trunk/common/org.maemo.esbox.help/tocreference.xml
===================================================================
--- trunk/common/org.maemo.esbox.help/tocreference.xml (rev 0)
+++ trunk/common/org.maemo.esbox.help/tocreference.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Reference" link_to="toc.xml#reference">
+
+ <topic label="Frequently-Asked Questions: ESbox" href="html/reference/FAQ.html">
+ </topic>
+ <topic label="Glossary" href="html/reference/Glossary.html">
+ </topic>
+</toc>
Added: trunk/common/org.maemo.esbox.help/toctasks.xml
===================================================================
--- trunk/common/org.maemo.esbox.help/toctasks.xml (rev 0)
+++ trunk/common/org.maemo.esbox.help/toctasks.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Tasks" link_to="toc.xml#tasks">
+ <topic label="Create a new Scratchbox target" href="html/gettingstarted/SettingPreferences.html#int">
+ </topic>
+ <topic label="Create Make Target" href="html/tasks/CreateMakeTarget.html">
+ </topic>
+ <topic label="Creating a OProfile Launch Configuration" href="html/tasks/CreateOprofileconfig.html">
+ </topic>
+ <topic label="Local Launching" href="html/concepts/LocalLaunching.html">
+ </topic>
+ <topic label="Remote Launching" href="html/concepts/RemoteLaunching.html">
+ </topic>
+ <topic label="Local Debugging" href="html/concepts/LocalDebugging.html">
+ </topic>
+ <topic label="Remote Debugging" href="html/concepts/RemoteDebugging.html">
+ </topic>
+ <topic label="Debian Package Management" href="html/tasks/DebianPackage.html">
+ </topic>
+</toc>
Property changes on: trunk/common/org.maemo.esbox.launch
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.launch/.classpath
===================================================================
--- trunk/common/org.maemo.esbox.launch/.classpath (rev 0)
+++ trunk/common/org.maemo.esbox.launch/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/org.maemo.esbox.launch/.project
===================================================================
--- trunk/common/org.maemo.esbox.launch/.project (rev 0)
+++ trunk/common/org.maemo.esbox.launch/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.launch</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.launch/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.maemo.esbox.launch/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/org.maemo.esbox.launch/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:23:35 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/org.maemo.esbox.launch/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.launch/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.maemo.esbox.launch/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Launch Plug-in
+Bundle-SymbolicName: org.maemo.esbox.launch;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-CoreActivator: org.maemo.esbox.launch.noexport.CoreActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.debug.ui;bundle-version="3.4.0",
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.ui;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.launch,
+ org.maemo.esbox.launch.adapters,
+ org.maemo.esbox.launch.core,
+ org.maemo.esbox.launch.ui
+Import-Package: org.eclipse.ui
+Bundle-Activator: org.maemo.esbox.internal.launch.Activator
Added: trunk/common/org.maemo.esbox.launch/about.html
===================================================================
--- trunk/common/org.maemo.esbox.launch/about.html (rev 0)
+++ trunk/common/org.maemo.esbox.launch/about.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+<h3>About This Content</h3>
+
+<h3>ESbox</h3>
+
+<p><a href="http://esbox.garage.maemo.org/" target="_blank">ESbox</a>
+is an Eclipse plug-in that helps programmers to develop applications for
+maemo platform on Scratchbox Apophis. It supports C/C++ and Python programming
+languages. Maemo 4.x SDKs (and later) will be supported.
+</p>
+
+<h3>License</h3>
+
+<p>See <a href="about_files/epl-v10.html">Eclipse Public License Version 1.0 ("EPL")</a>.
+</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>ESbox has a set of open source templates to help the development of applications. Such templates are distributed
+under <a href="about_files/COPYING.LESSER">LGPL license.</a></p>
+
+<address> © Copyright 2007-2008 INdT. All rights reserved. </address>
Added: trunk/common/org.maemo.esbox.launch/about_files/epl-v10.html
===================================================================
--- trunk/common/org.maemo.esbox.launch/about_files/epl-v10.html (rev 0)
+++ trunk/common/org.maemo.esbox.launch/about_files/epl-v10.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ at font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+ at page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.launch/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.launch/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.launch/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ schema/
Added: trunk/common/org.maemo.esbox.launch/icons/download.gif
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.launch/icons/download.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.launch/icons/full/obj16/local_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.launch/icons/full/obj16/local_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.launch/icons/full/obj16/oprofile_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.launch/icons/full/obj16/oprofile_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.launch/icons/full/obj16/remote_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.launch/icons/full/obj16/remote_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.launch/icons/full/obj16/valgrind_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.launch/icons/full/obj16/valgrind_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.launch/plugin.xml
===================================================================
--- trunk/common/org.maemo.esbox.launch/plugin.xml (rev 0)
+++ trunk/common/org.maemo.esbox.launch/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="LaunchProtocolType" name="Launch Protocol Type" schema="schema/LaunchProtocolType.exsd"/>
+ <extension-point id="LaunchProtocolPage" name="Launch Protocol Configuration Page" schema="schema/LaunchProtocolPage.exsd"/>
+</plugin>
Added: trunk/common/org.maemo.esbox.launch/schema/LaunchProtocolPage.exsd
===================================================================
--- trunk/common/org.maemo.esbox.launch/schema/LaunchProtocolPage.exsd (rev 0)
+++ trunk/common/org.maemo.esbox.launch/schema/LaunchProtocolPage.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,121 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.launch" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.maemo.esbox.launch" id="LaunchProtocolPage" name="Launch Protocol Configuration Page"/>
+ </appinfo>
+ <documentation>
+ This extension point provides a mechanism for contributing configuration UI for LaunchProtocolType extensions.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="launch_protocol_page" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="launch_protocol_page">
+ <complexType>
+ <attribute name="launch_protocol_id" type="string" use="required">
+ <annotation>
+ <documentation>
+ ID of a LaunchProtocolType extension.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A fully qualified name of a java class that implements ILaunchProtocolPage.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.maemo.esbox.launch.ui.AbstractLaunchProtocolPage:org.maemo.esbox.launch.ui.ILaunchProtocolPage"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 08/10/20008
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ See org.maemo.esbox.launch/plugin.xml
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ Value of the attribute class must be a fully qualified name of a Java class that implements the interface org.maemo.esbox.launch.ui.ILaunchProtocolPage.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2008 Nokia Corporation.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/common/org.maemo.esbox.launch/schema/LaunchProtocolType.exsd
===================================================================
--- trunk/common/org.maemo.esbox.launch/schema/LaunchProtocolType.exsd (rev 0)
+++ trunk/common/org.maemo.esbox.launch/schema/LaunchProtocolType.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,143 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.launch" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.maemo.esbox.launch" id="LaunchProtocolType" name="Launch Protocol Type"/>
+ </appinfo>
+ <documentation>
+ A launch protocol defines the protocol by which a programs is downloaded to remote device and by which it is invoked on the remote device. Examples are SSH and SBRSH. Each extension to this point is supposed to provide one or more types of launch protocol.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="launch_protocol" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="launch_protocol">
+ <annotation>
+ <documentation>
+ Defines the type of remote logic connection provided by the extension.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique identifier of the launch protocol type.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ User readable name. Will be displayed in UI. It must be unique.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string" use="required">
+ <annotation>
+ <documentation>
+ Short description of the protocol type. May get displayed in UI.
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Fully qualified name of the java class that implements the IRmoteLogicConnectionProvider interface.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.maemo.esbox.launch.AbstractLaunchProtocolType:org.maemo.esbox.launch.ILaunchProtocolType"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 08/08/2008
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ Please see plugin.xml in org.maemo.esbox.launch plugin.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ An extension must implement org.maemo.esbox.launch.ILaunchProtocolType. And it also must implement org.maemo.esbox.launch.ILaunchProtocol.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ Refer to org.maemo.esbox.device.launch.SSHLaunchProtocolType and org.maemo.esbox.device.launch.SSHLaunchProtocol.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2008 Nokia Corporation.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/internal/launch/Activator.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/internal/launch/Activator.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/internal/launch/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,131 @@
+package org.maemo.esbox.internal.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.launch";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocol.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocol.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocol.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,322 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API & Implementation. 02/17/2008
+ * Ed Swartz (Nokia) - refactoring
+ *******************************************************************************/
+package org.maemo.esbox.launch;
+
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.jface.resource.JFaceColors;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.launch.Activator;
+import org.maemo.esbox.ui.dialogs.PasswordInputDialog;
+
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.*;
+
+/**
+ * XXX: need a way to dispose a connection, since it holds onto a IMachine instance
+ * which needs to be released.
+ * @author LWang.
+ * @author eswartz
+ *
+ */
+public abstract class AbstractLaunchProtocol implements ILaunchProtocol {
+
+ private MessageConsole logConsole;
+ private boolean logRequested;
+ private ILaunchConfiguration config;
+
+ protected AbstractLaunchProtocol() {
+ super();
+ logConsole = null;
+ logRequested = false;
+ }
+
+ /**
+ * Constructor based on given launch configuration.
+ */
+ protected AbstractLaunchProtocol(ILaunchConfiguration config) {
+ super();
+
+ this.config = config;
+
+ // By default, enable log to debugger console of the launch configuration.
+ //
+ logConsole = ESboxLaunchUtils.getLaunchLogConsole(config);
+ logRequested = true;
+ }
+
+ /** Get the launch configuration with which we were created */
+ protected ILaunchConfiguration getLaunchConfiguration() {
+ return config;
+ }
+
+ public void enableLogToConsole(boolean enable) {
+ logRequested = enable;
+ }
+
+ public void setLogConsole(MessageConsole console) {
+ logConsole = console;
+ }
+
+ protected MessageConsole getLogConsole() {
+ return logConsole;
+ }
+
+ protected boolean isLogEnabled() {
+ return logRequested;
+ }
+
+ /**
+ * Convenience method. Create process launcher with given launcher factory
+ * and command arguments.
+ *
+ * @param processLauncherFactory
+ * @param workingDir
+ * @param cmdLine
+ * @param env
+ * @return
+ * @throws ESboxException
+ */
+ protected IProcessLauncher createProcessLauncher(
+ IProcessLauncherFactory processLauncherFactory,
+ ProcessLauncherParameters parameters) throws ESboxException {
+
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ processLauncherFactory, parameters);
+ processLauncher.usePTY(true);
+ return processLauncher;
+ }
+
+ /**
+ * Launch a command and log the command line and its output in given console.
+ *
+ * @param processLauncherFactory
+ * @param logConsole -- <code>null<code> means no logging.
+ * @param parameters process launch parameters
+ * @param waitTillEnd
+ * @return running or terminated process
+ * @throws ESboxException
+ */
+ private Process launchCommandAndLog(
+ MessageConsole logConsole,
+ ProcessLauncherParameters parameters,
+ boolean waitTillEnd) throws ESboxException {
+
+ Process process = null;
+
+ IProcessLauncher processLauncher = createRemoteCommandLauncher(parameters);
+
+ MessageConsoleStream out = null, err = null;
+
+ if (logConsole != null) {
+
+ final Color[] colors = { null, null };
+
+ // See global preference Run/Debug=>Console
+// These are restricted access.
+// colors[0] = DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR);
+// colors[1] = DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR);
+ colors[1] = JFaceColors.getErrorText(Display.getCurrent());
+
+ out = logConsole.newMessageStream();
+ err = logConsole.newMessageStream();
+
+ final MessageConsoleStream[] streams = { out, err };
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+// streams[0].setColor(colors[0]);
+ streams[1].setColor(colors[1]);
+ }
+
+ });
+ }
+
+ String fullCmdLine = CommandLineArguments.toCommandLine(processLauncher.getLaunchCommandArguments());
+
+ if (out != null) // log command line before we actually launch the process.
+ out.println(fullCmdLine);
+
+ // Now launch the process
+ process = processLauncher.createProcess();
+
+ if (waitTillEnd) {
+ // Hmm, this does not return exit code of the actual process.
+ // See org.eclipse.cdt.core.CommandLauncher.waitAndRead().
+ // Caller should use process.exitCode() to check that.
+ if (out != null && err != null)
+ processLauncher.waitAndRead(out, err, false /* showCommand */);
+ else
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ throw new ESboxException("The process is interrupted. Detail: " + e.getMessage());
+ }
+ }
+ else {
+ processLauncher.redirectToConsole(logConsole);
+ }
+
+ // "out" and "err" will be closed when the process dies.
+
+ if (waitTillEnd) {
+ int exitCode = process.exitValue();
+ if (exitCode != 0) {
+ throw new ESboxException("Command failed: " + fullCmdLine);
+ }
+ }
+ return process;
+ }
+
+ /**
+ * Optionally modify process launch parameters. The default implementation does nothing.
+ * @param parameters
+ */
+ protected void updateLaunchParameters(ProcessLauncherParameters parameters) {
+
+ }
+
+ // convenience method.
+ protected static ErrorLogger getErrorLogger()
+ {
+ return Activator.getErrorLogger();
+ }
+
+ protected IPreferenceProvider getPreferenceProvider(
+ ILaunchConfiguration config) {
+ IPreferenceProvider prefProvider;
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(config);
+ if (sdkTarget != null)
+ prefProvider = sdkTarget;
+ else
+ prefProvider = CorePlugin.getDefault().getCorePreferenceProvider();
+ return prefProvider;
+ }
+
+ public IStatus downloadFile(File hostFile, IPath targetFolder, IProgressMonitor monitor) {
+
+ Map<IPath, List<IPath>> targetPathsToFiles = new HashMap<IPath, List<IPath>>();
+
+ IPreferenceProvider prefProvider = CorePlugin.getDefault().getCorePreferenceProvider();
+ IPath basePath = getBaseTargetPath(prefProvider);
+
+ IPath targetPath = resolveTargetPath(basePath, targetFolder);
+
+ List<IPath> entries = Collections.singletonList((IPath)new Path(hostFile.getAbsolutePath()));
+ targetPathsToFiles.put(targetPath, entries);
+
+ return downloadFiles(targetPathsToFiles, monitor);
+ }
+
+ /**
+ * On Download tab in Launch configuration dialog for remote debug, user
+ * specifies a target path to download a file. The path, if relative, is
+ * relative to the base folder specified in global SSH preference panel.
+ * This method is to combine the path (if relative) with the base folder.
+ *
+ * Note the base folder may also be a relative path, which means it's
+ * relative to the HOME folder of the SSH user. So the return value of the
+ * method may still be a relative path.
+ *
+ * @param basePath the base folder for target paths; must be absolute
+ * @param targetPathFromUI
+ * @return a path, always absolute. "" on error.
+ */
+ protected IPath resolveTargetPath(IPath basePath, IPath targetPath) {
+ IPath retPath = null;
+
+ if (targetPath.isAbsolute()) {
+ retPath = targetPath;
+ } else {
+ targetPath = basePath.append(targetPath);
+
+ // The above "append" on "./" and "./" produces empty path.
+ if (targetPath.segmentCount() == 0)
+ targetPath = basePath;
+
+ retPath = targetPath;
+ }
+
+ return retPath;
+ }
+
+ /**
+ * Get the base target path to which all copied files go.
+ */
+ protected IPath getBaseTargetPath(IPreferenceProvider prefProvider) {
+ // This is a guess, but can be overcome
+ // if the SSH_DEST_FOLDER is absolute.
+
+ String targetBaseFolder = prefProvider.getPreferenceValue(ESboxPreferenceConstants.SSH_DEST_FOLDER);
+ IPath basePath = new Path(targetBaseFolder);
+ if (basePath.isAbsolute())
+ return basePath;
+
+ return getDeviceMachine().getUserHome().append(basePath);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#invokeCommandOnDevice(List, IPath, Properties, boolean)
+ */
+ public Process invokeRemoteCommand(
+ ProcessLauncherParameters parameters,
+ boolean waitTillEnd) throws ESboxException
+ {
+ MessageConsole logConsole = isLogEnabled() ? getLogConsole() : null;
+
+ return launchCommandAndLog(logConsole, parameters, waitTillEnd);
+ }
+
+ public IProcessLauncher createRemoteCommandLauncher(ProcessLauncherParameters parameters) throws ESboxException {
+
+ IProcessLauncherFactory factory = getDeviceMachine().getProcessLauncherFactory();
+
+ updateLaunchParameters(parameters);
+
+ return createProcessLauncher(factory, parameters);
+ }
+
+ protected String promptSudoPassword() {
+ Shell shell = WorkbenchUtils.getActiveShell();
+ final PasswordInputDialog dialog = new PasswordInputDialog(shell,
+ "Password Required",
+ MessageFormat.format("Enter the password for user ''{0}'' on ''{1}'' to run commands as root",
+ getDeviceMachine().getUserName(),
+ getDeviceMachine().getURI().getHost()));
+
+ Activator.getDefault().getWorkbench().getDisplay().syncExec(
+ new Runnable() {
+
+ public void run() {
+ dialog.open();
+ }
+
+ }
+ );
+
+ return dialog.getPassword();
+ }
+
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocolType.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocolType.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocolType.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Aug 8, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.internal.launch.Activator;
+
+import java.text.MessageFormat;
+
+/**
+ * @author LWang
+ *
+ */
+public abstract class AbstractLaunchProtocolType implements
+ ILaunchProtocolType, IExecutableExtension{
+
+ private String typeID;
+ private String typeName;
+ private String typeDescription;
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocolType#getTypeDescription()
+ */
+ public String getDescription() {
+ return typeDescription;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocolType#getTypeID()
+ */
+ public String getID() {
+ return typeID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocolType#getTypeName()
+ */
+ public String getName() {
+ return typeName;
+ }
+
+ public void setInitializationData(IConfigurationElement config,
+ String propertyName, Object data) throws CoreException {
+
+ String format = "Failed to get attribute ''{0}'' for element ''{1}''.\n";
+ String msg = null;
+
+ typeID = config.getAttribute(LaunchProtocolFactory.ATTR_ID);
+ if (typeID == null)
+ msg += MessageFormat.format(format, LaunchProtocolFactory.ATTR_ID, config.getName());
+
+ typeName = config.getAttribute(LaunchProtocolFactory.ATTR_NAME);
+ if (typeName == null)
+ msg += MessageFormat.format(format, LaunchProtocolFactory.ATTR_NAME, config.getName());
+
+ typeDescription = config.getAttribute(LaunchProtocolFactory.ATTR_DESCRIPTION);
+ if (typeDescription == null)
+ msg += MessageFormat.format(format, LaunchProtocolFactory.ATTR_DESCRIPTION, config.getName());
+
+ if (msg != null)
+ throw new CoreException(Activator.createErrorStatus(msg, null));
+ }
+
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ESboxDebuggerStatus.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ESboxDebuggerStatus.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ESboxDebuggerStatus.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (ling.5.wang at nokia.com) - initial API. 02/17/2008
+ *******************************************************************************/
+package org.maemo.esbox.launch;
+
+import org.eclipse.core.runtime.Status;
+import org.maemo.esbox.internal.launch.Activator;
+
+public class ESboxDebuggerStatus extends Status {
+
+ public ESboxDebuggerStatus(String message) {
+ this(ERROR, message);
+ }
+
+ public ESboxDebuggerStatus(int severity, String message) {
+ this(severity, OK, message, null);
+ }
+
+ public ESboxDebuggerStatus(Throwable exception) {
+ this(ERROR, OK, exception.getLocalizedMessage(), exception);
+ }
+
+ public ESboxDebuggerStatus(int severity, int code, String message, Throwable exception) {
+ super(severity, Activator.PLUGIN_ID, code, message, exception);
+ }
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ESboxLaunchUtils.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ESboxLaunchUtils.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ESboxLaunchUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,609 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API. 02/17/2008
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.launch;
+
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.provider.FileInfo;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.*;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.eclipse.ui.console.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.adapters.IDefaultExecutionEnvironmentAdapter;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.process.EnvironmentProperties;
+import org.maemo.esbox.core.process.ProcessLauncherParameters;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.launch.Activator;
+import org.maemo.esbox.launch.adapters.IRunStandaloneAdapter;
+import org.maemo.esbox.project.core.ProjectManager;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.*;
+
+/**
+ * @author LWang.
+ * @author eswartz
+ *
+ */
+public class ESboxLaunchUtils {
+
+ static public final String sboxMappingsContainerName = "Scratchbox Path Mappings"; //$NON-NLS-1$
+ static public final int SSH_PORT = 22;
+
+ static public int debugSessionCounter = 1;
+
+ public static String getProgramName(ILaunchConfiguration configuration) throws CoreException {
+ // XXX: refactor this, this comes from the CDT/python launch config constants,
+ // but we don't want to add a dependency on CDT/python here
+ String programName = configuration.getAttribute("org.eclipse.cdt.launch.PROGRAM_NAME", (String)null);
+ if (programName == null) {
+ programName = configuration.getAttribute("org.eclipse.ui.externaltools" + ".ATTR_LOCATION", "");
+ }
+ return programName;
+ }
+
+
+ /**
+ * Return the full path of the main program/module in the launch configuration.
+ * @param configuration
+ * @return - path, null if no program is specified by user for the launch configuration.
+ * @throws CoreException
+ */
+ public static String getProgramFullPath(ILaunchConfiguration configuration) throws CoreException {
+ String hp = null;
+
+ hp = getProgramName(configuration);
+ if (hp == null)
+ return null;
+
+ IPath p = new Path(hp);
+ if ( ! p.isAbsolute()) {
+ IProject proj = getProject(configuration);
+ if (proj != null) {
+ p = proj.getLocation().append(p);
+ hp = p.toPortableString();
+ }
+ }
+
+ return hp;
+ }
+
+ /**
+ * Get the project referenced by the launch configuration
+ * @param configuration
+ * @return IProject or <code>null</code>
+ * @throws CoreException
+ */
+ public static IProject getProject(ILaunchConfiguration configuration) throws CoreException {
+ String projectName;
+
+ // XXX: refactor this, this comes from the CDT and python launch config constants,
+ // but we don't want to add a dependency here for such a basic attribute
+ projectName = configuration.getAttribute("org.eclipse.cdt.launch.PROJECT_ATTR", "");
+ if (projectName.length() == 0) {
+ projectName = configuration.getAttribute("org.python.pydev.debug.ATTR_PROJECT", "");
+ }
+ if (projectName.length() > 0) {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ }
+ return null;
+ }
+
+
+ /**
+ * Get SDKTarget associated with the given project.
+ *
+ * @param project
+ * @return ISDKTarget associated with the project, if any. null on error.
+ */
+ static public ISDKTarget getSDKTarget(IProject project) {
+
+ ISDKTarget sdkTarget = null;
+
+ try {
+ sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
+ } catch (ESboxException e) {
+ // try old-style
+ try {
+ sdkTarget = ProjectManager.getInstance().getOldStyleProjectProperties(project).getSDKTarget();
+ } catch (ESboxException e1) {
+ // it's possible a project has no ISDKTarget associated.
+ Activator.getErrorLogger().logError("Failed to get SDKTarget for project:" + project.getName(), e);
+ }
+ }
+
+ return sdkTarget;
+ }
+
+ /**
+ * Get SDKTarget associated with the project of the given launch configuration.
+ *
+ * @param ILaunchConfiguration
+ * @return ISDKTarget associated with the underlying project. null on error.
+ */
+ static public ISDKTarget getSDKTarget(ILaunchConfiguration configuration) {
+
+ ISDKTarget sdkTarget = null;
+
+ try {
+ IProject project = getProject(configuration);
+ if (project != null)
+ sdkTarget = getSDKTarget(project);
+ } catch (CoreException e) {
+ // it's possible a project has no ISDKTarget associated.
+ Activator.getErrorLogger().logError("Failed to get SDKTarget for launch config: " + configuration.getName(), e);
+ }
+
+ return sdkTarget;
+ }
+
+ /**
+ * We create a log console for each launch configuration.
+ * This method will find the log console for the given launch configuration
+ * or else create a new one. Either way the console will be brought to front.
+ * <br>
+ * The console is supposed to show debug/run related commands and their output.
+ *
+ * @param config
+ * @return
+ */
+ public static MessageConsole getLaunchLogConsole(ILaunchConfiguration config) {
+
+ MessageConsole console = null;
+
+ String consoleName = "Launch Console : " + config.getName();
+
+ org.eclipse.ui.console.IConsole[] existing = ConsolePlugin.getDefault()
+ .getConsoleManager().getConsoles();
+
+ // Use existing one if any.
+ for (int i = 0; i < existing.length; i++) {
+ if (existing[i].getName().equals(consoleName)) {
+ console = (MessageConsole)existing[i];
+ break;
+ }
+ }
+
+ if (console == null) {
+ // create a new one.
+ console = new MessageConsole(consoleName, null);
+
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(
+ new org.eclipse.ui.console.IConsole[] { console });
+ }
+
+ // Show it.
+ ConsolePlugin.getDefault().getConsoleManager().showConsoleView(console);
+
+ return console;
+ }
+
+ /**
+ * Validate a remote connection by checking if we can do an SSH connection
+ * to the device specified in the given launch configuration. If not, show
+ * error to user.
+ *
+ * @param protocol
+ * @return true if validation passes, false otherwise.
+ * @throws CoreException
+ */
+ public static boolean validateRemoteConnection(ILaunchProtocol protocol) throws CoreException {
+
+ IMachine machine = protocol.getDeviceMachine();
+
+ IStatus status = MachineManager.getInstance().probeMachine(machine, null);
+ if (!status.isOK()) {
+ status = MachineManager.getInstance().acquireMachine(machine, null);
+ }
+
+ if (!status.isOK()) {
+ Activator.getErrorLogger().logAndShowError(status.getMessage(), status.getException());
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Validate a local launch configuration by validating scratchbox and invoking X and/or Maemo
+ * @param configuration
+ * @return same or updated configuration or <code>null</code> to cancel
+ * @throws CoreException
+ * @throws ESboxException
+ */
+ public static boolean validateLocalConnection(ILaunchConfiguration configuration) throws CoreException {
+
+ // ensure virtual machine, if used, is alive
+ ISDKTarget sdkTarget = getSDKTarget(configuration);
+ if (sdkTarget != null) {
+ IMachine machine = sdkTarget.getSDK().getMachine();
+ IStatus status = MachineManager.getInstance().acquireMachine(machine, null);
+ if (!status.isOK())
+ throw new CoreException(status);
+ }
+
+ // now establish the launch environment
+ final IProject project = getProject(configuration);
+ if (project == null) {
+ throw new CoreException(Activator.createErrorStatus(
+ "No project is selected for this launch configuration.", null));
+ }
+
+ final CoreException exceptions[] = {null};
+
+ try {
+ // see what the project wants for the execution environment
+ IExecutionEnvironment execEnv_ = ProjectManager.getInstance().
+ getProjectProperties(project).getExecutionEnvironment();
+
+ // if unknown, query a default
+ if (execEnv_ == null) {
+ IDefaultExecutionEnvironmentAdapter adapter = (IDefaultExecutionEnvironmentAdapter)
+ sdkTarget.getAdapter(IDefaultExecutionEnvironmentAdapter.class);
+ if (adapter != null) {
+ execEnv_ = adapter.getDefaultExecutionEnvironment(project);
+ }
+ }
+
+ final IExecutionEnvironment execEnv = execEnv_;
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ try {
+ if (execEnv != null)
+ execEnv.establishEnvironment(null, project);
+ }
+ catch (CoreException e) {
+ exceptions[0] = e;
+ }
+ }});
+ } catch (ESboxException e1) {
+ exceptions[0] = new CoreException(Activator.createErrorStatus("Failed to read execution environment", e1));
+ }
+
+ if (exceptions[0] != null)
+ throw exceptions[0];
+
+ return true;
+ }
+
+ /**
+ * Get the local mount point for the selected sbrsh binary path, which is recorded as one of the .sbrsh mounts
+ * <p>
+ * TODO: validate that the stored mount is actually still reflected in .sbrsh
+ * @param sdkTarget
+ * @return the local mount point
+ * @throws CoreException if there is no selected binary path
+ */
+ public static String getSbrshLocalMountPoint(ISDKTarget sdkTarget) throws CoreException {
+ String sbrshBinPath = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SBRSH_SELECTED_BIN_PATH);
+
+ String localMountPoint = "";
+ if (!sbrshBinPath.equals("")) {
+ String tokens[] = sbrshBinPath.split("#");
+ if (tokens.length > 1)
+ localMountPoint = tokens[1];
+ }
+
+ if (localMountPoint.equals("")) {
+ throw new CoreException(Activator.createErrorStatus(
+ "No mount is selected as the binary path in the Workspace > ESbox > Sbrsh preferences.",
+ null));
+
+ }
+ return localMountPoint;
+ }
+
+ /**
+ * Get the remote mount point for the selected sbrsh binary path, which is recorded as one of the .sbrsh mounts
+ * to which to copy binaries.
+ * <p>
+ * TODO: validate that the stored mount is actually still reflected in .sbrsh
+ * @param sdkTarget
+ * @return the remote mount point
+ * @throws CoreException if there is no selected binary path
+ */
+ public static String getSbrshRemoteMountPoint(ISDKTarget sdkTarget) throws CoreException {
+ String sbrshBinPath = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SBRSH_SELECTED_BIN_PATH);
+
+ String remoteMountPoint = "";
+ if (!sbrshBinPath.equals("")) {
+ String tokens[] = sbrshBinPath.split("#");
+ if (tokens.length > 2)
+ remoteMountPoint = tokens[2];
+ }
+
+ if (remoteMountPoint.equals("")) {
+ throw new CoreException(Activator.createErrorStatus(
+ "No mount is selected as the binary path in the Workspace > ESbox > Sbrsh preferences.",
+ null));
+
+ }
+ return remoteMountPoint;
+ }
+
+ /**
+ * Log debugger start message in the debugger log console for the given
+ * launch configuration. This is supposed to be called at the beginning of a
+ * debug/run session. It will make it easier for user to read debugger
+ * console log.
+ *
+ * @param config
+ */
+ static public void logLaunchSessionStart(ILaunchConfiguration config) {
+ MessageConsole debuggerConsole = getLaunchLogConsole(config);
+
+ MessageConsoleStream out = debuggerConsole.newMessageStream();
+
+ String msg = MessageFormat.format("\n<========= Launch Session: #{0} ============>\n\n", debugSessionCounter++);
+ out.print(msg);
+
+ try {
+ out.close();
+ } catch (IOException e) {
+ // don't care
+ }
+ }
+
+ /**
+ * Create a {@link CoreException} based on given error message. The
+ * CoreExcpetion object will be flagged as from ESBox core plugin.
+ *
+ * @param mesg
+ * @return
+ */
+ static public CoreException newCoreExceptionFromESbox(String mesg) {
+ return new CoreException(Activator.createErrorStatus(mesg, null));
+ }
+
+ static public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode) throws CoreException {
+ IProject project = getProject(configuration);
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(project);
+
+ // Now check if the SDKTarget of the project has been
+ // changed to a different one by user.
+
+ // For Python, different from C++, the same launch configuration
+ // (local or remote) can work without change with different SDKTargets.
+ // So don't do such check. .....LWang. 07/22/08
+ boolean forPython = configuration.getType().getIdentifier().toLowerCase().contains("python");
+
+ if (sdkTarget != null) {
+ if (!forPython &&
+ ! LaunchConfigurationData.isLaunchConfigurationApplicable(configuration, sdkTarget)) {
+ final String msg = MessageFormat.format(
+ "The build target of the project ''{0}'' has been changed to ''{1}''.\n\n"+
+ "The launch configuration ''{2}'' is not suitable any more.\n\n" +
+ "Please create a new launch configuration, for instance, by selecting the project " +
+ "and then clicking on the Debug button or Run button in the tool bar.",
+ project.getName(),
+ sdkTarget.getName(),
+ configuration.getName());
+
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ MessageDialog.openError(null, "Mismatched Build Target", msg);
+ }});
+
+ return false;
+ }
+ }
+ else {
+ throw newCoreExceptionFromESbox("Could not determine build target for project.");
+ }
+
+ return true;
+ }
+
+ /**
+ * Open an external browser and go to the given URL.
+ * Note this function must be called in UI thread.
+ *
+ * @param url
+ */
+ static public void showWebPageInBrowser(String url) {
+ IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
+ // use external browser since internal one which opens in an editor has no UI
+ // and somehow seems to ignore proxy settings
+
+ try {
+ URL networkingURL = new URL(url);
+ browserSupport.getExternalBrowser().openURL(networkingURL);
+ } catch (MalformedURLException e) {
+ Activator.getErrorLogger().logError("Malformed URL. Error: " + e.getMessage(), e);
+ } catch (PartInitException e) {
+ Activator.getErrorLogger().logError("Cannot navigate to the URL. Error: " + e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Core engine for copying files from the host to the target.
+ * @param targetFileSystemAccess the access to the target filesystem (this may even be scratchbox!)
+ * @param targetPathFiles fully resolved map of target paths and the host files which are copied there
+ * @param monitor
+ * @return status (OK if successful)
+ */
+ public static IStatus downloadFiles(IFileSystemAccess targetFileSystemAccess, Map<IPath, List<IPath>> targetPathFiles, IProgressMonitor monitor) {
+
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ monitor.beginTask("", targetPathFiles.size()*2 + targetPathFiles.keySet().size() + 1);
+
+ // Make sure the target folders exist on device by creating all the target
+ // directories if needed.
+
+ for (IPath targetPath : targetPathFiles.keySet()) {
+ IFileStore directory = targetFileSystemAccess.getFileStore(targetPath);
+ if (!directory.fetchInfo().exists()) {
+ try {
+ directory.mkdir(EFS.NONE, new SubProgressMonitor(monitor, 1));
+ } catch (CoreException e) {
+ return new ESboxDebuggerStatus(IStatus.ERROR, 0, "Failed to create one of the target paths on device: " + directory.toString(), e);
+ }
+ }
+ else
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ }
+
+ monitor.worked(1);
+
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+
+ // Now download the files, one target directory at a time.
+ //
+ for (Map.Entry<IPath, List<IPath>> pathEntry : targetPathFiles.entrySet()) {
+ List<IPath> hostFilePaths = pathEntry.getValue();
+ IFileStore targetDirectory = targetFileSystemAccess.getFileStore(pathEntry.getKey());
+
+ for (IPath hostFilePath : hostFilePaths) {
+ IFileStore targetFileStore = targetDirectory.getChild(hostFilePath.lastSegment());
+ IFileStore hostFileStore = EFS.getLocalFileSystem().getStore(hostFilePath);
+ try {
+ IProgressMonitor subMon = null;
+ if (monitor != null) {
+ monitor.subTask("Download to "+ pathEntry.getKey());
+ subMon = new SubProgressMonitor(monitor, 1);
+ }
+
+ // TODO: check timestamps
+ hostFileStore.copy(targetFileStore, EFS.OVERWRITE, subMon);
+
+ // XXX: when copying from Winders to Linux, we can't maintain the
+ // EXECUTABLE permission bit, so always set it
+ if (monitor != null) {
+ monitor.subTask("Set executable permission on "+ pathEntry.getKey());
+ subMon = new SubProgressMonitor(monitor, 1);
+ }
+
+ FileInfo info = new FileInfo();
+ info.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, true);
+ targetFileStore.putInfo(info, EFS.SET_ATTRIBUTES, subMon);
+
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+
+ } catch (CoreException e) {
+ // Bail out on first failure.
+ return e.getStatus();
+ }
+ }
+ }
+
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Get the IRunStandaloneSupport adapter for the target.
+ * @param sdkTarget
+ * @return IRunStandaloneSupport implementation or <code>null</code>
+ */
+ public static IRunStandaloneAdapter getRunStandaloneAdapter(ISDKTarget sdkTarget) {
+ if (sdkTarget == null)
+ return null;
+ return (IRunStandaloneAdapter) sdkTarget.getAdapter(IRunStandaloneAdapter.class);
+ }
+
+ /**
+ * Get the default recommended value for the "run standalone" option for the target,
+ * if it supports that feature.
+ * @param sdkTarget
+ * @return flag or false if not supported
+ */
+ public static boolean getRunStandaloneDefault(ISDKTarget sdkTarget) {
+ IRunStandaloneAdapter runStandaloneAdapter = getRunStandaloneAdapter(sdkTarget);
+ if (runStandaloneAdapter != null) {
+ return runStandaloneAdapter.getDefault();
+ }
+ return false;
+ }
+
+ /**
+ * Set the default value of the "run standalone" key for targets that support it.
+ * @param config
+ * @param runStandaloneKey
+ */
+ public static void setRunStandaloneDefault(
+ ILaunchConfigurationWorkingCopy config, String runStandaloneKey) {
+ ISDKTarget sdkTarget = getSDKTarget(config);
+ boolean isRunStandalone = getRunStandaloneDefault(sdkTarget);
+ config.setAttribute(runStandaloneKey, isRunStandalone);
+ }
+
+ /**
+ * Check whether the target supports "run standalone" and if so,
+ * see if it is enabled in the launch configuration, and morph
+ * the process launch parameters according to the setting.
+ * @param sdkTarget
+ * @param config
+ * @param parameters
+ */
+ public static void updateForRunStandalone(ISDKTarget sdkTarget,
+ ILaunchConfiguration config,
+ String runStandaloneKey,
+ ProcessLauncherParameters parameters) {
+ IRunStandaloneAdapter runStandaloneAdapter = getRunStandaloneAdapter(sdkTarget);
+ if (runStandaloneAdapter != null) {
+ boolean isRunStandalone = runStandaloneAdapter.getDefault();
+ try {
+ isRunStandalone = config.getAttribute(runStandaloneKey, isRunStandalone);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to read run standalone attribute", e);
+ }
+ runStandaloneAdapter.updateLaunch(parameters, isRunStandalone);
+ }
+ }
+
+ /**
+ * Get the environment from the launch configuration.
+ * <p>
+ * Note: this does not migrate old environment settings -- see ESboxCppLaunchUtils for that (with
+ * C/C++ launch configs).
+ * @return environment array[n] name=value
+ * @throws CoreException
+ */
+ public static String[] getEnvironment(ILaunchConfiguration config) throws CoreException {
+ String[] array = DebugPlugin.getDefault().getLaunchManager().getEnvironment(config);
+ if (array == null) {
+ return new String[0];
+ }
+ return array;
+ }
+
+ /**
+ * Get the environment settings from the launch configuration.
+ * @param launchConfiguration
+ * @return
+ */
+ public static Properties getEnvironmentAsProperty(
+ ILaunchConfiguration launchConfiguration) throws CoreException {
+ String[] envp = getEnvironment(launchConfiguration);
+ return EnvironmentProperties.createFromEnvp(envp);
+ }
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxCDTLaunchConfigurationConstants.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxCDTLaunchConfigurationConstants.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxCDTLaunchConfigurationConstants.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.launch;
+
+/**
+ * ESBox debugger & launch related constants.
+ *
+ */
+public interface IESboxCDTLaunchConfigurationConstants extends IESboxLaunchConfigurationConstants {
+
+ public static final String ATTR_START_GDB_SERVER = ESBOX_LAUNCH_ID + ".start_gdb_server"; //$NON-NLS-1$
+
+ public static final boolean START_GDB_SERVER_DEFAULT = true;
+
+ //=============================================================================
+ // The following are from plugin.xml files. So make sure they are synced between
+ // here and the corresponding xml files.
+ //=============================================================================
+
+ // Launch configuration types.
+ // org.maemo.esbox.launch/plugin.xml
+ //
+ public static final String CONFIG_TYPE_MAEMOLOCAL = "esboxLocalLaunchType";
+ public static final String CONFIG_TYPE_MAEMOREMOTE = "esboxRemoteLaunchType";
+ public static final String CONFIG_TYPE_OPROFILE = "esboxOprofileLaunchType";
+ public static final String CONFIG_TYPE_VALGRIND = "esboxValgrindLaunchType";
+
+ // Launch configuration types.
+ // org.maemo.esbox.debug.dsf.gdb/plugin.xml
+ //
+ public static final String CONFIG_TYPE_MAEMOLOCAL_DSF = "org.maemo.esbox.debug.dsf.gdb.localLaunchType";
+ public static final String CONFIG_TYPE_MAEMOREMOTE_DSF = "org.maemo.esbox.debug.dsf.gdb.remoteLaunchType";
+
+ // Debugger ID.
+ // org.maemo.esbox.debug/plugin.xml
+ //
+ public static final String DEBUGGER_ID_GDBDEBUGGER = "esboxGDBDebugger";
+ public static final String DEBUGGER_ID_GDBSERVERLOCAL = "esboxGDBServerDebugger";
+ public static final String DEBUGGER_ID_GDBSERVERREMOTE = "esboxGDBRemoteDebugger";
+
+ // DD Debugger ID.
+ // org.eclipse.dd.gdb/plugin.xml
+ //
+ public static final String DEBUGGER_ID_DD_GDBSERVERDEBUGGER = "org.eclipse.dd.gdb.GdbServerDebugger";
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxLaunchConfigurationConstants.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxLaunchConfigurationConstants.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxLaunchConfigurationConstants.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG)
+ *******************************************************************************/
+
+package org.maemo.esbox.launch;
+
+public interface IESboxLaunchConfigurationConstants {
+
+ public static final String ESBOX_LAUNCH_ID = "org.indt.esbox.launch";
+
+ /*
+ * The name of SDK associated with the launch configuration.
+ */
+ public static final String ATTR_SDK_NAME = ESBOX_LAUNCH_ID + ".sdk_name"; //$NON-NLS-1$
+
+ /*
+ * The name of SDK target associated with the launch configuration.
+ */
+ public static final String ATTR_SDK_TARGET_NAME = ESBOX_LAUNCH_ID + ".sdk_target_name"; //$NON-NLS-1$
+
+ public static final String ATTR_RUN_STANDALONE = ESBOX_LAUNCH_ID + ".run_standalone"; //$NON-NLS-1$
+
+ public static final boolean RUN_STANDALONE_DEFAULT = true;
+
+ public static final String ATTR_COPY_BINS = ESBOX_LAUNCH_ID + ".copy_bins"; //$NON-NLS-1$
+
+ public static final boolean COPY_BINS_DEFAULT = true;
+
+ public final static String DEFAULT_LOCAL_HOST = "127.0.0.1"; // IP address of local host. //$NON-NLS-1$
+
+ public final static String DEFAULT_HOST_IP = "192.168.2.14"; // default IP address of host PC. //$NON-NLS-1$
+
+ public final static String DEFAULT_TARGET_NAME = "192.168.2.15"; // default IP address of remote device. //$NON-NLS-1$
+
+ public final static String DEFAULT_GDBSERVER_PORT_NUMBER = "1234"; // default port# for gdbserver //$NON-NLS-1$
+
+ // This will hold name of a launch protocol type, e.g. SSH.
+ public static final String ATTR_DOWNLOAD_METHOD = ESBOX_LAUNCH_ID + ".download_method"; //$NON-NLS-1$
+
+ public static final String DEFAULT_SSH_PORT_NUMBER = "22"; // default port for SSH connections
+
+
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxLaunchHelpContextID.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxLaunchHelpContextID.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/IESboxLaunchHelpContextID.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar 6, 2008
+ *******************************************************************************/
+package org.maemo.esbox.launch;
+
+import org.maemo.esbox.internal.launch.Activator;
+
+
+/**
+ * @author LWang.
+ *
+ */
+public interface IESboxLaunchHelpContextID {
+ public static final String PREFIX = Activator.PLUGIN_ID + "."; //$NON-NLS-1$
+
+ // Launch shortcut: download method selection dialog.
+ public static final String LAUNCH_CONFIGURATION_DIALOG_DOWNLOAD_TAB = PREFIX + "launch_configuration_dialog_download_tab"; //$NON-NLS-1$
+ public static final String DOWNLOAD_METHOD_SELECTION_DIALOG = PREFIX + "download_method_selection_dialog"; //$NON-NLS-1$
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocol.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocol.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocol.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (ling.5.wang at nokia.com) - initial API. 02/17/2008
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.ProcessLauncherParameters;
+
+import java.io.File;
+import java.util.*;
+
+/**
+ * This encapsulates how host debugger handles certain operations on remote device
+ * or emulator such as downloading a file and invoking a command.
+ * @author LWang. Feb., 2008.
+ *
+ */
+public interface ILaunchProtocol {
+
+ /**
+ * Get a map of the files known to be copied from the host to the target.
+ * @return map of target paths to the list of host files copied there
+ * @see #downloadFiles(Map, IProgressMonitor)
+ */
+ public Map<IPath, List<IPath>> getTargetFoldersForHostFileMappings();
+
+ /**
+ * Download all files required by the given launch configuration. What and how and where to
+ * download is up to the implementation.
+ * @param monitor - progress monitor. can be null.
+ *
+ * @return IStatus (never null)
+ */
+ public IStatus downloadFiles(IProgressMonitor monitor);
+
+ /**
+ * Download the given mapping of files to target folders. What and how and where to
+ * download is up to the implementation.
+ *
+ * @param targetPathtoHostFiles map of resolved target folders to the host files to copy there
+ * @param targetFolder the target-side folder
+ * @param monitor - progress monitor. can be null.
+ *
+ * @return IStatus (never null)
+ */
+ public IStatus downloadFiles(Map<IPath, List<IPath>> targetPathToHostFiles, IProgressMonitor monitor);
+
+ /**
+ * Download given host file to the given folder on target device.
+ *
+ * @param hostFile
+ * @param targetFolder
+ * @param monitor - progress monitor. can be null.
+ * @return IStatus (never null)
+ */
+ public IStatus downloadFile(File hostFile, IPath targetFolder, IProgressMonitor monitor);
+
+ /**
+ * Using the files to transfer for a launch configuration, find out the location on the remote
+ * target to which the given file on host is supposed to be downloaded (e.g.
+ * via SSH), mounted (e.g. by SBRSH) or installed (e.g. by Debian package
+ * installation).
+ * @param filePath absolute file path on host machine (the Eclipse machine).
+ *
+ * @return the path to the file as it will appear on the target (WITH filename), or <code>null</code> on
+ * failure.
+ */
+ public IPath getFileLocationOnTarget(IPath filePath);
+
+ /**
+ * Map a file from the host to the device target. This returns the path that represents
+ * the exact same file on the target -- it does <b>not</b> correspond to files that
+ * are copied over.
+ * @param hostPath the host path
+ * @return path the path on the target, or <code>null</code>
+ */
+ public IPath convertHostToTargetPath(IPath hostPath);
+
+ /**
+ * Get the machine representation for the device.
+ * @return IMachine the machine
+ */
+ public IMachine getDeviceMachine();
+
+ /**
+ * Invoke given command on the remote target via this protocol.<br>
+ * <br>
+ *
+ * Compared with
+ * <i>{@link ILaunchProtocol#createRemoteCommandLauncher(ProcessLauncherParameters)}</i>,
+ * this is intended for clients who does not care much on handling details of the launchs.
+ * @param parameters process launch parameters
+ * @param waitTillEnd - whether to wait till the command finish
+ *
+ * @return if not waitTillEnd, the running Process; else the terminated process
+ * @throws ESboxException
+ */
+ public Process invokeRemoteCommand(ProcessLauncherParameters parameters,
+ boolean waitTillEnd)
+ throws ESboxException;
+
+ /**
+ * Create the process launcher for invoking given command on the remote
+ * target via this protocol.<br>
+ * <br>
+ *
+ * Compared with
+ * <i>{@link ILaunchProtocol#invokeRemoteCommand(ProcessLauncherParameters, boolean)}</i>,
+ * this API is intended for clients who wants more control on handling the
+ * process such as logging, adding extra arguments, and checking process
+ * output & error, etc.
+ * @param parameters launch parameters
+ *
+ * @return new process launcher, for which the process is not yet launched
+ * @throws ESboxException
+ */
+ public IProcessLauncher createRemoteCommandLauncher(ProcessLauncherParameters parameters) throws ESboxException;
+
+ /**
+ * Specify a console for logging commands invoked by this object.
+ *
+ * @param console
+ */
+ public void setLogConsole(MessageConsole console);
+
+ /**
+ * Enable or disable logging commands invoked by this object in the console
+ * specified by setLogConsole().
+ *
+ * @param enable
+ * @see ILaunchProtocol#setLogConsole(MessageConsole)
+ */
+ public void enableLogToConsole(boolean enable);
+
+ /**
+ * If a launch must be run as root, prepare to modify the launch and/or
+ * query the user for a password as needed to satisfy the request
+ * @throws CoreException
+ */
+ public void requireRunAsRoot() throws CoreException;
+
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocolType.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocolType.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocolType.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Aug 7, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+
+/**
+ * Implementor of the interface is supposed to provide one type of remote logic connection.
+ * It will provide concrete instances of the remote connection type upon request of client.
+ *
+ * @author LWang
+ *
+ */
+public interface ILaunchProtocolType {
+ /**
+ * Get ID of the remote connection type.
+ * @return
+ */
+ public String getID();
+
+ /**
+ * Get name of the remote connection type, e.g. SSH or SBRSH.
+ * @return
+ */
+ public String getName();
+
+ public String getDescription();
+
+ /**
+ * Get a concrete instance of this protocol type based on given launch
+ * configuration. Create a new one if no one exists yet.
+ *
+ * @param configuration
+ * @return
+ * @throws CoreException
+ */
+ public ILaunchProtocol getLaunchProtocol(ILaunchConfiguration configuration) throws CoreException;
+
+ /**
+ * Initializes the given launch configuration with
+ * default values for this launch protocol type.
+ *
+ * @param configuration
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration);
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchConfigurationData.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchConfigurationData.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchConfigurationData.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.launch;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class LaunchConfigurationData {
+
+ /**
+ * Check if the launch configuration is applicable to the given SDKTarget.
+ *
+ * @param configuration
+ * @param sdkTarget
+ * @return - true if SDK matches and SDKTarget architecture matches. false otherwise.
+ */
+ public static boolean isLaunchConfigurationApplicable(ILaunchConfiguration configuration, ISDKTarget sdkTarget) {
+ if (sdkTarget == null)
+ return false;
+
+ String sdkName;
+ String sdkTargetName;
+ try {
+ sdkName = configuration.getAttribute(IESboxLaunchConfigurationConstants.ATTR_SDK_NAME, "");
+ sdkTargetName = configuration.getAttribute(IESboxLaunchConfigurationConstants.ATTR_SDK_TARGET_NAME, "");
+ } catch (CoreException e) {
+ return false;
+ }
+
+ ISDK sdk = sdkTarget.getSDK();
+ if (! sdkName.equals(getUniqueSDKName(sdk)))
+ return false;
+
+ // Now SDK matches.
+ // check if architecture of the targets match.
+ //
+ if (! sdkTargetName.equals(sdkTarget.getName())) {
+ ISDKTarget[] targets = sdk.getSDKTargets();
+ boolean found = false;
+ for (ISDKTarget t : targets) {
+ if (t.getName().equals(sdkTargetName)) {
+ found = true;
+
+ if (! t.getArchitecture().equals(sdkTarget.getArchitecture()))
+ return false;
+ }
+ }
+
+ if (! found) // the target no longer exists !
+ return false;
+
+ return false;
+ }
+
+ return true;
+ }
+
+ public static String getUniqueSDKName(ISDK sdk) {
+ // The ISDK.getName() returns "scratchbox" for both Sbox1 and Sbox2. Thus this method.
+ //
+ return sdk.toString(); // refer to BaseSDK.toString().
+ }
+
+ /**
+ * Get the folder that contains most user projects. Note this is not
+ * supposed to get the real "common" parent as there is no way we can know
+ * where user will put his next new project. So this is just to do best
+ * guess.
+ *
+ * We assume the parent folder of the project to be the place where user put
+ * most of his projects, which is usually true in practice.
+ *
+ * @param configuration
+ * @return the path (host side)
+ */
+ public static String getProjectCommonParentFolder(IProject proj) {
+ String projectCommonParent = "";
+
+ if (proj != null) {
+ projectCommonParent = proj.getLocation().removeLastSegments(1).toPortableString();
+ }
+
+ return projectCommonParent;
+ }
+
+ /**
+ * Get the common parent folder that contains most user projects.
+ * @see LaunchConfigurationData#getProjectCommonParentFolder(IProject)
+ * @param configuration
+ * @return the path (host side)
+ */
+ public static String getProjectCommonParentFolder(ILaunchConfiguration configuration) {
+
+ IProject proj = null;
+ try {
+ proj = ESboxLaunchUtils.getProject(configuration);
+ } catch (CoreException e) {
+ // no project linked to this launch config yet.
+ }
+
+ return getProjectCommonParentFolder(proj);
+ }
+
+ /**
+ * Create SBRSH configuration file name for auto SBRSH configuration.
+ *
+ * @param configuration
+ * @return IPath
+ */
+ public static IPath getAutoSBRSHConfigurationFileName(ILaunchConfiguration configuration) {
+ String configFileName = "_esbox_" + configuration.getName() + ".sbrsh"; //$NON-NLS-1$
+
+ // Just put in /tmp.
+ // Putting it in project folder may cause unnecessary rebuild of the project as the file
+ // is re-generated on every launch...04/01/08
+ IPath path = new Path("/tmp");
+
+ return path.append(configFileName);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchProtocolFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchProtocolFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchProtocolFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Aug 7, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.internal.launch.Activator;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Factory for handling launch protocol extension.
+ *
+ * @author LWang
+ *
+ */
+public class LaunchProtocolFactory {
+
+ // These are from org.indt.exbox.debug/plugin.xml file.
+ // !!! Make sure they are in sync with the xml file. !!!
+ //
+ private static final String EXTENSION_ID = Activator.PLUGIN_ID + ".LaunchProtocolType";
+ private static final String DEFAULT_LAUNCH_PROTOCOL_NAME = "SSH";
+
+ public static final String ATTR_ID = "id";
+ public static final String ATTR_NAME = "name";
+ public static final String ATTR_DESCRIPTION = "description";
+ public static final String ATTR_CLASS = "class";
+
+ /* singleton instance */
+ private static LaunchProtocolFactory singleton = null;
+
+ /* This should be a short list */
+ private List<ILaunchProtocolType> pool;
+
+ /**
+ * Private constructor.
+ */
+ private LaunchProtocolFactory() {
+ pool = new ArrayList<ILaunchProtocolType>();
+
+ collectExtensions();
+ }
+
+ /**
+ * Get the singleton instance of this factory.
+ * @return
+ */
+ public static synchronized LaunchProtocolFactory getInstance() {
+ if (singleton == null)
+ singleton = new LaunchProtocolFactory();
+ return singleton;
+ }
+
+ /**
+ * Collect and initialize implementors of the RemoteLogicConnection
+ * extension points.
+ */
+ private void collectExtensions() {
+
+ ErrorLogger logger = Activator.getErrorLogger();
+
+ IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_ID);
+ if (extPoint == null) {
+ logger.logError("Failed to get extension point " + EXTENSION_ID, null);
+ return;
+ }
+
+ IExtension[] extensions = extPoint.getExtensions();
+
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+
+ String id = config.getAttribute(ATTR_ID);
+
+ try {
+ ILaunchProtocolType implementor =
+ (ILaunchProtocolType) config.createExecutableExtension(ATTR_CLASS);
+ pool.add(implementor);
+ } catch (Exception e) {
+ String msg = MessageFormat.format(
+ "Failed to load extension ''{0}'' for extension point {1}.",
+ id, EXTENSION_ID);
+ logger.logError(msg, e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Get all the ILaunchProtocolType extensions in the Eclipse installation.
+ *
+ * @return list, never null
+ */
+ public List<ILaunchProtocolType> getAllProtocolTypes() {
+ return pool;
+ }
+
+ public String[] getAllProtocolTypeNames() {
+ String[] names = new String[pool.size()];
+ int i = 0;
+ for (ILaunchProtocolType t : pool)
+ names[i++] = t.getName();
+
+ return names;
+ }
+
+ /**
+ * This is the default remote connection type that we'll give to a new launch configuration.
+ *
+ * @return
+ */
+ public String getDefaultProtocolName() {
+ return DEFAULT_LAUNCH_PROTOCOL_NAME;
+ }
+
+ /**
+ * TODO: This is a tmp method to accomodate existing code. Will remove soon
+ * as client should not need to do this check. Any protocol specific
+ * handling should be done by either the protocol extension or protocol page
+ * extension.
+ *
+ * @param name
+ * @return
+ */
+ public static boolean isSSHProtocol(String name) {
+ // Use "contains()" instead of "equals()" to accommodate "name"
+ // from ESbox 1.4.1 launch configuration so that
+ // existing old launch configurations will still work.
+ return name.contains("SSH");
+ }
+ /**
+ * TODO: remove soon.
+ * @param name
+ * @return
+ */
+ public static boolean isSBRSHProtocol(String name) {
+ // Use "contains()" instead of "equals()" to accommodate "name"
+ // from ESbox 1.4.1 launch configuration so that
+ // existing old launch configurations will still work.
+ return name.contains("SBRSH");
+ }
+
+ /**
+ * Get the launch protocol type identified by given name.
+ *
+ * @param name
+ * @return null if not found in current Eclipse installation.
+ */
+ public ILaunchProtocolType getLaunchProtocolType(String name) {
+ // HACK, accommodate "name" from ESbox 1.4.1 launch configuration so that
+ // existing old launch configurations will still work.
+ //
+ String V141_DOWNLOAD_METHOD_SSHCOPY = "Copy via SSH";
+ String V141_DOWNLOAD_METHOD_SBRSHMOUNT = "Mount via SBRSH";
+ if (name.equals(V141_DOWNLOAD_METHOD_SSHCOPY))
+ name = "SSH";
+ else if (name.equals(V141_DOWNLOAD_METHOD_SBRSHMOUNT))
+ name = "SBRSH";
+
+ for (ILaunchProtocolType t : pool) {
+ if (t.getName().equals(name))
+ return t;
+ }
+
+ return null;
+ }
+
+ /**
+ * Get the launch protocol type by given ID.
+ *
+ * @param name
+ * @return null if not found in current Eclipse installation.
+ */
+ public ILaunchProtocolType getLaunchProtocolTypeByID(String id) {
+ for (ILaunchProtocolType t : pool) {
+ if (t.getID().equals(id))
+ return t;
+ }
+
+ return null;
+ }
+
+ /**
+ * Get launch protocol instance based on user selection in the given
+ * launch configuration.
+ *
+ * @param configuration
+ * @return ILaunchProtocolType
+ * @throws CoreException
+ */
+ public ILaunchProtocol getLaunchProtocol(ILaunchConfiguration configuration) throws CoreException
+ {
+ ILaunchProtocolType type = null;
+ String msg;
+
+ String typeName = null;
+ try {
+ typeName = configuration.getAttribute(
+ IESboxCDTLaunchConfigurationConstants.ATTR_DOWNLOAD_METHOD,
+ "");
+ } catch (CoreException e) {
+ msg = MessageFormat.format(
+ "Cannot get launch protocol for launch configuration ''{0}''.",
+ configuration.getName());
+ Activator.getErrorLogger().logError(msg, e);
+ throw new CoreException(Activator.createErrorStatus(msg, e));
+ }
+
+ type = getLaunchProtocolType(typeName);
+ if (type == null) {
+ msg = MessageFormat.format(
+ "Cannot get remote logic connection with name ''{0}'' for launch configuration ''{1}''.",
+ typeName,
+ configuration.getName());
+ Activator.getErrorLogger().logError(msg, null);
+ throw new CoreException(Activator.createErrorStatus(msg, null));
+ }
+
+ return type.getLaunchProtocol(configuration);
+ }
+
+ /**
+ * Initialize the given launch configuration with defaults related to
+ * launch protocol (aka download-method).
+ *
+ * @param configuration
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // default download method
+ configuration.setAttribute(IESboxLaunchConfigurationConstants.ATTR_DOWNLOAD_METHOD,
+ getDefaultProtocolName());
+
+ // Launch protocol specific defaults, decided by each extension implementor.
+ for (ILaunchProtocolType t : pool) {
+ t.setDefaults(configuration);
+ }
+ }
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/adapters/IGdbServerSupportAdapter.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/adapters/IGdbServerSupportAdapter.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/adapters/IGdbServerSupportAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.launch.adapters;
+
+/**
+ * This adapter on an ISDKTarget provides the patterns for invoking gdbserver on a target.
+ * <p>
+ * The existence of the adapter means there is (probably) a custom GDB server pattern.
+ * @author eswartz
+ *
+ */
+public interface IGdbServerSupportAdapter {
+ /**
+ * Get the command pattern to launch gdbserver with the given executable
+ * @return String in the form <gdbserver> ${IP}:${PORT} (where IP or PORT are optional)
+ */
+ String getGDBServerCommandPattern();
+
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/adapters/IRunStandaloneAdapter.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/adapters/IRunStandaloneAdapter.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/adapters/IRunStandaloneAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.launch.adapters;
+
+import org.maemo.esbox.core.process.ProcessLauncherParameters;
+
+/**
+ * This adapter may be queried on ISDKTarget in order to see if it supports
+ * the concept of "standalone launches".
+ * <p>
+ * If this adapter is found, then launch configurations, etc. should enable UI
+ * which allows the user to choose whether to run programs standalone versus
+ * some other method (as a boolean). Then, process launcher parameters should be filtered
+ * through {@link #updateLaunch(ProcessLauncherParameters, boolean)} for either
+ * value of the setting.
+ * <p>
+ * In maemo, this implies the use of a helper script to run programs which are
+ * not installed, though the actual way a program is launched in this mode is up
+ * to the implementation.
+ * @author eswartz
+ *
+ */
+public interface IRunStandaloneAdapter {
+ /**
+ * Get the text of a label which can be used, e.g., in launch configurations
+ * to describe this feature.
+ * @return String
+ */
+ String getLabelText();
+
+ /**
+ * Get the text of a tooltip which can be used in UI to describe what this feature
+ * means.
+ * @return String
+ */
+ String getTooltipText();
+
+ /**
+ * Get the default recommended value for this setting.
+ * @return boolean
+ */
+ boolean getDefault();
+
+ /**
+ * Convert a launch to use run standalone support.
+ * @param parameters the command line arguments, environment, and current directory, updated when
+ * this feature is enabled
+ * @param isRunStandalone whether the feature is enabled
+ */
+ void updateLaunch(ProcessLauncherParameters parameters, boolean isRunStandalone);
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLaunchParameterAccessor.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLaunchParameterAccessor.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLaunchParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. July 27, 2008
+ *******************************************************************************/
+package org.maemo.esbox.launch.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+import java.util.Map;
+
+/**
+ * @author LWang
+ *
+ */
+public abstract class AbstractLaunchParameterAccessor
+ implements ILaunchParameterAccessor {
+
+ private ILaunchConfiguration fLaunchConfiguration;
+ private IProject fProject;
+
+ public AbstractLaunchParameterAccessor(
+ ILaunchConfiguration launchConfiguration) {
+ super();
+ fLaunchConfiguration = launchConfiguration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.ILaunchParameterAccessor#getProject()
+ */
+ public IProject getProject() throws CoreException {
+ if (fProject == null) {
+ String projectName = getProjectName(getLaunchConfiguration());
+ if (projectName != null) {
+ projectName = projectName.trim();
+ if (projectName.length() > 0) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project != null && project.exists()) {
+ fProject = project;
+ }
+ }
+ }
+ }
+ return fProject;
+ }
+
+ public ILaunchConfiguration getLaunchConfiguration() {
+ return fLaunchConfiguration;
+ }
+
+ protected CoreException newCoreException(String mesg) {
+ return newCoreException(mesg, null);
+ }
+
+ protected CoreException newCoreException(String mesg, Exception e) {
+ return new CoreException(new Status(IStatus.ERROR,
+ getPluginID(),
+ 0,
+ mesg,
+ e));
+ }
+
+ /**
+ * Implementation is launch type dependent.
+ *
+ * @param launchConfiguration
+ * @return
+ * @throws CoreException
+ */
+ abstract protected String getProjectName(ILaunchConfiguration launchConfiguration) throws CoreException;
+
+ /**
+ * This is the plugin ID to be used in CoreException thrown from this class family.
+ * @return
+ */
+ abstract protected String getPluginID();
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.ILaunchParameterAccessor#getHostToTargetSourceMappings()
+ */
+ public Map<IPath, IPath> getHostToTargetSourceMappings() {
+ // the default implementation
+ return null;
+ }
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLaunchProxy.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLaunchProxy.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLaunchProxy.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. July 24, 2008
+ *******************************************************************************/
+package org.maemo.esbox.launch.core;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+import java.text.DateFormat;
+import java.text.MessageFormat;
+import java.util.*;
+
+/**
+ * Base launch proxy that handles common tasks for all ESbox launch delegates,
+ * including those for CPP CDI, CPP DSF, Python and any future stuff.<br>
+ *
+ * @author LWang.
+ */
+public abstract class AbstractLaunchProxy implements ILaunchProxy {
+
+ private ILaunchConfiguration fLaunchConfiguration;
+
+ public AbstractLaunchProxy(ILaunchConfiguration launchConfiguration) {
+ super();
+ fLaunchConfiguration = launchConfiguration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.ILaunchProxy#getLaunchConfiguration()
+ */
+ public ILaunchConfiguration getLaunchConfiguration() {
+ return fLaunchConfiguration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.ILaunchProxy#runApplication(org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void runApplication(ILaunch launch, IProgressMonitor monitor) throws CoreException {
+
+ monitor.beginTask("", 100);
+
+ Process process = doRunApplication(new SubProgressMonitor(monitor, 90));
+
+ if (process != null) {
+ IPath exePath = getLaunchParameterAccessor().getProgramPathInRuntimeFileSystem();
+
+ /*
+ * Keep the "launch" in Debug View and add the process to the "launch".
+ * Advantage: user has a visual clue in IDE that a program is running on device.
+ */
+ DebugPlugin.newProcess(launch, process, renderProcessLabel(exePath.toPortableString()));
+
+ monitor.done();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.ILaunchProxy#preLaunchCheck(java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public boolean preLaunchCheck(String mode, IProgressMonitor monitor) throws CoreException {
+
+ return ESboxLaunchUtils.preLaunchCheck(fLaunchConfiguration, mode);
+ }
+
+ /**
+ * Carry out "run" by using ProcessLauncherParameters. Subclass can override to do its own way of run.
+ *
+ * @return Process from the "run".
+ * @throws CoreException on error.
+ */
+ protected Process doRunApplication(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("", 5);
+
+ ProcessLauncherParameters rInfo = createProgramLauncherParameters();
+ monitor.worked(1);
+
+ updateForRunStandalone(rInfo);
+ monitor.worked(1);
+
+ Process process = doRun(rInfo);
+ monitor.worked(3);
+
+ return process;
+ }
+
+ /**
+ * Create label in the Debug View for the process from the given command line.
+ *
+ * @param commandLine
+ * @return
+ */
+ protected String renderProcessLabel(String commandLine) {
+ String format = "{0} ({1})"; //$NON-NLS-1$
+ String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));
+ return MessageFormat.format(format, new Object[]{commandLine, timestamp});
+ }
+
+ protected CoreException newCoreException(String mesg) {
+ return newCoreException(mesg, null);
+ }
+
+ protected CoreException newCoreException(String mesg, Exception e) {
+ return new CoreException(new Status(IStatus.ERROR,
+ getPluginID(),
+ 0,
+ mesg,
+ e));
+ }
+
+ /**
+ * Throws a core exception with an error status object built from the given
+ * message, lower level exception, and error code.
+ *
+ * @param message
+ * the status message
+ * @param exception
+ * lower level exception associated with the error, or
+ * <code>null</code> if none
+ * @param code
+ * error code
+ */
+ protected void abort(String message, Throwable exception, int code) throws CoreException {
+ IStatus status;
+ if (exception != null) {
+ MultiStatus multiStatus = new MultiStatus(getPluginID(), code, message, exception);
+ multiStatus.add(new Status(IStatus.ERROR, getPluginID(), code, exception.getLocalizedMessage(), exception));
+ status= multiStatus;
+ } else {
+ status= new Status(IStatus.ERROR, getPluginID(), code, message, null);
+ }
+ throw new CoreException(status);
+ }
+
+ protected void cancel(String message, int code) throws CoreException {
+ throw new CoreException(new Status(IStatus.OK, getPluginID(), code, message, null));
+ }
+
+ protected void updateForRunStandalone(ProcessLauncherParameters info) throws CoreException {
+ ISDKTarget sdkTarget = ((IESboxLaunchParameterAccessor)getLaunchParameterAccessor()).getSDKTarget();
+ ESboxLaunchUtils.updateForRunStandalone(sdkTarget, fLaunchConfiguration,
+ IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE, info);
+ }
+
+ /**
+ * Create ProcessLauncherParameters that records how to run the program (the working
+ * directory in runtime file system, environment vars, command line with arguments
+ * in runtime file system, etc) of the underlying launch configuration.<br>
+ * <br>
+ * This is independent of whether to launch the process locally or remotely.
+ *
+ * @return new ProcessLauncherParameters
+ * @throws CoreException
+ */
+ public ProcessRunnerParameters createProgramLauncherParameters() throws CoreException {
+ IPath exeInSb = getLaunchParameterAccessor().getProgramPathInRuntimeFileSystem();
+ Properties env = getLaunchParameterAccessor().getEnvironmentAsProperty();
+ String arguments[] = getLaunchParameterAccessor().getProgramArguments();
+
+ IPath wdInSb = getLaunchParameterAccessor().getWorkingDirectory();
+
+ List<String> cmdLine = CommandLineArguments.createFromArray(arguments);
+ cmdLine.add(0, exeInSb.toPortableString());
+
+ ProcessRunnerParameters parameters = new ProcessRunnerParameters(wdInSb, cmdLine, env);
+
+ return parameters;
+ }
+
+ abstract protected Process doRun(ProcessLauncherParameters info) throws CoreException;
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLocalLaunchProxy.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLocalLaunchProxy.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractLocalLaunchProxy.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. July 24, 2008
+ *******************************************************************************/
+package org.maemo.esbox.launch.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+
+/**
+ * Abstract launch proxy for local launch of ESbox project (CPP, Python, Valgrind, etc).
+ *
+ * @author LWang.
+ */
+abstract public class AbstractLocalLaunchProxy extends AbstractLaunchProxy {
+
+ /**
+ * @param config
+ * @throws CoreException - e.g. the underlying project is not ESbox project.
+ */
+ public AbstractLocalLaunchProxy(ILaunchConfiguration config) throws CoreException {
+ super(config);
+ }
+
+ public boolean finalLaunchCheck(String mode, IProgressMonitor monitor) throws CoreException {
+
+ // This should be done after the pre-launch build.
+ return ESboxLaunchUtils.validateLocalConnection(getLaunchConfiguration());
+ }
+
+ protected Process doRun(ProcessLauncherParameters info) throws CoreException {
+ try {
+ IESboxLaunchParameterAccessor eLPA = (IESboxLaunchParameterAccessor)getLaunchParameterAccessor();
+
+ return ProcessRunnerCreator.createAndLaunchProcess(
+ eLPA.getSDKTarget(), info);
+ } catch (ESboxException e) {
+ String msg = "Failed to run program: " +
+ CommandLineArguments.toCommandLine(info.getCommandLine());
+ throw newCoreException(msg, e);
+ }
+ }
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractRemoteLaunchProxy.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractRemoteLaunchProxy.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/AbstractRemoteLaunchProxy.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. July 24, 2008
+ *******************************************************************************/
+package org.maemo.esbox.launch.core;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.ILaunchProtocol;
+
+/**
+ * Abstract launch proxy for remote launch of ESbox project (CPP, Python, etc).
+ *
+ * @author LWang.
+ */
+abstract public class AbstractRemoteLaunchProxy extends AbstractLaunchProxy {
+
+ /**
+ * @param config
+ * @throws CoreException - e.g. the underlying project is not ESbox project.
+ */
+ public AbstractRemoteLaunchProxy(ILaunchConfiguration config) throws CoreException {
+ super(config);
+ }
+
+ public boolean finalLaunchCheck(String mode, IProgressMonitor monitor) throws CoreException {
+
+ // This should be done after the pre-launch build.
+ IRemoteLaunchParameterAccessor lpa = (IRemoteLaunchParameterAccessor)getLaunchParameterAccessor();
+ return ESboxLaunchUtils.validateRemoteConnection(lpa.getLaunchProtocol());
+ }
+
+ // Special for remote run: downloading files.
+ @Override
+ protected Process doRunApplication(IProgressMonitor monitor)
+ throws CoreException {
+
+ monitor.beginTask("", 100);
+
+ monitor.subTask("Downloading files");
+ downloadFiles(new SubProgressMonitor(monitor, 80));
+
+ monitor.subTask("Launching process");
+ return super.doRunApplication(new SubProgressMonitor(monitor, 20));
+ }
+
+ protected Process doRun(ProcessLauncherParameters info) throws CoreException {
+ try {
+ IRemoteLaunchParameterAccessor lpa = (IRemoteLaunchParameterAccessor)getLaunchParameterAccessor();
+
+ // Launch the process on the DeviceMachine.
+ return ProcessRunnerCreator.createAndLaunchProcess(
+ lpa.getLaunchProtocol().getDeviceMachine().getProcessLauncherFactory(),
+ lpa.getSDKTarget(),
+ info);
+ } catch (ESboxException e) {
+ String msg = "Failed to run program: " +
+ CommandLineArguments.toCommandLine(info.getCommandLine());
+ throw newCoreException(msg, e);
+ }
+ }
+
+ public void downloadFiles(IProgressMonitor monitor) throws CoreException {
+ IRemoteLaunchParameterAccessor lpa = (IRemoteLaunchParameterAccessor)getLaunchParameterAccessor();
+
+ // Get connection for download.
+ ILaunchProtocol protocol = lpa.getLaunchProtocol();
+
+ IStatus status = protocol.downloadFiles(monitor);
+ if (!status.isOK())
+ throw new CoreException(status);
+ }
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IESboxLaunchParameterAccessor.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IESboxLaunchParameterAccessor.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IESboxLaunchParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Aug 1, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch.core;
+
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * ESbox specific parameters related with underlying launch configuration.
+ *
+ * @author LWang
+ *
+ */
+public interface IESboxLaunchParameterAccessor extends ILaunchParameterAccessor {
+ public ISDKTarget getSDKTarget();
+
+ /**
+ * Get the machine on which the launch occurs
+ * XXX: need to be able to wrap a ISDKTarget around a machine, so we don't need two checks every time
+ * @return IMachine a local/build machine for a local launch or a device machine for a remote launch
+ */
+ public IMachine getMachine();
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IGDBParameterAccessor.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IGDBParameterAccessor.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IGDBParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jun 19, 2008
+ *******************************************************************************/
+package org.maemo.esbox.launch.core;
+
+import org.eclipse.core.runtime.CoreException;
+
+import java.util.List;
+
+/**
+ * Interface that launches GDB and manage all parameters/options related to
+ * launching and configuring GDB. <br>
+ * <br>
+ * The base implementation {@link BaseGDBLaunchManager} should be sufficient for most
+ * clients. If you have special needs, you are recommended to subclass the base
+ * implementation. <br>
+ * <br>
+ * Example #1: GDB is usually launched on the host machine where Eclipse is
+ * running, but it can also be launched on a remote machine through, say, SSH. <br>
+ * Example #2: GDB is usually launched in the host file system, but it can also
+ * be launched in a chroot'ed file system such as Scratchbox (see
+ * http://www.scratchbox.org)<br>
+ *
+ * @author LWang
+ */
+public interface IGDBParameterAccessor extends ILaunchParameterAccessor {
+
+ /**
+ * This is to launch GDB process. <br>
+ * Note #1: This should just launch the process without occupying its
+ * InputStream and OutputStream, as those streams will be used by DSF.<br>
+ *
+ * @return Process - the Process representation of the underlying GDB
+ * process.
+ * @throws CoreException - throw {@link CoreException} on error.
+ */
+ Process launchGDB() throws CoreException;
+
+ /**
+ * Return the command line that is used to launch GDB.
+ *
+ * @return
+ */
+ public List<String> getGDBCommandLine();
+
+ /**
+ * Get init file for GDB.
+ *
+ * @return file name, may have relative or absolute path, or empty string
+ * ("") indicating an init file is not specified.
+ * @throws CoreException
+ * - error in getting the option.
+ */
+ public String getGDBInitFile() throws CoreException;
+
+ /**
+ * Whether to auto load shared library.
+ *
+ * @return
+ * @throws CoreException
+ * - error in getting the option.
+ */
+ public boolean autoLoadSharedLibrary() throws CoreException;
+
+ /**
+ * @throws CoreException
+ * - error in getting the option.
+ */
+ public List<String> getSharedLibraryPaths() throws CoreException;
+
+ /**
+ * Get paths for source lookup. But source containers can change (e.g. added
+ * by user) during a debug session and must be honored, so is it good to
+ * have the static conversion here ?
+ *
+ * @return
+ * @throws CoreException
+ */
+// public List<String> getsourceLookupPaths() throws CoreException;
+
+ /**
+ * Check if debugger connection is TCP/IP
+ */
+ public boolean debuggerConnectionIsTCP() throws CoreException;
+
+ /**
+ * Get the address of the remote device to connect to
+ * @return IP address or hostname
+ * @throws CoreException
+ */
+ public String getTargetIPAddress() throws CoreException;
+
+ /**
+ * Get the port of the remote device to connect to
+ * @return port
+ * @throws CoreException
+ */
+ public int getTargetIPPort() throws CoreException;
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/ILaunchParameterAccessor.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/ILaunchParameterAccessor.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/ILaunchParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. July 27, 2008
+ *******************************************************************************/
+package org.maemo.esbox.launch.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+import java.util.Properties;
+
+/**
+ * Interface for accessing parameters/options related to run and debug. The parameters here
+ * are mostly but not necessarily from a launch configuration. <br>
+ * <br>
+ *
+ * @author LWang
+ */
+public interface ILaunchParameterAccessor {
+
+ /**
+ * Get project associated with the launch.
+ *
+ * @return IProject, may be null.
+ * @throws CoreException
+ */
+ public IProject getProject() throws CoreException;
+
+ /**
+ * Get underlying launch configuration.
+ * @return
+ */
+ public ILaunchConfiguration getLaunchConfiguration();
+
+ /**
+ * Get path of the main debugged program file (e.g. exe file for CPP or module
+ * file for Python) in the host (eclipse machine) file system. <br>
+ * This is the program path specified by user in the launch configuraiton UI.
+ *
+ * @return IPath - non-null path.
+ * @throws CoreException - if any error occurs, e.g. program not specified by user.
+ */
+ public IPath getProgramPathInHostFileSystem() throws CoreException;
+
+ /**
+ * Get path of the main debugged program file (e.g. exe file for CPP or module
+ * file for Python) in the file system where it's built. <br>
+ * It's often the same as its path in host (Eclipse machine) file system. But it
+ * can be different, for instance, it is path in Scratchbox1 file system for
+ * Scratchbox1 project.
+ *
+ * @return IPath - non-null path.
+ * @throws CoreException - if any error occurs, e.g. program not specified by user.
+ */
+ public IPath getProgramPathInBuildtimeFileSystem() throws CoreException;
+
+ /**
+ * Get path of the debugged program file (e.g. exe file for CPP or module
+ * file for Python) in the runtime file system. <br>
+ * For instance, it is in Scratchbox1 file system for Scratchbox1 local debug,
+ * and it is path on remote device for remote debug.
+ *
+ * @return IPath - non-null path.
+ * @throws CoreException - if any error occurs, e.g. program not specified by user.
+ */
+ public IPath getProgramPathInRuntimeFileSystem() throws CoreException;
+
+ /**
+ * get arguments for the debugged program.
+ *
+ * @return String
+ * @throws CoreException
+ * - error in getting the option.
+ */
+ public String[] getProgramArguments() throws CoreException;
+
+ /**
+ * Get working directory for the debugged program from user. This is
+ * the value from the launch configuration. For local debug, it should be
+ * a path in Eclipse machine. For remote debug, it should be a path on
+ * remote target device/machine.
+ *
+ * @return IPath - path, or null of user does not specify one in UI.
+ * @throws CoreException
+ * - on errors. e.g. invalid directory from user, non-existent directory.
+ */
+ public IPath getWorkingDirectoryFromUser() throws CoreException;
+
+ /**
+ * Offer default working directory for the underlying launch configuration.
+ * The default working directory is launch configuration type specific.<br>
+ * <br>
+ * Note: For local launch, the path returned should be in host (eclipse machine)
+ * file system, namely it's not converted. For remote debug, it should be a
+ * path on remote device. <br>
+ *
+ * @return a non-null path
+ * @throws CoreException - if no default can be determined.
+ */
+ public IPath getDefaultWorkingDirectory() throws CoreException;
+
+ /**
+ * Get working directory for the debugged program. The working directory is usually
+ * specified by user. Otherwise the default, which is implementation specific,
+ * will be returned.<br>
+ * Note the path is a path in the runtime file system of the program. For instance,
+ * it should be in Scratchbox file system for ESbox local debug,
+ * and it should be path on remote device for remote debug.
+ *
+ * @return IPath - non-null path.
+ * @throws CoreException
+ * - on errors. e.g. invalid directory from user, non-existent directory,
+ * user does not specify one nor there is default.
+ */
+ public IPath getWorkingDirectory() throws CoreException;
+
+ public Properties getEnvironmentAsProperty() throws CoreException;
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/ILaunchProxy.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/ILaunchProxy.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/ILaunchProxy.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. July 29, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.process.ProcessRunnerParameters;
+
+/**
+ * launch proxy that handles ESbox specific launch related tasks.<br>
+ * The "launch proxy" is supposed to be called by different LauchDelegates to
+ * carry out ESbox specific tasks.
+ *
+ * @author LWang.
+ */
+public interface ILaunchProxy {
+
+ // Following API are match of those in {@link ILaunchConfigurationDelegate2}
+
+ public void runApplication(ILaunch launch, IProgressMonitor monitor)
+ throws CoreException;
+
+ public boolean preLaunchCheck(String mode, IProgressMonitor monitor)
+ throws CoreException;
+
+ public boolean finalLaunchCheck(String mode,
+ IProgressMonitor monitor) throws CoreException;
+
+ // Following are auxiliary methods.
+
+ /**
+ * Get underlying launch configuration.
+ */
+ public ILaunchConfiguration getLaunchConfiguration();
+
+ /**
+ * get the launchParameterAccessor for the underlying LaunchConfiguration.
+ * @return
+ */
+ public ILaunchParameterAccessor getLaunchParameterAccessor();
+
+ /**
+ * ID of the plugin that carries out the launch.
+ * @return
+ */
+ public String getPluginID();
+
+ /**
+ * Create ProcessLauncherParameters that records how to run the program (the working
+ * directory in runtime file system, environment vars, command line with arguments
+ * in runtime file system, etc) of the underlying launch configuration.<br>
+ * <br>
+ * This is independent of whether to launch the process locally or remotely.
+ *
+ * @return
+ * @throws CoreException
+ */
+ public ProcessRunnerParameters createProgramLauncherParameters() throws CoreException;
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IRemoteLaunchParameterAccessor.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IRemoteLaunchParameterAccessor.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/core/IRemoteLaunchParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 31, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch.core;
+
+import org.maemo.esbox.launch.ILaunchProtocol;
+
+/**
+ * @author LWang
+ *
+ */
+public interface IRemoteLaunchParameterAccessor extends
+ IESboxLaunchParameterAccessor {
+
+ public ILaunchProtocol getLaunchProtocol();
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/AbstractLaunchProtocolPage.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/AbstractLaunchProtocolPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/AbstractLaunchProtocolPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Aug 12, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+
+import java.util.Observable;
+import java.util.Observer;
+
+/**
+ * Common methods for all LaunchProtocolPage.
+ *
+ * @author LWang
+ *
+ */
+public abstract class AbstractLaunchProtocolPage extends
+ AbstractLaunchConfigurationTab implements ILaunchProtocolPage, Observer, IExecutableExtension {
+
+ private String fLaunchProtocolID = null;
+ private boolean fIsInitializing;
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ui.ILaunchProtocolPage#getLaunchProtocolID()
+ */
+ public String getLaunchProtocolID() {
+ return fLaunchProtocolID;
+ }
+
+ // This is called when the extension instance is loaded.
+ public void setInitializationData(IConfigurationElement config,
+ String propertyName, Object data) throws CoreException {
+
+ fLaunchProtocolID = config.getAttribute(LaunchProtocolPageFactory.ATTR_PROTOCOL_ID);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ui.ILaunchProtocolPage#init(java.lang.String)
+ */
+ public void init(String launchProtocolID) {
+ fLaunchProtocolID = launchProtocolID;
+ }
+
+ public void update(Observable arg0, Object arg1) {
+ if (! isInitializing()) {
+ updateLaunchConfigurationDialog();
+ }
+ }
+
+ protected boolean isInitializing() {
+ return fIsInitializing;
+ }
+
+ protected void setInitializing( boolean isInitializing ) {
+ fIsInitializing = isInitializing;
+ }
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/DownloadMethodSelectionDialog.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/DownloadMethodSelectionDialog.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/DownloadMethodSelectionDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Apr 4, 2008
+ *******************************************************************************/
+package org.maemo.esbox.launch.ui;
+
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ListDialog;
+import org.maemo.esbox.launch.*;
+
+import java.util.List;
+
+/**
+ * Dialog asking user to choose the download method for remote debug.
+ * The dialog has two parts. One part lists the options for user to select.
+ * The other part displays description for the current selected option.
+ *
+ * @author LWang.
+ */
+public class DownloadMethodSelectionDialog extends ListDialog {
+
+ // Ask user to choose download method.
+ String[] fMethods;
+
+ // Must match the order of the above array element.
+ String[] fMethodDescription;
+
+ /**
+ * The list of input for the dialog
+ */
+ private Text fDescriptionText = null;
+
+ ILabelProvider provider = new LabelProvider() {
+ /**
+ * The <code>LabelProvider</code> implementation of this
+ * <code>ILabelProvider</code> method returns the element's <code>toString</code>
+ * string. Subclasses may override.
+ */
+ public String getText(Object element) {
+ if (element == null) {
+ return ""; //$NON-NLS-1$
+ } else if (element instanceof String) {
+ return (String)element;
+ }
+ return element.toString();
+ }
+ };
+
+ /**
+ * Constructor
+ * @param input
+ * @param resource
+ * @param mode
+ */
+ public DownloadMethodSelectionDialog(Shell shell) {
+ super(shell);
+
+ List<ILaunchProtocolType> rConns = LaunchProtocolFactory.
+ getInstance().getAllProtocolTypes();
+
+ fMethods = new String[rConns.size()];
+ fMethodDescription = new String[rConns.size()];
+
+ for (int i=0; i < rConns.size(); i++) {
+ fMethods[i] = rConns.get(i).getName();
+ fMethodDescription[i] = rConns.get(i).getDescription();
+ }
+
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ setTitle("Download Method Selection");
+ setAddCancelButton(true);
+ setMessage("Please choose which download method to use:");
+ setLabelProvider(provider);
+ setContentProvider(new ArrayContentProvider());
+
+ setInput(fMethods);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Composite comp = (Composite) super.createContents(parent);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IESboxLaunchHelpContextID.DOWNLOAD_METHOD_SELECTION_DIALOG);
+ return comp;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#getInitialSize()
+ */
+ protected Point getInitialSize() {
+ return new Point(450, 550);
+ }
+
+ /**
+ * @see org.eclipse.ui.dialogs.ListDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ getOkButton().setEnabled(false);
+ getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ getOkButton().setEnabled(!event.getSelection().isEmpty());
+ }
+ });
+ }
+
+ /**
+ * @see org.eclipse.ui.dialogs.ListDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite container) {
+ Composite comp = (Composite) super.createDialogArea(container);
+
+ Group group = new Group(comp, SWT.NONE);
+ group.setLayout(new GridLayout(1, false));
+ group.setText("Description");
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 120;
+ group.setLayoutData(gd);
+
+ fDescriptionText = new Text(group, SWT.WRAP | SWT.READ_ONLY);
+ gd = new GridData(GridData.FILL_BOTH);
+ fDescriptionText.setLayoutData(gd);
+ fDescriptionText.setBackground(group.getBackground());
+ getTableViewer().getTable().addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {}
+ public void widgetSelected(SelectionEvent e) {
+ Object o = e.item.getData();
+ if(o instanceof String) {
+ int idx = 0;
+ while (idx < fMethods.length) {
+ if (fMethods[idx].equals(o))
+ break;
+ idx++;
+ }
+ String txt = fMethodDescription[idx];
+ fDescriptionText.setText(txt);
+ }
+ }
+ });
+ return comp;
+ }
+ }
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ESboxDownloadTab.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ESboxDownloadTab.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ESboxDownloadTab.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,348 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar 5, 2008
+ *******************************************************************************/
+package org.maemo.esbox.launch.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.internal.launch.Activator;
+import org.maemo.esbox.launch.*;
+
+import java.util.List;
+
+/**
+ * Tab for preferences that control what, where and how to download files to device.
+ *
+ * @author LWang.
+ *
+ */
+public class ESboxDownloadTab extends AbstractLaunchConfigurationTab {
+
+ private Combo fDownloadMethodCombo;
+ private Composite fDynamicArea;
+
+ private ILaunchProtocolPage fDynamicPage;
+
+ ErrorLogger fErrorLogger = Activator.getErrorLogger();
+
+ // A flag to prevent excessive operations (e.g. call to performApply())
+ // during initialization of the panel.
+ private boolean fIsInitializing = false;
+
+ private List<ILaunchProtocolType> fLaunchProtocolPool;
+
+ private ILaunchConfigurationWorkingCopy fLaunchConfigWC;
+ private ILaunchConfiguration fLaunchConfig;
+ private String fCurrLaunchProtocolID = null;
+
+ /**
+ * Creates composite control and sets the specified layout data.
+ *
+ * @param parent the parent of the new composite
+ * @param numColumns the number of columns for the new composite
+ * @param layoutMode - GridData modes that should be applied to this control
+ * @return the newly-created composite
+ */
+ public static Composite createCompositeEx(Composite parent, int numColumns, int layoutMode) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setFont(parent.getFont());
+
+ composite.setLayout(new GridLayout(numColumns, true));
+ composite.setLayoutData(new GridData(layoutMode));
+ return composite;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite comp = createCompositeEx( parent, 2, GridData.FILL_BOTH );
+ setControl( comp );
+
+ // Set help context ID.
+ Activator.getDefault().getWorkbench().getHelpSystem().
+ setHelp(getControl(), IESboxLaunchHelpContextID.LAUNCH_CONFIGURATION_DIALOG_DOWNLOAD_TAB);
+
+ GridLayout gd =(GridLayout)comp.getLayout();
+ gd.makeColumnsEqualWidth = false;
+ gd.marginHeight = 10;
+ gd.marginWidth = 10;
+
+ // Combo box for download method
+
+ Label label = new Label( comp, SWT.NONE );
+ label.setText( "Download Method:" );
+ fDownloadMethodCombo = new Combo( comp, SWT.READ_ONLY | SWT.DROP_DOWN );
+
+ // Display names of all ILaunchProtocolType extensions.
+
+ // Note we display the names in the order by which the corresponding connection types appear
+ // in the global pool, so that we can easily get the connection type
+ // based on selection index in the combo box.
+ fLaunchProtocolPool = LaunchProtocolFactory.getInstance().getAllProtocolTypes();
+ String[] connNames = new String[fLaunchProtocolPool.size()];
+ for (int i = 0 ; i < fLaunchProtocolPool.size(); i++)
+ connNames[i] = fLaunchProtocolPool.get(i).getName();
+
+ fDownloadMethodCombo.setItems( connNames );
+
+ fDownloadMethodCombo.addSelectionListener( new SelectionListener() {
+
+ public void widgetDefaultSelected( SelectionEvent e ) {
+ }
+
+ public void widgetSelected( SelectionEvent e ) {
+ dataChanged();
+ if (! isInitializing())
+ updateUI();
+ }
+ } );
+
+ createSeparator(comp, 2);
+
+ // Area that holds dynamic launch protocol page
+ //
+ fDynamicArea = new Composite(comp, SWT.NONE);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ gData.horizontalSpan = 2;
+ fDynamicArea.setLayoutData(gData);
+ GridLayout gLayout = new GridLayout();
+ gLayout.marginHeight = 0;
+ gLayout.marginWidth = 0;
+ gLayout.numColumns = 1;
+ fDynamicArea.setLayout(gLayout);
+ }
+
+
+ public ILaunchProtocolPage getDynamicPage() {
+ return fDynamicPage;
+ }
+
+
+ public void setDynamicPage(ILaunchProtocolPage dynamicPage) {
+ fDynamicPage = dynamicPage;
+ }
+
+ public Composite getDynamicArea() {
+ return fDynamicArea;
+ }
+
+
+ @Override
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ return getDynamicPage().isValid(launchConfig);
+ }
+
+ public void dataChanged() {
+ if (! isInitializing()) {
+ updateLaunchConfigurationDialog();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return "Download";
+ }
+
+ protected boolean isInitializing() {
+ return fIsInitializing;
+ }
+
+ private void setInitializing( boolean isInitializing ) {
+ fIsInitializing = isInitializing;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ setInitializing(true);
+
+ setLaunchConfiguration(configuration);
+
+ //---------- Download method ------------------
+
+ String downloadMethod = "";
+ try {
+ downloadMethod = configuration.getAttribute(
+ IESboxCDTLaunchConfigurationConstants.ATTR_DOWNLOAD_METHOD,
+ LaunchProtocolFactory.getInstance().getDefaultProtocolName());
+ } catch (CoreException e) {
+ fErrorLogger.logError("Failed to get download method from launch configuration", e);
+ }
+
+ for (int i = 0; i < fLaunchProtocolPool.size(); i++) {
+ // Use "contains()" instead of "equals()" to accommodate values from ESbox 1.4.1
+ // launch configurations..... 08/10/08
+ if (downloadMethod.contains(fLaunchProtocolPool.get(i).getName()))
+ {
+ fDownloadMethodCombo.select(i);
+
+ // Get corresponding launch protocol page.
+ ILaunchProtocolPage page = LaunchProtocolPageFactory.getInstance().getProtocolPage(fLaunchProtocolPool.get(i).getID());
+ setDynamicPage(page);
+ }
+ }
+
+ // Call this to decide dynamic page.
+ updateUI();
+
+ getDynamicPage().initializeFrom(configuration);
+
+ setInitializing(false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+
+ configuration.setAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_DOWNLOAD_METHOD,
+ fDownloadMethodCombo.getItem(fDownloadMethodCombo.getSelectionIndex()));
+
+ getDynamicPage().performApply(configuration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ /* all is done in
+ * @see ESboxRemoteRunLaunchConfigurationTabGroup#setDefaults(configuration).
+ */
+ setLaunchConfigurationWorkingCopy(configuration);
+
+ if (getDynamicPage() != null)
+ getDynamicPage().setDefaults(configuration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
+ super.activated(workingCopy);
+
+ // forces page to get focus so that help works without having to select some control first.
+ getControl().setFocus();
+
+ getDynamicPage().activated(workingCopy);
+ }
+
+ /**
+ * Overridden here so that any error message in the dynamic UI gets
+ * returned.
+ *
+ * @see ILaunchConfigurationTab#getErrorMessage()
+ */
+ public String getErrorMessage() {
+ ILaunchProtocolPage page = getDynamicPage();
+ if ( (super.getErrorMessage() != null) || (page == null)) {
+ return super.getErrorMessage();
+ }
+ return page.getErrorMessage();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getImage()
+ */
+ @Override
+ public Image getImage() {
+ return Activator.getImageDescriptor("icons/download.gif").createImage();
+ }
+
+ /**
+ * Change UI based on change of certain options.
+ */
+ private void updateUI() {
+ ILaunchProtocolType protocol =fLaunchProtocolPool.get(fDownloadMethodCombo.getSelectionIndex());
+ if (protocol == null) {
+ // should not happen
+ Activator.getErrorLogger().logError("Download method selection is not valid.", null);
+ return;
+ }
+
+ String protocolID = protocol.getID();
+
+ if (! protocolID.equals(fCurrLaunchProtocolID)) {
+
+ fDownloadMethodCombo.setToolTipText(protocol.getDescription());
+
+ fCurrLaunchProtocolID = protocolID;
+
+ // Dispose of any current child widgets in the dynamic area
+ Control[] children = getDynamicArea().getChildren();
+ for (int i = 0; i < children.length; i++) {
+ children[i].dispose();
+ }
+
+ ILaunchProtocolPage page = LaunchProtocolPageFactory.getInstance().getProtocolPage(protocolID);
+ setDynamicPage(page);
+
+ // Ask the dynamic UI to create its Control
+ page.setLaunchConfigurationDialog(getLaunchConfigurationDialog());
+ page.createControl(getDynamicArea());
+ // Required
+ getDynamicArea().layout();
+ }
+
+ // initialize the newly created page with current working copy of launch configuration.
+ //
+ ILaunchConfigurationWorkingCopy wc = getLaunchConfigurationWorkingCopy();
+ if (wc == null) {
+ try {
+ if (getLaunchConfiguration().isWorkingCopy()) {
+ setLaunchConfigurationWorkingCopy((ILaunchConfigurationWorkingCopy)getLaunchConfiguration());
+ } else {
+ setLaunchConfigurationWorkingCopy(getLaunchConfiguration().getWorkingCopy());
+ }
+ wc = getLaunchConfigurationWorkingCopy();
+
+ } catch (CoreException e) {
+ return;
+ }
+ }
+// if (initDefaults()) {
+// page.setDefaults(wc);
+
+// setInitializeDefault(false);
+ getDynamicPage().initializeFrom(wc);
+ }
+
+ protected ILaunchConfigurationWorkingCopy getLaunchConfigurationWorkingCopy() {
+ return fLaunchConfigWC;
+ }
+
+ protected void setLaunchConfiguration(ILaunchConfiguration launchConfiguration) {
+ fLaunchConfig = launchConfiguration;
+ setLaunchConfigurationWorkingCopy(null);
+ }
+
+ protected ILaunchConfiguration getLaunchConfiguration() {
+ return fLaunchConfig;
+ }
+
+ protected void setLaunchConfigurationWorkingCopy(ILaunchConfigurationWorkingCopy workingCopy) {
+ fLaunchConfigWC = workingCopy;
+ }
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ILaunchProtocolPage.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ILaunchProtocolPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ILaunchProtocolPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Aug 12, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch.ui;
+
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+
+/**
+ * Interface for configuration UI page that's contributed via the "LaunchProtocolPage"
+ * extension points.
+ *
+ * @author LWang
+ *
+ */
+public interface ILaunchProtocolPage extends ILaunchConfigurationTab {
+
+ /**
+ * Returns the identifier of the launch protocol this page is associated with.
+ */
+ public String getLaunchProtocolID();
+
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/LaunchProtocolPageFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/LaunchProtocolPageFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/LaunchProtocolPageFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Aug 12, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch.ui;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.internal.launch.Activator;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Factory for handling launch protocol page extension.
+ *
+ * @author LWang
+ *
+ */
+public class LaunchProtocolPageFactory {
+
+ // These are from org.indt.exbox.launch/plugin.xml file.
+ // !!! Make sure they are in sync with the xml file. !!!
+ //
+ private static final String EXTENSION_ID = Activator.PLUGIN_ID + ".LaunchProtocolPage";
+
+ public static final String ATTR_PROTOCOL_ID = "launch_protocol_id";
+ public static final String ATTR_CLASS = "class";
+
+ /* singleton instance */
+ private static LaunchProtocolPageFactory singleton = null;
+
+ /* This should be a short list */
+ private List<ILaunchProtocolPage> pool;
+
+ /**
+ * Private constructor.
+ */
+ private LaunchProtocolPageFactory() {
+ pool = new ArrayList<ILaunchProtocolPage>();
+
+ collectExtensions();
+ }
+
+ /**
+ * Get the singleton instance of this factory.
+ * @return
+ */
+ public static synchronized LaunchProtocolPageFactory getInstance() {
+ if (singleton == null)
+ singleton = new LaunchProtocolPageFactory();
+ return singleton;
+ }
+
+ /**
+ * Collect and initialize implementors of the RemoteLogicConnection
+ * extension points.
+ */
+ private void collectExtensions() {
+
+ ErrorLogger logger = Activator.getErrorLogger();
+
+ IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_ID);
+ if (extPoint == null) {
+ logger.logError("Failed to get extension point " + EXTENSION_ID, null);
+ return;
+ }
+
+ IExtension[] extensions = extPoint.getExtensions();
+
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+
+ String id = null;
+
+ try {
+ id = config.getAttribute(ATTR_PROTOCOL_ID);
+ if (id == null)
+ throw new Exception(MessageFormat.format("Expected attribute {0} not found.", ATTR_PROTOCOL_ID));
+
+ ILaunchProtocolPage implementor =
+ (ILaunchProtocolPage) config.createExecutableExtension(ATTR_CLASS);
+ pool.add(implementor);
+ } catch (Exception e) {
+ String msg = MessageFormat.format(
+ "Failed to load extension ''{0}'' for extension point {1}.",
+ extension.getLabel(), EXTENSION_ID);
+ logger.logError(msg, e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Get all the ILaunchProtocolPage extensions in the Eclipse installation.
+ *
+ * @return list, never null
+ */
+ public List<ILaunchProtocolPage> getAllProtocolPages() {
+ return pool;
+ }
+
+ /**
+ * Get the launch protocol page identified by given protocol id.
+ *
+ * @param name
+ * @return null if not found in current Eclipse installation.
+ */
+ public ILaunchProtocolPage getProtocolPage(String protocolID) {
+ for (ILaunchProtocolPage t : pool) {
+ if (t.getLaunchProtocolID().equals(protocolID))
+ return t;
+ }
+
+ return null;
+ }
+}
Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/StatusInfo.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/StatusInfo.java (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/StatusInfo.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar, 2008
+ *******************************************************************************/
+package org.maemo.esbox.launch.ui;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.maemo.esbox.internal.launch.Activator;
+
+/**
+ * A settable IStatus.
+ * Can be an error, warning, info or ok. For error, info and warning states,
+ * a message describes the problem.
+ */
+public class StatusInfo implements IStatus {
+
+ public static final IStatus OK_STATUS= new StatusInfo();
+
+ private String fStatusMessage;
+ private int fSeverity;
+
+ /**
+ * Creates a status set to OK (no message)
+ */
+ public StatusInfo() {
+ this(OK, null);
+ }
+
+ /**
+ * Creates a status .
+ * @param severity The status severity: ERROR, WARNING, INFO and OK.
+ * @param message The message of the status. Applies only for ERROR,
+ * WARNING and INFO.
+ */
+ public StatusInfo(int severity, String message) {
+ fStatusMessage= message;
+ fSeverity= severity;
+ }
+
+ /**
+ * Returns if the status' severity is OK.
+ */
+ public boolean isOK() {
+ return fSeverity == IStatus.OK;
+ }
+
+ /**
+ * Returns if the status' severity is WARNING.
+ */
+ public boolean isWarning() {
+ return fSeverity == IStatus.WARNING;
+ }
+
+ /**
+ * Returns if the status' severity is INFO.
+ */
+ public boolean isInfo() {
+ return fSeverity == IStatus.INFO;
+ }
+
+ /**
+ * Returns if the status' severity is ERROR.
+ */
+ public boolean isError() {
+ return fSeverity == IStatus.ERROR;
+ }
+
+ /**
+ * @see IStatus#getMessage
+ */
+ public String getMessage() {
+ return fStatusMessage;
+ }
+
+ /**
+ * Sets the status to ERROR.
+ * @param errorMessage The error message (can be empty, but not null)
+ */
+ public void setError(String errorMessage) {
+ Assert.isNotNull(errorMessage);
+ fStatusMessage= errorMessage;
+ fSeverity= IStatus.ERROR;
+ }
+
+ /**
+ * Sets the status to WARNING.
+ * @param warningMessage The warning message (can be empty, but not null)
+ */
+ public void setWarning(String warningMessage) {
+ Assert.isNotNull(warningMessage);
+ fStatusMessage= warningMessage;
+ fSeverity= IStatus.WARNING;
+ }
+
+ /**
+ * Sets the status to INFO.
+ * @param infoMessage The info message (can be empty, but not null)
+ */
+ public void setInfo(String infoMessage) {
+ Assert.isNotNull(infoMessage);
+ fStatusMessage= infoMessage;
+ fSeverity= IStatus.INFO;
+ }
+
+ /**
+ * Sets the status to OK.
+ */
+ public void setOK() {
+ fStatusMessage= null;
+ fSeverity= IStatus.OK;
+ }
+
+ /*
+ * @see IStatus#matches(int)
+ */
+ public boolean matches(int severityMask) {
+ return (fSeverity & severityMask) != 0;
+ }
+
+ /**
+ * Returns always <code>false</code>.
+ * @see IStatus#isMultiStatus()
+ */
+ public boolean isMultiStatus() {
+ return false;
+ }
+
+ /*
+ * @see IStatus#getSeverity()
+ */
+ public int getSeverity() {
+ return fSeverity;
+ }
+
+ /*
+ * @see IStatus#getPlugin()
+ */
+ public String getPlugin() {
+ return Activator.PLUGIN_ID;
+ }
+
+ /**
+ * Returns always <code>null</code>.
+ * @see IStatus#getException()
+ */
+ public Throwable getException() {
+ return null;
+ }
+
+ /**
+ * Returns always the error severity.
+ * @see IStatus#getCode()
+ */
+ public int getCode() {
+ return fSeverity;
+ }
+
+ /**
+ * Returns always <code>null</code>.
+ * @see IStatus#getChildren()
+ */
+ public IStatus[] getChildren() {
+ return new IStatus[0];
+ }
+
+}
Property changes on: trunk/common/org.maemo.esbox.project.core
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.project.core/.classpath
===================================================================
--- trunk/common/org.maemo.esbox.project.core/.classpath (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/org.maemo.esbox.project.core/.project
===================================================================
--- trunk/common/org.maemo.esbox.project.core/.project (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.project.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.project.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.maemo.esbox.project.core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:21:40 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/org.maemo.esbox.project.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.project.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Project Core Plug-in
+Bundle-SymbolicName: org.maemo.esbox.project.core;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-CoreActivator: org.maemo.esbox.project.core.noexport.CoreActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.eclipse.core.resources;bundle-version="3.4.0";visibility:=reexport,
+ org.eclipse.core.expressions;bundle-version="3.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.project.core
+Bundle-Activator: org.maemo.esbox.internal.project.core.Activator
Added: trunk/common/org.maemo.esbox.project.core/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.project.core/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ schema/
Added: trunk/common/org.maemo.esbox.project.core/plugin.xml
===================================================================
--- trunk/common/org.maemo.esbox.project.core/plugin.xml (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="projectType" name="Project Type" schema="schema/projectType.exsd"/>
+ <extension-point id="oldStyleProjectPropertiesProvider" name="Old-Style Project Properties Provider" schema="schema/oldStyleProjectPropertiesProvider.exsd"/>
+ <extension-point id="esbox_templates" name="ESbox Templates" schema="schema/esbox_templates.exsd"/>
+ <extension-point id="esbox_templateAssociations" name="ESbox Template Associations Extension Point" schema="schema/esbox_templatesAssociations.exsd"/>
+ <extension-point id="esboxLanguageTemplateProvider" name="ESbox Language Template Provider" schema="schema/esboxLanguageTemplateProvider.exsd"/>
+
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.maemo.esbox.project.core.ESboxPropertyTester"
+ id="org.maemo.esbox.cpp.project.core.PropertyTester"
+ namespace="org.maemo.esbox.cpp"
+ properties="isESboxProject"
+ type="org.eclipse.core.runtime.IAdaptable">
+ </propertyTester>
+ </extension>
+
+</plugin>
Added: trunk/common/org.maemo.esbox.project.core/schema/esboxLanguageTemplateProvider.exsd
===================================================================
--- trunk/common/org.maemo.esbox.project.core/schema/esboxLanguageTemplateProvider.exsd (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/schema/esboxLanguageTemplateProvider.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.project.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.maemo.esbox.project.core" id="esboxLanguageTemplateProvider" name="ESbox Language Template Provider"/>
+ </appinfo>
+ <documentation>
+ This extension allows contribution of templates for different languages.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="languageTemplateContributor"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="languageTemplateContributor">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class implementing ITemplateProvider
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.maemo.esbox.project.core.ITemplateProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: trunk/common/org.maemo.esbox.project.core/schema/esbox_templates.exsd
===================================================================
--- trunk/common/org.maemo.esbox.project.core/schema/esbox_templates.exsd (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/schema/esbox_templates.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,232 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.maemo.esbox.core" id="esbox_templates" name="ESbox Template Extension point"/>
+ </appInfo>
+ <documentation>
+ This templates extension point facilitates the users to contribute their Template XMLs to the Template Engine plug-in.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <documentation>
+ Extension point added to Template Engine plugin. Any plugin, which intends to contribute XML templates to the Template Engine must extend this extension point, and add the template element.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="template" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ Id for the extension in the extender plugin.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ Optional name attribute.
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="template">
+ <annotation>
+ <documentation>
+ By adding the templates extension point the users can contribute their Template XMLs to the Template Engine plugin.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="toolChain" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique identifier for this template contribution. This does not need to be the same as the id of the template (as defined in template.xml) it is contributing. This allows contributing the same template.xml more than once (for example for multiple project types, or with alternate page sequences).
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="location" type="string" use="required">
+ <annotation>
+ <documentation>
+ The path of template.xml (relative to the base of the containing plug-in). For example "templates/TemplateOne/template.xml". This attribute is mandatory.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="projectType" type="string" use="required">
+ <annotation>
+ <documentation>
+ This attribute is a project type id referring to the cdt project type that the template will be associated with. Project types are contributed to the org.eclipse.cdt.managedbuilder.core.buildDefinitions extension-point.
+This attribute is mandatory. CDT pre-defines the following values of the build artifact type property:
+<ul>
+<li>"org.eclipse.cdt.build.core.buildArtefactType.exe" - to represent executable
+<li>"org.eclipse.cdt.build.core.buildArtefactType.staticLib" - to represent static library
+<li>"org.eclipse.cdt.build.core.buildArtefactType.sharedLib" - to represent shared library
+<li>ISVs can define their own custom build artifact values by contributing to the org.eclipse.cdt.managedbuilder.core.buildProperties extension point.
+</ul>
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isCategory" type="boolean">
+ <annotation>
+ <documentation>
+ If true this template contribution should appear as a folder. Defaults to false.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="filterPattern" type="string">
+ <annotation>
+ <documentation>
+ filterPattern is a java.util.regex.Pattern format string which is used to match against build configuration ids. This is an optional attribute, if absent will all configurations will match.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="pagesAfterTemplateSelectionProvider" type="string">
+ <annotation>
+ <documentation>
+ A class that implements org.eclipse.cdt.templateengine.IPagesAfterTemplateSelectionProvider interface to create pages that will be appended to the pages returned from TemplatesChoiceWizard.getPagesAfterTemplateSelection().
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.ui.templateengine.IPagesAfterTemplateSelectionProvider"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="category" type="string" use="default" value="%Other">
+ <annotation>
+ <documentation>
+ (ESBox) The name of the category under which this template appears.
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="executionEnvironment" type="string" use="default" value="org.maemo.esbox.core.execution_environment.unknown">
+ <annotation>
+ <documentation>
+ (ESBox) The name of the execution environment the project requires.
+ This is the id of an org.maemo.esbox.core.execution_environment extension point.
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="projectNature" type="string" use="required">
+ <annotation>
+ <documentation>
+ (ESBox) The name of the project nature the template is associated with. Used to distinguish
+ C/C++ and Python (etc.) projects.
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="toolChain">
+ <annotation>
+ <documentation>
+ This element is used to reference an existing toolchain by its unique identifier.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique identifier of a toolchain contributed to the org.eclipse.cdt.managedbuilder.core.buildDefinitions extension point.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ This extension point was added in CDT 4.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of the extension point usage:
+<p>
+<pre>
+ <extension point="org.eclipse.cdt.core.templates">
+ <template
+ id="org.foobar.templates.MyExampleTemplate"
+ location="templates/MyExampleTemplate/template.xml"
+ projectType="org.eclipse.cdt.build.core.buildArtefactType.exe"
+ filterPattern=".*">
+ </template>
+ </extension>
+</pre>
+
+For more details on how to define your own templates, please check examples provided under <samp>org.eclipse.cdt.ui.templateengine</samp>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ An implementation of this extension point is supplied in <samp>org.eclipse.cdt.templateengine</samp>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2007 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 at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+Symbian - Initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/common/org.maemo.esbox.project.core/schema/esbox_templates.properties
===================================================================
--- trunk/common/org.maemo.esbox.project.core/schema/esbox_templates.properties (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/schema/esbox_templates.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1 @@
+Other=Other
Added: trunk/common/org.maemo.esbox.project.core/schema/esbox_templatesAssociations.exsd
===================================================================
--- trunk/common/org.maemo.esbox.project.core/schema/esbox_templatesAssociations.exsd (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/schema/esbox_templatesAssociations.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,148 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.maemo.esbox.core" id="esbox_templateAssociations" name="ESbox Template Associations"/>
+ </appInfo>
+ <documentation>
+ This extension-point allows developers to specify toolchains that should be enabled for selection for use with a pre-existing template. This solves the problem over how ISV's can have templates defined and shipped with CDT support their own toolchains, without having to modify CDT itself.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <documentation>
+ Each extension consists of a sequence of template elements, each of which define child elements for the new toolchains that should be enabled for selection during new project creation.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="template" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ The unique identifier for this extension
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="toolChain">
+ <annotation>
+ <documentation>
+ This element is used to reference an existing toolchain by its unique identifier.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique identifier of a toolchain contributed to the org.eclipse.cdt.managedbuilder.core.buildDefinitions extension point.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="template">
+ <annotation>
+ <documentation>
+ This element references an existing template contribution's unique identifier in order that toolchains contributed separately to the template can be made selectable on project creation.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="toolChain" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique identifier of the template-contribution (the id in plugin.xml rather than the template.xml) that should have the specified additional toolchains enabled for selection during new project creation.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ This extension point was added in CDT 4.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ If you developed toolchain's with ids "com.foobar.toolchain1.base" and "com.foobar.toolchain2.base", which you wanted enabled for the empty project type built into the cdt core, you could use the following to achieve this:
+
+<pre>
+<extension point="org.eclipse.cdt.core.templateAssociations">
+ <template id="org.eclipse.cdt.build.core.templates.EmptyProject">
+ <toolChain id="com.foobar.toolchain1.base"/>
+ <toolChain id="com.foobar.toolchain2.base"/>
+ </template>
+</extension>
+</pre>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2007 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 at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+Symbian - Initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/common/org.maemo.esbox.project.core/schema/oldStyleProjectPropertiesProvider.exsd
===================================================================
--- trunk/common/org.maemo.esbox.project.core/schema/oldStyleProjectPropertiesProvider.exsd (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/schema/oldStyleProjectPropertiesProvider.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.project.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.maemo.esbox.project.core" id="oldStyleProjectPropertiesProvider" name="Old-Style Project Properties Provider"/>
+ </appinfo>
+ <documentation>
+ This provides an implementation of an obsolete project properties provider for use in converting projects from ESbox 1.4 (or PluThon) to a new format.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="projectPropertiesProvider"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="projectPropertiesProvider">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class implementing this interface.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.maemo.esbox.project.core.IOldStyleProjectPropertiesProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: trunk/common/org.maemo.esbox.project.core/schema/projectType.exsd
===================================================================
--- trunk/common/org.maemo.esbox.project.core/schema/projectType.exsd (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/schema/projectType.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,107 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.project.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.maemo.esbox.project.core" id="projectType" name="Project Type"/>
+ </appinfo>
+ <documentation>
+ This declares a project type (e.g. C/C++ or Python) which provides an implementation of org.maemo.esbox.project.core.IProjectType.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="projectType"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="projectType">
+ <annotation>
+ <documentation>
+ A project type declaration.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ The class implementing IESboxProjectType.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.maemo.esbox.project.core.IESboxProjectType"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 1.5
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/internal/project/core/Activator.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/internal/project/core/Activator.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/internal/project/core/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,116 @@
+package org.maemo.esbox.internal.project.core;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.project.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxBuildConfigurationBase.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxBuildConfigurationBase.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxBuildConfigurationBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,259 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.resources.IProject;
+import org.maemo.esbox.core.IPersistentPropertyAccess;
+import org.maemo.esbox.core.execEnv.ExecutionEnvironmentFactory;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+import org.maemo.esbox.core.sdk.*;
+
+/**
+ * Implementation of a basic ESbox build configuration.
+ * <p>
+ * We don't know the lifetimes of these objects, so don't store
+ * references to objects, just low level strings which can be used to
+ * look them up.
+ * @author eswartz
+ *
+ */
+public class ESboxBuildConfigurationBase implements IESboxBuildConfiguration {
+ protected static final String TARGET_NAME_PROPERTY = "targetName";
+ protected static final String ID_PROPERTY = "id";
+ protected static final String NAME_PROPERTY = "name";
+ protected static final String SDK_NAME_PROPERTY = "sdkName";
+ protected static final String EXECUTION_ENVIRONMENT_PROPERTY = "executionEnvironment";
+
+ private final IProject project;
+
+ private String sdkName;
+
+ private String sdkTargetName;
+
+ private String execEnvId;
+
+ private String id;
+
+ private String name;
+
+ protected IESboxProjectHandle projectHandle;
+
+ private boolean changed;
+
+ /**
+ * Create new build configuration from project creator defaults.
+ * @param projectHandle
+ * @param parameters
+ */
+ public ESboxBuildConfigurationBase(IESboxProjectHandle projectHandle,
+ ESboxBuildConfigurationParameters parameters) {
+ this.project = projectHandle.getProject();
+ this.projectHandle = projectHandle;
+ this.name = parameters.getName();
+ this.sdkName = parameters.getSdkName();
+ this.sdkTargetName = parameters.getSdkTargetName();
+ this.execEnvId = parameters.getExecutionEnvironmentId();
+ this.id = parameters.getId();
+ }
+
+ /**
+ * Create a configuration from existing configuration.
+ * @param access
+ */
+ public ESboxBuildConfigurationBase(IESboxProjectHandle projectHandle,
+ String id,
+ String name, IPersistentPropertyAccess access) {
+ this.id = id;
+ this.name = name;
+ this.project = projectHandle.getProject();
+ this.projectHandle = projectHandle;
+ load(access);
+ setChanged(false);
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((project == null) ? 0 : project.getName().hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ESboxBuildConfigurationBase other = (ESboxBuildConfigurationBase) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ if (project == null) {
+ if (other.project != null)
+ return false;
+ } else if (!project.getName().equals(other.project.getName()))
+ return false;
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "Build Configuration: id(" + id + "), name(" + name + ")";
+ }
+
+ protected void load(IPersistentPropertyAccess access) {
+ sdkName = access.read(SDK_NAME_PROPERTY);
+ sdkTargetName = access.read(TARGET_NAME_PROPERTY);
+ execEnvId = access.read(EXECUTION_ENVIRONMENT_PROPERTY);
+ }
+
+ public void save(IPersistentPropertyAccess access) {
+ access.write(SDK_NAME_PROPERTY, sdkName);
+ access.write(TARGET_NAME_PROPERTY, sdkTargetName);
+ access.write(EXECUTION_ENVIRONMENT_PROPERTY, execEnvId);
+ }
+
+ /**
+ * @return the changed
+ */
+ public boolean isChanged() {
+ return changed;
+ }
+
+ /**
+ * @param changed the changed to set
+ */
+ public void setChanged(boolean changed) {
+ this.changed = changed;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxBuildConfiguration#getProject()
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxBuildConfiguration#getExecutionEnvironment()
+ */
+ public IExecutionEnvironment getExecutionEnvironment() {
+ return ExecutionEnvironmentFactory.getInstance().findExecutionEnvironment(execEnvId);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxBuildConfiguration#getExecutionEnvironmentId()
+ */
+ public String getExecutionEnvironmentId() {
+ return execEnvId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxBuildConfiguration#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxBuildConfiguration#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxBuildConfiguration#getSDK()
+ */
+ public ISDK getSDK() {
+ for (ISDK sdk : SDKFactory.getInstance().getSDKs()) {
+ if (sdk.getName().equals(sdkName)) {
+ return sdk;
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxBuildConfiguration#getSDKName()
+ */
+ public String getSDKName() {
+ return sdkName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxBuildConfiguration#getSDKTarget()
+ */
+ public ISDKTarget getSDKTarget() {
+ ISDK sdk = getSDK();
+ if (sdk != null)
+ return sdk.findSDKTarget(sdkTargetName);
+ else
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxBuildConfiguration#getSDKTargetName()
+ */
+ public String getSDKTargetName() {
+ return sdkTargetName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxBuildConfiguration#getProjectInfo()
+ */
+ public IESboxProjectHandle getProjectHandle() {
+ return projectHandle;
+ }
+
+ public void setProjectHandle(IESboxProjectHandle projectHandle) {
+ this.projectHandle = projectHandle;
+ }
+
+ /**
+ * Set the id for the build configuration.
+ * @param id
+ */
+ public void setId(String id) {
+ if (id == null)
+ throw new NullPointerException();
+ this.id = id;
+ }
+
+ /**
+ * Create a canonical unique identifier for a build configuration.
+ * @param sdkName
+ * @param sdkTargetName
+ * @return
+ */
+ public static String createId(String sdkName, String sdkTargetName) {
+ return sdkName + "~" + sdkTargetName;
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxBuildConfigurationParameters.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxBuildConfigurationParameters.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxBuildConfigurationParameters.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * These are the parameters used to initialize an ESbox build configuration.
+ * @author eswartz
+ *
+ */
+public class ESboxBuildConfigurationParameters {
+
+ private final String name;
+ private String id;
+ private String executionEnvironmentId;
+ private String sdkTargetName;
+ private String sdkName;
+ private ISDKTarget sdkTarget; // may be null
+
+ /**
+ * Initialize parameter block with the user-visible name and SDK target name and SDK name;
+ * this is used when the SDK target is not actually known.
+ * @param name
+ * @param sdkTargetName
+ * @param sdkName
+ */
+ public ESboxBuildConfigurationParameters(String name, String sdkTargetName, String sdkName) {
+ this.name = name;
+ this.setSdkTargetName(sdkTargetName);
+ this.setSdkName(sdkName);
+ this.setId(sdkName + "~" + sdkTargetName);
+ }
+
+ /**
+ * Initialize parameter block with the user-visible name and existing SDK target
+ * @param name
+ * @param sdkTarget
+ */
+ public ESboxBuildConfigurationParameters(String name, ISDKTarget sdkTarget) {
+ this.name = name;
+ setSdkTarget(sdkTarget);
+ this.setId(sdkName + "~" + sdkTargetName);
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param executionEnvironmentId the executionEnvironmentId to set
+ */
+ public void setExecutionEnvironmentId(String executionEnvironmentId) {
+ this.executionEnvironmentId = executionEnvironmentId;
+ }
+
+ /**
+ * @return the executionEnvironmentId
+ */
+ public String getExecutionEnvironmentId() {
+ return executionEnvironmentId;
+ }
+
+ /**
+ * @param sdkTargetName the sdkTargetName to set
+ */
+ public void setSdkTargetName(String sdkTargetName) {
+ this.sdkTargetName = sdkTargetName;
+ }
+
+ /**
+ * @return the sdkTargetName
+ */
+ public String getSdkTargetName() {
+ return sdkTargetName;
+ }
+
+ /**
+ * @param sdkName the sdkName to set
+ */
+ public void setSdkName(String sdkName) {
+ this.sdkName = sdkName;
+ }
+
+ /**
+ * @return the sdkName
+ */
+ public String getSdkName() {
+ return sdkName;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Get the SDK target associated with the parameters.
+ */
+ public ISDKTarget getSdkTarget() {
+ return sdkTarget;
+ }
+
+ /**
+ * @param sdkTarget the sdkTarget to set
+ */
+ public void setSdkTarget(ISDKTarget sdkTarget) {
+ if (sdkTarget != null) {
+ setSdkTargetName(sdkTarget.getName());
+ setSdkName(sdkTarget.getSDK().getName());
+ }
+ this.sdkTarget = sdkTarget;
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxConfigHandler.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxConfigHandler.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxConfigHandler.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.project.core;
+
+import org.maemo.esbox.core.execEnv.ExecutionEnvironmentFactory;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Contains basic elements used to configure an ESbox Project:
+ * <p>
+ * - A template info to identify which is the project type;<br>
+ * - A set of SDK targets for specifying the build configurations for the project<br>
+ * - An execution environment describing the requirements at runtime
+ * <p>
+ * This uses string ids rather than actual SDK target / execution environments where possible,
+ * since it's also used when converting projects, where there may be the possibility
+ * of missing targets or environments. But when the SDK target is known, it should be set.
+ */
+public abstract class ESboxConfigHandler {
+
+ private ITemplate template;
+
+ private String targetName;
+
+ private String execEnv;
+
+ private List<ESboxBuildConfigurationParameters> buildConfigParams;
+
+ /**
+ * Constructor.
+ * Constructs an empty configure handler.
+ */
+ protected ESboxConfigHandler() {
+ buildConfigParams = new ArrayList<ESboxBuildConfigurationParameters>();
+ }
+
+ /**
+ * Return the template info.
+ * @return the template info.
+ */
+ public ITemplate getTemplate() {
+ return template;
+ }
+
+ /**
+ * Modify the current template info.
+ * @param template the new template info.
+ */
+ public void setTemplate(ITemplate template) {
+ this.template = template;
+ if (template != null) {
+ this.execEnv = template.getExecutionEnvironmentId();
+ }
+ }
+
+ /**
+ * Set the execution environment. Must match a <plugin>.execution_environment extension
+ * point id.<p>
+ * @return extension point id
+ * @see {@link IExecutionEnvironment} and {@link ExecutionEnvironmentFactory}
+ */
+ public void setExecutionEnvironment(String execEnv) {
+ this.execEnv = execEnv;
+ }
+
+ /**
+ * Get the UI name for the main target.
+ * @return
+ */
+ public String getInitialTargetName() {
+ return targetName;
+ }
+
+ /**
+ * Set the UI name for the main target.
+ * @param newTargetName
+ */
+ public void setInitialTargetName(String newTargetName) {
+ this.targetName = newTargetName;
+ }
+
+ /**
+ * Get the environment in which the program runs.
+ * @return extension point id
+ * @see {@link IExecutionEnvironment} and {@link ExecutionEnvironmentFactory}
+ */
+ public String getExecutionEnvironment() {
+ return execEnv;
+ }
+
+ /**
+ * Edit/modify the list of build configurations for the initial project.
+ * <p>
+ * The execution environment will be filled in from the {@link #getExecutionEnvironment()} in
+ * this class if not otherwise specified.
+ * <p>
+ * The initially active configuration should be set via {@link #setInitialTargetName(String)}.
+ * Likewise, this list must reference that active configuration.
+ * @return modifiable list
+ */
+ public List<ESboxBuildConfigurationParameters> getBuildConfigurationParameters() {
+ return buildConfigParams;
+ }
+
+ /**
+ * Set the list of build configurations for the initial project.
+ * <p>
+ * The execution environment will be filled in from the {@link #getExecutionEnvironment()} in
+ * this class if not otherwise specified.
+ * <p>
+ * The initially active configuration should be set via {@link #setInitialTargetName(String)}.
+ * Likewise, this list must reference that active configuration. */
+ public void setBuildConfigurationParameters(List<ESboxBuildConfigurationParameters> params) {
+ buildConfigParams = params;
+ }
+
+ /**
+ * Convenience method to initialize a single-configuration project
+ */
+ public void initializeSingleBuildConfiguration(String targetName, String sdkName) {
+ ESboxBuildConfigurationParameters params = new ESboxBuildConfigurationParameters(
+ targetName, targetName, sdkName);
+ buildConfigParams.clear();
+ buildConfigParams.add(params);
+ setInitialTargetName(targetName);
+ }
+
+ /**
+ * Convenience method to initialize a single-configuration project
+ */
+ public void initializeSingleBuildConfiguration(ISDKTarget sdkTarget) {
+ ESboxBuildConfigurationParameters params = new ESboxBuildConfigurationParameters(
+ sdkTarget.getName(), sdkTarget);
+ buildConfigParams.clear();
+ buildConfigParams.add(params);
+ setInitialTargetName(sdkTarget.getName());
+ }
+
+ public ISDKTarget getInitialSDKTarget() {
+ for (ESboxBuildConfigurationParameters params : getBuildConfigurationParameters()) {
+ if (params.getSdkTargetName().equals(getInitialTargetName()))
+ return params.getSdkTarget();
+ }
+ return null;
+ }
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectCreatorConverter.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectCreatorConverter.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectCreatorConverter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,362 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.project.core;
+
+import com.nokia.cpp.internal.api.utils.core.ProjectUtils;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.project.core.Activator;
+
+import java.util.Calendar;
+import java.util.Map;
+
+/**
+ * This class encompasses the mechanics of project creation and conversion.
+ * <p>
+ * Use {@link #setup(IProject, IPath, ESboxConfigHandler)} followed by {@link #getProjectCreatorRunnable()}
+ * to create a new project, or {@link #setup(IProject, IPath, ESboxConfigHandler)}
+ * followed by {@link #getProjectConverterRunnable()} to convert an existing project.
+ * <p>
+ * A conversion does the same thing as creation, except that it does not have any
+ * template processes and expects the project to exist already.
+ * @author eswartz
+ *
+ */
+public abstract class ESboxProjectCreatorConverter {
+ protected IProject project;
+ private ESboxConfigHandler configHandler;
+ private boolean isCreating;
+ protected IESboxProjectHandle projectHandle;
+
+ /**
+ * Create the project identified by the given handle and configuration data.
+ *
+ * @param project
+ * the project handle
+ * @param configHandler
+ * configuration of SDK target and template to use
+ * @throws CoreException
+ */
+ public void setup(IProject project, ESboxConfigHandler configHandler) {
+ this.project = project;
+ this.configHandler = configHandler;
+ }
+
+ /**
+ * Create the actual project (e.g. C/C++, Python, ...) for the 'project'
+ * and open it, make it a viable empty project, and add the natures.
+ *
+ * @param description
+ * the project description, for use in creating a project,
+ * or null when converting
+ * @param monitor
+ * @throws CoreException
+ */
+ protected abstract void createConcreteProject(
+ IProjectDescription description, IProgressMonitor monitor)
+ throws CoreException;
+
+ /**
+ * Perform any initializations before running template processes (also run during
+ * conversion, when there are no such processes).
+ * @param monitor
+ * @throws CoreException
+ */
+ protected abstract void initializeBeforeTemplateOperations(IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * With the 'project' existing and open, and any template tasks having been
+ * executed to populate its contents, perform any tasks needed to initialize
+ * it for the initial active configuration.
+ *
+ * @throws CoreException
+ */
+ protected abstract void initializeConcreteProject(IProgressMonitor monitor)
+ throws CoreException;
+
+ /**
+ * Perform any finalizations after running template processes (also run during
+ * conversion, when there are no such processes).
+ * @param monitor
+ * @throws CoreException
+ */
+ protected abstract void finalizeAfterTemplateOperations(IProgressMonitor monitor) throws CoreException;
+
+
+ /**
+ * Do the work (creation or converting) on the project.
+ * @param create if true, create rather than convert
+ * @param projectLocation if create, then null for default location or the full filesystem path
+ */
+ private void workOnProject(boolean create, IPath projectLocation, IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask(create ? "Creating project:" : "Converting project:", 10);
+
+ isCreating = create;
+
+ if (create) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IProjectDescription description = workspace
+ .newProjectDescription(project.getName());
+ if (projectLocation != null)
+ description.setLocation(projectLocation);
+
+ createConcreteProject(description, new SubProgressMonitor(monitor, 1));
+
+ if (monitor.isCanceled())
+ throw new OperationCanceledException();
+ } else {
+ createConcreteProject(null, new SubProgressMonitor(monitor, 1));
+
+ if (monitor.isCanceled())
+ throw new OperationCanceledException();
+ }
+
+ if (monitor.isCanceled())
+ throw new OperationCanceledException();
+
+ // make the high-level project
+ projectHandle = createProjectHandle(project);
+
+ IPath projectPath = ProjectUtils.getRealProjectLocation(project);
+ if (projectPath == null)
+ throw new CoreException(Activator.createErrorStatus("Project location is unknown", null));
+
+ // now create all the configurations
+ IESboxBuildConfiguration defaultConfig = null;
+ for (ESboxBuildConfigurationParameters parameters : configHandler.getBuildConfigurationParameters()) {
+ // fill in defaults
+ if (parameters.getExecutionEnvironmentId() == null) {
+ parameters.setExecutionEnvironmentId(
+ configHandler.getExecutionEnvironment());
+ }
+
+ IESboxBuildConfiguration config = projectHandle.createBuildConfiguration(parameters);
+ if (defaultConfig == null || parameters.getName().equals(configHandler.getInitialTargetName())) {
+ defaultConfig = config;
+ projectHandle.setCurrentConfiguration(config);
+ }
+
+ // ensure the project is actually visible from this target
+ try {
+ config.getSDKTarget().convertHostToTargetPath(projectPath);
+ } catch (ESboxException e) {
+ throw new CoreException(Activator.createErrorStatus(e.getMessage(), null));
+ }
+ }
+
+ // create the project with these build configs
+ projectHandle.create(new SubProgressMonitor(monitor, 1));
+
+ ESboxTemplateProcessInfo.currentConfigHandler = getConfigHandler();
+ ESboxTemplateProcessInfo.currentProject = project;
+
+ initializeBeforeTemplateOperations(new SubProgressMonitor(monitor, 1));
+
+ CoreException templateException = null;
+ try {
+ if (configHandler.getTemplate() != null) {
+ finalizeTemplateVariables(projectLocation);
+
+ // don't let template failures kill the project
+ try {
+ executeTemplateProcesses();
+ } catch (CoreException e) {
+ templateException = e;
+ }
+
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ throw new OperationCanceledException();
+ }
+
+ initializeConcreteProject(new SubProgressMonitor(monitor, 2));
+
+ if (monitor.isCanceled())
+ throw new OperationCanceledException();
+
+ } finally {
+ // don't abort early (in a non-configurable project)
+
+ // get the files created by the concretization of the project
+ project.refreshLocal(IResource.DEPTH_INFINITE,
+ new SubProgressMonitor(monitor, 1));
+
+ finalizeAfterTemplateOperations(new SubProgressMonitor(monitor, 1));
+
+ ESboxTemplateProcessInfo.currentConfigHandler = null;
+ ESboxTemplateProcessInfo.currentProject = null;
+ }
+
+ if (templateException != null)
+ throw templateException;
+
+ monitor.done();
+ }
+
+ /**
+ * Create the info for the given project type.
+ * @param project2
+ * @return
+ */
+ abstract protected IESboxProjectHandle createProjectHandle(IProject project);
+
+ @SuppressWarnings("unchecked")
+ private void finalizeTemplateVariables(IPath projectLocation) {
+ Map<String, String> data = (Map) configHandler.getTemplate()
+ .getValueStore();
+
+ String projName = project.getName();
+ projName = projName != null ? projName.trim() : ""; //$NON-NLS-1$
+ data.put("projectName", projName); //$NON-NLS-1$
+ data.put("baseName", getBaseName(projName)); //$NON-NLS-1$
+ data.put("baseNameUpper", getBaseName(projName).toUpperCase()); //$NON-NLS-1$
+ data.put("baseNameLower", getBaseName(projName).toLowerCase()); //$NON-NLS-1$
+
+ String location = "";
+ if (projectLocation != null) {
+ location = projectLocation.toOSString();
+ } else {
+ location = project.getLocation().toOSString();
+ }
+ // TODO: are these really the same?
+ data.put("projectLocation", location);
+ data.put("location", location);
+
+ Calendar now = Calendar.getInstance();
+ if (data.get("year") == null) {
+ data.put("year", "" + now.get(Calendar.YEAR));
+ }
+ }
+
+ private String getBaseName(String name) {
+ String baseName = name;
+ int dot = baseName.lastIndexOf('.');
+ if (dot != -1) {
+ baseName = baseName.substring(dot + 1);
+ }
+ dot = baseName.indexOf(' ');
+ if (dot != -1) {
+ baseName = baseName.substring(0, dot);
+ }
+ return baseName;
+ }
+
+ protected void executeTemplateProcesses() throws CoreException {
+ /*
+ IStatus[] statuses = configHandler.getTemplate()
+ .executeTemplateProcesses(null, false);
+
+ if (statuses.length > 0) {
+ final MultiStatus multiStatus = new MultiStatus(
+ CoreActivator.PLUGIN_ID, 0,
+ "Template project creation failed", null);
+ boolean anyErrors = false;
+ for (IStatus status : statuses) {
+ if (status.getSeverity() == IStatus.ERROR) {
+ multiStatus.merge(status);
+ anyErrors = true;
+ }
+ }
+ if (anyErrors) {
+ throw new CoreException(multiStatus);
+ }
+ }
+ */
+ // TODO
+ MultiStatus status = configHandler.getTemplate().executeTemplateProcesses(null);
+ if (!status.isOK())
+ throw new CoreException(status);
+ }
+
+ /**
+ * XXX: this would go only in the Python creator (which doesn't exist yet)
+ * Register the project with ESbox
+ *
+ * @throws CoreException
+ */
+ protected void registerProjectPython() throws CoreException {
+ /*
+ IProjectProperties projectProperties = ProjectManager.getInstance().getProjectProperties(project);
+
+ // set the target
+ projectProperties.setTargetName(configHandler.getInitialTargetName());
+
+ // set the execution environment
+ projectProperties.setExecutionEnvironmentId(configHandler.getExecutionEnvironment());
+ */
+ }
+
+ public String getBuildSystemId() {
+ return null;
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ public ESboxConfigHandler getConfigHandler() {
+ return configHandler;
+ }
+
+ /** For use by subclasses to distinguish 'create' from 'convert' modes */
+ protected boolean isCreating() {
+ return isCreating;
+ }
+
+ /**
+ * Get a workspace runnable which will create and initialize the project
+ *
+ * @param projectLocation the full filesystem path to the location, or <code>null</code> for the
+ * default location.
+ * @return runnable which creates the project
+ */
+ public IWorkspaceRunnable getProjectCreatorRunnable(final IPath projectLocation) {
+
+ return new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ workOnProject(true, projectLocation, monitor);
+ }
+ };
+ }
+
+ /**
+ * Get a workspace runnable which will convert an existing project
+ *
+ * @return runnable which creates the project
+ */
+ public IWorkspaceRunnable getProjectConverterRunnable() {
+
+ return new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ workOnProject(false, null, monitor);
+
+ // remove any markers associated with a bad build of an old proect
+ IMarker[] markers = project.findMarkers(IMarker.PROBLEM, true, 0);
+ for (IMarker marker : markers) {
+ if (marker.getAttribute(IOldESboxProjectBuilder.ATTR_NEEDS_CONVERSION) != null)
+ marker.delete();
+ }
+ }
+ };
+ }
+
+ /**
+ * Get the current project info. This is not available until {@link #createConcreteProject(IProjectDescription, IProgressMonitor)}
+ * has succeeded.
+ * @return
+ */
+ public IESboxProjectHandle getProjectHandle() {
+ return projectHandle;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectHandleBase.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectHandleBase.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectHandleBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.maemo.esbox.internal.project.core.Activator;
+
+/**
+ * Useful base class for IESboxProjectHandle implementations
+ * @author eswartz
+ *
+ */
+public abstract class ESboxProjectHandleBase implements IESboxProjectHandle {
+
+ protected final IProject project;
+
+ /**
+ *
+ */
+ public ESboxProjectHandleBase(IProject project) {
+ this.project = project;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((project == null) ? 0 : project.getName().hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ESboxProjectHandleBase other = (ESboxProjectHandleBase) obj;
+ if (project == null) {
+ if (other.project != null)
+ return false;
+ } else if (!project.getName().equals(other.project.getName()))
+ return false;
+ return true;
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ @Override
+ public String toString() {
+ return "Project Info: project(" + project.getName() + ")";
+ }
+
+ /**
+ * Obtain build parameters with all missing values filled in from a base configuration.
+ * @param parameters the parameters to establish
+ * @param baseConfig the configuration to use for parameters not set
+ * @return either parameters or a new block
+ */
+ protected ESboxBuildConfigurationParameters fillInBuildParameters(ESboxBuildConfigurationParameters parameters, IESboxBuildConfiguration baseConfig) {
+ ESboxBuildConfigurationParameters fullParameters = parameters;
+ if (baseConfig != null) {
+ fullParameters = new ESboxBuildConfigurationParameters(
+ parameters.getName(),
+ parameters.getSdkTarget() != null ?
+ parameters.getSdkTarget() :
+ baseConfig.getSDKTarget()
+ );
+ if (fullParameters.getSdkTargetName() == null)
+ fullParameters.setSdkTargetName(parameters.getSdkTargetName() != null
+ ? parameters.getSdkTargetName() : baseConfig.getSDKTargetName());
+ if (fullParameters.getSdkName() == null)
+ fullParameters.setSdkName(parameters.getSdkName() != null
+ ? parameters.getSdkName() : baseConfig.getSDKName());
+ if (parameters.getExecutionEnvironmentId() != null)
+ fullParameters.setExecutionEnvironmentId(parameters.getExecutionEnvironmentId());
+ else
+ fullParameters.setExecutionEnvironmentId(baseConfig.getExecutionEnvironmentId());
+ }
+ return fullParameters;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#clearBuildState()
+ */
+ public void clearBuildState() {
+ try {
+ // touching the project description may convince the incremental builder will clear its state
+ project.setDescription(project.getDescription(), new NullProgressMonitor());
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to touch project description", e);
+ }
+ }
+
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectPropertiesWrapper.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectPropertiesWrapper.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxProjectPropertiesWrapper.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import com.nokia.cpp.internal.api.utils.core.Check;
+
+import org.eclipse.core.resources.IProject;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.project.core.Activator;
+
+/**
+ * This wraps the old ESboxProjectProperties class in a new API for the configuration
+ * of ESbox projects with active build configurations. It's a transitional
+ * class only.
+ * @author eswartz
+ *
+ */
+public class ESboxProjectPropertiesWrapper implements IProjectProperties {
+
+ private IProject project ;
+
+ public ESboxProjectPropertiesWrapper(IProject project) {
+ Check.checkArg(project);
+ this.project = project;
+ }
+
+ private void logError(Exception e) {
+ Activator.getErrorLogger().logError("Failed to access property in ESbox project", e);
+ }
+
+ /**
+ * Get the current ESbox build configuration
+ * @return {@link IESboxBuildConfiguration}, never <code>null</code>
+ * @throws ESboxException if active build configuration is not available
+ */
+ private IESboxBuildConfiguration getCurrentConfiguration() throws ESboxException {
+ IESboxProjectHandle projectHandle = ProjectManager.getInstance().getProjectHandle(project);
+ if (projectHandle == null)
+ throw new ESboxException("Cannot create project properties for " + project.getName() +"; be sure this is an up-to-date ESbox project");
+ IESboxBuildConfiguration current = projectHandle.getCurrentConfiguration();
+ if (current == null)
+ throw new ESboxException("There is no ESbox-compatible active build configuration in project '" + projectHandle.getProject().getName() + "'");
+ return current;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IProjectProperties#getExecutionEnvironment()
+ */
+ public IExecutionEnvironment getExecutionEnvironment() {
+ try {
+ return getCurrentConfiguration().getExecutionEnvironment();
+ } catch (ESboxException e) {
+ logError(e);
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IProjectProperties#getExecutionEnvironmentId()
+ */
+ public String getExecutionEnvironmentId() {
+ try {
+ return getCurrentConfiguration().getExecutionEnvironmentId();
+ } catch (ESboxException e) {
+ logError(e);
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IProjectProperties#getSDK()
+ */
+ public ISDK getSDK() throws ESboxException {
+ return getCurrentConfiguration().getSDK();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IProjectProperties#getSDKName()
+ */
+ public String getSDKName() {
+ try {
+ return getCurrentConfiguration().getSDKName();
+ } catch (ESboxException e) {
+ logError(e);
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IProjectProperties#getSDKTarget()
+ */
+ public ISDKTarget getSDKTarget() throws ESboxException {
+ return getCurrentConfiguration().getSDKTarget();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IProjectProperties#getTargetName()
+ */
+ public String getTargetName() {
+ try {
+ return getCurrentConfiguration().getSDKTargetName();
+ } catch (ESboxException e) {
+ logError(e);
+ return null;
+ }
+ }
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxPropertyTester.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxPropertyTester.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxPropertyTester.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.expressions.IPropertyTester;
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * Test properties of ESbox resources for use in UI filtering and activation
+ * <p>
+ * <li>isESboxProject -- tell if the current project is an ESbox C++ project
+ *
+ * @author eswartz
+ *
+ */
+public class ESboxPropertyTester extends PropertyTester implements
+ IPropertyTester {
+
+ protected IProject getProject(Object receiver) {
+ IResource rsrc = null;
+ if (receiver instanceof IResource) {
+ rsrc = (IResource) receiver;
+ } else if (receiver instanceof IAdaptable) {
+ rsrc = (IResource) (((IAdaptable) receiver).getAdapter(IResource.class));
+ }
+ if (rsrc == null)
+ return null;
+ return rsrc.getProject();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ public boolean test(Object receiver, String property, Object[] args,
+ Object expectedValue) {
+
+ IProject project = getProject(receiver);
+ if (project != null) {
+ if (property.equals("isESboxProject")) {
+ return ProjectManager.getInstance().isESboxProject(project);
+ }
+ }
+
+
+ return false;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxStandaloneProjectHandleBase.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxStandaloneProjectHandleBase.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxStandaloneProjectHandleBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,293 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.core.IPersistentPropertyAccess;
+import org.maemo.esbox.core.xml.ResourceXMLFileStorage;
+import org.maemo.esbox.core.xml.XMLUtils;
+import org.maemo.esbox.internal.project.core.Activator;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A project handle for a project with standalone build configuration settings
+ * (as opposed to, say, CDT, where ESbox build configurations are just proxies).
+ * This stores the information about the project's build configurations in
+ * a file called ".esbox_settings" in the project.
+ *
+ * @author eswartz
+ *
+ */
+public abstract class ESboxStandaloneProjectHandleBase extends ESboxProjectHandleBase implements IESboxProjectHandle {
+
+ private static final String SETTINGS_FILE = ".esbox_settings";
+
+ private static final String SETTINGS = "settings";
+
+ private static final String CURRENT_CONFIG = "currentConfig";
+ private static final String CONFIGS = "configs";
+
+ private static final String CONFIG = "config";
+
+ private static final String ID = "id";
+
+ private static final String NAME = "name";
+
+ private List<IESboxBuildConfiguration> configurations;
+ private IESboxBuildConfiguration currentConfiguration;
+
+ /**
+ * @param project
+ */
+ public ESboxStandaloneProjectHandleBase(IProject project) {
+ super(project);
+ this.configurations = new ArrayList<IESboxBuildConfiguration>();
+ this.currentConfiguration = null;
+
+ load();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#getProject()
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#getBuildConfigurations()
+ */
+ public IESboxBuildConfiguration[] getBuildConfigurations() {
+ synchronized (configurations) {
+ return (IESboxBuildConfiguration[]) configurations.toArray(new IESboxBuildConfiguration[configurations.size()]);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#findBuildConfiguration(java.lang.String)
+ */
+ public IESboxBuildConfiguration findBuildConfiguration(String id) {
+ synchronized (configurations) {
+ for (IESboxBuildConfiguration configuration : configurations) {
+ if (id.equals(configuration.getId())) {
+ return configuration;
+ }
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#createBuildConfiguration(org.maemo.esbox.project.core.ESboxBuildConfigurationParameters)
+ */
+ public IESboxBuildConfiguration createBuildConfiguration(
+ ESboxBuildConfigurationParameters parameters) throws CoreException {
+ IESboxBuildConfiguration buildConfiguration =
+ doCreateBuildConfiguration(parameters);
+ synchronized (configurations) {
+ if (configurations.isEmpty())
+ currentConfiguration = buildConfiguration;
+ configurations.add(buildConfiguration);
+ }
+ return buildConfiguration;
+ }
+
+ /**
+ * Create the build configuration type for this project.
+ * @param parameters
+ * @return new ESboxBuildConfigurationBase
+ */
+ abstract protected ESboxBuildConfigurationBase doCreateBuildConfiguration(
+ ESboxBuildConfigurationParameters parameters);
+
+ /**
+ * Create and aoad a build configuration with the given id and name.
+ * @param id
+ * @param name
+ * @param access
+ * @return
+ */
+ abstract protected ESboxBuildConfigurationBase doLoadBuildConfiguration(String id,
+ String name, IPersistentPropertyAccess access);
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#createBuildConfiguration(org.maemo.esbox.project.core.ESboxBuildConfigurationParameters, org.maemo.esbox.project.core.IESboxBuildConfiguration)
+ */
+ public IESboxBuildConfiguration createBuildConfiguration(
+ ESboxBuildConfigurationParameters parameters,
+ IESboxBuildConfiguration baseConfig) throws CoreException {
+ // make new config if not based on anything
+ if (baseConfig == null)
+ return createBuildConfiguration(parameters);
+
+ ESboxBuildConfigurationParameters fullParameters =
+ fillInBuildParameters(parameters, baseConfig);
+
+ return createBuildConfiguration(fullParameters);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#editBuildConfiguration(org.maemo.esbox.project.core.IESboxBuildConfiguration)
+ */
+ public IESboxBuildConfiguration editBuildConfiguration(
+ IESboxBuildConfiguration config) throws CoreException {
+ return config;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#removeBuildConfiguration(org.maemo.esbox.project.core.IESboxBuildConfiguration)
+ */
+ public void removeBuildConfiguration(IESboxBuildConfiguration config)
+ throws CoreException {
+ synchronized (configurations) {
+ configurations.remove(config);
+ if (currentConfiguration.equals(config)) {
+ if (configurations.isEmpty()) {
+ currentConfiguration = null;
+ } else {
+ currentConfiguration = configurations.get(0);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#create(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void create(IProgressMonitor monitor) throws CoreException {
+ save(monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#save(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void save(IProgressMonitor monitor) throws CoreException {
+ if (configurations.isEmpty())
+ throw newCoreException("Cannot save project with no build configurations");
+
+ if (currentConfiguration == null)
+ throw newCoreException("No current build configuration is set");
+
+ // make the settings file
+ ResourceXMLFileStorage storage = new ResourceXMLFileStorage(project.getFile(SETTINGS_FILE));
+ storage.create(SETTINGS);
+
+ Element documentElement = storage.getDocumentElement();
+ Document document = documentElement.getOwnerDocument();
+
+ // write the configurations block
+ synchronized (configurations) {
+ Element configsElement = XMLUtils.findOrCreateChildElement(
+ document, documentElement, CONFIGS);
+
+ // remember the current one
+ configsElement.setAttribute(CURRENT_CONFIG, currentConfiguration.getId());
+
+ // write each configuration
+ for (IESboxBuildConfiguration configuration : configurations) {
+ Element configElement = document.createElement(CONFIG);
+ configsElement.appendChild(configElement);
+
+ configElement.setAttribute(ID, configuration.getId());
+ configElement.setAttribute(NAME, configuration.getName());
+
+ XMLPersistentPropertyAccess configAccess =
+ new XMLPersistentPropertyAccess(configElement);
+
+ ((ESboxBuildConfigurationBase) configuration).save(configAccess);
+ }
+
+ }
+
+ storage.save();
+ }
+
+ /**
+ * Load the existing configurations from disk
+ */
+ private void load() {
+ // read the settings file
+ ResourceXMLFileStorage storage = new ResourceXMLFileStorage(project.getFile(SETTINGS_FILE));
+ try {
+ storage.load(SETTINGS);
+ } catch (CoreException e) {
+ // ok, nothing here yet
+ return;
+ }
+
+ Element documentElement = storage.getDocumentElement();
+ Document document = documentElement.getOwnerDocument();
+
+ // read the configurations block
+ synchronized (configurations) {
+ Element configsElement = XMLUtils.findOrCreateChildElement(
+ document, documentElement, CONFIGS);
+
+ // remember the current one
+ String currentId = configsElement.getAttribute(CURRENT_CONFIG);
+
+ // read each configuration
+ Element[] configElements = XMLUtils.getChildElementsNamed(configsElement, CONFIG);
+ for (Element configElement : configElements) {
+ String id = configElement.getAttribute(ID);
+ String name = configElement.getAttribute(NAME);
+
+ if (id == null || name == null) {
+ Activator.getErrorLogger().logError("Ignoring invalid build configuration in " + SETTINGS_FILE, null);
+ } else {
+
+ IPersistentPropertyAccess access = new XMLPersistentPropertyAccess(configElement);
+
+ IESboxBuildConfiguration config = doLoadBuildConfiguration(
+ id, name, access);
+
+ if (currentId.equals(id)) {
+ currentConfiguration = config;
+ }
+
+ configurations.add(config);
+ }
+
+ }
+ }
+ }
+
+ private CoreException newCoreException(String string) {
+ return new CoreException(Activator.createErrorStatus(string, null));
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#getCurrentConfiguration()
+ */
+ public IESboxBuildConfiguration getCurrentConfiguration() {
+ return currentConfiguration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#setCurrentConfiguration(org.maemo.esbox.project.core.IESboxBuildConfiguration)
+ */
+ public void setCurrentConfiguration(IESboxBuildConfiguration config)
+ throws CoreException {
+ if (config == null)
+ throw newCoreException("Cannot make current a null configuration");
+ if (!configurations.contains(config))
+ throw newCoreException("Cannot make current a foreign build configuration");
+ currentConfiguration = config;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateEngine.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateEngine.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateEngine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.internal.project.core.Activator;
+
+import java.util.*;
+
+/**
+ * Entry point for accessing (project) templates visible to ESbox.
+ * @author eswartz
+ *
+ */
+public class ESboxTemplateEngine {
+
+ private static final String CLASS = "class";
+ private static ESboxTemplateEngine instance;
+ public static ESboxTemplateEngine getInstance() {
+ if (instance == null) {
+ instance = new ESboxTemplateEngine();
+ }
+ return instance;
+ }
+
+ private List<ILanguageTemplateProvider> languageTemplateProviders;
+ private ESboxTemplateEngine() {
+ languageTemplateProviders = new ArrayList<ILanguageTemplateProvider>();
+ initializeLanguageTemplateProviders();
+ }
+
+ /**
+ * Initialize the list of language-specific template providers.
+ */
+ private void initializeLanguageTemplateProviders() {
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(ILanguageTemplateProvider.ID).getExtensions();
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+ try {
+ ILanguageTemplateProvider provider = (ILanguageTemplateProvider) config.createExecutableExtension(CLASS);
+ languageTemplateProviders.add(provider);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to create ITemplateProvider", e);
+ }
+
+ }
+ }
+ }
+
+ /**
+ * Returns all the templates, no filtering is done.
+ * @return non-<code>null</code> array
+ */
+ public ITemplate[] getTemplates() {
+ List<ITemplate> templates = new ArrayList<ITemplate>();
+ for (ILanguageTemplateProvider provider : languageTemplateProviders) {
+ ITemplate[] providerTemplates = provider.getTemplates();
+ templates.addAll(Arrays.asList(providerTemplates));
+ }
+ return (ITemplate[]) templates.toArray(new ITemplate[templates.size()]);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateFilter.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateFilter.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateFilter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.project.core;
+
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.project.core.Activator;
+
+import java.util.List;
+import java.util.regex.Pattern;
+
+/**
+ * This class implements the logic used to evaluate the "filterPattern"
+ * used in ESbox templates.
+ * <p>
+ * The pattern is in the form:
+ * <pre>
+ * <SDK platform> [ '|' ... ]
+ * </pre>
+ * @author eswartz
+ *
+ */
+public class ESboxTemplateFilter {
+
+ private static ESboxTemplateFilter instance;
+
+ public static ESboxTemplateFilter getInstance() {
+ if (instance == null) {
+ instance = new ESboxTemplateFilter();
+ }
+ return instance;
+ }
+
+ /**
+ * Tell whether the filter pattern passes, for the given list of
+ * SDK targets.
+ * @param targets the targets that will be used
+ * @param filterPattern the filter pattern from the template
+ * @param matchAll if true, pattern must match all the targets; if false, pattern must not fail on any targets
+ * @return true if pattern matches (keep template), false if not (filter out template)
+ */
+ public boolean passesFilter(List<ISDKTarget> targets, String filterPattern, boolean matchAll) {
+ Pattern pattern = null;
+ try {
+ pattern = Pattern.compile(filterPattern, Pattern.CASE_INSENSITIVE);
+ } catch (IllegalArgumentException e) {
+ Activator.getErrorLogger().logError("Could not compile filterPattern: " + filterPattern, e);
+ return true;
+ }
+
+ boolean matchedAll = true;
+ boolean matchedAny = false;
+ for (ISDKTarget target : targets) {
+ String platform = target.getPlatform().getName();
+ if (pattern.matcher(platform).matches()) {
+ matchedAny = true;
+ } else {
+ matchedAll = false;
+ }
+ }
+ return matchAll ? matchedAll : (matchedAny || targets.size() == 0);
+ }
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateProcessInfo.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateProcessInfo.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ESboxTemplateProcessInfo.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.resources.IProject;
+
+/**
+ * This class stores information used by template processes.
+ * <p>
+ * Sadly, CDT's template parameter map, which claims to be Object -> Object,
+ * is really String -> String, so we can't keep this data in the template parameter
+ * map as we'd like.
+ * <p>
+ * We rely on the presumption that only one wizard will be running at a time
+ * and store information here instead.
+ * @author eswartz
+ *
+ */
+public class ESboxTemplateProcessInfo {
+
+ public static IProject currentProject;
+ public static ESboxConfigHandler currentConfigHandler;
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxBuildConfiguration.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxBuildConfiguration.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxBuildConfiguration.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.resources.IProject;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * This encapsulates access to the data associated with an ESbox build
+ * configuration.
+ * @author eswartz
+ *
+ */
+public interface IESboxBuildConfiguration {
+ /**
+ * Get the project info for the build configuration (will be <code>null</code>
+ * for newly created configuration).
+ * @return {@link IESboxProjectHandle}
+ */
+ IESboxProjectHandle getProjectHandle();
+
+ /**
+ * Get the id
+ * @return per-project unique id
+ */
+ String getId();
+
+ /**
+ * Get the name
+ * @return name of the configuration
+ */
+ String getName();
+
+ /**
+ * Get the project.
+ * @return IProject project
+ */
+ IProject getProject();
+
+ /**
+ * Get the associated SDK target
+ * @return {@link ISDKTarget} or <code>null</code> if not registered
+ */
+ ISDKTarget getSDKTarget();
+
+ /**
+ * Get the associated SDK target name
+ * @return String
+ */
+ String getSDKTargetName();
+
+ /**
+ * Get the associated SDK
+ * @return {@link ISDK} or <code>null</code> if not registered
+ */
+ ISDK getSDK();
+
+ /**
+ * Get the associated SDK name
+ * @return String
+ */
+ String getSDKName();
+
+ /**
+ * Get the execution environment
+ * @return {@link IExecutionEnvironment} or <code>null</code> if not found
+ */
+ IExecutionEnvironment getExecutionEnvironment();
+
+ /**
+ * Get the execution environment identifier
+ * @return String
+ */
+ String getExecutionEnvironmentId();
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxProjectHandle.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxProjectHandle.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxProjectHandle.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * This is the interface abstracting access to an ESbox project from
+ * the underlying build system details.
+ * @author eswartz
+ *
+ */
+public interface IESboxProjectHandle {
+ /**
+ * Get the associated project.
+ * @return IProject
+ */
+ IProject getProject();
+
+ /**
+ * Create a new build configuration. This configuration is free-floating and not active until
+ * the project info is saved.
+ * @param parameters
+ * @return new {@link IESboxBuildConfiguration}
+ */
+ IESboxBuildConfiguration createBuildConfiguration(
+ ESboxBuildConfigurationParameters parameters) throws CoreException;
+
+ /**
+ * Create a new build configuration whose contents are initialized from
+ * another one. This configuration is free-floating and not active until
+ * the project info is saved.
+ * @param parameters where anything not set is taken from baseConfig
+ * @param baseConfig
+ * a base configuaration to take data from
+ * @return new {@link IESboxBuildConfiguration}
+ * @throws CoreException if parameters are invalid, or if project cannot be modified,
+ * or if project cannot accept more than one build configuration
+ */
+ IESboxBuildConfiguration createBuildConfiguration(
+ ESboxBuildConfigurationParameters parameters,
+ IESboxBuildConfiguration baseConfig) throws CoreException;
+
+ /**
+ * Create the project metadata and apply the current build configurations.
+ * Implies #save().
+ * @throws CoreException
+ * @see #createBuildConfiguration(ISDKTarget, String)
+ * @see #addBuildConfiguration(IESboxBuildConfiguration)
+ */
+ void create(IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Save changes made to the project metadata and build configurations.
+ */
+ void save(IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Get the existing build configurations (which apply to ESbox -- ignoring
+ * any others that may exist on the project). This reflects any changes
+ * that have been made but not yet saved.
+ * @return non-<code>null</code> array
+ */
+ IESboxBuildConfiguration[] getBuildConfigurations();
+
+ /**
+ * Remove a build configuration. Project info must be saved before
+ * this takes effect. (I.e., the active build configuration may be a removed
+ * configuration.)
+ * @param config
+ * @throws IllegalArgumentException if config not in project
+ */
+ void removeBuildConfiguration(IESboxBuildConfiguration config) throws CoreException;
+
+ /**
+ * Set the current configuration. This is applied immediately unless changes are pending.
+ * @param config existing configuration
+ */
+ void setCurrentConfiguration(IESboxBuildConfiguration config) throws CoreException;
+
+ /**
+ * Get the current configuration.
+ * @return existing configuration or <code>null</code> if it's not an ESbox build config
+ */
+ IESboxBuildConfiguration getCurrentConfiguration();
+
+ /**
+ * Get the build configuration with the given id
+ * @param id
+ * @return IESboxBuildConfiguration or <code>null</code> if none such exists or it's not an ESbox build config
+ */
+ IESboxBuildConfiguration findBuildConfiguration(String id);
+
+ /**
+ * Return an editable copy of the build configuration. This is not applied until the project is saved.
+ * @param config existing configuration
+ * @throws CoreException
+ */
+ IESboxBuildConfiguration editBuildConfiguration(IESboxBuildConfiguration config) throws CoreException;
+
+ /** Ensure the project will be rebuilt when key aspects of its configuration change.
+ * <p>
+ * We'd love to use the proper "callOnEmptyDelta=true" setting on the builder,
+ * rather than touching the description like this -- but on the other hand, that setting
+ * will force ALL the projects to be built whenever you launch! So this, at least,
+ * makes only the project itself be built rather than all of them, but it also
+ * means that Project > Build can be inert unless Eclipse knows there have been
+ * resource changes OR users use a custom ESbox build command which runs this function.
+ */
+ void clearBuildState();
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxProjectType.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxProjectType.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IESboxProjectType.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.resources.IProject;
+
+/**
+ * This class, implemented by the projectType extension point, creates
+ * IESboxProjectInfo instances for projects.
+ * @author eswartz
+ *
+ */
+public interface IESboxProjectType {
+ /**
+ * Get the unique identifier for this project type.
+ */
+ String getId();
+
+ /**
+ * Tell whether the provider supports the given project.
+ *
+ * @param project
+ * @return boolean
+ */
+ boolean isProjectSupported(IProject project);
+
+ /**
+ * Create an instance of IESboxProjectInfo for the given project.
+ * @param project
+ * @return IESboxProjectInfo
+ */
+ IESboxProjectHandle createProjectHandle(IProject project);
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IIndexerConfigurationSettings.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IIndexerConfigurationSettings.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IIndexerConfigurationSettings.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.runtime.*;
+
+/**
+ * This class manages gathering and setting indexer settings for a CDT project
+ * or build configuration. The specific subclass of this class determines
+ * where the entries go.
+ * <p>
+ * Once constructed, call {@link #initialize(IProgressMonitor)} to gather
+ * existing path entries. Calls to {@link #addMacroDefinition(String, String)}
+ * and {@link #addIncludePath(IPath, boolean)} will update this list. Call
+ * {@link #commit(IProgressMonitor)} to save results back to the project.
+ *
+ * @author eswartz
+ *
+ */
+public interface IIndexerConfigurationSettings {
+
+ /**
+ * Initialize the settings object by reading information.
+ * @param monitor
+ * @throws CoreException
+ */
+ void initialize(IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Add a source folder to all configurations
+ * @param path workspace-relative path
+ */
+ void addSourceFolder(IPath path);
+
+ /**
+ * Add a macro definition to all configurations
+ * @param macroName
+ * @param macroValue
+ */
+ void addMacroDefinition(String macroName, String macroValue);
+
+ /**
+ * Add a macro definition to the given configuration
+ * @param configId
+ * @param macroName
+ * @param macroValue
+ */
+ void addMacroDefinition(String configId, String macroName, String macroValue);
+
+ /**
+ * Add an include path to all configurations
+ * @param entries
+ * @param path SDK target-relative path
+ * @param isSystemInclude
+ */
+ void addIncludePath(IPath path, boolean isSystemInclude);
+
+ /**
+ * Add an include path to the given configuration
+ * @param configId
+ * @param entries
+ * @param path SDK target-relative path
+ * @param isSystemInclude
+ */
+ void addIncludePath(String configId, IPath path, boolean isSystemInclude);
+
+ /**
+ * Commit changes to the indexer settings.
+ * @param monitor
+ */
+ void commit(IProgressMonitor monitor) throws CoreException;
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ILanguageTemplateProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ILanguageTemplateProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ILanguageTemplateProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.maemo.esbox.internal.project.core.Activator;
+
+
+/**
+ * Implementation of the esboxLanguageTemplateProvider extension point.
+ * @author eswartz
+ *
+ */
+public interface ILanguageTemplateProvider {
+ static final String ID = Activator.PLUGIN_ID + ".esboxLanguageTemplateProvider";
+
+ /**
+ * Get all the known templates available for the language.
+ * @return
+ */
+ ITemplate[] getTemplates();
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IOldESboxProjectBuilder.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IOldESboxProjectBuilder.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IOldESboxProjectBuilder.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+/**
+ * @author eswartz
+ *
+ */
+public interface IOldESboxProjectBuilder {
+ /** This is an attribute (value 'true') set on problem markers
+ * generated by the old make builder.
+ */
+ public static final String ATTR_NEEDS_CONVERSION = "convertable";
+
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IOldStyleProjectPropertiesProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IOldStyleProjectPropertiesProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IOldStyleProjectPropertiesProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.resources.IProject;
+
+/**
+ * Implementation of oldStyleProjectPropertiesProvider extension point.
+ * @author eswartz
+ *
+ */
+public interface IOldStyleProjectPropertiesProvider {
+
+ /**
+ * Attempt to create old-style project properties for the given project.
+ * @param project
+ * @return IProjectProperties or <code>null</code> if project format not supported
+ */
+ IProjectProperties createProjectProperties(IProject project);
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IProjectProperties.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IProjectProperties.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/IProjectProperties.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * This interface provides access to properties for the active configuration
+ * of a project. This is a transitional interface for the benefit of old
+ * code.
+ * @author eswartz
+ *
+ */
+public interface IProjectProperties {
+ /**
+ * Get the SDK target (SDK + target name) for the project's configured SDK
+ * @return SDK target, never <code>null</code>
+ * @throws ESboxException if no target known
+ */
+ ISDKTarget getSDKTarget() throws ESboxException;
+
+ /**
+ * Get the SDK for the project
+ * @return SDK, never <code>null</code>
+ * @throws ESboxException if no SDK known
+ */
+ ISDK getSDK() throws ESboxException;
+
+ String getTargetName();
+
+ String getSDKName();
+
+
+ String getExecutionEnvironmentId();
+
+ /**
+ * Get the execution environment registered for a project, or {@link MaemoExecutionEnvironment}
+ * if the property is not registered (for old workspaces)
+ * @param project (may be null for default)
+ * @return {@link IExecutionEnvironment}, never <code>null</code>
+ */
+ IExecutionEnvironment getExecutionEnvironment();
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ITemplate.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ITemplate.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ITemplate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+
+import java.util.Map;
+
+/**
+ * This is an abstract interface to a project or class template.
+ * <p>
+ * This type is adaptable to the real underlying template type for the given
+ * language or toolkit.
+ * @author eswartz
+ *
+ */
+public interface ITemplate extends IAdaptable {
+
+ /**
+ * Get the id for the template
+ * @return
+ */
+ String getTemplateId();
+
+ /**
+ * Get the human-visible name of the template
+ * @return String
+ */
+ String getName();
+
+ /**
+ * Get the description for the template
+ * @return String
+ */
+ String getDescription();
+
+ /**
+ * Get the execution environment this template is intended to work with
+ * @return id or <code>null</code>
+ * @see IExecutionEnvironment
+ */
+ String getExecutionEnvironmentId();
+
+ String getCategory();
+
+ String getProjectNature();
+
+ /**
+ * Get the pattern used to filter templates given the available SDK/targets
+ * @return
+ */
+ String getFilterPattern();
+
+ /**
+ * Get the map of keys to values for items associated with the template.
+ * These are values defined through the template UI or internally by the wizard.
+ * @return Map, never <code>null</code>
+ */
+ Map<String, String> getValueStore();
+
+ /**
+ * Execute template processes, returning statuses in the MultiStatus
+ * @return MultiStatus, never <code>null</code>
+ */
+ MultiStatus executeTemplateProcesses(IProgressMonitor monitor);
+
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ProjectManager.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ProjectManager.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ProjectManager.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,229 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.project.core.Activator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This is the accessor for project access in ESbox.
+ * @author eswartz
+ *
+ */
+public class ProjectManager {
+
+ private static final String PROJECT_TYPE_EXTENSION_ID = Activator.PLUGIN_ID + ".projectType";
+ private static final String OLD_STYLE_PROJECT_PROPERTY_PROVIDER_EXTENSION_ID = Activator.PLUGIN_ID + ".oldStyleProjectPropertiesProvider";
+ private static final String CLASS = "class";
+
+ private static ProjectManager instance;
+
+ public static synchronized ProjectManager getInstance() {
+ if (instance == null) {
+ instance = new ProjectManager();
+ }
+ return instance;
+ }
+
+ private List<IESboxProjectType> projectTypes;
+ private List<IOldStyleProjectPropertiesProvider> oldStyleProjectPropertiesProviders;
+
+ /**
+ *
+ */
+ public ProjectManager() {
+ projectTypes = new ArrayList<IESboxProjectType>();
+ oldStyleProjectPropertiesProviders = new ArrayList<IOldStyleProjectPropertiesProvider>();
+ initializeProjectTypeList();
+ initializeOldStyleProjectPropertiesProviderList();
+ }
+
+ /**
+ * Initialize the list of project types.
+ */
+ private void initializeProjectTypeList() {
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(PROJECT_TYPE_EXTENSION_ID).getExtensions();
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+ try {
+ IESboxProjectType projectType = (IESboxProjectType) config.createExecutableExtension(CLASS);
+ projectTypes.add(projectType);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to create IESboxProjectType", e);
+ }
+
+ }
+ }
+ }
+
+ /**
+ * Initialize the list of old style project property providers.
+ */
+ private void initializeOldStyleProjectPropertiesProviderList() {
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(OLD_STYLE_PROJECT_PROPERTY_PROVIDER_EXTENSION_ID).getExtensions();
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+ try {
+ IOldStyleProjectPropertiesProvider provider =
+ (IOldStyleProjectPropertiesProvider) config.createExecutableExtension(CLASS);
+ oldStyleProjectPropertiesProviders.add(provider);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to create IOldStyleProjectPropertiesProvider", e);
+ }
+
+ }
+ }
+ }
+ /**
+ * Get access to the project properties for the given project. This is a wrapper
+ * for a more complicated set of steps that will get the {@link IESboxProjectHandle}
+ * for the project, access its current {@link IESboxBuildConfiguration}, and read it.
+ * @param project
+ * @return IProjectProperties, never <code>null</code>
+ * @throws ESboxException if project does not exist or is not an ESbox project
+ */
+ public IProjectProperties getProjectProperties(IProject project) throws ESboxException {
+ return new ESboxProjectPropertiesWrapper(project);
+ }
+
+ /**
+ * Get access to the old-style (ESbox 1.4 or older) project properties for the given project.
+ * This should only be used for explicit conversion operations.
+ * @param project
+ * @return IProjectProperties, never <code>null</code>
+ * @throws ESboxException if project's properties cannot be created
+ */
+ public IProjectProperties getOldStyleProjectProperties(IProject project) throws ESboxException {
+ if (!project.exists() || !project.isOpen())
+ throw new ESboxException("Cannot create old-style project properties for nonexistent or closed project " + project.getName());
+ for (IOldStyleProjectPropertiesProvider provider : oldStyleProjectPropertiesProviders) {
+ IProjectProperties properties = provider.createProjectProperties(project);
+ if (properties != null)
+ return properties;
+ }
+ throw new ESboxException("Cannot create old-style project properties for project " + project.getName());
+ }
+
+ /**
+ * Validate setting the SDK target for the given project location.
+ * This ensures the project is in the correct location for the SDK target to function.
+ * @param projectPath the project path to query
+ * @param SDK target to query, never <code>null</code>
+ * @throw {@link ESboxException} if invalid
+ */
+ public void validateSDKTargetForProjectLocation(IPath projectLocation, ISDKTarget sdkTarget) throws ESboxException {
+ sdkTarget.convertHostToTargetPath(projectLocation);
+ }
+
+ /**
+ * Validate setting the SDK target for the project. This ensures the project is
+ * in the correct location for the SDK target to function.
+ * @param project the project to query
+ * @param SDK target to query, never <code>null</code>
+ * @throw {@link ESboxException} if invalid
+ */
+ public void validateSDKTargetForProject(IProject project, ISDKTarget sdkTarget) throws ESboxException {
+ IPath projectLocation = project.getRawLocation();
+ if (projectLocation == null)
+ projectLocation = project.getLocation();
+ validateSDKTargetForProjectLocation(projectLocation, sdkTarget);
+ }
+
+ /**
+ * Get the SDK target (SDK + target name) for the project's configured SDK
+ * @return SDK target, never <code>null</code>
+ * @throws ESboxException if no target known
+ */
+ public ISDKTarget getSDKTarget(IProject project) throws ESboxException {
+ return getProjectProperties(project).getSDKTarget();
+ }
+
+ /**
+ * Get the SDK for the project
+ * @return SDK, never <code>null</code>
+ * @throws ESboxException if no SDK known
+ */
+ public ISDK getSDK(IProject project) throws ESboxException {
+ return getProjectProperties(project).getSDK();
+ }
+
+ /**
+ * Get the project type with the given id.
+ * @param projectTypeId the extension point id of the project type
+ * @return the {@link IESboxProjectType} or <code>null</code>
+ */
+ public IESboxProjectType getProjectType(String projectTypeId) {
+ for (IESboxProjectType projectType : projectTypes) {
+ if (projectType.getId().equals(projectTypeId)) {
+ return projectType;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the project type for the given project.
+ * @param project the existing and open project to query
+ * @return {@link IESboxProjectType} or <code>null</code>
+ */
+ public IESboxProjectType getProjectType(IProject project) {
+ for (IESboxProjectType projectType : projectTypes) {
+ if (projectType.isProjectSupported(project)) {
+ return projectType;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create project info for the given project. This returns a non-unique
+ * handle for accessing an existing project. If you are planning to
+ * create a new project or change an existing project to some other
+ * type, use {@link #getProjectType(String)} and {@link IESboxProjectType#createProjectHandle(IProject)} instead.
+ * @param project the project
+ * @return IESboxProjectInfo or <code>null</code> for unsupported, nonexisting, or closed project
+ */
+ public IESboxProjectHandle getProjectHandle(IProject project) {
+ IESboxProjectType projectType = getProjectType(project);
+ if (projectType == null)
+ return null;
+ return projectType.createProjectHandle(project);
+ }
+
+ /**
+ * Tell if the project is any sort of ESbox project
+ * @param project
+ * @return true: either old or new style C++ project or Python project
+ */
+ public boolean isESboxProject(IProject project) {
+ return getProjectType(project) != null;
+ /*
+ return ESboxProjectNature.isNatureInProject(project)
+ || ESboxCppProjectNature.isNatureInProject(project)
+ || ESboxPythonProjectNature.isESboxPythonProject(project);
+ */
+ }
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ProjectScriptLauncher.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ProjectScriptLauncher.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/ProjectScriptLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+
+/**
+ * Class handle all methods that needs some graphical environment.
+ * It invokes graphical thing that are ordered in window - preferences -
+ * Scratchbox preferences.
+ * @author kosola
+ * modified by Raul Fernandes Herbster
+ * modified by eswartz
+ */
+public class ProjectScriptLauncher {
+
+ private static ProjectScriptLauncher singleton = null;
+
+ /**
+ * Constructor
+ */
+ private ProjectScriptLauncher() {
+ }
+
+ public static synchronized ProjectScriptLauncher getInstance() {
+ if (singleton == null)
+ singleton = new ProjectScriptLauncher();
+ return singleton;
+ }
+
+ /**
+ * Kill all instances of a given process
+ * @param processName executable name
+ * @param processLabel the user-visible name for the process
+ * @throws ScratchboxException
+ */
+ public void killProcess(IMachine machine, String processName, String processLabel) throws ESboxException {
+
+ List<IProcess> processes = machine.getProcessLister().getProcesses(new ProcessFilterCmdLineRegexp(".*" + processName + ".*"));
+ for (IProcess process : processes) {
+ try {
+ process.terminate();
+ } catch (IOException e) {
+ throw new ESboxException("Error killing " + processName, e);
+ }
+ }
+ }
+
+ public void verifyFiles(IPath[] files) throws ESboxException {
+ for (IPath file : files) {
+ if (!file.toFile().exists())
+ throw new ESboxException("File " + file.toPortableString()
+ + " does not exist");
+ }
+ }
+
+ /**
+ * Run 'scriptname' in 'path' location with 'wait' for 'project'.
+ * Once complete, refreshes the project.
+ * @param path
+ * @param scriptname the script, with "./" if needed
+ * @param comment
+ * @param errormessage
+ * @param monitor if not null, wait for progress to finish
+ * @param project
+ * @return exit code (if monitor is not null)
+ */
+ public int runScript(IPath path, String scriptname, final String comment,
+ String errormessage, IProgressMonitor monitor, final IProject project) throws ESboxException {
+ verifyFiles(new IPath[] { path.append(scriptname) });
+
+ IPath wd = path;
+
+ final ISDKTarget sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
+ IPath wdInScratchbox = sdkTarget.convertHostToTargetPath(wd);
+
+ IProcessLauncherFactory launcherFactory = sdkTarget.getProcessLauncherFactory();
+
+ final IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ launcherFactory, wdInScratchbox,
+ scriptname);
+
+ final Process process = processLauncher.createProcess();
+
+ final MessageConsole console = CorePlugin.getDefault().getConsole(
+ true,
+ sdkTarget,
+ comment);
+
+
+ if (monitor == null) {
+ WorkspaceJob job = new WorkspaceJob(comment) {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ monitor.beginTask("", 2);
+ monitor.subTask(comment);
+ try {
+ processLauncher.redirectToConsole(console);
+ try {
+ while (true) {
+ if (monitor.isCanceled()) {
+ process.destroy();
+ return Status.CANCEL_STATUS;
+ }
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ try {
+ process.exitValue();
+ break;
+ } catch (IllegalThreadStateException e) {
+ // still running
+ }
+ monitor.worked(1);
+ }
+ } finally {
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ } finally {
+ monitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.setRule(project);
+ job.schedule();
+ return -1;
+ } else {
+ final int[] exits = { -1 };
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+
+ public void run(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("", 2);
+ monitor.subTask(comment);
+ try {
+ OutputStream out = console.newOutputStream();
+ exits[0] = processLauncher.waitAndRead(out, out, new SubProgressMonitor(monitor, 1));
+ project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
+ } finally {
+ monitor.done();
+ }
+ }
+
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(
+ runnable,
+ project,
+ 0,
+ monitor);
+ } catch (OperationCanceledException e) {
+ // ignore
+ } catch (Exception e) {
+ throw new ESboxException(e);
+ }
+ return exits[0];
+ }
+ }
+
+ /**
+ * Wait for a running process to complete, allowing user to cancel (which kills the process)
+ * @param process the process
+ * @param monitor a progress monitor
+ * @return exit code
+ * @throws InterruptedException if process is canceled
+ */
+ public int waitForProcess(Process process, IProgressMonitor monitor) throws InterruptedException {
+ while (true) {
+ // wait a while to avoid polling
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ throw e;
+ }
+
+ try {
+ // see if the process terminated yet
+ return process.exitValue();
+ } catch (IllegalThreadStateException e) {
+ // thrown by #exitValue() when not finished, good
+ }
+
+ // see if user canceled
+ if (monitor.isCanceled()) {
+ process.destroy();
+ throw new InterruptedException();
+ }
+ }
+ }
+
+ /**
+ * Make sure the build machine associated with the project is alive.
+ * This must be called from the UI thread or some other top-level caller,
+ * since it can deadlock.
+ * @param project
+ * @param monitor
+ */
+ public void ensureBuildMachine(IProject project,
+ IProgressMonitor monitor) throws ESboxException {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ ISDK sdk = ProjectManager.getInstance().getSDK(project);
+ if (sdk == null)
+ throw new ESboxException("Invalid SDK for project: " + project);
+ IMachine machine = sdk.getMachine();
+ IStatus status = MachineManager.getInstance().acquireMachine(machine, monitor);
+ if (!status.isOK())
+ throw new ESboxException(status.getMessage(), status.getException());
+ }
+
+}
Added: trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/XMLPersistentPropertyAccess.java
===================================================================
--- trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/XMLPersistentPropertyAccess.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.core/src/org/maemo/esbox/project/core/XMLPersistentPropertyAccess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.core;
+
+import com.nokia.cpp.internal.api.utils.core.ObjectUtils;
+
+import org.maemo.esbox.core.IPersistentPropertyAccess;
+import org.w3c.dom.Element;
+
+/**
+ * This class implements persistent property storage in XML. Changes are made
+ * to a provided Element. The client is responsible for loading/creating the
+ * document and saving any changes.
+ * @author eswartz
+ *
+ */
+public class XMLPersistentPropertyAccess implements IPersistentPropertyAccess {
+
+ private Element element;
+ private boolean changed;
+
+ /**
+ * Create property access from a loaded document at the given element.
+ * @param storage
+ * @param element
+ */
+ public XMLPersistentPropertyAccess(Element element) {
+ this.element = element;
+ this.changed = false;
+ }
+
+ public Element getElement() {
+ return element;
+ }
+
+ public String read(String propertyId) {
+ if (element == null)
+ return null;
+ return element.getAttribute(propertyId);
+ }
+
+ public void write(String propertyId, String value) {
+ if (element == null)
+ return;
+ if (!ObjectUtils.equals(value, element.getAttribute(propertyId))) {
+ element.setAttribute(propertyId, value);
+ changed = true;
+ }
+ }
+
+ /**
+ * @return the changed
+ */
+ public boolean isChanged() {
+ return changed;
+ }
+
+ /**
+ * @param changed the changed to set
+ */
+ public void setChanged(boolean changed) {
+ this.changed = changed;
+ }
+
+}
Property changes on: trunk/common/org.maemo.esbox.project.ui
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.project.ui/.classpath
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/.classpath (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/org.maemo.esbox.project.ui/.project
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/.project (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.project.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.project.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:22:38 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/org.maemo.esbox.project.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Project UI Plug-in
+Bundle-SymbolicName: org.maemo.esbox.project.ui;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-CoreActivator: org.maemo.esbox.project.ui.noexport.UIActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.ui;bundle-version="1.5.0",
+ org.eclipse.ui.ide;bundle-version="3.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.project.ui,
+ org.maemo.esbox.project.ui.properties,
+ org.maemo.esbox.project.ui.wizards
+Bundle-Activator: org.maemo.esbox.internal.project.ui.UIActivator
Added: trunk/common/org.maemo.esbox.project.ui/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ icons/
Added: trunk/common/org.maemo.esbox.project.ui/icons/full/obj16/fldr_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.project.ui/icons/full/obj16/fldr_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.project.ui/icons/full/obj16/variable_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.project.ui/icons/full/obj16/variable_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/internal/project/ui/UIActivator.java
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/internal/project/ui/UIActivator.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/internal/project/ui/UIActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,145 @@
+package org.maemo.esbox.internal.project.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.project.ui";
+
+ // The shared instance
+ private static UIActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public UIActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return UIActivator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ // The plugin registry
+ private static ImageRegistry imageRegistry = new ImageRegistry(Display.getDefault());
+
+ public static Image getImage(String path) {
+ ImageDescriptor descriptor = imageRegistry.getDescriptor(path);
+ if (descriptor == null) {
+ descriptor = getImageDescriptor(path);
+ imageRegistry.put(path, descriptor);
+ }
+ return imageRegistry.get(path);
+ }
+}
Added: trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/ESboxBuildConfigurationsPage.java
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/ESboxBuildConfigurationsPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/ESboxBuildConfigurationsPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,304 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.project.ui.UIActivator;
+import org.maemo.esbox.project.core.*;
+import org.maemo.esbox.project.ui.properties.BaseESBoxBuildTargetPropertyPage;
+import org.maemo.esbox.ui.ESboxBuildTargetUI;
+import org.maemo.esbox.ui.ESboxBuildTargetUI.IBuildTargetCheckedListener;
+
+import java.util.*;
+
+/**
+ * This page allows managing the build configurations controlled by ESbox.
+ * <p>
+ * This page is displayed either under Project > Properties > ESbox Build Configurations
+ * or the Manage Configurations... dialog.
+ * <p>
+ * For now, this maintains a 1:1 mapping between ISDKTarget and ESboxBuildConfiguration.
+ * Later, we should allow copying, deleting, renaming targets and assigning
+ * unique attributes to their build configurations.
+ * <p>
+ * This UI is shown for old-style ESbox projects as well.
+ * @author eswartz
+ *
+ */
+public class ESboxBuildConfigurationsPage extends BaseESBoxBuildTargetPropertyPage {
+ private CheckboxTreeViewer targetTreeViewer;
+ private List<IESboxBuildConfiguration> currentConfigurations;
+ private Set<ISDKTarget> currentTargets;
+ protected IESboxProjectHandle projectHandle;
+ protected ISDKTarget currentTarget;
+ private boolean targetsWereMissing;
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.properties.BaseESBoxBuildTargetPropertyPage#getPageTitle()
+ */
+ @Override
+ protected String getPageTitle() {
+ return "Configurations";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.properties.BaseESBoxBuildTargetPropertyPage#getInformationText()
+ */
+ @Override
+ protected String getInformationText() {
+ return "Select the build configurations for this project which are used to cross-compile and run your application.\n\nThe selected configuration is the active one.";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.properties.BaseESBoxBuildTargetPropertyPage#createBuildTargetUI(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected void createBuildTargetUI(Composite composite) {
+ Composite control = new Composite(composite, SWT.NONE);
+ GridLayout controlLayout = new GridLayout(2, false);
+
+ controlLayout.marginHeight = 0;
+ controlLayout.marginWidth = 0;
+
+ control.setLayout(controlLayout);
+ control.setLayoutData(new GridData(GridData.FILL_BOTH
+ | GridData.GRAB_VERTICAL));
+
+ Composite tablePane = new Composite(control, SWT.NONE);
+ GridLayout tablePaneLayout = new GridLayout();
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+
+ tablePaneLayout.marginHeight = 0;
+ tablePaneLayout.marginWidth = 0;
+ tablePane.setLayout(tablePaneLayout);
+ tablePane.setLayoutData(gridData);
+
+ targetTreeViewer = ESboxBuildTargetUI.createConfiguredBuildTargetCheckboxViewer(
+ tablePane, ESboxBuildTargetUI.DEFAULT_STYLE);
+
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ targetTreeViewer.getTree().setLayoutData(gridData);
+
+ ESboxBuildTargetUI.setupStandardBuildTargetCheckboxViewer(targetTreeViewer,
+ new IBuildTargetCheckedListener() {
+
+ public void buildTargetChecked(Object selectedElement, Object[] checkedElements) {
+ Set<Object> checked = new LinkedHashSet<Object>(Arrays.asList(checkedElements));
+
+ // add targets
+ currentTargets.clear();
+ for (Object targetObj : checked.toArray()) {
+ if (targetObj instanceof ISDKTarget)
+ currentTargets.add((ISDKTarget) targetObj);
+ }
+
+ updateApplyButton();
+ }
+
+ });
+
+ targetTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ currentTarget = null;
+ for (Iterator<?> iter = ((IStructuredSelection) event.getSelection()).iterator();
+ iter.hasNext(); ) {
+ Object obj = iter.next();
+ if (obj instanceof ISDKTarget) {
+ currentTarget = (ISDKTarget) obj;
+ }
+ }
+ updateApplyButton();
+
+ }
+
+ });
+
+ refreshData();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#isValid()
+ */
+ @Override
+ public boolean isValid() {
+ boolean valid = true;
+ setErrorMessage(null);
+ if (currentTargets.isEmpty()) {
+ if (targetsWereMissing)
+ setErrorMessage("One or more build targets is no longer present; choose a new current build target.");
+ else
+ setErrorMessage("No build targets are checked");
+ valid = false;
+ } else if (currentTarget == null || !currentTargets.contains(currentTarget)) {
+ setErrorMessage("The (new) current target must be selected");
+ valid = false;
+ }
+ return valid;
+ }
+
+ /**
+ *
+ */
+ private void refreshData() {
+ currentConfigurations = getCurrentConfigurations();
+
+ // TODO: this is provisional, assuming a close to 1:1 relation
+ // between IESBoxBuildConfiguration and ISDKTarget
+
+ currentTargets = new LinkedHashSet<ISDKTarget>();
+ for (IESboxBuildConfiguration config : currentConfigurations) {
+ ISDKTarget sdkTarget = config.getSDKTarget();
+ if (sdkTarget != null)
+ currentTargets.add(sdkTarget);
+ }
+ targetsWereMissing = currentConfigurations.size() > 0 && currentTargets.isEmpty();
+
+ IESboxBuildConfiguration currentConfiguration = projectHandle.getCurrentConfiguration();
+ if (currentConfiguration != null)
+ currentTarget = currentConfiguration.getSDKTarget();
+
+ // populate the tree and set the SDK targets corresponding to the build configs
+ targetTreeViewer.setInput(new Object());
+ targetTreeViewer.setCheckedElements((ISDKTarget[]) currentTargets.toArray(new ISDKTarget[currentTargets.size()]));
+
+ if (currentTarget != null)
+ targetTreeViewer.setSelection(new StructuredSelection(currentTarget));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.PropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public void setElement(IAdaptable element) {
+ super.setElement(element);
+ if (project != null)
+ projectHandle = ProjectManager.getInstance().getProjectHandle(project);
+ else
+ projectHandle = null;
+ }
+
+ /**
+ * Get the current ESbox configurations for the project
+ * @param project
+ * @return
+ */
+ protected java.util.List<IESboxBuildConfiguration> getCurrentConfigurations() {
+ if (projectHandle != null) {
+ IESboxBuildConfiguration[] configs = projectHandle.getBuildConfigurations();
+ return Arrays.asList(configs);
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performOk()
+ */
+ @Override
+ public boolean performOk() {
+ IESboxBuildConfiguration someConfig = null;
+ IESboxBuildConfiguration currentConfig = null;
+
+ boolean changed = false;
+
+ for (ISDKTarget target : currentTargets) {
+ // make sure we have at least one build config per target
+ boolean found = false;
+ IESboxBuildConfiguration config = null;
+
+ // find a config matching the SDK target selected
+ for (IESboxBuildConfiguration aConfig : currentConfigurations) {
+ if (aConfig.getSDKTargetName().equals(target.getName())) {
+ config = aConfig;
+ found = true;
+ break;
+ }
+
+ // for a new SDK target, figure a default to steal settings from (TODO: provide UI)
+ if (aConfig.getSDKTarget() != null)
+ someConfig = aConfig;
+ }
+
+
+ if (!found) {
+ ESboxBuildConfigurationParameters parameters =
+ new ESboxBuildConfigurationParameters(target.getName(),
+ target);
+ try {
+ config = projectHandle.createBuildConfiguration(parameters, someConfig);
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().logAndShowError("Failed to create new build configuration", e);
+ }
+
+ changed = true;
+ }
+
+ if (currentTarget == target) {
+ currentConfig = config;
+ }
+ }
+
+ // Remove any configurations for which the SDK target is no longer selected.
+
+ // XXX: for now, delete invalid build configs too (no other way to remove them)
+ for (IESboxBuildConfiguration config : currentConfigurations) {
+ if (config.getSDKTarget() == null || !currentTargets.contains(config.getSDKTarget())) {
+ try {
+ if (config == currentConfig)
+ currentConfig = null;
+ projectHandle.removeBuildConfiguration(config);
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().logAndShowError("Failed to delete build configuration: " + config, e);
+ }
+ changed = true;
+ }
+ }
+
+ if (currentConfig != null && !currentConfig.equals(projectHandle.getCurrentConfiguration())) {
+ try {
+ projectHandle.setCurrentConfiguration(currentConfig);
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().logAndShowError("Failed to set current build configuration", e);
+ }
+ changed = true;
+ }
+
+ if (changed) {
+ try {
+ projectHandle.save(null);
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().logAndShowError("Failed to save build configurations", e);
+ }
+ }
+
+ refreshData();
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.properties.BaseESBoxBuildTargetPropertyPage#refresh()
+ */
+ @Override
+ protected void refresh() {
+ targetTreeViewer.refresh();
+ }
+}
Added: trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/ESboxProjectContentsArea.java
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/ESboxProjectContentsArea.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/ESboxProjectContentsArea.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,411 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.project.ui;
+
+import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.*;
+import org.eclipse.osgi.util.TextProcessor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.project.core.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * Based on {@link ProjectContentsArea}. This class had to be rewritten because the default value cannot
+ * be modified by extending the class and overloading or implementing an abstract method. Because of such
+ * modification, others classes had to be rewritten.
+ */
+public class ESboxProjectContentsArea {
+ private static final String ERROR_INVALID_PATH = "The path is invalid.";
+ private static final String ERROR_PATH_EMPTY = "The path is empty.";
+ private static final String ERROR_NOT_ABSOLUTE = "The path is not absolute.";
+ private static final String ERROR_NOT_VALID = "The path is invalid.";
+ private static final String ERROR_CANNOT_CREATE = "Cannot create a folder at the path.";
+ private static final String ERROR_FILE_EXISTS = "The path refers to a file.";
+
+ //private static final String DEFAULT_LOCATION = CoreActivator.getDefault().getPluginPreferences().getString(ESboxPreferenceConstants.SBOX_WORKSPACE.toString());
+ private static final String BROWSE_LABEL = "Browse...";
+ private static final int SIZING_TEXT_FIELD_WIDTH = 250;
+ private Label locationLabel;
+ private Text locationPathField;
+ private Button browseButton;
+ private IErrorMessageReporter errorReporter;
+ private String projectName = "";
+ private Button useDefaultsButton;
+ private IProject existingProject;
+ private ESboxConfigHandler esboxHandler;
+
+ /**
+ * Create a new instance of a ProjectContentsLocationArea.
+ *
+ * @param composite
+ */
+ public ESboxProjectContentsArea(ESboxConfigHandler esboxHandler, IErrorMessageReporter er) {
+ this.esboxHandler = esboxHandler;
+ errorReporter = er;
+ }
+
+ /**
+ * Create the contents of the receiver.
+ *
+ * @param composite
+ * @param defaultEnabled
+ * @return
+ */
+ public Composite createContents(Composite composite, boolean defaultEnabled) {
+ // project specification group
+ Composite projectGroup = new Composite(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 4;
+ projectGroup.setLayout(layout);
+
+ useDefaultsButton = new Button(projectGroup, SWT.CHECK | SWT.RIGHT);
+ useDefaultsButton.setText("Use default location");
+ useDefaultsButton.setSelection(defaultEnabled);
+ GridData buttonData = new GridData();
+ buttonData.horizontalSpan = 4;
+ useDefaultsButton.setLayoutData(buttonData);
+
+ createUserEntryArea(projectGroup, defaultEnabled);
+
+ useDefaultsButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ boolean useDefaults = useDefaultsButton.getSelection();
+ locationPathField.setText(TextProcessor.process(getProjectLocation()));
+ setUserAreaEnabled(!useDefaults);
+ }
+ });
+ setUserAreaEnabled(!defaultEnabled);
+ return projectGroup;
+ }
+
+ /**
+ * Return whether or not we are currently showing the default location for
+ * the project.
+ *
+ * @return boolean
+ */
+ public boolean isDefault() {
+ return useDefaultsButton.getSelection();
+ }
+
+ /**
+ * Create the area for user entry.
+ *
+ * @param composite
+ * @param defaultEnabled
+ */
+ private void createUserEntryArea(Composite composite, boolean defaultEnabled) {
+ // location label
+ locationLabel = new Label(composite, SWT.NONE);
+ locationLabel.setText("Location:"); //$NON-NLS-1$
+
+ // project location entry field
+ locationPathField = new Text(composite, SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = SIZING_TEXT_FIELD_WIDTH;
+ data.horizontalSpan = 2;
+ locationPathField.setLayoutData(data);
+
+ // browse button
+ browseButton = new Button(composite, SWT.PUSH);
+ browseButton.setText(BROWSE_LABEL);
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ handleLocationBrowseButtonPressed();
+ }
+ });
+
+ if (defaultEnabled) {
+ locationPathField.setText(TextProcessor
+ .process(getDefaultPathDisplayString()));
+ } else {
+ if (existingProject == null) {
+ locationPathField.setText("");
+ } else {
+ locationPathField.setText(TextProcessor.process(existingProject
+ .getLocation().toString()));
+ }
+ }
+
+ locationPathField.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ errorReporter.reportError(checkValidLocation());
+ }
+ });
+ }
+
+ /**
+ * Return the path we are going to display. If it is a file URI then remove
+ * the file prefix.
+ *
+ * NOTE: this method had to be modified to change the value displayed at path text element.
+ * The default value points to the workspace inside Scratchbox.
+ *
+ * @return String
+ */
+ private String getDefaultPathDisplayString() {
+
+ /*
+ URI defaultURI = null;
+ if (existingProject != null) {
+ defaultURI = existingProject.getLocationURI();
+ }
+
+ // Handle files specially. Assume a file if there is no project to query
+ if (defaultURI == null || defaultURI.getScheme().equals(FILE_SCHEME)) {
+ //return DEFAULT_LOCATION.concat(projectName).toString();
+
+ ISDK sdk = esboxHandler.getSDK();
+ if (sdk != null)
+ return esboxHandler.getSDK().getSDKRoot().toOSString();
+ else
+ return "";
+ }
+ return defaultURI.toString();
+ */
+ return getProjectLocation();
+
+ }
+
+ /**
+ * Set the enablement state of the receiver.
+ *
+ * @param enabled
+ */
+ private void setUserAreaEnabled(boolean enabled) {
+ locationLabel.setEnabled(enabled);
+ locationPathField.setEnabled(enabled);
+ browseButton.setEnabled(enabled);
+ }
+
+ /**
+ * Return the browse button. Usually referenced in order to set the layout
+ * data for a dialog.
+ *
+ * @return Button
+ */
+ public Button getBrowseButton() {
+ return browseButton;
+ }
+
+ /**
+ * Open an appropriate directory browser
+ */
+ private void handleLocationBrowseButtonPressed() {
+
+ String selectedDirectory = null;
+ String dirName = getPathFromLocationField();
+
+ if (!dirName.equals("")) {
+ File f = new Path(dirName).toFile();
+ if (!f.exists()) dirName = "";
+ }
+
+ DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
+ dialog.setMessage("Select a project location"); //$NON-NLS-1$
+ dialog.setFilterPath(dirName);
+ selectedDirectory = dialog.open();
+
+ if (selectedDirectory != null)
+ updateLocationField(selectedDirectory);
+ }
+
+ /**
+ * Update the location field based on the selected path.
+ *
+ * @param selectedPath
+ */
+ private void updateLocationField(String selectedPath) {
+ locationPathField.setText(TextProcessor.process(selectedPath));
+ }
+
+ /**
+ * Return the path on the location field.
+ *
+ * @return String
+ */
+ private String getPathFromLocationField() {
+ URI fieldURI;
+ try {
+ fieldURI = new URI(locationPathField.getText());
+ } catch (URISyntaxException e) {
+ return locationPathField.getText();
+ }
+ return fieldURI.getPath();
+ }
+
+ /**
+ * Check if the entry in the widget location is valid. If it is valid return
+ * null. Otherwise return a string that indicates the problem.
+ *
+ * @return String
+ */
+ public String checkValidLocation() {
+
+ if (isDefault()) return null;
+
+ String locationFieldContents = locationPathField.getText();
+
+ if (locationFieldContents.length() == 0)
+ return ERROR_PATH_EMPTY;
+
+ URI newPath = getProjectLocationURI();
+
+ if (newPath == null)
+ return ERROR_INVALID_PATH;
+
+ if (!Path.EMPTY.isValidPath(locationFieldContents))
+ return ERROR_NOT_VALID;
+
+ Path p = new Path(locationFieldContents);
+
+ if (!p.isAbsolute())
+ return ERROR_NOT_ABSOLUTE;
+
+ // first require it to be visible from all targets if needed
+ for (ESboxBuildConfigurationParameters params : esboxHandler.getBuildConfigurationParameters()) {
+ if (params.getSdkTarget() != null) {
+ try {
+ ProjectManager.getInstance().validateSDKTargetForProjectLocation(
+ p, params.getSdkTarget());
+ } catch (ESboxException e) {
+ return e.getMessage();
+ }
+ }
+ }
+
+ // try to create dummy file
+ File f = p.toFile();
+ if (!f.exists()) {
+ boolean result = false;
+ try {
+ result = f.createNewFile();
+ } catch (IOException e) {}
+
+ if (result)
+ f.delete();
+ else
+ return ERROR_CANNOT_CREATE;
+ } else {
+ if (f.isFile())
+ return ERROR_FILE_EXISTS;
+ }
+
+ // ignore the user path when it is the same as the default
+ if (!p.equals(getDefaultProjectLocation())) {
+ //create a dummy project for the purpose of validation if necessary
+ IProject project = existingProject;
+ if (project == null) {
+ String name = new Path(locationFieldContents).lastSegment();
+ if (name != null && Path.EMPTY.isValidSegment(name))
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ else
+ return ERROR_INVALID_PATH;
+ }
+ IStatus locationStatus = project.getWorkspace().validateProjectLocationURI(project, newPath);
+
+ if (!locationStatus.isOK()) {
+ return locationStatus.getMessage();
+ }
+ }
+ if (existingProject != null) {
+ URI projectPath = existingProject.getLocationURI();
+ if (projectPath != null && URIUtil.equals(projectPath, newPath))
+ return ERROR_INVALID_PATH;
+ }
+
+ return null;
+ }
+
+ /**
+ * Get the URI for the location field if possible.
+ * @return URI or <code>null</code> if it is not valid.
+ */
+ public URI getProjectLocationURI() {
+ return URIUtil.toURI(getProjectLocation()); //locationPathField.getText());
+ }
+
+ /**
+ * Set the text to the default or clear it if not using the defaults.
+ * @param newName
+ * the name of the project to use. If <code>null</code> use the
+ * existing project name.
+ */
+ public void updateProjectName(String newName) {
+ projectName = newName;
+ if (isDefault())
+ locationPathField.setText(TextProcessor.process(getDefaultPathDisplayString()));
+ }
+
+ /**
+ * Return the location for the project. If we are using defaults then return
+ * an appropriate location for all the selected SDKs.
+ * <p>
+ * NOTE: this method was modified to return the correct ESbox project location. If it is
+ * default, the location is pointed to Scratchbox internal workspace.
+ *
+ * @return String
+ */
+ public String getProjectLocation() {
+ if (isDefault()) {
+ IPath wsLocation = getDefaultProjectLocation();
+ ISDKTarget defaultSdkTarget = esboxHandler.getInitialSDKTarget();
+ try {
+ // make sure the workspace's default location is in the sdk scope
+ for (ESboxBuildConfigurationParameters params : esboxHandler.getBuildConfigurationParameters()) {
+ // run to validate the check and throw away the result... if no exception, it's OK
+ ISDKTarget sdkTarget = params.getSdkTarget();
+ if (sdkTarget != null)
+ sdkTarget.convertHostToTargetPath(wsLocation);
+ }
+
+ // they all succeeded
+ return wsLocation.toOSString();
+ } catch (ESboxException e) {
+ // not valid, make a recommended path
+ return defaultSdkTarget.getSDKRoot()
+ .append("home")
+ .append(defaultSdkTarget.getPreferenceValue(ESboxPreferenceConstants.USER))
+ .append("workspace")
+ .append(projectName).toOSString();
+ }
+
+ }
+ return locationPathField.getText();
+ }
+
+ public IPath getDefaultProjectLocation() {
+ return ResourcesPlugin.getWorkspace().getRoot().getLocation().append(projectName);
+ }
+
+ /**
+ * IErrorMessageReporter is an interface for type that allow message
+ * reporting. Null means "clear error messages area".
+ */
+ public interface IErrorMessageReporter {
+ public void reportError(String errorMessage);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/properties/BaseESBoxBuildTargetPropertyPage.java
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/properties/BaseESBoxBuildTargetPropertyPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/properties/BaseESBoxBuildTargetPropertyPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG)
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.project.ui.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.ui.IPreferenceConstants;
+
+
+/**
+ * This is the base property page for configuring project build targets.
+ * @author romulo
+ * @author eswartz
+ */
+public abstract class BaseESBoxBuildTargetPropertyPage extends PropertyPage implements IWorkbenchPropertyPage {
+ protected IProject project;
+
+ /**
+ * Constructs a new TargetPreferencePage.
+ */
+ public BaseESBoxBuildTargetPropertyPage() {
+ setTitle(getPageTitle());
+ setPreferenceStore(CorePlugin.getDefault().getPreferenceStore());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.PropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public void setElement(IAdaptable element) {
+ super.setElement(element);
+ project = null;
+ if (element == null)
+ return;
+ IResource resource = (IResource)getElement().getAdapter(IResource.class);
+ if (resource == null)
+ return;
+ project = resource.getProject();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(final Composite parent) {
+ Composite labelPane = new Composite(parent, SWT.NONE);
+ labelPane.setLayout(new GridLayout());
+ labelPane.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+
+ Link hyperlink = new Link(labelPane, SWT.NONE);
+ hyperlink.setText("<a href=\"workspace\">Configure global ESbox Targets...</a>");
+ hyperlink.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, true));
+
+ hyperlink.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
+ getShell(),
+ IPreferenceConstants.ESBOX_PREFERENCE_TARGETS_ID,
+ new String[] {
+ IPreferenceConstants.ESBOX_PREFERENCE_GROUP_ID,
+ IPreferenceConstants.ESBOX_PREFERENCE_TARGETS_ID,
+ },
+ null);
+ dialog.open();
+ refresh();
+ }
+ });
+
+ //Label separator = new Label(labelPane, SWT.SEPARATOR | SWT.HORIZONTAL);
+ //separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(getPageTitle());
+ label.setFont(JFaceResources.getFontRegistry().getBold(
+ JFaceResources.DIALOG_FONT));
+
+ addCustomLeadingUI(parent);
+
+ Composite control = new Composite(parent, SWT.NONE);
+ GridLayout controlLayout = new GridLayout(2, false);
+
+ controlLayout.marginHeight = 0;
+ controlLayout.marginWidth = 0;
+
+ control.setLayout(controlLayout);
+ control.setLayoutData(new GridData(GridData.FILL_BOTH
+ | GridData.GRAB_VERTICAL));
+
+ createBuildTargetUI(control);
+
+ Label information = new Label(labelPane, SWT.WRAP);
+ information.setText(getInformationText());
+ information.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
+
+ addCustomTrailingUI(parent);
+
+ Dialog.applyDialogFont(control);
+
+ return control;
+ }
+
+ /**
+ * Add any custom UI to the top of the page
+ * @param control
+ */
+ protected void addCustomLeadingUI(Composite control) {
+ }
+ /**
+ * Add any custom UI to the bottom of the page
+ * @param control
+ */
+ protected void addCustomTrailingUI(Composite control) {
+ }
+
+ /**
+ * Create the UI
+ * @param control
+ */
+ abstract protected void createBuildTargetUI(Composite control);
+
+ /**
+ * Refresh the UI after the ESbox Targets UI dialog is closed.
+ */
+ abstract protected void refresh();
+
+ /**
+ * Get the information label which shows up at the top of the page.
+ * @return
+ */
+ protected abstract String getInformationText();
+
+ /**
+ * Get the big title of the page.
+ * @return
+ */
+ protected abstract String getPageTitle();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ // Nothing to do
+ }
+
+ protected IProject getProject() {
+ return ((IResource)getElement().getAdapter(IResource.class)).getProject();
+ }
+
+}
Added: trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/properties/ESboxProjectPropertyPage.java
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/properties/ESboxProjectPropertyPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/properties/ESboxProjectPropertyPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG)
+ *******************************************************************************/
+
+package org.maemo.esbox.project.ui.properties;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.maemo.esbox.core.CorePlugin;
+
+
+ at Deprecated //This panel is not shown currently
+public class ESboxProjectPropertyPage extends PropertyPage implements
+ IWorkbenchPropertyPage {
+
+ public ESboxProjectPropertyPage() {
+ setTitle("ESbox Properties");
+ setPreferenceStore(CorePlugin.getDefault().getPreferenceStore());
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite labelPane = new Composite(parent, SWT.NONE);
+ labelPane.setLayout(new GridLayout());
+ labelPane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label information = new Label(labelPane, SWT.NONE);
+ information
+ .setText("Expand the tree to edit properties of your ESbox project.");
+ return labelPane;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxBaseProjectTargetSelectionPage.java
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxBaseProjectTargetSelectionPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxBaseProjectTargetSelectionPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,426 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.ui.wizards;
+
+import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.project.ui.UIActivator;
+import org.maemo.esbox.project.core.*;
+import org.maemo.esbox.project.ui.ESboxProjectContentsArea;
+import org.maemo.esbox.project.ui.ESboxProjectContentsArea.IErrorMessageReporter;
+
+import java.io.File;
+import java.net.URI;
+import java.util.Collections;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class ESboxBaseProjectTargetSelectionPage extends WizardPage {
+
+ static final Image IMG_SDK = UIActivator.getImage("icons/full/obj16/fldr_obj.gif");
+ static final Image IMG_TARGET = UIActivator.getImage("icons/full/obj16/variable_obj.gif");
+ protected Text projectNameField;
+ protected IPath projectLocation;
+ protected ESboxProjectContentsArea locationArea;
+ private String initialProjectFieldValue;
+ protected ESboxConfigHandler configHandler;
+ protected Button filterTargetsButton;
+ protected ITemplate defaultProjectNameTemplate;
+
+ class TemplateTargetFilter extends ViewerFilter {
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
+ if (!(element instanceof ISDKTarget)) {
+ return true;
+ }
+
+ if (filterTargetsButton.getSelection() == false)
+ return true;
+
+ if (configHandler.getTemplate() == null)
+ return true;
+
+ ISDKTarget target = (ISDKTarget) element;
+ String filterPattern = configHandler.getTemplate().getFilterPattern();
+ if (filterPattern == null)
+ return true;
+
+ return ESboxTemplateFilter.getInstance().passesFilter(
+ Collections.singletonList(target),
+ filterPattern,
+ true);
+ }
+
+ }
+ /**
+ * @param configHandler2
+ */
+ public ESboxBaseProjectTargetSelectionPage(ESboxConfigHandler configHandler) {
+ super("wizardPage");
+ setTitle("Project Configuration");
+ setDescription(getPageDescription());
+ this.configHandler = configHandler;
+ projectLocation = new Path("");
+ defaultProjectNameTemplate = null;
+ }
+
+ /**
+ * @return
+ */
+ abstract protected String getPageDescription();
+
+ /**
+ * @param pageName
+ * @param title
+ * @param titleImage
+ */
+ public ESboxBaseProjectTargetSelectionPage(String pageName, String title,
+ ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+ /**
+ * Get an error reporter for the receiver.
+ * @return IErrorMessageReporter
+ */
+ private IErrorMessageReporter getErrorReporter() {
+ return new IErrorMessageReporter(){
+ public void reportError(String errorMessage) {
+ setErrorMessage(errorMessage);
+ boolean valid = errorMessage == null;
+ if(valid) valid = validatePage();
+ setPageComplete(valid);
+ }
+ };
+ }
+
+ /**
+ * Create contents of the wizard
+ * @param parent
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ final GridLayout gridLayout_2 = new GridLayout();
+ gridLayout_2.numColumns = 2;
+ container.setLayout(gridLayout_2);
+ //
+ setControl(container);
+
+ final Label projectNameLabel = new Label(container, SWT.NONE);
+ projectNameLabel.setText("Project &name:");
+
+ projectNameField = new Text(container, SWT.BORDER);
+ projectNameField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ projectNameField.addListener(SWT.Modify, new Listener() {
+ public void handleEvent(Event e) {
+ locationArea.updateProjectName(projectNameField.getText().trim());
+ setPageComplete(validatePage());
+ }
+ });
+
+ locationArea = new ESboxProjectContentsArea(configHandler, getErrorReporter());
+ Composite locationAreaComposite = locationArea.createContents(container, true);
+ GridData gd_locationArea = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gd_locationArea.horizontalSpan = 2;
+ locationAreaComposite.setLayoutData(gd_locationArea);
+
+ createTargetSelectionUI(container);
+
+
+ filterTargetsButton = new Button(container, SWT.CHECK);
+ final GridData gd_filterTargetsButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
+ filterTargetsButton.setLayoutData(gd_filterTargetsButton);
+ filterTargetsButton.setText("F&ilter build targets based on selected template");
+ filterTargetsButton.setSelection(true);
+
+ filterTargetsButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ refreshTargets();
+ }
+ });
+
+ // make everything go
+ initializeTargetModel();
+
+ setPageComplete(false);
+ }
+
+ /**
+ * Create the target selection UI in the given container
+ */
+ abstract protected void createTargetSelectionUI(Composite container);
+
+ /**
+ * Initialize the target viewer
+ */
+ abstract protected void initializeTargetModel();
+
+ /**
+ * Refresh the target viewer
+ */
+ abstract protected void refreshTargets();
+
+ /**
+ * Select the default targets when the target UI becomes visible
+ */
+ abstract protected void selectDefaultSDKTargets();
+
+
+
+ @Override
+ public void setVisible(boolean visible) {
+ // get a default project name when first we see the page
+ updateDefaultProjectName();
+
+ // get a sensible default target
+ selectDefaultSDKTargets();
+
+ super.setVisible(visible);
+ }
+
+ protected void updateDefaultProjectName() {
+ ITemplate template = configHandler.getTemplate();
+ if (template == null)
+ return;
+
+ if (defaultProjectNameTemplate != template || initialProjectFieldValue == null) {
+ if (template != null) {
+ String id = template.getTemplateId();
+
+ // the last segment is sufficient
+ int idx = id.lastIndexOf('.');
+ if (idx >= 0)
+ initialProjectFieldValue = id.substring(idx + 1).toLowerCase();
+ else
+ initialProjectFieldValue = id.toLowerCase();
+
+ projectNameField.setText(initialProjectFieldValue);
+ locationArea.updateProjectName(initialProjectFieldValue);
+ defaultProjectNameTemplate = template;
+ }
+ }
+ }
+
+ /**
+ * Get the default project location, based on the name
+ * @return
+ */
+ protected IPath getDefaultProjectLocation() {
+ return getProjectHandle().getLocation();
+ }
+
+ /**
+ * Update variables when the project location changes
+ */
+ protected void changeProjectLocation(String path) {
+ projectLocation = new Path(path);
+
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ if (projectNameField.getText().length() == 0)
+ return false;
+ // in case template changed
+ refreshTargets();
+ return super.isPageComplete();
+ }
+
+ /**
+ * Returns whether this page's controls currently all contain valid
+ * values.
+ *
+ * @return <code>true</code> if all controls are valid, and
+ * <code>false</code> if at least one is invalid
+ */
+ protected boolean validatePage() {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ setMessage(null);
+
+ String projectFieldContents = getProjectNameFieldValue();
+ if (projectFieldContents.length() == 0) {
+ setErrorMessage("Project name cannot be empty."); //$NON-NLS-1$
+ return false;
+ }
+
+ IStatus nameStatus = workspace.validateName(projectFieldContents,
+ IResource.PROJECT);
+ if (!nameStatus.isOK()) {
+ setErrorMessage(nameStatus.getMessage());
+ return false;
+ }
+
+ IProject handle = getProjectHandle();
+
+ // see if Eclipse knows about the project
+ if (handle.exists()) {
+ setErrorMessage("A project with this name already exists."); //$NON-NLS-1$
+ return false;
+ }
+
+ // see if the filesystem knows about it
+ File f = new File(getProjectLocation().getPath());
+ if (f.exists()) {
+ if (f.isDirectory()) {
+ setMessage("The project location already exists.", DialogPage.ERROR); //$NON-NLS-1$
+ return false;
+ } else {
+ setErrorMessage("The project location points to a file."); //$NON-NLS-1$
+ return false;
+ }
+ }
+
+ String msg = locationArea.checkValidLocation();
+ if (msg != null) {
+ setErrorMessage(msg);
+ return false;
+ }
+
+ // make sure the target is selected
+ if (configHandler.getBuildConfigurationParameters().isEmpty()) {
+ setErrorMessage("No build target(s) selected.");
+ return false;
+ }
+
+ if (configHandler.getInitialTargetName() == null) {
+ setErrorMessage("No initial build target selected.");
+ return false;
+ }
+
+ setErrorMessage(null);
+ return true;
+ }
+
+ /**
+ * Returns the current project name as entered by the user, or its anticipated
+ * initial value.
+ *
+ * @return the project name, its anticipated initial value, or <code>null</code>
+ * if no project name is known
+ */
+ public String getProjectName() {
+ if (projectNameField == null) {
+ return initialProjectFieldValue;
+ }
+ return getProjectNameFieldValue();
+ }
+
+ public URI getProjectLocation() {
+ return URIUtil.toURI(locationArea.getProjectLocation());
+ }
+
+ /**
+ * Creates a project resource handle for the current project name field value.
+ * <p>
+ * This method does not create the project resource; this is the responsibility
+ * of <code>IProject::create</code> invoked by the new project resource wizard.
+ * </p>
+ *
+ * @return the new project resource handle
+ */
+ protected IProject getProjectHandle() {
+ String projectName = getProjectNameFieldValue();
+ if (projectName.length() == 0)
+ return null;
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ }
+
+ /**
+ * Returns the value of the project name field
+ * with leading and trailing spaces removed.
+ *
+ * @return the project name in the field
+ */
+ private String getProjectNameFieldValue() {
+ if (projectNameField == null) {
+ return ""; //$NON-NLS-1$
+ }
+
+ return projectNameField.getText().trim();
+ }
+
+ /**
+ * Get the project location to set in a project description.
+ * This will be null if the project will be created in the default location
+ * (this differs from the "is default" checkbox since the location
+ * may have been adjusted to point inside the scratchbox installation).
+ * @return IPath or null
+ */
+ public IPath getProjectDescriptionLocation() {
+ //IPath projectLocation = getProjectLocation();
+ IPath projectLocation = new Path(getProjectLocation().getPath());
+ if (projectLocation.equals(locationArea.getDefaultProjectLocation()))
+ return null;
+ return projectLocation;
+ }
+
+ /**
+ * Get a candidate SDK target for use as a default selection
+ * @return
+ */
+ protected ISDKTarget getCandidateSDKTarget() {
+ if (configHandler.getInitialSDKTarget() != null) {
+ return configHandler.getInitialSDKTarget();
+ }
+ return null;
+
+ /*
+
+ ISDKTarget currentSDKTarget = null;
+
+ // select the last known SB1 SDK target
+ if (currentSDKTarget == null) {
+ try {
+ currentSDKTarget = ScratchboxFacade.getInstance().getCurrentSDKTarget(
+ ScratchboxSDKFacade.getInstance().getScratchbox1SDK());
+ } catch (ScratchboxException e1) {
+ // ok, ignore that... try for the first sb2 target
+ }
+ }
+
+ // select the last known SB2 SDK target
+ if (currentSDKTarget == null) {
+ try {
+ currentSDKTarget = ScratchboxFacade.getInstance().getCurrentSDKTarget(
+ ScratchboxSDKFacade.getInstance().getScratchbox2SDK());
+ } catch (ScratchboxException e2) {
+ // ok, that didn't work either
+ }
+ }
+ return currentSDKTarget;
+ }
+
+ */
+ }
+
+
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxCommonNewProjectWizard.java
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxCommonNewProjectWizard.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxCommonNewProjectWizard.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,284 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation, INdT
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia) - rewrite of work from Raul
+ *******************************************************************************/
+package org.maemo.esbox.project.ui.wizards;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
+import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
+import org.maemo.esbox.internal.project.ui.UIActivator;
+import org.maemo.esbox.project.core.*;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+
+/**
+ * This common wizard for new projects is adapted from the original
+ * ESboxCommonProjectWizard and follows the Nokia Carbide.c++ convention for
+ * page layout:
+ * <p>
+ * <li>Target selection (SDK_ARMEL, etc)</li>
+ * <li>Template selection (filtered by selected target, or optionally not)</li>
+ * <li>Variable selection (generated by template wizard for selected template)</li>
+ * </p>
+ */
+public abstract class ESboxCommonNewProjectWizard extends BasicNewResourceWizard
+implements IExecutableExtension {
+
+ protected IConfigurationElement fConfigElement;
+
+ private ESboxConfigHandler configHandler;
+ private IWizardPage[] templatePages;
+
+ private ESboxBaseProjectTargetSelectionPage fProjectTargetPage;
+ private ESboxTemplateSelectionPage fTemplatePage;
+ private ESboxProjectCreatorConverter projectCreator;
+
+ /**
+ * Construct a new wizard with the given title and description.
+ * @param title the title of the wizard.
+ * @param desc the description of the wizard.
+ */
+ public ESboxCommonNewProjectWizard(String title, String desc) {
+ super();
+ setDialogSettings(UIActivator.getDefault().getDialogSettings());
+ setForcePreviousAndNextButtons(true);
+ setWindowTitle(title);
+ }
+
+ /**
+ * This must be called from subclasses before using the wizard.
+ * @param handler
+ */
+ protected void setConfigHandler(ESboxConfigHandler handler) {
+ this.configHandler = handler;
+
+ }
+ /**
+ * This must be called from subclasses before using the wizard.
+ * @param projectCreator
+ */
+ protected void setProjectCreator(
+ ESboxProjectCreatorConverter projectCreator) {
+ this.projectCreator = projectCreator;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ public void addPages() {
+ fTemplatePage = new ESboxTemplateSelectionPage(getConfigHandler(), getProjectNatureIdPattern());
+ fProjectTargetPage = createTargetSelectionPage();
+ addPage(fTemplatePage);
+ addPage(fProjectTargetPage);
+
+ }
+
+ /**
+ * @return
+ */
+ protected ESboxBaseProjectTargetSelectionPage createTargetSelectionPage() {
+ return new ESboxProjectSingleTargetSelectionPage(getConfigHandler());
+ }
+
+ protected IWizardPage getPageBeforeTemplatePages() {
+ return fProjectTargetPage;
+ }
+
+
+ /**
+ *
+ * @param defaults
+ * @param onFinish
+ * @return
+ */
+ public IProject createProject() {
+ configureTemplate(getTemplate(), templatePages);
+
+ IPath projectLocation = fProjectTargetPage.getProjectDescriptionLocation();
+ projectCreator.setup(fProjectTargetPage.getProjectHandle(), configHandler);
+
+ // start creation process
+ invokeRunnable(projectCreator.getProjectCreatorRunnable(projectLocation));
+
+ return projectCreator.getProject();
+ }
+
+
+ /**
+ * Configure the template with the values gathered by the wizard.
+ * @param template
+ * @param templatePages
+ */
+ abstract protected void configureTemplate(ITemplate template, IWizardPage[] templatePages);
+
+ private ITemplate getTemplate() {
+ return configHandler.getTemplate();
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ public boolean performFinish() {
+ // create project if it is not created yet
+ //if (getProject(fProjectTargetPage.isCurrent(), true) == null) return false;
+ IProject project = createProject();
+ if (project == null)
+ return false;
+
+ BasicNewProjectResourceWizard.updatePerspective(fConfigElement);
+ selectAndReveal(project);
+ return true;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performCancel()
+ */
+ public boolean performCancel() {
+ //clearProject();
+ return true;
+ }
+
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ fConfigElement= config;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
+ */
+ public IWizardPage getNextPage(IWizardPage page) {
+ if (page == getPageBeforeTemplatePages()) {
+ IWizardPage followingPage = getPageFollowingTemplatePages();
+ if (followingPage != null)
+ followingPage.setWizard(this);
+
+ ITemplate template = getTemplate();
+ if (template == null)
+ return followingPage;
+
+ templatePages = getTemplateContributedPages(template);
+
+ if (templatePages.length > 0)
+ return templatePages[0];
+ else
+ return followingPage;
+ } else if (isTemplatePage(page)) {
+ return getPageFollowingTemplatePages();
+ }
+ IWizardPage nextPage = super.getNextPage(page);
+
+ if (nextPage == fProjectTargetPage) {
+ fProjectTargetPage.updateDefaultProjectName();
+ }
+ return nextPage;
+ }
+
+ /**
+ * Get the pages the template will insert into the wizard.
+ * @param template
+ * @return non-<code>null</code> array of pages
+ */
+ abstract protected IWizardPage[] getTemplateContributedPages(ITemplate template);
+
+ private boolean isTemplatePage(IWizardPage page) {
+ if (templatePages == null)
+ return false;
+ for (IWizardPage templatePage : templatePages)
+ if (templatePage == page)
+ return true;
+ return false;
+ }
+
+ /** Get the page following the pages added by the template. This must be non-null */
+ abstract protected IWizardPage getPageFollowingTemplatePages();
+
+ public void dispose() {
+ fProjectTargetPage.dispose();
+ fTemplatePage.dispose();
+ }
+
+ /**
+ * Returns last project name used for creation
+ */
+ public String getLastProjectName() {
+ return fProjectTargetPage.getProjectName();
+ }
+
+ public URI getLastProjectLocation() {
+ return fProjectTargetPage.getProjectLocation();
+ }
+
+ public IProject getLastProject() {
+ return fProjectTargetPage.getProjectHandle();
+ }
+
+ public ESboxConfigHandler getConfigHandler() {
+ return configHandler;
+ }
+
+ private boolean invokeRunnable(final IWorkspaceRunnable workspaceRunnable) {
+ // CDT still locks the whole workspace
+ //ISchedulingRule rule = projectCreator.getProject();
+ ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
+
+ final WorkspaceModifyOperation operation = new WorkspaceModifyOperation(rule) {
+
+ @Override
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException, InvocationTargetException,
+ InterruptedException {
+ workspaceRunnable.run(monitor);
+ }
+
+ };
+
+ WorkspaceJob job = new WorkspaceJob("Creating project " + projectCreator.getProject().getName() ) {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ operation.run(monitor);
+ } catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ } catch (Exception e) {
+ if (e instanceof InvocationTargetException
+ && ((InvocationTargetException) e).getTargetException() instanceof CoreException)
+ e = (CoreException) ((InvocationTargetException) e).getTargetException();
+
+ UIActivator.getErrorLogger().logAndShowError(null, e);
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.setRule(rule);
+ job.setUser(true);
+ job.schedule();
+
+ return true;
+ }
+
+ /** Get the pattern for the allowed project nature ids for templates */
+ protected abstract String getProjectNatureIdPattern();
+}
Added: trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxProjectMultiTargetSelectionPage.java
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxProjectMultiTargetSelectionPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxProjectMultiTargetSelectionPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.project.ui.wizards;
+
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.project.core.ESboxBuildConfigurationParameters;
+import org.maemo.esbox.project.core.ESboxConfigHandler;
+import org.maemo.esbox.ui.ESboxBuildTargetUI;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This UI allows selecting multiple targets.
+ * @author eswartz
+ *
+ */
+public class ESboxProjectMultiTargetSelectionPage extends ESboxBaseProjectTargetSelectionPage {
+
+ private CheckboxTreeViewer targetTree;
+
+ /**
+ * Create the wizard
+ * @param commonNewProjectWizard
+ */
+ public ESboxProjectMultiTargetSelectionPage(ESboxConfigHandler configHandler) {
+ super(configHandler);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.wizards.ESboxBaseProjectTargetSelectionPage#getPageDescription()
+ */
+ @Override
+ protected String getPageDescription() {
+ return "Select the project location, checkmark the desired build targets, and select the initial build target.";
+ }
+
+ /**
+ * @param container
+ */
+ protected void createTargetSelectionUI(Composite container) {
+ final Label buildTargetLabel = new Label(container, SWT.NONE);
+ buildTargetLabel.setText("Build &targets:");
+ GridData gd = new GridData(SWT.LEFT, SWT.TOP, false, false);
+ gd.horizontalSpan = 2;
+ buildTargetLabel.setLayoutData(gd);
+
+ targetTree = ESboxBuildTargetUI.createConfiguredBuildTargetCheckboxViewer(container, ESboxBuildTargetUI.DEFAULT_STYLE);
+ targetTree.setFilters(new ViewerFilter[] { new TemplateTargetFilter() });
+
+ gd = new GridData(SWT.FILL, SWT.FILL, false, true);
+ gd.horizontalSpan = 2;
+ targetTree.getTree().setLayoutData(gd);
+
+ ESboxBuildTargetUI.setupStandardBuildTargetCheckboxViewer(targetTree,
+ new ESboxBuildTargetUI.IBuildTargetCheckedListener() {
+
+ public void buildTargetChecked(Object selectedElement,
+ Object[] checkedElements) {
+ updateBuildConfigurationParameters();
+ }
+
+ });
+
+ // the selected element is the active configuration
+ targetTree.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateBuildConfigurationParameters();
+ }
+
+ });
+
+ }
+
+ /**
+ *
+ */
+ protected void updateBuildConfigurationParameters() {
+ // update all entries for full SDKs
+ List<ESboxBuildConfigurationParameters> params = configHandler.getBuildConfigurationParameters();
+ params.clear();
+
+ List<String> targetNames = new ArrayList<String>();
+
+ // the checked entries are the build targets
+ for (Object element : targetTree.getCheckedElements()) {
+ if (element instanceof ISDKTarget) {
+ ISDKTarget sdkTarget = (ISDKTarget) element;
+ params.add(new ESboxBuildConfigurationParameters(sdkTarget.getName(), sdkTarget));
+ targetNames.add(sdkTarget.getName());
+ }
+ }
+
+ Object element = ((IStructuredSelection) targetTree.getSelection()).getFirstElement();
+ if (element instanceof ISDKTarget) {
+ ISDKTarget sdkTarget = (ISDKTarget) element;
+ if (targetNames.contains(sdkTarget.getName()))
+ configHandler.setInitialTargetName(sdkTarget.getName());
+ else
+ configHandler.setInitialTargetName(null);
+ }
+
+ // ping location area's idea of default path if initial SDK changes
+ locationArea.updateProjectName(projectNameField.getText());
+ setPageComplete(validatePage());
+
+ }
+
+ /**
+ *
+ */
+ protected void refreshTargets() {
+ targetTree.refresh();
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.wizards.ESboxBaseProjectTargetSelectionPage#initializeTargetModel()
+ */
+ @Override
+ protected void initializeTargetModel() {
+ targetTree.setInput(new Object());
+ }
+
+
+ protected void selectDefaultSDKTargets() {
+ // TODO: store persistent property instead of assuming sb1 or sb2
+ if (!targetTree.getSelection().isEmpty())
+ return;
+
+ ISDKTarget currentSDKTarget = getCandidateSDKTarget();
+
+ if (currentSDKTarget != null) {
+ targetTree.setCheckedElements(new Object[] { currentSDKTarget });
+ targetTree.setSelection(new StructuredSelection(currentSDKTarget));
+ }
+
+ }
+
+}
Added: trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxProjectSingleTargetSelectionPage.java
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxProjectSingleTargetSelectionPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxProjectSingleTargetSelectionPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.project.ui.wizards;
+
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.project.core.ESboxConfigHandler;
+import org.maemo.esbox.ui.ESboxBuildTargetUI;
+
+/**
+ * This UI allows selecting a single target.
+ * @author eswartz
+ *
+ */
+public class ESboxProjectSingleTargetSelectionPage extends ESboxBaseProjectTargetSelectionPage {
+
+ private TreeViewer targetTree;
+
+ /**
+ * Create the wizard
+ * @param commonNewProjectWizard
+ */
+ public ESboxProjectSingleTargetSelectionPage(ESboxConfigHandler configHandler) {
+ super(configHandler);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.wizards.ESboxBaseProjectTargetSelectionPage#getPageDescription()
+ */
+ @Override
+ protected String getPageDescription() {
+ return "Select the project location and initial build target.";
+ }
+
+ /**
+ * @param container
+ */
+ protected void createTargetSelectionUI(Composite container) {
+ final Label buildTargetLabel = new Label(container, SWT.NONE);
+ buildTargetLabel.setText("Build &target:");
+ GridData gd = new GridData(SWT.LEFT, SWT.TOP, false, false);
+ gd.horizontalSpan = 2;
+ buildTargetLabel.setLayoutData(gd);
+
+ targetTree = ESboxBuildTargetUI.createConfiguredBuildTargetViewer(container, ESboxBuildTargetUI.DEFAULT_STYLE);
+ targetTree.setFilters(new ViewerFilter[] { new TemplateTargetFilter() });
+
+ gd = new GridData(SWT.FILL, SWT.FILL, false, true);
+ gd.horizontalSpan = 2;
+ targetTree.getTree().setLayoutData(gd);
+
+ targetTree.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ Object element = ((IStructuredSelection) targetTree.getSelection()).getFirstElement();
+ if (element instanceof ISDKTarget) {
+ ISDKTarget sdkTarget = (ISDKTarget) element;
+ configHandler.initializeSingleBuildConfiguration(sdkTarget);
+ } else {
+ configHandler.getBuildConfigurationParameters().clear();
+ }
+ // ping location area's idea of default path if SDK changes
+ locationArea.updateProjectName(projectNameField.getText());
+ setPageComplete(validatePage());
+ }
+
+ });
+
+ }
+
+ /**
+ *
+ */
+ protected void refreshTargets() {
+ targetTree.refresh();
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.wizards.ESboxBaseProjectTargetSelectionPage#initializeTargetModel()
+ */
+ @Override
+ protected void initializeTargetModel() {
+ targetTree.setInput(new Object());
+ }
+
+
+ protected void selectDefaultSDKTargets() {
+ // TODO: store persistent property instead of assuming sb1 or sb2
+ if (!targetTree.getSelection().isEmpty())
+ return;
+
+ ISDKTarget currentSDKTarget = getCandidateSDKTarget();
+
+ if (currentSDKTarget != null) {
+ targetTree.setSelection(new StructuredSelection(currentSDKTarget));
+ }
+
+ }
+}
Added: trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxTemplateSelectionPage.java
===================================================================
--- trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxTemplateSelectionPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.project.ui/src/org/maemo/esbox/project/ui/wizards/ESboxTemplateSelectionPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,266 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.project.ui.wizards;
+
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.core.sdk.SDKFactory;
+import org.maemo.esbox.internal.project.ui.UIActivator;
+import org.maemo.esbox.project.core.*;
+
+import java.util.*;
+import java.util.List;
+
+/**
+ * This page allows selecting a template from a categorized tree of templates which
+ * apply to the currently installed SDKs and current project wizard.
+ * @author eswartz
+ *
+ */
+public class ESboxTemplateSelectionPage extends WizardPage {
+
+ static final Image IMG_CATEGORY = UIActivator.getImage("icons/full/obj16/fldr_obj.gif");
+ static final Image IMG_ITEM = UIActivator.getImage("icons/full/obj16/variable_obj.gif");
+
+ class TemplateTreeContentProvider implements IStructuredContentProvider,
+ ITreeContentProvider {
+ private ITemplate[] templates;
+ private Map<String, java.util.List<ITemplate>> ttree;
+
+ public TemplateTreeContentProvider() {
+ this.templates = ESboxTemplateEngine.getInstance().getTemplates();
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public void dispose() {
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (ttree == null) {
+ ttree = new LinkedHashMap<String, java.util.List<ITemplate>>();
+ // top-level elements are category names
+ for (ITemplate template : templates) {
+ String category = template.getCategory();
+ if (category == null)
+ category = "Other";
+ java.util.List<ITemplate> categoryTemplates = ttree.get(category);
+ if (categoryTemplates == null) {
+ categoryTemplates = new ArrayList<ITemplate>();
+ ttree.put(category, categoryTemplates);
+ }
+ categoryTemplates.add(template);
+ }
+ }
+ // promote uncategorized elements to top level
+ List<Object> rootElements = new ArrayList<Object>(ttree.keySet());
+ List<ITemplate> uncategorized = ttree.get("");
+ if (uncategorized != null) {
+ rootElements.remove("");
+ rootElements.addAll(uncategorized);
+ }
+ return ttree.keySet().toArray();
+ }
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof String) {
+ java.util.List<ITemplate> templates = ttree.get((String) parentElement);
+ return templates.toArray();
+ } else {
+ return new Object[0];
+ }
+ }
+ public Object getParent(Object element) {
+ for (String category : ttree.keySet()) {
+ if (ttree.get(category) == element)
+ return category;
+ }
+ return null;
+ }
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+ }
+
+ class TemplateTreeFilter extends ViewerFilter {
+ private List<ISDKTarget> allSDKTargets;
+
+ public TemplateTreeFilter() {
+ this.allSDKTargets = Arrays.asList(
+ SDKFactory.getInstance().getAllSDKTargets());
+ }
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
+ // category?
+ if (element instanceof String) {
+ // filter out empty categories by checking their filtered children
+ boolean anyChildrenVisible = false;
+
+ ITreeContentProvider provider = (TemplateTreeContentProvider) ((StructuredViewer) viewer).getContentProvider();
+ Object[] categoryTemplates = provider.getChildren(element);
+
+ if (categoryTemplates == null)
+ return false;
+
+ for (Object template : categoryTemplates) {
+ if (select(viewer, element, template)) {
+ anyChildrenVisible = true;
+ break;
+ }
+ }
+
+ return anyChildrenVisible;
+ }
+
+ // don't show templates for different kinds of projects
+ ITemplate template = (ITemplate) element;
+ String projectNature = template.getProjectNature();
+ if (projectNature != null && !projectNature.matches(projectNaturePattern))
+ return false;
+
+ // now check whether we're filtering by enabled SDKs
+ if (!filterTemplatesByButton.getSelection())
+ return true;
+
+ String pattern = template.getFilterPattern();
+ if (pattern == null)
+ return true;
+
+ return ESboxTemplateFilter.getInstance().passesFilter(
+ allSDKTargets,
+ pattern,
+ false);
+ }
+
+ }
+
+ class TemplateTreeLabelProvider extends LabelProvider {
+
+ public Image getImage(Object element) {
+ if (element instanceof String)
+ return IMG_CATEGORY;
+ return IMG_ITEM;
+ }
+
+ public String getText(Object element) {
+ if (element instanceof String)
+ return (String) element;
+ return ((ITemplate) element).getName();
+ }
+ }
+
+ private Tree tree;
+ private Text templateDescriptionText;
+ private TreeViewer templateViewer;
+ private ESboxConfigHandler configHandler;
+ private Button filterTemplatesByButton;
+ private String projectNaturePattern;
+
+ /**
+ * Create the wizard
+ */
+ public ESboxTemplateSelectionPage(ESboxConfigHandler configHandler, String projectNaturePattern) {
+ super("wizardPage");
+ this.configHandler = configHandler;
+ this.projectNaturePattern = projectNaturePattern;
+ setTitle("Template Project Type");
+ setDescription("Select the project template.");
+ }
+
+ /**
+ * Create contents of the wizard
+ * @param parent
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ final GridLayout gridLayout_2 = new GridLayout();
+ container.setLayout(gridLayout_2);
+ //
+ setControl(container);
+
+ final Label projectNameLabel = new Label(container, SWT.NONE);
+ projectNameLabel.setText("Choose a template:");
+
+ templateViewer = new TreeViewer(container, SWT.BORDER);
+ templateViewer.setContentProvider(new TemplateTreeContentProvider());
+ templateViewer.setLabelProvider(new TemplateTreeLabelProvider());
+ templateViewer.setFilters(new ViewerFilter[] { new TemplateTreeFilter() });
+
+ tree = templateViewer.getTree();
+ tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ templateDescriptionText = new Text(container,
+ SWT.READ_ONLY | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
+ final GridData gd_text = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gd_text.widthHint = 200;
+
+ GC gc = new GC(getShell().getDisplay());
+ gd_text.heightHint = gc.getFontMetrics().getHeight() * 8;
+ gc.dispose();
+
+ templateDescriptionText.setLayoutData(gd_text);
+
+ filterTemplatesByButton = new Button(container, SWT.CHECK);
+ filterTemplatesByButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ templateViewer.refresh();
+ }
+ });
+ filterTemplatesByButton.setSelection(true);
+ filterTemplatesByButton.setText("Filter templates based on enabled SDKs");
+
+ templateViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) templateViewer.getSelection();
+ Object element = selection.getFirstElement();
+ if (element instanceof ITemplate) {
+ ITemplate template = (ITemplate) element;
+ updateTemplate(template);
+ } else {
+ updateTemplate(null);
+ }
+ }
+ });
+
+ templateViewer.setAutoExpandLevel(2);
+ templateViewer.setInput(new Object());
+ }
+
+ protected void updateTemplate(ITemplate template) {
+ if (template != null) {
+ configHandler.setTemplate(template);
+ templateDescriptionText.setText(template.getDescription());
+ } else {
+ configHandler.setTemplate(null);
+ templateDescriptionText.setText("");
+ }
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ // in case SDK target or installed SDKs changed
+ templateViewer.refresh();
+ return super.isPageComplete();
+ }
+
+
+}
Property changes on: trunk/common/org.maemo.esbox.ssh
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.ssh/.classpath
===================================================================
--- trunk/common/org.maemo.esbox.ssh/.classpath (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/org.maemo.esbox.ssh/.project
===================================================================
--- trunk/common/org.maemo.esbox.ssh/.project (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.ssh</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.ssh/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.maemo.esbox.ssh/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:20:36 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/org.maemo.esbox.ssh/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.ssh/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SSH Core Plug-in
+Bundle-SymbolicName: org.maemo.esbox.ssh;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-CoreActivator: org.maemo.esbox.ssh.noexport.CoreActivator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.eclipse.jsch.core;bundle-version="1.1.100",
+ org.eclipse.jsch.ui;bundle-version="1.1.100",
+ org.maemo.esbox.ui;bundle-version="1.5.0",
+ com.jcraft.jsch;bundle-version="0.1.37"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: INdT / Nokia
+Export-Package: org.maemo.esbox.internal.api.ssh,
+ org.maemo.esbox.internal.ssh;
+ x-friends:="org.maemo.esbox.core.tests,
+ org.maemo.esbox.cpp.tests,
+ org.maemo.esbox.device.tests,
+ org.maemo.esbox.linux.tests,
+ org.maemo.esbox.maemosdk.tests,
+ org.maemo.esbox.python.tests",
+ org.maemo.esbox.ssh,
+ org.maemo.esbox.ssh.ui
+Bundle-Activator: org.maemo.esbox.internal.ssh.Activator
Added: trunk/common/org.maemo.esbox.ssh/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.ssh/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ conf/
Added: trunk/common/org.maemo.esbox.ssh/conf/run_linux_wait.bat
===================================================================
--- trunk/common/org.maemo.esbox.ssh/conf/run_linux_wait.bat (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/conf/run_linux_wait.bat 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,16 @@
+ at echo off
+ at rem Command line arguments to this script MUST BE QUOTED...
+ at rem Adding quotes inside here, on the other hand, seriously confuses the command processor!
+
+set QEMU=%1
+set QEMU_DIR=%2
+set DATA_DIR=%3
+set SSH_REDIR=%4
+set CIFS_REDIR=%5
+shift
+shift
+shift
+shift
+shift
+
+%QEMU% -kernel-kqemu -hda %DATA_DIR%/hda.img -hdb %DATA_DIR%/hdb.img -fda %DATA_DIR%/super_grub.img -usb -L %QEMU_DIR% -m 384 -redir tcp:%SSH_REDIR%::22 -redir tcp:%CIFS_REDIR%::4445 %1 %2 %3 %4 %5 %6 %7 %8 %9
Added: trunk/common/org.maemo.esbox.ssh/plugin.xml
===================================================================
--- trunk/common/org.maemo.esbox.ssh/plugin.xml (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.maemo.esbox.core.build_machine_factory">
+ <build_machine_factory
+ class="org.maemo.esbox.internal.ssh.QemuBuildMachineFactory">
+ </build_machine_factory>
+ <build_machine_factory
+ class="org.maemo.esbox.internal.ssh.RemoteSSHLinuxBuildMachineFactory">
+ </build_machine_factory>
+ </extension>
+ <extension
+ id="org.maemo.esbox.core.filesystems.ssh"
+ point="org.eclipse.core.filesystem.filesystems">
+ <filesystem
+ scheme="ssh">
+ <run
+ class="org.maemo.esbox.internal.ssh.SSHFileSystem">
+ </run>
+ </filesystem>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.maemo.esbox.ui.esboxPreferencePage"
+ class="org.maemo.esbox.ssh.ui.ESboxSSHPreferencePage"
+ id="org.maemo.esbox.ssh.esboxPreferencePage.ssh"
+ name="SSH">
+ </page>
+ </extension>
+</plugin>
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/DeviceSSHLinuxMachine.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/DeviceSSHLinuxMachine.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/DeviceSSHLinuxMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.ssh;
+
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.core.machine.IDeviceMachine;
+import org.maemo.esbox.core.machine.ISharedFilesystemProvider;
+import org.maemo.esbox.internal.ssh.*;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+
+/**
+ * This machine is a remote Linux device.
+ * @author eswartz
+ *
+ */
+public class DeviceSSHLinuxMachine extends SSHMachineBackend implements IDeviceMachine {
+ public final static String ID = Activator.PLUGIN_ID + ".device_machine";
+
+ /**
+ * @param configuration
+ * @param sharedFilesystemProvider
+ */
+ public DeviceSSHLinuxMachine(String name,
+ SSHConfiguration configuration, ISharedFilesystemProvider sharedFilesystemProvider) {
+ super(ID, name, Platform.OS_LINUX,
+ new SSHDeviceMachineController(configuration, name),
+ configuration,
+ sharedFilesystemProvider);
+ }
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/SSHDeviceMachineController.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/SSHDeviceMachineController.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/SSHDeviceMachineController.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.ssh;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.maemo.esbox.core.machine.IMachineController;
+import org.maemo.esbox.core.machine.MachineException;
+import org.maemo.esbox.internal.ssh.Activator;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.MessageFormat;
+
+/**
+ * This is a controller for a detached device which we can detect over SSH.
+ * @author eswartz
+ *
+ */
+public class SSHDeviceMachineController extends SSHMachineControllerBase implements
+ IMachineController {
+
+ /**
+ * @param configuration
+ * @param name
+ */
+ public SSHDeviceMachineController(SSHConfiguration configuration, String name) {
+ super(configuration, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doStartMachine()
+ */
+ @Override
+ protected IStatus doStartMachine(IProgressMonitor monitor) throws MachineException {
+ // can't start automatically
+ return Status.CANCEL_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doStopMachine()
+ */
+ @Override
+ protected IStatus doStopMachine(IProgressMonitor monitor) throws MachineException {
+ return super.doStopMachine(monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doAskUserToRepairMachine(org.eclipse.swt.widgets.Shell, org.eclipse.core.runtime.IStatus)
+ */
+ protected Result doAskUserToRepairMachine(Shell parent, IStatus status) {
+ final Result results[] = { null };
+ if (!status.isOK()) {
+ String title = "Cannot connect";
+ String message = MessageFormat.format("Cannot connect to device ''{0}'':\n\n{1}\n\n"+
+ "The \"Help\" button will abort and take you to the maemo PC Connectivity webpage.",
+ getName(),
+ status.getMessage());
+ final String winTitle = title, winMsg = message;
+
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+
+ MessageDialog messageDialog = new MessageDialog(null, winTitle,
+ null,
+ winMsg,
+ MessageDialog.WARNING,
+ new String[] {
+ IDialogConstants.RETRY_LABEL,
+ IDialogConstants.IGNORE_LABEL,
+ IDialogConstants.ABORT_LABEL,
+ IDialogConstants.HELP_LABEL },
+ 0);
+ int ret = messageDialog.open();
+ switch (ret) {
+ case 0:
+ results[0] = Result.RETRY;
+ break;
+ case 1:
+ results[0] = Result.IGNORE;
+ break;
+ case 2:
+ results[0] = Result.ABORT;
+ break;
+ case 3:
+ // launch the help URL
+ results[0] = Result.ABORT;
+ showWebPageInBrowser("http://maemo.org/development/documentation/pc_connectivity/"); // $NON-NLS-1$
+ break;
+ }
+ }});
+ }
+
+ return results[0];
+ }
+
+ /**
+ * Open an external browser and go to the given URL.
+ * Note this function must be called in UI thread.
+ *
+ * @param url
+ */
+ static public void showWebPageInBrowser(String url) {
+ IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
+ // use external browser since internal one which opens in an editor has no UI
+ // and somehow seems to ignore proxy settings
+
+ try {
+ URL networkingURL = new URL(url);
+ browserSupport.getExternalBrowser().openURL(networkingURL);
+ } catch (MalformedURLException e) {
+ Activator.getErrorLogger().logError("Malformed URL. Error: " + e.getMessage(), e);
+ } catch (PartInitException e) {
+ Activator.getErrorLogger().logError("Cannot navigate to the URL. Error: " + e.getMessage(), e);
+ }
+ }
+}
+
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/SSHMachineControllerBase.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/SSHMachineControllerBase.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/api/ssh/SSHMachineControllerBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.ssh;
+
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.swt.widgets.Display;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineException;
+import org.maemo.esbox.internal.api.core.machine.BaseMachineController;
+import org.maemo.esbox.internal.api.core.machine.MachineControllerProbingJob;
+import org.maemo.esbox.internal.ssh.Activator;
+import org.maemo.esbox.internal.ssh.JSchSessionFactory;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+import java.net.ConnectException;
+import java.text.MessageFormat;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class SSHMachineControllerBase extends BaseMachineController {
+
+ private final String name;
+ protected final SSHConfiguration configuration;
+ private MachineControllerProbingJob probeJob;
+ private static final int JOB_SCHEDULE_TIME = 30 * 1000; // 30 sec
+
+ /**
+ *
+ */
+ public SSHMachineControllerBase(SSHConfiguration configuration, String name) {
+ super();
+ this.configuration = configuration;
+ this.name = name;
+ }
+
+ /**
+ * Call this to establish periodic probing of the machine status, rather
+ * than probing on demand.
+ * @param machine
+ */
+ public synchronized void usePeriodicProbe(IMachine machine) {
+ if (probeJob != null)
+ probeJob.cancel();
+ this.probeJob = new MachineControllerProbingJob(machine, this, JOB_SCHEDULE_TIME);
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ protected IStatus expensiveProbeMachine(IProgressMonitor monitor) {
+ IStatus status = null;
+ final IStatus[] statuses = { null };
+ Thread thread = new Thread("Testing SSH connection") {
+ /* (non-Javadoc)
+ * @see java.lang.Thread#run()
+ */
+ @Override
+ public void run() {
+ try {
+ Session session = JSchSessionFactory.createSessionAndConnect(configuration);
+ session.disconnect();
+ statuses[0] = Status.OK_STATUS;
+ } catch (JSchException e) {
+ // stoopid JSCH wraps exception MESSAGES, but doesn't keep the CAUSE
+ if (e.getCause() instanceof ConnectException || e.getMessage().contains("java.net.ConnectException"))
+ statuses[0] = Activator.createErrorStatus(
+ MessageFormat.format("Failed to connect to the SSH server.\n\nCheck that the server is running on ''{3}'' at the address {0}:{1}.",
+ configuration.getTargetIPAddress(),
+ ""+configuration.getTargetPort(),
+ name), e);
+ else if (e.getMessage().contains("InterruptedIOException")
+ || e.getMessage().contains("SocketTimeoutException"))
+ statuses[0] = Activator.createErrorStatus(
+ MessageFormat.format("Timed out connecting to the SSH server.\n\nCheck that the machine is physically connected and running an SSH server at {0}:{1};\nalso, make sure the address is not blocked by a firewall.",
+ configuration.getTargetIPAddress(),
+ ""+configuration.getTargetPort(),
+ name), e);
+ else
+ statuses[0] = Activator.createStatus(IStatus.WARNING,
+ MessageFormat.format("Cannot authenticate with {2} SSH agent at {0}:{1};\ncheck that your username/password are correct and that it is not rejecting connections from this computer.",
+ configuration.getTargetIPAddress(),
+ ""+configuration.getTargetPort(),
+ name), e);
+ } finally {
+ if (statuses[0] == null)
+ statuses[0] = Status.CANCEL_STATUS;
+ }
+ }
+ };
+
+ // This is the timeout for the probing. Should be at least the timeout
+ // for the SSH connection used by the above JSchSessionFactory.createSessionAndConnect().
+ // Make them similar so that the connection timeout from caller/user applies to probing.
+ //
+ final int timeout = configuration.getConnectionTimeout()*1000 + 100;
+ int increment = 50;
+
+ monitor.beginTask("Querying SSH at " + configuration.getTargetIPAddress() + ":" + configuration.getTargetPort(), timeout);
+ thread.start();
+ try {
+ for (int num = 0; num < timeout; num+=increment) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ while (display.readAndDispatch()) ;
+ }
+ monitor.worked(increment);
+ if (monitor.isCanceled())
+ statuses[0] = Status.CANCEL_STATUS;
+ try {
+ thread.join(increment);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ if (statuses[0] != null)
+ break;
+ }
+
+ } finally {
+ // copy status here in case thread writes to it later
+ status = statuses[0];
+ if (status == null)
+ status = Status.CANCEL_STATUS;
+ monitor.done();
+ }
+
+ if (thread.isAlive())
+ thread.interrupt();
+
+ return status;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doProbeMachine(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected synchronized IStatus doProbeMachine(IProgressMonitor monitor) {
+ IStatus status = null;
+ if (probeJob != null) {
+ status = probeJob.getStatus();
+ }
+ if (status == null) {
+ // force it
+ status = expensiveProbeMachine(monitor);
+ }
+ return status;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doStopMachine(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected IStatus doStopMachine(IProgressMonitor monitor)
+ throws MachineException {
+ if (probeJob != null) {
+ probeJob.cancel();
+ probeJob = null;
+ }
+ return Status.OK_STATUS;
+ }
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/Activator.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/Activator.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,131 @@
+package org.maemo.esbox.internal.ssh;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.ssh";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/BuggySB2QEMUStreamWrapperFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/BuggySB2QEMUStreamWrapperFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/BuggySB2QEMUStreamWrapperFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.ssh;
+
+import org.maemo.esbox.internal.api.core.machine.IStreamWrapper;
+import org.maemo.esbox.internal.api.core.machine.IStreamWrapperFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author eswartz
+ *
+ */
+public class BuggySB2QEMUStreamWrapperFactory implements IStreamWrapperFactory {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.IStreamWrapperFactory#createStreamWrapper(java.io.InputStream, java.io.InputStream)
+ */
+ public IStreamWrapper createStreamWrapper(InputStream in, InputStream err) {
+ return new BuggySB2QEMUStreamWrapper(in, err);
+ }
+
+ /**
+ * Under an older version of sb2-qemu-arm, qemu improperly confuses ssh with gdb and terminates
+ * a process with a gdb packet rather than closing the streams. These packets look like
+ * $W00#b7, $W01#b8, or $W02#b9, and echoing all input as this sequence. (The W value is
+ * the exit code, and I'm unsure what the #... values are, but they're not always related
+ * to the exit value.)
+ * <p>
+ * As a workaround, watch for these sequences and close the streams when we see them.
+ * @author eswartz
+ *
+ */
+ class BuggySB2QEMUStreamWrapper implements IStreamWrapper {
+
+ private InputStream out;
+ private InputStream err;
+ private boolean hitWeirdToken;
+
+ final byte[] weirdTokens = { '$', 'W', '0', '0', '#', 'b', '7' };
+ private int weirdTokenIdx;
+
+ public BuggySB2QEMUStreamWrapper(InputStream out, InputStream err) {
+ this.out = out;
+ this.err = err;
+ this.weirdTokenIdx = 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.SSHProcess.IStreamWrapper#isClosed()
+ */
+ public boolean isClosed() {
+ return hitWeirdToken;
+ }
+ public InputStream getInputStream() {
+
+ return new InputStream() {
+ byte[] lastTokens = new byte[weirdTokens.length];
+ int lastTokenIdxEnd = 0;
+ int lastTokenIdxSt = 0;
+
+ @Override
+ public int read() throws IOException {
+ if (hitWeirdToken)
+ return -1;
+
+ int ch;
+
+ do {
+ // release cached chars first
+ if (weirdTokenIdx == 0 && lastTokenIdxSt < lastTokenIdxEnd) {
+ ch = lastTokens[lastTokenIdxSt++] & 0xff;
+ if (lastTokenIdxSt == lastTokenIdxEnd) {
+ lastTokenIdxSt = lastTokenIdxEnd = 0;
+ }
+ return ch;
+ }
+
+ ch = out.read();
+
+ if (ch >= 0) {
+ if (weirdTokenIdx == 2 ||weirdTokenIdx == 3 || weirdTokenIdx == 5 || weirdTokenIdx == 6
+ ? "0123456789abcdef".contains("" + (char)ch)
+ : weirdTokens[weirdTokenIdx] == ch) {
+ // hold the prefix in cache
+ weirdTokenIdx++;
+ if (weirdTokenIdx == weirdTokens.length) {
+ hitWeirdToken = true;
+ return -1;
+ } else {
+ lastTokens[lastTokenIdxEnd++] = (byte) ch;
+ continue;
+ }
+ } else {
+ // mismatch, release lastTokens
+ if (weirdTokenIdx > 0) {
+ // release these tokens first
+ lastTokens[lastTokenIdxEnd++] = (byte) ch;
+ weirdTokenIdx = 0;
+ continue;
+ }
+ }
+ }
+
+ return ch;
+ } while (true);
+ }
+
+ };
+ }
+
+ public InputStream getErrorStream() {
+ return new InputStream() {
+
+ @Override
+ public int read() throws IOException {
+ if (hitWeirdToken)
+ return -1;
+
+ return err.read();
+ }
+
+ };
+ }
+
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/JSchSessionFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/JSchSessionFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/JSchSessionFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.ssh;
+
+import com.jcraft.jsch.*;
+
+import org.eclipse.jsch.core.IJSchLocation;
+import org.eclipse.jsch.core.IJSchService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.testing.TestableObject;
+import org.maemo.esbox.ssh.SSHConfiguration;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * Common entry point for creating sessions using JSch.
+ * @author eswartz
+ *
+ */
+public class JSchSessionFactory {
+
+ //private static JSch jsch;
+
+ public static IJSchService getJSchService() throws JSchException {
+ Activator activator = Activator.getDefault();
+ if (activator == null || activator.getBundle() == null)
+ throw new JSchException("No workbench running");
+ BundleContext bundleContext = activator.getBundle().getBundleContext();
+ if (bundleContext == null)
+ throw new JSchException("No bundle context available for querying JSch");
+ ServiceReference serviceReference = bundleContext.getServiceReference(IJSchService.class.getName());
+ if (serviceReference == null)
+ throw new JSchException("No JSch service registered with OSGi");
+
+ IJSchService jschService = (IJSchService) bundleContext.getService(serviceReference);
+ return jschService;
+ }
+
+ /**
+ * Create a session for the given SSH configuration and
+ * user info implementation.
+ * <p>
+ * @param configuration
+ * @param userInfo implementation that asks for authentication
+ * information
+ * @return Session (never null), not yet connected (use #connect())
+ * @throws JSchException
+ */
+ public static Session createSession(
+ final SSHConfiguration configuration,
+ UserInfo userInfo)
+ throws JSchException {
+
+ IJSchService jschService = getJSchService();
+
+ IJSchLocation location = jschService.getLocation(configuration.getUserName(), configuration.getTargetIPAddress(), configuration.getTargetPort());
+ location.setPassword(configuration.getUserPassword());
+
+ Session session = jschService.createSession(location, userInfo);
+ //session.setProxy(...);
+ session.setTimeout(configuration.getConnectionTimeout() * 1000);
+ session.setPassword(configuration.getUserPassword());
+
+ return session;
+ }
+
+ /**
+ * Create a session for the given SSH configuration and
+ * user info implementation.
+ * <p>
+ * @param configuration
+ * @param userInfo implementation that asks for authentication
+ * information
+ * @return Session (never null), not yet connected (use #connect())
+ * @throws JSchException
+ */
+ /*
+ public static Session createSession__(
+ final SSHConfiguration configuration,
+ UserInfo userInfo)
+ throws JSchException {
+
+ ServiceReference serviceReference = CoreActivator.getDefault().getBundle().getBundleContext().getServiceReference(IJSchService.class.getName());
+
+ IJSchService jschService = (IJSchService) CoreActivator.getDefault().getBundle().getBundleContext().getService(serviceReference);
+ if (jsch == null) {
+ jsch = new JSch();
+ }
+
+ Session session = jsch.getSession(configuration.getUserName(),
+ configuration.getTargetIPAddress(),
+ configuration.getPort());
+ //session.setProxy(...);
+ session.setTimeout(configuration.getConnectionTimeout() * 1000);
+ session.setPassword(configuration.getUserPassword());
+ if (userInfo == null) {
+ userInfo = new NonInteractiveUserInfo(configuration);
+ }
+
+ session.setUserInfo(userInfo);
+
+ return session;
+ }
+ */
+
+ /**
+ * Create a session for the given SSH configuration and
+ * default user info provider (interactive if workbench is running but
+ * not unit tests, else non-interactive). The latter requires that
+ * the SSHConfiguration contain a valid password.
+ * @param configuration
+ * @return Session (never null), which is connected
+ * @throws JSchException
+ */
+ public static Session createSessionAndConnect(
+ final SSHConfiguration configuration) throws JSchException {
+ UserInfo userInfo = null;
+ if (!PlatformUI.isWorkbenchRunning() || isJUnitRunning()) {
+ // avoid exception by trying to make shell from workbench
+ userInfo = new NonInteractiveUserInfo(configuration);
+ }
+ Session session = createSession(configuration, userInfo);
+ JSchSessionFactory.getJSchService().connect(session, configuration.getConnectionTimeout() * 1000, null);
+ return session;
+ }
+
+ private static boolean isJUnitRunning() {
+ TestableObject testableObject = PlatformUI.getTestableObject();
+ if (testableObject != null) {
+ return testableObject.getTestHarness() != null;
+ }
+ return false;
+ }
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/MountWalker.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/MountWalker.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/MountWalker.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.ssh;
+
+
+import org.maemo.esbox.ssh.IMountVisitor;
+
+import java.io.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * This class iterates /proc/mounts and invokes a visitor for each entry.
+ * @author eswartz
+ *
+ */
+public class MountWalker {
+ private static final Pattern MOUNT_LINE = Pattern.compile(
+ "(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+).*");
+
+ public MountWalker() {
+ }
+
+ /**
+ * Invoke the visitor for each entry parsed from the mounts.
+ * Does not close the input stream.
+ * @param is
+ * @param visitor
+ */
+ public void accept(InputStream is, IMountVisitor visitor) {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+ String line;
+ try {
+ while ((line = reader.readLine()) != null) {
+ Matcher matcher = MOUNT_LINE.matcher(line);
+ if (matcher.matches()) {
+ visitor.handleMount(
+ matcher.group(1), matcher.group(2), matcher.group(3), matcher.group(4));
+ } else {
+ Activator.getErrorLogger().logError("Unexpected line parsing mounts:\n "+ line, null);
+ }
+ }
+ } catch (IOException e) {
+ Activator.getErrorLogger().logError("Error parsing mounts", e);
+ }
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/NonInteractiveUserInfo.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/NonInteractiveUserInfo.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/NonInteractiveUserInfo.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import com.jcraft.jsch.UserInfo;
+
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+
+
+/**
+ * @author eswartz
+ *
+ */
+public class NonInteractiveUserInfo implements UserInfo {
+ /**
+ *
+ */
+ private final SSHConfiguration configuration;
+
+ /**
+ * @param configuration
+ */
+ public NonInteractiveUserInfo(SSHConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ public String getPassphrase() {
+ return null;
+ }
+
+ public String getPassword() {
+ return configuration.getUserPassword();
+ }
+
+ public boolean promptPassphrase(String arg0) {
+ System.out.println(arg0);
+ return false;
+ }
+
+ public boolean promptPassword(String arg0) {
+ System.out.println(arg0);
+ return false;
+ }
+
+ public boolean promptYesNo(String arg0) {
+ System.out.println(arg0);
+ return true;
+ }
+
+ public void showMessage(String arg0) {
+ System.out.println(arg0);
+ }
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuBuildMachineFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuBuildMachineFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuBuildMachineFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import org.maemo.esbox.core.machine.IBuildMachineFactory;
+import org.maemo.esbox.internal.api.core.machine.IBuildMachineImpl;
+import org.maemo.esbox.ssh.IQemuConfiguration;
+
+/**
+ * @author eswartz
+ *
+ */
+public class QemuBuildMachineFactory implements IBuildMachineFactory {
+
+ private IQemuConfiguration configuration;
+
+ public QemuBuildMachineFactory() {
+ this.configuration = new StockQemuConfiguration();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachineFactory#createMachine(java.lang.String)
+ */
+ public synchronized IBuildMachineImpl[] createMachines() {
+ IBuildMachineImpl qemuMachine = new QemuMachine(configuration);
+ return new IBuildMachineImpl[] { qemuMachine };
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuMachine.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuMachine.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.widgets.Display;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.internal.api.core.machine.IBuildMachineImpl;
+import org.maemo.esbox.ssh.IQemuConfiguration;
+import org.maemo.esbox.ui.dialogs.DialogUtils;
+import org.maemo.esbox.ui.dialogs.PasswordInputDialog;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.text.MessageFormat;
+import java.util.Map;
+
+
+/**
+ * This is a build machine running under QEMU.
+ * @author eswartz
+ *
+ */
+public class QemuMachine extends SSHMachineBackend implements IVirtualMachine, IBuildMachineImpl {
+
+ public final static String ID = Activator.PLUGIN_ID + ".qemu_machine";
+ public final static String NAME = "QEMU Linux Virtual Machine";
+
+ public QemuMachine(IQemuConfiguration configuration) {
+ super(ID, NAME, configuration.getOS(),
+ new QemuMachineController(configuration),
+ configuration.getSSHConfiguration(),
+ configuration.getSharedFilesystemProvider());
+ ((QemuMachineController)getMachineController()).usePeriodicProbe(this);
+ }
+
+ /**
+ * This method is called on the UI thread. It should validate that
+ * the shared filesystems are available, prompting the user for a password
+ * and launching 'mount_share.sh' to mount them otherwise.
+ * @param subProgressMonitor
+ * @return Status of mount
+ */
+ public IStatus validateSharedMounts(IProgressMonitor monitor) {
+
+ ISharedFilesystemProvider sharedFilesystemProvider =
+ getSharedFilesystemProvider();
+ Map<IPath, IPath> sharedFolders =
+ sharedFilesystemProvider.getSharedFolders();
+
+ monitor.beginTask("Validating shared folders", sharedFolders.size() * 2);
+
+ boolean neededMount = false;
+
+ for (Map.Entry<IPath, IPath> entry : sharedFolders.entrySet()) {
+ if (!isPathMounted(entry.getValue())) {
+ neededMount = true;
+ PasswordInputDialog dialog = new PasswordInputDialog(
+ DialogUtils.getShell(),
+ "Password Required",
+ MessageFormat.format(
+ "Enter the password for user ''{0}'' to mount the share ''{1}'':",
+ MachineRegistry.getInstance().getLocalMachine().getUserName(),
+ entry.getKey()));
+ if (IDialogConstants.CANCEL_ID == dialog.open())
+ continue;
+
+ // TODO: this assumes a certain script exists on the VM
+ try {
+ mountSharesWithPassword(dialog.getPassword());
+ } catch (ESboxException e) {
+ return Activator.createErrorStatus(
+ MessageFormat.format(
+ "Could not mount ''{0}'' in {1}",
+ entry.getKey().toString(),
+ getName()), e);
+ }
+
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ }
+ }
+
+ // verify that the mounting succeeded
+ boolean allSharesMounted = true;
+ if (neededMount) {
+ for (Map.Entry<IPath, IPath> entry : sharedFolders.entrySet()) {
+ if (!isPathMounted(entry.getValue())) {
+ allSharesMounted = false;
+ }
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ }
+ }
+
+ monitor.done();
+
+ if (!allSharesMounted) {
+ return Activator.createStatus(IStatus.WARNING,
+ MessageFormat.format(
+ "Not all the known shares were mounted in {0}; builds may fail",
+ getName()));
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Run the 'mount_share.sh' script to mount shares.
+ * @param password
+ */
+ protected void mountSharesWithPassword(final String password) throws ESboxException {
+ IProcessLauncherFactory processLauncherFactory = getProcessLauncherFactory();
+ final IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory,
+ getUserHome(),
+ CommandLineArguments.createFromVarArgs(
+ "sh",
+ "mount_share.sh"));
+
+ processLauncher.usePTY(true);
+ final Process process = processLauncher.createProcess();
+ final ESboxException[] exceptions = { null };
+
+ Thread thread = new Thread("Send password to mount") {
+
+ /* (non-Javadoc)
+ * @see java.lang.Thread#run()
+ */
+ @Override
+ public void run() {
+ try {
+ /* this goes to a weird stream (somehow) so we can't read it,
+ even though it shows up when we put stuff to the Console!
+ InputStream is = process.getInputStream();
+ int ch;
+ // read "Password:"
+ while ((ch = is.read()) != -1) {
+ if (ch == ':') {
+ break;
+ }
+ }
+ */
+
+ // send password
+ OutputStream os = process.getOutputStream();
+ os.write((password + "\n").getBytes());
+ os.close();
+
+ // now let the remaining output go to the Console
+ processLauncher.redirectToConsole(false, null, "Mounting shares");
+ try {
+ int exit = process.waitFor();
+ if (exit != 0) {
+ exceptions[0] = new ESboxException("Mounting script did not succeed; check Console for errors");
+ return;
+ }
+ } catch (InterruptedException e) {
+ }
+
+ } catch (IOException e) {
+ exceptions[0] = new ESboxException("Failed to send password", e);
+ return;
+ }
+ }
+ };
+ thread.start();
+
+ boolean timedOut = false;
+ try {
+ int timeout = 10 * 1000;
+ Display display = Display.getCurrent();
+ while (thread.isAlive() && timeout > 0) {
+ timeout -= 50;
+ thread.join(50);
+ if (display != null) {
+ while (display.readAndDispatch()) ;
+ }
+ }
+ if (timeout <= 0) {
+ timedOut = true;
+ }
+ } catch (InterruptedException e) {
+ }
+
+ process.destroy();
+
+ if (!thread.isAlive()) {
+ if (exceptions[0] != null) {
+ throw exceptions[0];
+ }
+ }
+ if (timedOut) {
+ if (thread.isAlive())
+ thread.interrupt();
+ throw new ESboxException("Timeout sending password");
+ }
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuMachineController.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuMachineController.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/QemuMachineController.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,423 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.HostUtils;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineException;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.internal.api.ssh.SSHMachineControllerBase;
+import org.maemo.esbox.ssh.IQemuConfiguration;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.Socket;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This is the basic implementation of a QEMU machine
+ * @author eswartz
+ *
+ */
+public class QemuMachineController extends SSHMachineControllerBase {
+
+ /**
+ *
+ */
+ static final String QEMU_LAUNCHER = "conf/run_linux_wait.bat";
+ /** thread and process are non-null if we launched QEMU ourselves */
+ Process launchedQemu;
+ /** thread and process are non-null if we launched QEMU ourselves */
+ QemuWatcherThread launchedQemuThread;
+ private IQemuConfiguration qemuConfiguration;
+ private boolean isValidating;
+
+ class QemuWatcherThread extends Thread {
+ private IProcessLauncher launcher;
+ private ByteArrayOutputStream err;
+ private ByteArrayOutputStream out;
+ public QemuWatcherThread(IProcessLauncher launcher) {
+ this.launcher = launcher;
+ }
+ public void run() {
+ // TODO: make this go to the console
+
+ // wait for it
+ out = new ByteArrayOutputStream();
+ err = new ByteArrayOutputStream();
+ launcher.waitAndRead(out, err);
+ System.out.println(out);
+ System.out.println(err);
+ }
+ }
+
+ public QemuMachineController(IQemuConfiguration configuration) {
+ super(configuration.getSSHConfiguration(), "QEMU");
+ this.qemuConfiguration = configuration;
+ }
+
+ /**
+ * @param processLauncher
+ * @return
+ */
+ MachineException processOutput(String message, QemuWatcherThread thread) {
+ return new MachineException(
+ MessageFormat.format("{0}\nCommand line: {1}\nstdout: {2}\nstderr: {3}",
+ message,
+ CommandLineArguments.toCommandLine(thread.launcher.getLaunchCommandArguments()),
+ thread.out,
+ thread.err));
+ }
+
+ @Override
+ protected IStatus doStartMachine(IProgressMonitor monitor) throws MachineException {
+ // we're here due to an error state
+ if (launchedQemu != null) {
+ // kill the running one since there's no way to fix it
+ launchedQemu.destroy();
+ launchedQemu = null;
+ fireMachineStateChanged();
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ }
+
+ if (!HostUtils.isWindows()) {
+ throw new MachineException("Launching QEMU from Linux not implemented yet");
+ }
+
+ String batchFile;
+ try {
+ URL url = FileLocator.find(Activator.getDefault().getBundle(),
+ new Path(QEMU_LAUNCHER),
+ null);
+ if (url == null) {
+ throw new MachineException("Cannot locate " + QEMU_LAUNCHER);
+ }
+ batchFile = new Path(FileLocator.toFileURL(url).getPath()).toOSString();
+ } catch (IOException e1) {
+ throw new MachineException("Cannot extract " + QEMU_LAUNCHER, e1);
+ }
+
+ /* XXX: can't use CommandLineArguments#createFromCommandLine() for DOS
+ String launchPattern = "cmd /c \"${BATCH_FILE}\" \"${QEMU}\" \"${BIOS_DIR}\" \"${DATA_DIR}\" ${SSH_PORT}";
+
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("BATCH_FILE", batchFile);
+ substitutor.define("QEMU", configuration.getExecutable());
+ substitutor.define("BIOS_DIR", configuration.getBiosPath());
+ substitutor.define("DATA_DIR", configuration.getDiskImagePath());
+ substitutor.define("SSH_PORT", "" + configuration.getSSHConfiguration().getPort());
+
+ String commandString = substitutor.substitute(launchPattern);
+ System.out.println(commandString);
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine(commandString);
+ */
+
+ List<String> cmdLine = new ArrayList<String>();
+ cmdLine.add("cmd");
+ cmdLine.add("/c");
+ cmdLine.add(batchFile);
+
+ cmdLine.add(qemuConfiguration.getExecutable());
+ cmdLine.add(qemuConfiguration.getBiosPath());
+ cmdLine.add(qemuConfiguration.getDiskImagePath());
+ cmdLine.add("" + qemuConfiguration.getSSHConfiguration().getTargetPort());
+ cmdLine.add("" + qemuConfiguration.getCIFSPort());
+
+ String commandString = CommandLineArguments.toCommandLine(cmdLine);
+ System.out.println(commandString);
+
+ IProcessLauncherFactory processLauncherFactory = new HostProcessLauncherFactory();
+ final IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ processLauncherFactory, null, cmdLine);
+ try {
+ launchedQemu = processLauncher.createProcess();
+ } catch (ESboxException e) {
+ throw new MachineException("Cannot launch qemu: " + CommandLineArguments.toCommandLine(cmdLine), e);
+ }
+
+ launchedQemuThread = new QemuWatcherThread(processLauncher);
+ launchedQemuThread.start();
+
+ long timeout = System.currentTimeMillis() + 300 * 1000;
+ while (true) {
+ if (!launchedQemuThread.isAlive()) {
+ throw processOutput("qemu launch failed", launchedQemuThread);
+ }
+
+ for (int cnt = 0; cnt < 10; cnt++) {
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ doStopMachine(monitor);
+ return Status.CANCEL_STATUS;
+ }
+
+ Display display = Display.getCurrent();
+ if (display != null) {
+ while (display.readAndDispatch()) ;
+ }
+ }
+
+ // test the connection
+ IStatus status = doProbeMachine(monitor);
+ if (status.isOK()) {
+ // XXX: do this more intelligently
+ // sshd starts a few moments before /etc/rc.local is run,
+ // so kernel parameters like vdso might not be configured yet...
+ // wait a few seconds more to avoid immediately invoking
+ // scratchbox commands and failing.
+ for (int cnt = 0; cnt < 50; cnt++) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ while (display.readAndDispatch()) ;
+ }
+
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ }
+ }
+ break;
+ }
+
+ if (System.currentTimeMillis() >= timeout) {
+ throw processOutput("Timed out waiting for qemu startup", launchedQemuThread);
+ }
+ }
+
+ fireMachineStateChanged();
+ return Status.OK_STATUS;
+ }
+
+
+ @Override
+ protected IStatus doStopMachine(IProgressMonitor monitor) throws MachineException {
+ IStatus status = super.doStopMachine(monitor);
+ if (!status.isOK())
+ return status;
+
+ // only try halting if we created it
+ if (launchedQemuThread != null && launchedQemuThread.isAlive()) {
+ // make it halt
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine(
+ "sudo -S halt now");
+
+ Process process;
+ try {
+
+ process = new SSHProcess(qemuConfiguration.getSSHConfiguration(),
+ cmdLine,
+ null,
+ null,
+ null);
+ try {
+ // send the password for sudo
+ process.getOutputStream().write(qemuConfiguration.getSSHConfiguration().getUserPassword().getBytes());
+ process.getOutputStream().write('\n');
+ process.getOutputStream().close();
+
+ // this will return right away, it seems
+ process.waitFor();
+ } catch (InterruptedException e2) {
+ throw new MachineException("Aborted halting Linux host in QEMU", e2);
+ }
+ } catch (Exception e) {
+ throw new MachineException("Cannot stop processes in Linux host in QEMU", e);
+ }
+
+ // probe until it's not responding
+
+ long timeout = System.currentTimeMillis() + 60 * 1000;
+ while (true) {
+ for (int cnt = 0; cnt < 10; cnt++) {
+ try {
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ while (Display.getCurrent().readAndDispatch()) ;
+ }
+
+ // test the connection
+ status = doProbeMachine(monitor);
+ if (!status.isOK()) {
+ // wait a LITTLE longer -- termination of ssh doesn't mean we have really shut down
+ for (int cnt = 0; cnt < 75; cnt++) {
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ doStopMachine(monitor);
+ return Status.CANCEL_STATUS;
+ }
+
+ while (Display.getCurrent().readAndDispatch()) ;
+ }
+ break;
+ }
+
+ if (System.currentTimeMillis() >= timeout) {
+ throw processOutput("Timed out waiting for qemu shutdown", launchedQemuThread);
+ }
+ }
+
+ // stop monitoring
+ launchedQemuThread.interrupt();
+ launchedQemuThread = null;
+
+ // now, kill the process
+ launchedQemu.destroy();
+ launchedQemu = null;
+
+ fireMachineStateChanged();
+
+ return Status.OK_STATUS;
+ } else {
+ return Activator.createStatus(IStatus.WARNING,
+ "Not terminating QEMU session that this IDE did not create");
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doAskUserToRepairMachine(org.eclipse.swt.widgets.Shell, org.eclipse.core.runtime.IStatus)
+ */
+ @Override
+ protected Result doAskUserToRepairMachine(Shell shell, IStatus status) {
+ // see if QEMU *seems* to be running... i.e. something is listening on the SSH port
+ try {
+ Socket socket = new Socket(qemuConfiguration.getSSHConfiguration().getTargetIPAddress(),
+ qemuConfiguration.getSSHConfiguration().getTargetPort());
+ socket.close();
+
+
+ final boolean[] results = { false };
+ if (!WorkbenchUtils.isJUnitRunning()) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ results[0] = MessageDialog.openConfirm(null, "QEMU running?",
+ MessageFormat.format(
+ "QEMU may still be running, but it seems to be halted or crashed\n"
+ +"(or something else owns the server socket {0}:{1}).\n\n"
+ +"Please kill it if necessary and select 'Ok' to retry.",
+ qemuConfiguration.getSSHConfiguration().getTargetIPAddress(),
+ ""+qemuConfiguration.getSSHConfiguration().getTargetPort()));
+ }
+
+ });
+ }
+
+ if (!results[0]) {
+ // canceled
+ return Result.ABORT;
+ }
+ return Result.RETRY;
+
+ } catch (IOException e) {
+ // no one listening to the port, so probably qemu not running; ignore the error and keep trying
+ return Result.IGNORE;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#acquireMachine(org.maemo.esbox.core.machine.IMachine, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public IStatus acquireMachine(IMachine machine, IProgressMonitor monitor) {
+ monitor.beginTask("", 2);
+ IStatus status = super.acquireMachine(machine, new SubProgressMonitor(monitor, 1));
+ if (!status.isOK())
+ return status;
+
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+
+ // now, verify shared folders
+ QemuMachine qemuMachine = (QemuMachine) machine;
+
+ status = qemuMachine.validateSharedMounts(new SubProgressMonitor(monitor, 1));
+
+ return status;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#probeMachine(org.maemo.esbox.core.machine.IMachine, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public IStatus probeMachine(final IMachine machine, final IProgressMonitor monitor) {
+ monitor.beginTask("", 2);
+ IStatus status = super.probeMachine(machine, new SubProgressMonitor(monitor, 1));
+ if (!status.isOK())
+ return status;
+
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+
+ try {
+ // try to ensure mounts are shared, but don't sync on this here
+ if (!isValidating) {
+ isValidating = true;
+ Runnable runnable = new Runnable() {
+
+ public void run() {
+ IStatus status = ((QemuMachine) machine).validateSharedMounts(
+ new SubProgressMonitor(monitor, 1));
+ if (!status.isOK()) {
+ Activator.getErrorLogger().logError(status.getMessage(), status.getException());
+ }
+ isValidating = false;
+ }
+
+ };
+ Display display = Display.getCurrent();
+ if (display == null)
+ Display.getDefault().asyncExec(runnable);
+ else
+ runnable.run();
+ }
+
+ return Status.OK_STATUS;
+ } finally {
+ monitor.worked(1);
+ monitor.done();
+ }
+ }
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteMachineController.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteMachineController.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteMachineController.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.machine.MachineException;
+import org.maemo.esbox.internal.api.ssh.SSHMachineControllerBase;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+import java.text.MessageFormat;
+
+/**
+ * @author eswartz
+ *
+ */
+public class RemoteMachineController extends SSHMachineControllerBase {
+
+ /**
+ * @param configuration
+ */
+ public RemoteMachineController(SSHConfiguration configuration) {
+ super(configuration, "Linux");
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doAskUserToRepairMachine(org.eclipse.swt.widgets.Shell, org.eclipse.core.runtime.IStatus)
+ */
+ @Override
+ protected Result doAskUserToRepairMachine(Shell shell, IStatus status) {
+ boolean fixed = MessageDialog.openConfirm(null, "Remote machine down",
+ MessageFormat.format(
+ "The remote machine at {0}:{1} is not responding.\n\nPlease boot it or enable its SSH daemon, then hit Ok.",
+ configuration.getTargetIPAddress(),
+ ""+configuration.getTargetPort()));
+ if (fixed)
+ return Result.RETRY;
+ else
+ return Result.ABORT;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doStartMachine()
+ */
+ @Override
+ protected IStatus doStartMachine(IProgressMonitor monitor) throws MachineException {
+ // can't do this automatically
+ return Status.CANCEL_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.BaseMachineController#doStopMachine()
+ */
+ @Override
+ protected IStatus doStopMachine(IProgressMonitor monitor) throws MachineException {
+ return super.doStopMachine(monitor);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteSSHLinuxBuildMachineFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteSSHLinuxBuildMachineFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteSSHLinuxBuildMachineFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.widgets.Display;
+import org.maemo.esbox.core.machine.IBuildMachineFactory;
+import org.maemo.esbox.internal.api.core.machine.IBuildMachineImpl;
+import org.maemo.esbox.internal.api.core.machine.StockSharedFilesystemProvider;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+import java.net.URI;
+
+/**
+ * This factory builds remote non-QEMU Linux build machines.
+ * @author eswartz
+ *
+ */
+public class RemoteSSHLinuxBuildMachineFactory implements IBuildMachineFactory {
+
+ public synchronized IBuildMachineImpl[] createMachines() {
+ final URI[] uris = { null };
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ SSHMachineSetupDialog dialog = new SSHMachineSetupDialog(null);
+ if (dialog.open() == IDialogConstants.OK_ID) {
+ uris[0] = dialog.getURI();
+ }
+ }
+
+ });
+ if (uris[0] != null) {
+ SSHConfiguration configuration = new SSHConfiguration(uris[0]);
+ IBuildMachineImpl remoteMachine = new RemoteSSHLinuxMachine(configuration,
+ new StockSharedFilesystemProvider(configuration.getUserName()));
+ return new IBuildMachineImpl[] { remoteMachine };
+ }
+ return new IBuildMachineImpl[] {};
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteSSHLinuxMachine.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteSSHLinuxMachine.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/RemoteSSHLinuxMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.core.machine.ISharedFilesystemProvider;
+import org.maemo.esbox.internal.api.core.machine.IBuildMachineImpl;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+
+/**
+ * This machine is a remote non-VM Linux build machine.
+ * @author eswartz
+ *
+ */
+public class RemoteSSHLinuxMachine extends SSHMachineBackend implements IBuildMachineImpl {
+
+ public final static String ID = Activator.PLUGIN_ID + ".remote_machine";
+ public final static String NAME = "Remote Linux Machine";
+
+
+ /**
+ * @param sharedFilesystemProvider
+ * @param id
+ * @param name
+ * @param machineController
+ * @param fileSystemAccess
+ * @param processLauncherFactory
+ * @param processLister
+ */
+ public RemoteSSHLinuxMachine(SSHConfiguration configuration, ISharedFilesystemProvider sharedFilesystemProvider) {
+ super(ID, NAME, Platform.OS_LINUX,
+ new RemoteMachineController(configuration),
+ configuration,
+ sharedFilesystemProvider);
+ ((RemoteMachineController) getMachineController()).usePeriodicProbe(this);
+ }
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileInfo.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileInfo.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileInfo.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,260 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import com.jcraft.jsch.SftpATTRS;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.runtime.PlatformObject;
+
+/**
+ * We wrap the SFTP attributes here instead of using FileInfo, which has an unacceptable
+ * loss of information with regard to permissions, esp. when copying files.
+ * @author eswartz
+ *
+ */
+public class SSHFileInfo extends PlatformObject implements IFileInfo {
+ static final int S_IRUSR = 00400; // read by owner
+
+ static final int S_IWUSR = 00200; // write by owner
+
+ static final int S_IXUSR = 00100; // execute/search by owner
+
+ static final int S_IREAD = 00400; // read by owner
+
+ static final int S_IWRITE = 00200; // write by owner
+
+ static final int S_IEXEC = 00100; // execute/search by owner
+
+ static final int S_IRGRP = 00040; // read by group
+
+ static final int S_IWGRP = 00020; // write by group
+
+ static final int S_IXGRP = 00010; // execute/search by group
+
+ static final int S_IROTH = 00004; // read by others
+
+ static final int S_IWOTH = 00002; // write by others
+
+ static final int S_IXOTH = 00001; // execute/search by others
+
+ static final int R_OK = 1;
+ static final int W_OK = 2;
+ static final int X_OK = 4;
+
+ private final SftpATTRS attrs;
+ private String name;
+ private boolean archive;
+ private boolean hidden;
+
+ private int myuid;
+
+ private int mygid;
+
+ private String link;
+
+ private boolean exists;
+
+ public SSHFileInfo(String name, SftpATTRS attrs, String link, int myuid, int mygid) {
+ this.exists = true;
+ this.name = name;
+ this.attrs = attrs;
+ this.link = link;
+ this.myuid = myuid;
+ this.mygid = mygid;
+
+ int idx = name.lastIndexOf('.');
+ String extension = "";
+ if (idx >= 0) {
+ extension = name.substring(idx + 1);
+ }
+ this.archive = extension.matches("gz|bz2|zip|Z");
+ this.hidden = name.startsWith(".");
+ }
+
+ /**
+ * @param name
+ */
+ public SSHFileInfo(String name) {
+ this.name = name;
+ this.exists = false;
+ this.attrs = null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.IFileInfo#exists()
+ */
+ public boolean exists() {
+ return exists;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.IFileInfo#getAttribute(int)
+ */
+ public boolean getAttribute(int attribute) {
+ if (attrs == null)
+ return false;
+ switch (attribute) {
+ case EFS.ATTRIBUTE_ARCHIVE:
+ return archive;
+ case EFS.ATTRIBUTE_EXECUTABLE:
+ return access(X_OK);
+ case EFS.ATTRIBUTE_HIDDEN:
+ return hidden;
+ case EFS.ATTRIBUTE_LINK_TARGET:
+ return link != null;
+ case EFS.ATTRIBUTE_READ_ONLY:
+ return !access(W_OK);
+ case EFS.ATTRIBUTE_SYMLINK:
+ return link != null;
+ }
+ return false;
+ }
+
+ /**
+ * @param ok
+ * @return
+ */
+ private boolean access(int ok) {
+ if (attrs == null)
+ return false;
+
+ boolean userOwns = attrs.getUId() == myuid;
+
+ // XXX: this is not right, because the user can be in multiple groups
+ boolean userGroup = attrs.getGId() == mygid;
+
+ int permFlags;
+ if (userOwns) {
+ if (ok == R_OK)
+ permFlags = S_IRUSR;
+ else if (ok == W_OK)
+ permFlags = S_IWUSR;
+ else
+ permFlags = S_IXUSR;
+ } else if (userGroup) {
+ if (ok == R_OK)
+ permFlags = S_IRGRP + S_IROTH;
+ else if (ok == W_OK)
+ permFlags = S_IWGRP + S_IWOTH;
+ else
+ permFlags = S_IXGRP + S_IXOTH;
+ } else {
+ if (ok == R_OK)
+ permFlags = S_IROTH;
+ else if (ok == W_OK)
+ permFlags = S_IWOTH;
+ else
+ permFlags = S_IXOTH;
+ }
+
+ return (attrs.getPermissions() & permFlags) == permFlags;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.IFileInfo#getStringAttribute(int)
+ */
+ public String getStringAttribute(int attribute) {
+ if (attribute == EFS.ATTRIBUTE_LINK_TARGET)
+ return link;
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.IFileInfo#getLastModified()
+ */
+ public long getLastModified() {
+ if (attrs == null)
+ return 0;
+ return attrs.getMTime();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.IFileInfo#getLength()
+ */
+ public long getLength() {
+ if (attrs == null || attrs.isDir())
+ return 0;
+ return attrs.getSize();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.IFileInfo#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.IFileInfo#isDirectory()
+ */
+ public boolean isDirectory() {
+ if (attrs == null)
+ return false;
+ return attrs.isDir();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.IFileInfo#setAttribute(int, boolean)
+ */
+ public void setAttribute(int attribute, boolean value) {
+ if (attrs == null)
+ return;
+
+ switch (attribute) {
+ case EFS.ATTRIBUTE_ARCHIVE:
+ this.archive = value;
+ break;
+ case EFS.ATTRIBUTE_HIDDEN:
+ this.hidden = value;
+ break;
+ case EFS.ATTRIBUTE_LINK_TARGET:
+ // ignore
+ break;
+ case EFS.ATTRIBUTE_SYMLINK:
+ // ignore
+ break;
+ case EFS.ATTRIBUTE_READ_ONLY:
+ if (value)
+ attrs.setPERMISSIONS(attrs.getPermissions() & ~(S_IWUSR + S_IWGRP + S_IWOTH));
+ else
+ attrs.setPERMISSIONS(attrs.getPermissions() | (S_IWUSR + S_IWGRP + S_IWOTH));
+ break;
+ case EFS.ATTRIBUTE_EXECUTABLE:
+ if (value)
+ attrs.setPERMISSIONS(attrs.getPermissions() | (S_IXUSR + S_IXGRP + S_IXOTH));
+ else
+ attrs.setPERMISSIONS(attrs.getPermissions() & ~(S_IXUSR + S_IXGRP + S_IXOTH));
+ break;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.IFileInfo#setLastModified(long)
+ */
+ public void setLastModified(long time) {
+ if (attrs == null)
+ return;
+ attrs.setACMODTIME(attrs.getATime(), (int) time);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object o) {
+ if (o instanceof IFileInfo)
+ return name.compareTo(((IFileInfo) o).getName());
+ return 0;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileStore.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileStore.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileStore.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,880 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import com.jcraft.jsch.*;
+import com.jcraft.jsch.ChannelSftp.LsEntry;
+
+import org.eclipse.core.filesystem.*;
+import org.eclipse.core.filesystem.provider.FileInfo;
+import org.eclipse.core.filesystem.provider.FileStore;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.Policy;
+
+import java.io.*;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+
+/**
+ * EFS file store over SSH
+ * @author eswartz
+ *
+ */
+public class SSHFileStore extends FileStore {
+ static public boolean DEBUG = false;
+
+ static final int S_IRUSR = 00400; // read by owner
+ static final int S_IWUSR = 00200; // write by owner
+ static final int S_IXUSR = 00100; // execute/search by owner
+ static final int S_IREAD = 00400; // read by owner
+ static final int S_IWRITE = 00200; // write by owner
+ static final int S_IEXEC = 00100; // execute/search by owner
+ static final int S_IRGRP = 00040; // read by group
+ static final int S_IWGRP = 00020; // write by group
+ static final int S_IXGRP = 00010; // execute/search by group
+ static final int S_IROTH = 00004; // read by others
+ static final int S_IWOTH = 00002; // write by others
+ static final int S_IXOTH = 00001; // execute/search by others
+
+ static final int R_OK = 1;
+ static final int W_OK = 2;
+ static final int X_OK = 4;
+
+ private final IPath path;
+ private final SSHFileSystem fileSystem;
+
+ private final URI uri;
+
+ /**
+ */
+ public SSHFileStore(SSHFileSystem fileSystem, URI uri) {
+ this.fileSystem = fileSystem;
+ this.uri = uri;
+ this.path = new Path(uri.getPath());
+ }
+
+ protected CoreException newError(String msg, Throwable t) {
+ return new CoreException(Activator.createErrorStatus(msg, t));
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result
+ + ((fileSystem == null) ? 0 : fileSystem.hashCode());
+ result = prime * result + ((uri == null) ? 0 : uri.hashCode());
+ return result;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SSHFileStore other = (SSHFileStore) obj;
+ if (fileSystem == null) {
+ if (other.fileSystem != null)
+ return false;
+ } else if (!fileSystem.equals(other.fileSystem))
+ return false;
+ if (uri == null) {
+ if (other.uri != null)
+ return false;
+ } else if (!uri.equals(other.uri))
+ return false;
+ return true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#toURI()
+ */
+ @Override
+ public URI toURI() {
+ return uri;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#getName()
+ */
+ @Override
+ public String getName() {
+ return path.lastSegment();
+ }
+
+ /** Find cached FileInfo from the remote system for 'path'. Returns <code>null</code> if not found. */
+ protected FileInfo findFileInfo(URI uri) {
+ FileInfo fileInfo = fileSystem.getCachedFileInfo(uri);
+ return fileInfo;
+ }
+
+ /** Find cached or fetch FileInfo from the remote system for 'path'. Always returns FileInfo. */
+ protected FileInfo findOrCreateFileInfo(ChannelSftp channel, URI uri) throws SftpException {
+ FileInfo fileInfo = fileSystem.getCachedFileInfo(uri);
+ if (fileInfo != null)
+ return fileInfo;
+ fileInfo = createFileInfo(channel, uri, channel.lstat(uri.getPath()));
+ fileSystem.setCachedFileInfo(uri, fileInfo);
+ return fileInfo;
+ }
+
+ protected FileInfo createFileInfo(ChannelSftp channel, URI uri, SftpATTRS attrs) {
+ IPath path = new Path(uri.getPath());
+ String name = path.lastSegment();
+ if (name == null)
+ name = ""; // for "/"
+ FileInfo fileInfo = new FileInfo(name);
+ int idx = name.lastIndexOf('.');
+ String extension = "";
+ if (idx >= 0) {
+ extension = name.substring(idx + 1);
+ }
+ fileInfo.setAttribute(EFS.ATTRIBUTE_ARCHIVE, extension.matches("gz|bz2|zip|Z"));
+ fileInfo.setAttribute(EFS.ATTRIBUTE_HIDDEN, name.startsWith("."));
+ fileInfo.setExists(true);
+
+ if (attrs.isLink()) {
+ // if a symlink, fetch its info and retain linked target info
+
+ fileInfo.setAttribute(EFS.ATTRIBUTE_SYMLINK, true);
+ String realPath = path.toPortableString();
+ try {
+ String link = channel.readlink(realPath);
+ fileInfo.setStringAttribute(EFS.ATTRIBUTE_LINK_TARGET, link);
+
+ // must report linked info
+ String linkPath;
+ if (link.startsWith("/"))
+ linkPath = link;
+ else
+ linkPath = path.removeLastSegments(1).append(link).toPortableString();
+
+ URI linkUri;
+ try {
+ linkUri = new URI(fileSystem.getScheme(),
+ uri.getAuthority(),
+ linkPath,
+ null,
+ null);
+
+ FileInfo linkFileInfo = findOrCreateFileInfo(channel, linkUri);
+
+ fileInfo.setLength(linkFileInfo.getLength());
+ fileInfo.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, linkFileInfo.getAttribute(EFS.ATTRIBUTE_EXECUTABLE));
+ fileInfo.setAttribute(EFS.ATTRIBUTE_READ_ONLY, linkFileInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY));
+ fileInfo.setLastModified(linkFileInfo.getLastModified());
+
+ } catch (URISyntaxException e) {
+ // should not happen
+ Activator.getErrorLogger().logError("Internal error resolving softlink from " + uri + " against " + linkPath, e);
+ }
+
+ } catch (SftpException e) {
+ fileInfo.setExists(false);
+ Activator.getErrorLogger().logError("Cannot read symlink " + realPath, e);
+ }
+ } else {
+ if (!attrs.isDir()) {
+ fileInfo.setLength(attrs.getSize());
+ } else {
+ fileInfo.setLength(EFS.NONE);
+ }
+
+ fileInfo.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, access(attrs, X_OK));
+
+ // do not ever return read-only for directories, since this
+ // baffles the messed-up default impl for directory copying
+ if (attrs.isDir())
+ fileInfo.setAttribute(EFS.ATTRIBUTE_READ_ONLY, false);
+ else
+ fileInfo.setAttribute(EFS.ATTRIBUTE_READ_ONLY, !access(attrs, W_OK));
+
+ fileInfo.setDirectory(attrs.isDir());
+ // seconds -> milliseconds
+ fileInfo.setLastModified((long)attrs.getMTime() * 1000);
+ }
+
+ fileSystem.setCachedFileInfo(uri, fileInfo);
+ return fileInfo;
+ }
+
+ /**
+ * @param ok
+ * @return
+ */
+ private boolean access(SftpATTRS attrs, int ok) {
+ if (attrs == null)
+ return false;
+
+ boolean userOwns = attrs.getUId() == fileSystem.lookupUserUID(uri);
+
+ // XXX: this is not right, because the user can be in multiple groups
+ boolean userGroup = attrs.getGId() == fileSystem.lookupUserGID(uri);
+
+ int permFlags;
+ if (userOwns) {
+ if (ok == R_OK)
+ permFlags = S_IRUSR;
+ else if (ok == W_OK)
+ permFlags = S_IWUSR;
+ else
+ permFlags = S_IXUSR;
+ } else if (userGroup) {
+ if (ok == R_OK)
+ permFlags = S_IRGRP + S_IROTH;
+ else if (ok == W_OK)
+ permFlags = S_IWGRP + S_IWOTH;
+ else
+ permFlags = S_IXGRP + S_IXOTH;
+ } else {
+ if (ok == R_OK)
+ permFlags = S_IROTH;
+ else if (ok == W_OK)
+ permFlags = S_IWOTH;
+ else
+ permFlags = S_IXOTH;
+ }
+
+ return (attrs.getPermissions() & permFlags) == permFlags;
+
+ }
+ interface ILsEntryHandler {
+ void handle(ChannelSftp channel, ChannelSftp.LsEntry entry) ;
+ }
+
+ protected void iterateEntries(ILsEntryHandler handler) throws CoreException {
+ try {
+ ChannelSftp channel = fileSystem.getChannel(uri);
+ FileInfo info = findOrCreateFileInfo(channel, uri);
+ if (info != null && !info.isDirectory()) {
+ return;
+ }
+ Vector<ChannelSftp.LsEntry> entries = channel.ls(uri.getPath());
+ for (ChannelSftp.LsEntry entry : entries) {
+ if (filterEntry(entry)) {
+ handler.handle(channel, entry);
+ }
+ }
+ } catch (SftpException e) {
+ // assume it's not a directory
+ return;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#childInfos(int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public IFileInfo[] childInfos(int options, IProgressMonitor monitor)
+ throws CoreException {
+ final List<IFileInfo> infos = new ArrayList<IFileInfo>(1);
+ iterateEntries(new ILsEntryHandler() {
+ public void handle(ChannelSftp channel, LsEntry entry) {
+ infos.add(createFileInfo(channel, getChildURI(entry.getFilename()), entry.getAttrs()));
+ }
+ });
+ return (IFileInfo[]) infos.toArray(new IFileInfo[infos.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#childStores(int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public IFileStore[] childStores(int options, IProgressMonitor monitor)
+ throws CoreException {
+ final List<IFileStore> stores = new ArrayList<IFileStore>(1);
+ iterateEntries(new ILsEntryHandler() {
+ public void handle(ChannelSftp channel, LsEntry entry) {
+ //IPath childPath = path.append(entry.getFilename());
+ IFileStore store = getChild(entry.getFilename());
+ createFileInfo(channel, store.toURI(), entry.getAttrs());
+ stores.add(store);
+ }
+ });
+ return (IFileStore[]) stores.toArray(new IFileStore[stores.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#childNames(int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public String[] childNames(int options, IProgressMonitor monitor)
+ throws CoreException {
+ final List<String> names = new ArrayList<String>(1);
+ iterateEntries(new ILsEntryHandler() {
+ public void handle(ChannelSftp channel, LsEntry entry) {
+ names.add(entry.getFilename());
+ }
+ });
+ return (String[]) names.toArray(new String[names.size()]);
+ }
+
+ /**
+ * @param entry
+ * @return
+ */
+ private boolean filterEntry(LsEntry entry) {
+ return !entry.getFilename().equals(".") && !entry.getFilename().equals("..");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#getChild(java.lang.String)
+ */
+ @Override
+ public IFileStore getChild(String name) {
+ // XXX: cache?
+ URI child = getChildURI(name);
+ return fileSystem.getStore(child);
+ }
+
+ /**
+ * @param name
+ * @return
+ */
+ private URI getChildURI(String name) {
+ URI child = null;
+ try {
+ child = new URI(uri.getScheme(),
+ uri.getAuthority(),
+ path.append(name).toPortableString(),
+ null,
+ null);
+ return child;
+ } catch (URISyntaxException e) {
+ Activator.getErrorLogger().logError("Internal error resolving child of " + uri + " with " + name, e);
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#getParent()
+ */
+ @Override
+ public IFileStore getParent() {
+ if (path.segmentCount() > 0) {
+ URI parent;
+ try {
+ parent = new URI(uri.getScheme(),
+ uri.getAuthority(),
+ path.removeLastSegments(1).toPortableString(),
+ null,
+ null);
+ return fileSystem.getStore(parent);
+ } catch (URISyntaxException e) {
+ Activator.getErrorLogger().logError("Internal error resolving parent of " + uri, e);
+ return null;
+ }
+ }
+ else
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#fetchInfo(int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public IFileInfo fetchInfo(int options, IProgressMonitor monitor)
+ throws CoreException {
+ FileInfo info = findFileInfo(uri);
+ if (info != null) {
+ if (DEBUG) System.out.println("Using cached info for " + uri);
+ return info;
+ }
+
+ if (DEBUG) System.out.println("Fetching info for " + uri);
+
+
+ if (monitor != null)
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ try {
+ ChannelSftp channel = fileSystem.getChannel(uri);
+ SftpATTRS lstat = channel.lstat(uri.getPath());
+ info = createFileInfo(channel, uri, lstat);
+ } catch (SftpException e) {
+ info = new FileInfo(path.lastSegment());
+ } finally {
+ if (monitor != null)
+ monitor.done();
+ }
+ return info;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#putInfo(org.eclipse.core.filesystem.IFileInfo, int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void putInfo(IFileInfo newInfo, int options, IProgressMonitor monitor)
+ throws CoreException {
+
+ if (monitor != null)
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ try {
+ ChannelSftp channel = fileSystem.getChannel(uri);
+
+ // set permission bits?
+ if ((options & EFS.SET_ATTRIBUTES) != 0) {
+ SftpATTRS lstat = channel.lstat(uri.getPath());
+
+ int newPerms = lstat.getPermissions();
+
+ // always set all bits, whether user owns or not
+
+ // XXX: ignore attempts to turn off X bit for directories, since
+ // this is set by buggy FileStore#copyDirectory() which sets perms BEFORE copying files
+ if (newInfo.getAttribute(EFS.ATTRIBUTE_EXECUTABLE)
+ || lstat.isDir())
+ newPerms |= S_IXUSR + S_IXGRP + S_IXOTH;
+ else
+ newPerms &= ~(S_IXUSR + S_IXGRP + S_IXOTH);
+
+ if (newInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY))
+ newPerms &= ~(S_IWUSR + S_IWGRP + S_IWOTH);
+ else
+ newPerms |= (S_IWUSR + S_IWGRP + S_IWOTH);
+
+ channel.chmod(newPerms, uri.getPath());
+ }
+
+ // set last modified time?
+ if ((options & EFS.SET_LAST_MODIFIED) != 0) {
+ // milliseconds -> seconds for Unix
+ int seconds = (int) (newInfo.getLastModified() / 1000);
+ channel.setMtime(uri.getPath(), seconds);
+ }
+
+ flush();
+
+ } catch (SftpException e) {
+ fileSystem.setCachedFileInfo(uri, new FileInfo(path.lastSegment()));
+ } finally {
+ if (monitor != null)
+ monitor.done();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#openInputStream(int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public InputStream openInputStream(int options, IProgressMonitor monitor)
+ throws CoreException {
+ if (monitor != null)
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ try {
+ final ChannelSftp getChannel = fileSystem.createChannel(uri);
+
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ final InputStream getStream = getChannel.get(uri.getPath(),
+ new SSHSftpProgressMonitor(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)));
+
+ return new InputStream() {
+
+ @Override
+ public int read() throws IOException {
+ return getStream.read();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.InputStream#read(byte[], int, int)
+ */
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ return getStream.read(b, off, len);
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.InputStream#close()
+ */
+ @Override
+ public void close() throws IOException {
+ super.close();
+ if (DEBUG) System.out.println("closing input channel for " + uri);
+ getChannel.exit();
+ }
+
+ };
+ } catch (SftpException e) {
+ throw newError("Cannot get file " + path, e);
+ } finally {
+ if (monitor != null)
+ monitor.done();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#openOutputStream(int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public OutputStream openOutputStream(int options, IProgressMonitor monitor)
+ throws CoreException {
+ if (monitor != null)
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ try {
+ int mode;
+
+ if ((options & EFS.APPEND) != 0) {
+ mode = ChannelSftp.APPEND;
+ } else {
+ mode = ChannelSftp.OVERWRITE;
+ }
+
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ SSHSftpProgressMonitor sftpMonitor = new SSHSftpProgressMonitor(
+ new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
+
+ flush();
+
+ final ChannelSftp putChannel = fileSystem.createChannel(uri);
+ final OutputStream putStream = putChannel.put(uri.getPath(), sftpMonitor, mode);
+ return new OutputStream() {
+
+ @Override
+ public void write(int b) throws IOException {
+ putStream.write(b);
+ SSHFileStore.this.flush();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#write(byte[], int, int)
+ */
+ @Override
+ public void write(byte[] b, int off, int len)
+ throws IOException {
+ putStream.write(b, off, len);
+ SSHFileStore.this.flush();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#close()
+ */
+ @Override
+ public void close() throws IOException {
+ putStream.close();
+ if (DEBUG) System.out.println("closing output channel for " + uri);
+ putChannel.exit();
+ SSHFileStore.this.flush();
+ }
+
+ };
+ } catch (SftpException e) {
+ throw newError("Cannot write file " + uri, e);
+ } finally {
+ if (monitor != null)
+ monitor.done();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#delete(int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void delete(int options, IProgressMonitor monitor)
+ throws CoreException {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ ChannelSftp channel = fileSystem.getChannel(uri);
+ try {
+ // files or directories
+ SftpATTRS attrs;
+ try {
+ attrs = channel.lstat(uri.getPath());
+ } catch (SftpException e) {
+ // doesn't exist; fine
+ return;
+ }
+ if (attrs.isDir()) {
+ recurseRmdir(channel, this, monitor);
+ } else {
+ channel.rm(uri.getPath());
+ monitor.worked(1);
+ }
+ } catch (SftpException e) {
+ throw newError("Cannot delete file " + path, e);
+ } finally {
+ flush();
+ monitor.done();
+ }
+ }
+
+ /**
+ * Delete children and directory, best effort
+ * @param channel
+ * @param fileStore
+ * @throws CoreException
+ * @throws SftpException
+ */
+ private void recurseRmdir(ChannelSftp channel, SSHFileStore dir, IProgressMonitor monitor) throws CoreException, SftpException {
+ IFileStore[] kids = dir.childStores(EFS.NONE, new SubProgressMonitor(monitor, 1));
+ for (IFileStore kid : kids) {
+ if (kid.fetchInfo().isDirectory())
+ recurseRmdir(channel, (SSHFileStore) kid, monitor);
+ else
+ kid.delete(EFS.NONE, new SubProgressMonitor(monitor, 1));
+ }
+ channel.rmdir(dir.toURI().getPath());
+ dir.flush();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#mkdir(int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public IFileStore mkdir(int options, IProgressMonitor monitor)
+ throws CoreException {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ ChannelSftp channel = fileSystem.getChannel(uri);
+ try {
+ recurseMkdir(channel, this, monitor, 0 == (options & EFS.SHALLOW));
+ } catch (SftpException e) {
+ throw newError("Cannot create directory " + path, e);
+ } finally {
+ monitor.done();
+ }
+ return this;
+ }
+
+
+ /**
+ * Create directory and parents
+ * @param path2
+ * @param monitor
+ */
+ private boolean recurseMkdir(ChannelSftp channel, SSHFileStore store, IProgressMonitor monitor, boolean recurse) throws CoreException, SftpException {
+ if (store == null)
+ return false;
+
+ String path = store.toURI().getPath();
+ try {
+ SftpATTRS attrs = channel.stat(path);
+ if (!attrs.isDir()) {
+ throw newError("File exists at: " + path, null);
+ }
+ return true;
+ } catch (SftpException e) {
+ monitor.worked(1);
+ if (recurse && !recurseMkdir(channel, (SSHFileStore) store.getParent(), monitor, true))
+ return false;
+ channel.mkdir(path);
+ store.flush();
+ return true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#copy(org.eclipse.core.filesystem.IFileStore, int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void copy(IFileStore destination, int options,
+ IProgressMonitor monitor) throws CoreException {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ if (this.equals(destination))
+ return;
+ if (fetchInfo().isDirectory())
+ copyDirectory(this, destination, options, monitor);
+ else
+ copyFile(this, destination, options, monitor);
+ }
+
+ protected void copyDirectory(SSHFileStore source, IFileStore destination,
+ int options, IProgressMonitor monitor) throws CoreException {
+ // brute copy from FileStore, because transferAttributes ordering and behavior is broken and private!
+ try {
+ IFileStore[] children = null;
+ int opWork = 1;
+ if ((options & EFS.SHALLOW) == 0) {
+ children = childStores(EFS.NONE, null);
+ opWork += children.length;
+ }
+ monitor.beginTask("", opWork);
+ destination.mkdir(EFS.NONE, new SubProgressMonitor(monitor, 1));
+
+ if (children != null) {
+ // copy children
+ for (int i = 0; i < children.length; i++)
+ children[i].copy(destination.getChild(children[i].getName()), options,
+ new SubProgressMonitor(monitor, 1));
+ }
+
+ //[[[
+ // transfer full attributes AFTER copying
+ transferAllAttributes(this, destination);
+ //]]]
+ } finally {
+ monitor.done();
+ }
+ }
+
+ protected void copyFile(SSHFileStore source, IFileStore destination, int options, IProgressMonitor monitor) throws CoreException {
+ // brute copy from FileStore, because transferAttributes is private and broken, and it doesn't close streams!
+ try {
+ if ((options & EFS.OVERWRITE) == 0 && destination.fetchInfo().exists())
+ throw newError("Destination exists: " + destination, null);
+ IFileInfo sourceInfo = source.fetchInfo();
+ long length = sourceInfo.getLength();
+ int totalWork;
+ if (length == -1)
+ totalWork = IProgressMonitor.UNKNOWN;
+ else
+ totalWork = 1;
+ String sourcePath = toString();
+ monitor.beginTask("Copying " + sourcePath, totalWork);
+ InputStream in = null;
+ OutputStream out = null;
+ try {
+ in = openInputStream(EFS.NONE, new SubProgressMonitor(monitor, 0));
+ out = destination.openOutputStream(EFS.NONE, new SubProgressMonitor(monitor, 0));
+
+ try {
+ byte[] buffer = new byte[32768];
+ int len;
+ while ((len = in.read(buffer)) > 0) {
+ monitor.worked(len);
+ if (monitor.isCanceled())
+ throw new CoreException(Status.CANCEL_STATUS);
+ out.write(buffer, 0, len);
+ }
+ } catch (IOException e) {
+ throw newError("Error copying file", e);
+ }
+
+ //[[[
+ // well... maybe not, because this incorrectly sets the mod date, which isn't in the base impl
+ //transferAllAttributes(source, destination);
+ //]]]
+ } catch (CoreException e) {
+ //if we failed to write, try to cleanup the half written file
+ destination.delete(EFS.NONE, null);
+
+ throw e;
+ } finally {
+ Policy.close(in);
+ Policy.close(out);
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+
+
+ /**
+ * @param fileStore
+ * @param destination
+ * @throws CoreException
+ */
+ protected void transferAllAttributes(SSHFileStore fileStore,
+ IFileStore destination) throws CoreException {
+ if (uri.getAuthority().equals(destination.toURI().getAuthority())) {
+ try {
+ ChannelSftp channel = fileSystem.getChannel(uri);
+ SftpATTRS attrs = channel.lstat(fileStore.toURI().getPath());
+ channel.chmod(attrs.getPermissions(), destination.toURI().getPath());
+ channel.setMtime(destination.toURI().getPath(), attrs.getMTime());
+ } catch (SftpException e) {
+ Activator.getErrorLogger().logError("Cannot retrieve or set full attributes", e);
+ }
+ } else {
+ destination.putInfo(fileStore.fetchInfo(), EFS.SET_ATTRIBUTES | EFS.SET_LAST_MODIFIED, null);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#move(org.eclipse.core.filesystem.IFileStore, int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void move(IFileStore destination, int options,
+ IProgressMonitor monitor) throws CoreException {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ if (this.equals(destination)) {
+ throw newError("Cannot overwrite self", null);
+ }
+
+ try {
+ if (destination.getFileSystem().equals(fileSystem)
+ && uri.getAuthority().equals(destination.toURI().getAuthority())) {
+ // this might be on the same mount, too
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ ChannelSftp channel = fileSystem.getChannel(uri);
+ try {
+ URI destURI = destination.toURI();
+ if ((options & EFS.OVERWRITE) != 0) {
+ // check if target exists
+ FileInfo destInfo;
+ try {
+ destInfo = findOrCreateFileInfo(channel, destURI);
+
+ if (destInfo.exists()) {
+ fileSystem.getStore(destURI).delete(EFS.NONE, new SubProgressMonitor(monitor, 1));
+ }
+ } catch (SftpException e) {
+ // nope!
+ }
+ }
+
+ // now rename
+ channel.rename(uri.getPath(), destURI.getPath());
+
+ // do NOT need to flush info, except for top-level directory or for softlink...
+ // but might as well not waste time retrieving it right now anyway
+ flush();
+
+ return;
+ } catch (SftpException e) {
+ // fallback behavior -- copy and delete
+ }
+ }
+
+ // fallthrough
+ super.move(destination, options, monitor);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ /**
+ * Flush the cached info for the store
+ */
+ void flush() {
+ if (DEBUG) System.out.println("Flushing info for " + uri);
+
+ fileSystem.setCachedFileInfo(uri, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileStore#getFileSystem()
+ */
+ @Override
+ public IFileSystem getFileSystem() {
+ return fileSystem;
+ }
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileSystem.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileSystem.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHFileSystem.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import com.jcraft.jsch.*;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.provider.FileInfo;
+import org.eclipse.core.filesystem.provider.FileSystem;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+import java.net.URI;
+import java.util.*;
+
+/**
+ * EFS filesystem implementation over SSH
+ * @author eswartz
+ *
+ */
+public class SSHFileSystem extends FileSystem {
+ protected final String SFTP = "sftp";
+ //private final SSHConfiguration sshConfiguration;
+ /** map of authority to channel */
+ private Map<String, ChannelSftp> channelMap;
+ private Map<String, Session> sessionMap;
+
+ private WeakHashMap<URI, FileInfo> cachedFileInfo;
+ private Map<String, UnixUserInformation> cachedUserInfo;
+
+ public SSHFileSystem() {
+ //this.sshConfiguration = sshConfiguration;
+ this.channelMap = new HashMap<String, ChannelSftp>();
+ this.sessionMap = new HashMap<String, Session>();
+ this.cachedFileInfo = new WeakHashMap<URI, FileInfo>();
+ this.cachedUserInfo = new HashMap<String, UnixUserInformation>();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1 * prime;
+ return result;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ //SSHFileSystem other = (SSHFileSystem) obj;
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileSystem#attributes()
+ */
+ @Override
+ public int attributes() {
+ return EFS.ATTRIBUTE_EXECUTABLE + EFS.ATTRIBUTE_HIDDEN + EFS.ATTRIBUTE_LINK_TARGET + EFS.ATTRIBUTE_READ_ONLY + EFS.ATTRIBUTE_SYMLINK;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileSystem#canDelete()
+ */
+ @Override
+ public boolean canDelete() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileSystem#canWrite()
+ */
+ @Override
+ public boolean canWrite() {
+ return true;
+ }
+
+ /** Get a shared channel for atomic operations */
+ public synchronized ChannelSftp getChannel(URI uri) throws CoreException {
+ try {
+ ChannelSftp channel = channelMap.get(uri.getAuthority());
+ if (channel == null) {
+ Session session = getSession(uri);
+ channel = (ChannelSftp) session.openChannel(SFTP);
+ channel.connect();
+ channelMap.put(uri.getAuthority(), channel);
+ }
+ return channel;
+ } catch (JSchException e) {
+ throw new CoreException(Activator.createErrorStatus("Cannot create sftp channel", e));
+ }
+ }
+
+ /** Create a new channel for a stream operation */
+ public ChannelSftp createChannel(URI uri) throws CoreException {
+ try {
+ Session session = getSession(uri);
+ ChannelSftp channel = (ChannelSftp) session.openChannel(SFTP);
+ channel.connect();
+ return channel;
+ } catch (JSchException e) {
+ throw new CoreException(Activator.createErrorStatus("Cannot create sftp channel", e));
+ }
+ }
+ public synchronized Session getSession(URI uri) throws CoreException {
+ try {
+ Session session = sessionMap.get(uri.getAuthority());
+ if (session == null || !session.isConnected()) {
+ SSHConfiguration sshConfiguration = new SSHConfiguration(uri);
+ session = JSchSessionFactory.createSessionAndConnect(sshConfiguration);
+ sessionMap.put(uri.getAuthority(), session);
+ }
+ return session;
+ } catch (JSchException e) {
+ throw new CoreException(Activator.createErrorStatus("Cannot create sftp session", e));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileSystem#getStore(java.net.URI)
+ */
+ @Override
+ public IFileStore getStore(URI uri) {
+ if (!"ssh".equals(uri.getScheme()))
+ return EFS.getNullFileSystem().getStore(uri);
+ return new SSHFileStore(this, uri);
+ }
+
+ /** Get possibly cached file information about path in this filesystem. */
+ FileInfo getCachedFileInfo(URI path) {
+ return cachedFileInfo.get(path);
+ }
+
+ /** Set and possibly cache file information about path in this fileystem. */
+ void setCachedFileInfo(URI path, FileInfo info) {
+ if (info != null)
+ cachedFileInfo.put(path, info);
+ else
+ cachedFileInfo.remove(path);
+ }
+
+ /**
+ * @param userInfo
+ * @return
+ */
+ private UnixUserInformation getUnixUserInformation(URI uri) {
+ String userInfo = uri.getUserInfo();
+ String userName = userInfo;
+ int idx = userInfo.indexOf(':');
+ if (idx >= 0) {
+ userName = userInfo.substring(0, idx);
+ }
+
+ String userKey = userName + "@" + uri.getHost() + ":" + uri.getPort();
+ UnixUserInformation unixUserInfo = cachedUserInfo.get(userKey);
+ if (unixUserInfo == null) {
+ IProcessLauncherFactory processLauncherFactory = new SSHProcessLauncherFactory(
+ new SSHConfiguration(uri));
+ try {
+ unixUserInfo = UnixUserInformation.create(processLauncherFactory, userName);
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logError("Cannot determine user information for " + userName, e);
+ return null;
+ }
+
+ cachedUserInfo.put(userKey, unixUserInfo);
+ }
+
+ return unixUserInfo;
+ }
+
+ /**
+ *
+ * @param userInfo
+ * @return
+ * @see http://tools.ietf.org/html/rfc2396
+ */
+ public int lookupUserUID(URI uri) {
+ UnixUserInformation uidGid = getUnixUserInformation(uri);
+ return uidGid != null ? uidGid.getUid() : 0;
+ }
+
+ /**
+ * @param userInfo
+ * @return
+ * @see http://tools.ietf.org/html/rfc2396
+ */
+ public int lookupUserGID(URI uri) {
+ UnixUserInformation uidGid = getUnixUserInformation(uri);
+ return uidGid != null ? uidGid.getGid() : 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.filesystem.provider.FileSystem#getStore(org.eclipse.core.runtime.IPath)
+ */
+ @Override
+ public IFileStore getStore(IPath path) {
+ // the URI must be provided (host, user, port ...)
+ return EFS.getNullFileSystem().getStore(path);
+ }
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHMachineBackend.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHMachineBackend.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHMachineBackend.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,289 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import com.nokia.cpp.internal.api.utils.core.Pair;
+
+import org.eclipse.core.filesystem.*;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.Policy;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.internal.api.core.machine.*;
+import org.maemo.esbox.ssh.*;
+
+import java.io.*;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+
+/**
+ * This class implements the guts of a machine that uses
+ * SSH services to implement process and file access.
+ * @author eswartz
+ *
+ */
+public abstract class SSHMachineBackend extends Machine implements IMachineBackend, ISSHMachine {
+ private IFileSystem sshFileSystem;
+ private IFileSystemMappingImpl fileSystemMappingImpl;
+ private IFileSystemAccess sshFileSystemAccess;
+ private SSHConfiguration sshConfiguration;
+ private IProcessLister processLister;
+ private Map<String,String> gatheredEnv;
+ protected final ISharedFilesystemProvider sharedFilesystemProvider;
+ private String userName;
+
+ public SSHMachineBackend(String id, String name, String os,
+ IMachineController controller,
+ SSHConfiguration sshConfiguration,
+ ISharedFilesystemProvider sharedFilesystemProvider) {
+ super(name, os, controller);
+ this.sshConfiguration = sshConfiguration;
+ this.sharedFilesystemProvider = sharedFilesystemProvider;
+
+ try {
+ sshFileSystem = EFS.getFileSystem("ssh");
+ } catch (CoreException e) {
+ sshFileSystem = new SSHFileSystem();
+ }
+
+ this.userName = sshConfiguration.getUserName();
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IBuildMachine#canBuildFor(java.lang.String)
+ */
+ public boolean canBuildFor(String os) {
+ return os.equals(getOS());
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.ISSHMachine#getSshConfiguration()
+ */
+ public SSHConfiguration getSshConfiguration() {
+ return sshConfiguration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getEnvironmentVariablePrefix()
+ */
+ public String getEnvironmentVariablePrefix() {
+ return "SSH";
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IMachineBackend#getFileSystemAccess()
+ */
+ public synchronized IFileSystemMapping getFileSystemMapping() {
+ if (fileSystemMappingImpl == null) {
+ boolean isRemoteCaseSensitive = true;
+ fileSystemMappingImpl = new FileSystemMapping(
+ FileSystemMapping.getHostCanonicalizer(),
+ FileSystemMapping.getMachineCanonicalizer(isRemoteCaseSensitive));
+ initializeMappings();
+ }
+ return fileSystemMappingImpl;
+ }
+
+ protected synchronized void initializeMappings() {
+ List<Pair<IPath, IPath>> mappings = fileSystemMappingImpl.getHostToTargetRootMappings();
+
+ // the other machine is totally remote so nothing is visible
+ mappings.clear();
+
+ // ... unless it's explicitly shared
+ if (sharedFilesystemProvider != null) {
+ Map<IPath, IPath> sharedFolders = sharedFilesystemProvider.getSharedFolders();
+
+ for (Map.Entry<IPath, IPath> entry : sharedFolders.entrySet()) {
+ mappings.add(new Pair<IPath, IPath>(entry.getKey(), entry.getValue()));
+ }
+ }
+
+ fileSystemMappingImpl.setHostToTargetRootMappings(mappings);
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IMachineBackend#getFileSystem()
+ */
+ public synchronized IFileSystemAccess getFileSystemAccess() {
+ if (sshFileSystemAccess == null && sshFileSystem != null) {
+ sshFileSystemAccess = new IFileSystemAccessImpl() {
+
+ public URI getURIForPath(IPath path) {
+ try {
+ String userInfo = sshConfiguration.getUserName();
+ if (sshConfiguration.getUserPassword() != null)
+ userInfo += ":" + sshConfiguration.getUserPassword();
+
+ return new URI("ssh",
+ userInfo,
+ sshConfiguration.getTargetIPAddress(),
+ sshConfiguration.getTargetPort(),
+ path.toPortableString(),
+ null,
+ null);
+ } catch (URISyntaxException e) {
+ Activator.getErrorLogger().logError("Failed to create SSH EFS URI", e);
+ return URI.create("ssh:/");
+ }
+ }
+
+ public IFileSystem getFileSystem() {
+ return sshFileSystem;
+ }
+
+ public IFileStore getFileStore(IPath machinePath) {
+ return sshFileSystem.getStore(getURIForPath(machinePath));
+ }
+
+ };
+ }
+ return sshFileSystemAccess;
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IMachineBackend#getProcessLister()
+ */
+ public synchronized IProcessLister getProcessLister() {
+ if (processLister == null) {
+ processLister = new UnixProcessLister(getProcessLauncherFactory());
+ }
+ return processLister;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getProcessLauncherFactory()
+ */
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return new SSHProcessLauncherFactory(sshConfiguration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#createProcess(org.eclipse.core.runtime.IPath, java.util.List, java.util.Properties, org.eclipse.cdt.utils.pty.PTY)
+ */
+ public Process createProcess(IPath workingDirectory,
+ List<String> commandLine, Properties environment, boolean usePty)
+ throws Exception {
+ return new SSHProcess(sshConfiguration, commandLine, environment, workingDirectory);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getStandardEnvironment()
+ */
+ public Map<String, String> getStandardEnvironment() {
+ if (gatheredEnv == null) {
+ gatheredEnv = new HashMap<String, String>();
+ try {
+ // once per session, find out what the standard environment is
+ Process process = createProcess(null, CommandLineArguments.createFromCommandLine("sh -c set"), null, false);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ String[] parts = line.split("=", 2);
+ if (parts.length == 2) {
+ String name = parts[0];
+ // ignore variables specific to the SSH session that is retrieving the variables
+ if (!name.startsWith("SSH_")) {
+ // value is quoted
+ String value = parts[1];
+ if (value.length() >= 2 && value.startsWith("'") && value.endsWith("'")) {
+ value = value.substring(1, value.length() - 1).replace("\\'", "'");
+ }
+
+ gatheredEnv.put(parts[0], value);
+ }
+ }
+ }
+ process.waitFor();
+ } catch (Exception e) {
+ Activator.getErrorLogger().logError("Cannot read standard environment", e);
+ }
+ }
+ return gatheredEnv;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#isAlive()
+ */
+ public synchronized boolean isAlive() {
+ IStatus status = getMachineController().probeMachine(this, new NullProgressMonitor());
+ return status.isOK();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getUsername()
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getUserHome()
+ */
+ public IPath getUserHome() {
+ if (userName.equals("root"))
+ return new Path("/root");
+ else
+ return new Path("/home").append(userName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getURI()
+ */
+ public URI getURI() {
+ return URI.create("ssh://"
+ + sshConfiguration.getTargetIPAddress()
+ + ":"
+ + sshConfiguration.getTargetPort());
+ }
+
+ public ISharedFilesystemProvider getSharedFilesystemProvider() {
+ return sharedFilesystemProvider;
+ }
+
+ /**
+ * Tell whether the given path is mounted on the machine.
+ * @param value the path to check
+ * @return true: an entry in /proc/mounts matches, else false
+ */
+ public boolean isPathMounted(IPath value) {
+ IFileStore store = getFileSystemAccess().getFileStore(new Path("/proc/mounts"));
+ InputStream is = null;
+ try {
+ MountWalker walker = new MountWalker();
+ final boolean[] found = { false };
+ final String path = value.toPortableString();
+ is = store.openInputStream(0, null);
+ walker.accept(is, new IMountVisitor() {
+
+ public boolean handleMount(String device, String point,
+ String fsType, String options) {
+ if (point.equals(path)) {
+ found[0] = true;
+ return false;
+ }
+ return true;
+ }
+
+ });
+ return found[0];
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Cannot parse mounts", e);
+ return false;
+ } finally {
+ Policy.close(is);
+ }
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHMachineSetupDialog.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHMachineSetupDialog.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHMachineSetupDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.ssh;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * Asks the user to provide the URI for an SSH machine.
+ * @author eswartz
+ *
+ */
+public class SSHMachineSetupDialog extends Dialog {
+
+ private URI uri;
+ private Text text;
+ private CLabel info;
+
+ /**
+ * @param parentShell
+ */
+ protected SSHMachineSetupDialog(Shell parentShell) {
+ super(parentShell);
+ setBlockOnOpen(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText("Remote SSH Machine Setup");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setLayout(new GridLayout(1, false));
+
+ CLabel label = new CLabel(composite, SWT.NONE);
+ label.setText("Enter the URI for the machine:");
+ label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
+
+ text = new Text(composite, SWT.BORDER);
+ text.setText("ssh://user:qatest@127.0.0.1:2222");
+ uri = URI.create(text.getText());
+ GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
+ gridData.minimumWidth = 200;
+ text.setLayoutData(gridData);
+
+ /*CLabel spacing =*/ new CLabel(composite, SWT.NONE);
+
+ info = new CLabel(composite, SWT.NONE);
+ info.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
+ info.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
+
+ text.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ try {
+ uri = new URI(text.getText());
+ info.setText("");
+ getButton(IDialogConstants.OK_ID).setEnabled(true);
+ } catch (URISyntaxException ex) {
+ info.setText(ex.getMessage());
+ getShell().layout(true, true);
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ }
+ }
+
+ });
+
+ return composite;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ @Override
+ protected void okPressed() {
+ super.okPressed();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
+ */
+ @Override
+ protected void cancelPressed() {
+ uri = null;
+ super.cancelPressed();
+ }
+
+ public URI getURI() {
+ return uri;
+ }
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcess.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcess.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.ssh;
+
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.Session;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.internal.api.core.machine.IStreamWrapper;
+import org.maemo.esbox.internal.api.core.machine.IStreamWrapperFactory;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.*;
+
+/**
+ * Implement java.lang.Process using the SSH protocol
+ * @author eswartz
+ *
+ */
+public class SSHProcess extends Process {
+
+ //private static final byte IGNCR = 35;
+ private Session session;
+ private ChannelExec channel;
+ private OutputStream in;
+
+ private Thread monitorThread;
+ protected boolean exited;
+ protected int exitValue;
+
+ private IStreamWrapper streamWrapper;
+
+ public SSHProcess(final SSHConfiguration configuration,
+ List<String> cmdLine,
+ Properties env,
+ IPath cwd) throws Exception {
+ this(configuration, cmdLine, env, cwd, injectSSHProcessWrapper());
+ }
+
+ /**
+ * XXX FIXME HACK TODO: until the official sb2-qemu-arm with the bugfix is in the repository, use this hack to ensure processes terminate
+ * @return
+ */
+ private static IStreamWrapperFactory injectSSHProcessWrapper() {
+ for (StackTraceElement element : new Exception().getStackTrace()) {
+ if (element.getClassName().contains("Scratchbox2ProcessLauncher")) {
+ return new BuggySB2QEMUStreamWrapperFactory();
+ }
+ }
+ return null;
+ }
+
+ public SSHProcess(final SSHConfiguration configuration,
+ List<String> cmdLine,
+ Properties env,
+ IPath cwd,
+ IStreamWrapperFactory wrapperFactory) throws Exception {
+ session = JSchSessionFactory.createSessionAndConnect(configuration);
+
+ channel = (ChannelExec) session.openChannel("exec");
+ channel.setXForwarding(true);
+
+ //// CDT's CommandLauncher does this!!
+ // try (but fail) to convince it not to translate \n to \r\n
+ //channel.setTerminalMode(new byte[] {
+ // IGNCR, 0, 0, 0, 1,
+ // 0
+ //});
+
+ // env passing is broken until 0.1.38
+ /*
+ for (Map.Entry<Object, Object> entry : env.entrySet()) {
+ channel.setEnv(entry.getKey().toString(), entry.getValue().toString());
+ }
+ */
+
+ String commandLine = CommandLineArguments.toCommandLine(cmdLine);
+
+ if (env != null) {
+ String envCmdLine = "";
+ boolean needShell = false;
+ for (Map.Entry<Object, Object> entry : env.entrySet()) {
+ needShell = true;
+ envCmdLine += entry.getKey() + "=" +
+ //'"' + entry.getValue() + "\";"
+ "\"" + CommandLineArguments.escape(entry.getValue().toString(), false) + "\""
+ //"'" + entry.getValue().toString().replaceAll("'", "\\\\'") + "'"
+ + " ";
+ }
+
+ if (needShell) {
+ commandLine = "/bin/sh -c \"" + CommandLineArguments.escape(envCmdLine + commandLine, false) + "\"";
+ }
+ }
+
+ if (cwd != null) {
+ commandLine = "cd \"" + cwd.toPortableString() + "\" && " + commandLine;
+ }
+
+ System.out.println(commandLine);
+
+ channel.setCommand(commandLine);
+ channel.connect();
+
+ final InputStream err = channel.getExtInputStream();
+ final InputStream out = channel.getInputStream();
+ in = channel.getOutputStream();
+
+ if (wrapperFactory != null) {
+ streamWrapper = wrapperFactory.createStreamWrapper(out, err);
+ } else {
+ streamWrapper = new IStreamWrapper() {
+
+ public InputStream getErrorStream() {
+ return err;
+ }
+
+ public InputStream getInputStream() {
+ return out;
+ }
+
+ public boolean isClosed() {
+ return false;
+ }
+
+ };
+ }
+
+ exitValue = -1;
+ exited = false;
+
+ monitorThread = new Thread(new Runnable() {
+
+ public void run() {
+ try {
+ channel.run();
+
+ // Done running, but must still wait a little while
+ // for the exit status to be set... but that won't be
+ // sent until the SSH daemon has sent all the pending stdout/stderr
+ // content.
+ //
+ // The client of SSHProcess, though, might be waiting for
+ // the exit status before it reads the streams!
+ //
+ // But, according to {@link Process}, deadlock may be expected
+ // if the client is not reading stdout/stderr on time.
+
+ while (channel.isConnected() && channel.getExitStatus() == -1 && !streamWrapper.isClosed()) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ return;
+ }
+ }
+
+ if (streamWrapper.isClosed()) {
+ channel.disconnect();
+ }
+
+ // alert waiting #waitFor() that we're done
+ synchronized (SSHProcess.this) {
+ int exit = channel.getExitStatus();
+ SSHProcess.this.exited = true;
+ SSHProcess.this.exitValue = exit;
+ SSHProcess.this.notifyAll();
+ }
+
+ } finally {
+ // finally done, release the session
+ session.disconnect();
+ }
+ }
+
+ }, "SSH process monitor: " + commandLine);
+ monitorThread.start();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Process#destroy()
+ */
+ @Override
+ public void destroy() {
+ if (monitorThread.isAlive()) {
+ channel.disconnect();
+ monitorThread.interrupt();
+ exitValue = (2 << 8) | 255; // SIGINT
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Process#exitValue()
+ */
+ @Override
+ public synchronized int exitValue() {
+ if (exited) {
+ return exitValue;
+ }
+ throw new IllegalThreadStateException();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Process#getErrorStream()
+ */
+ @Override
+ public InputStream getErrorStream() {
+ return streamWrapper.getErrorStream();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Process#getInputStream()
+ */
+ @Override
+ public InputStream getInputStream() {
+ return streamWrapper.getInputStream();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Process#getOutputStream()
+ */
+ @Override
+ public OutputStream getOutputStream() {
+ return in;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Process#waitFor()
+ */
+ @Override
+ public int waitFor() throws InterruptedException {
+ synchronized (this) {
+ while (!exited && monitorThread.isAlive()) {
+ this.wait(500);
+ }
+ exited = true;
+ }
+
+ return exitValue();
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcessLauncher.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcessLauncher.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcessLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar 17, 2008
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.BaseProcessLauncher;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.internal.api.core.machine.IStreamWrapperFactory;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+import java.util.*;
+
+/**
+ * For launching a process on the given remote host via SSH.
+ *
+ * @author LWang.
+ *
+ */
+public class SSHProcessLauncher extends BaseProcessLauncher {
+
+ private SSHConfiguration configuration;
+ private IStreamWrapperFactory streamWrapperFactory;
+
+ public SSHProcessLauncher(
+ SSHConfiguration configuration,
+ List<String> cmdLine,
+ Properties environment,
+ IPath workingDirectory,
+ IPreferenceProvider prefProvider) {
+ super(cmdLine,
+ environment,
+ workingDirectory,
+ prefProvider);
+ this.configuration = configuration;
+ }
+
+ public void setStreamWrapperFactory(IStreamWrapperFactory factory) {
+ this.streamWrapperFactory = factory;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoPrefix()
+ */
+ @Override
+ protected String getLaunchInfoPrefix() {
+ return configuration.getURI() + " ";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoStandardEnvironment()
+ */
+ @Override
+ protected Map<String, String> getLaunchInfoStandardEnvironment() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#setupForLaunch()
+ */
+ @Override
+ protected void setupForLaunch() throws ESboxException {
+ // nothing special
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#doCreateProcess()
+ */
+ @Override
+ public Process doCreateProcess() throws Exception {
+ return new SSHProcess(configuration, getLaunchCommandArguments(),
+ getLaunchEnvironment(), getLaunchCurrentWorkingDirectory(),
+ streamWrapperFactory);
+ }
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcessLauncherFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcessLauncherFactory.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHProcessLauncherFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar 17, 2008
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.internal.api.core.BaseProcessLauncherFactory;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * Launch processes over SSH.
+ * @author LWang.
+ * @author eswartz
+ *
+ */
+public class SSHProcessLauncherFactory extends BaseProcessLauncherFactory {
+
+ private SSHConfiguration configuration;
+ private Properties standardEnv;
+
+ public SSHProcessLauncherFactory(SSHConfiguration config) {
+ super(false);
+ configuration = config;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncherFactory#doCreateProcessLaunchHandler(org.eclipse.core.runtime.IPath, java.util.List, java.util.Properties, org.eclipse.cdt.utils.pty.PTY)
+ */
+ @Override
+ protected IProcessLauncher doCreateProcessLaunchHandler(
+ IPath workingDirectory, List<String> cmdLine,
+ Properties environment) {
+ return new SSHProcessLauncher(
+ configuration,
+ cmdLine,
+ environment != null ? environment : readStandardEnvironment(),
+ workingDirectory,
+ CorePlugin.getDefault().getCorePreferenceProvider());
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncherFactory#readStandardEnvironment()
+ */
+ @Override
+ protected Properties readStandardEnvironment() {
+ if (standardEnv == null) {
+ standardEnv = new Properties();
+
+ mergeOrSetUserVariables("SSH", standardEnv, null);
+ }
+ return standardEnv;
+ }
+
+ public SSHConfiguration getConfiguration() {
+ return configuration;
+ }
+
+ public void setConfiguration(SSHConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHSftpProgressMonitor.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHSftpProgressMonitor.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/SSHSftpProgressMonitor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import com.jcraft.jsch.SftpProgressMonitor;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+/**
+ * @author eswartz
+ * @author Raul Fernandes Herbster
+ *
+ */
+class SSHSftpProgressMonitor implements SftpProgressMonitor {
+
+ private IProgressMonitor monitor = new NullProgressMonitor();
+
+ private long count = 0;
+
+ private boolean inited = false;
+
+ public SSHSftpProgressMonitor(IProgressMonitor monitor) {
+ this.monitor = monitor;
+ }
+ /*
+ * (non-Javadoc)
+ * @see com.jcraft.jsch.SftpProgressMonitor#init(int, java.lang.String, java.lang.String, long)
+ */
+ public void init(int op, String src, String dest, long max) {
+ monitor.beginTask(op == GET ? "SFTP GET" : "SFTP PUT", (int) max);
+ inited = true;
+ count = 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.jcraft.jsch.SftpProgressMonitor#count(long)
+ */
+ public boolean count(long count) {
+ if (!inited) {
+ monitor.beginTask("SFTP operation", IProgressMonitor.UNKNOWN);
+ }
+ monitor.worked((int)this.count);
+ return !(monitor.isCanceled());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.jcraft.jsch.SftpProgressMonitor#end()
+ */
+ public void end() {
+ monitor.done();
+ }
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/StockQemuConfiguration.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/StockQemuConfiguration.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/StockQemuConfiguration.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.core.machine.ISharedFilesystemProvider;
+import org.maemo.esbox.internal.api.core.machine.StockSharedFilesystemProvider;
+import org.maemo.esbox.ssh.IQemuConfiguration;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+/**
+ * @author eswartz
+ *
+ */
+public class StockQemuConfiguration implements IQemuConfiguration {
+
+
+ private SSHConfiguration sshConfiguration = new SSHConfiguration(
+ "127.0.0.1", 2222, "devel", "qatest",
+ 10 /*timeout*/
+ );
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IQemuConfiguration#getOS()
+ */
+ public String getOS() {
+ return Platform.OS_LINUX;
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IQemuConfiguration#getSSHConfiguration()
+ */
+ public SSHConfiguration getSSHConfiguration() {
+ return sshConfiguration;
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IQemuConfiguration#getBiosPath()
+ */
+ public String getBiosPath() {
+ return "c:/Program Files/Qemu";
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IQemuConfiguration#getDiskImagePath()
+ */
+ public String getDiskImagePath() {
+ return "c:/Program Files/Nokia/Carbide for Maemo/vm";
+ }
+
+ /* (non-Javadoc)
+ * @see testrse.IQemuConfiguration#getExecutable()
+ */
+ public String getExecutable() {
+ return "c:/program files/qemu/qemu.exe";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IQemuConfiguration#getUserName()
+ */
+ public String getUserName() {
+ return sshConfiguration.getUserName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IQemuConfiguration#getSharedFilesystemProvider()
+ */
+ public ISharedFilesystemProvider getSharedFilesystemProvider() {
+ return new StockSharedFilesystemProvider(sshConfiguration.getUserName());
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IQemuConfiguration#getCIFSPort()
+ */
+ public int getCIFSPort() {
+ return 4445;
+ }
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/UnixUserInformation.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/UnixUserInformation.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/internal/ssh/UnixUserInformation.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.ssh;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.*;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * This class encapsulates the details of a user's identification, as seen in the command "id".
+ * @author eswartz
+ *
+ */
+public class UnixUserInformation {
+ private final String userName;
+ private final int uid;
+ private final int gid;
+ private final int[] groups;
+
+ private static final Pattern idPattern = Pattern.compile(
+ "uid=(\\d+)\\(.*\\)\\s+gid=(\\d+)\\(.*\\)(?:\\s+groups=(.*))?", Pattern.MULTILINE);
+
+ private static final Pattern groupPattern = Pattern.compile(
+ "(\\d+)\\(.*\\)");
+
+ public static UnixUserInformation create(IProcessLauncherFactory processLauncherFactory, String userName) throws ESboxException {
+ IProcessLauncher processLaunchHandler = processLauncherFactory.createProcessLaunchHandler(
+ null,
+ CommandLineArguments.createFromCommandLine("/usr/bin/id"),
+ null);
+ Process process = processLaunchHandler.createProcess();
+ StringBuilder builder = new StringBuilder();
+ InputStream is = process.getInputStream();
+ int ch;
+ try {
+ while ((ch = is.read()) != -1) {
+ builder.append((char) ch);
+ }
+ } catch (IOException e) {
+ throw new ESboxException(e);
+ }
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ throw new ESboxException(e);
+ }
+
+ String output = builder.toString().trim();
+ Matcher matcher = idPattern.matcher(output);
+ if (!matcher.matches())
+ throw new ESboxException("'id' output does not match expected pattern: " + output);
+
+ int uid = Integer.parseInt(matcher.group(1));
+ int gid = Integer.parseInt(matcher.group(2));
+
+ String groupLine = matcher.group(3);
+ String[] groupParts;
+ if (groupLine != null)
+ groupParts = groupLine.split(",");
+ else
+ groupParts = new String[0];
+ int[] groups = new int[groupParts.length];
+
+ int idx = 0;
+ for (String groupPart : groupParts) {
+ matcher = groupPattern.matcher(groupPart);
+ if (!matcher.matches()) {
+ throw new ESboxException("'id' output does not match expected pattern for group: " + groupPart);
+ }
+ groups[idx++] = Integer.parseInt(matcher.group(1));
+ }
+
+ return new UnixUserInformation(userName, uid, gid, groups);
+ }
+
+ private UnixUserInformation(String userName, int uid, int gid, int[] groups) {
+ this.userName = userName;
+ this.uid = uid;
+ this.gid = gid;
+ this.groups = groups;
+ }
+
+ /**
+ * @return the userName
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * @return the uid
+ */
+ public int getUid() {
+ return uid;
+ }
+
+ /**
+ * @return the gid
+ */
+ public int getGid() {
+ return gid;
+ }
+
+ /**
+ * @return the groups
+ */
+ public int[] getGroups() {
+ return groups;
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/IMountVisitor.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/IMountVisitor.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/IMountVisitor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ssh;
+
+public interface IMountVisitor {
+ /** Handle a mount.
+ * @param device
+ * @param point
+ * @param fsType
+ * @param options
+ * @return true to continue walking, else false
+ */
+ boolean handleMount(String device, String point, String fsType, String options);
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/IQemuConfiguration.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/IQemuConfiguration.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/IQemuConfiguration.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ssh;
+
+import org.maemo.esbox.core.machine.ISharedFilesystemProvider;
+
+/**
+ * This interface, implemented by clients, provides settings needed
+ * to launch and communicate with a virtual machine using QEMU.
+ * <p>
+ * XXX Currently this is expected to return non-changing values.
+ * If values change, ensure that a listener is added so machines
+ * can respond to changes.
+ * @author eswartz
+ *
+ */
+public interface IQemuConfiguration {
+
+ /** Get the OS this runs (Platform.OS_xxx) */
+ String getOS();
+
+ /** Get the name (path + filename) of the program to launch. */
+ String getExecutable();
+
+ /** Get the path of the BIOS files. */
+ String getBiosPath();
+
+ /** Get the base path of the disk images. */
+ String getDiskImagePath();
+
+ /** Get the SSH configuration. */
+ SSHConfiguration getSSHConfiguration();
+
+ /**
+ * Get the name of the primary user on this machine
+ */
+ String getUserName();
+
+ /**
+ * Get the shared filesystems
+ */
+ ISharedFilesystemProvider getSharedFilesystemProvider();
+
+ /**
+ * Get the port for CIFS (Samba/Windows shares) access
+ * @return
+ */
+ int getCIFSPort();
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ISSHMachine.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ISSHMachine.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ISSHMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ssh;
+
+import org.maemo.esbox.core.machine.IMachine;
+
+/**
+ * SSH extension of a machine.
+ * @author eswartz
+ *
+ */
+public interface ISSHMachine extends IMachine {
+ /** Get the configuration for the machine. (Changes do not affect the machine.) */
+ public SSHConfiguration getSshConfiguration();
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/SSHConfiguration.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/SSHConfiguration.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/SSHConfiguration.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar 17, 2008
+ *******************************************************************************/
+package org.maemo.esbox.ssh;
+
+import java.net.URI;
+
+/**
+ * Configuration data for SSH connection to a remote target.
+ *
+ * @author LWang.
+ * @author eswartz
+ *
+ */
+public class SSHConfiguration implements Cloneable {
+
+ /**
+ *
+ */
+ private static final int SSH_PORT = 22;
+ private String targetIPAddress = ""; // IP address or name of remote target.
+ private int targetPort = SSH_PORT; // SSH protocol port
+ private String userName = ""; // user name on remote target.
+ private String userPassword = null; // password of the user.
+ private int connectionTimeout = 10; // Timeout (in seconds) for ssh based commands.
+ private String hostIPAddress = ""; // IP address or name of host as seen by remote.
+ private int hostPort = SSH_PORT; // SSH protocol port for accessing host from remote.
+
+ public SSHConfiguration(String targetIPAddress, int targetPort,
+ String hostIPAddress, int hostPort,
+ String userName, String userPassword,
+ int connectionTimeout) {
+ super();
+ this.targetIPAddress = targetIPAddress;
+ this.targetPort = targetPort < 0 ? SSH_PORT : targetPort;
+ this.hostIPAddress = hostIPAddress;
+ this.hostPort = hostPort < 0 ? SSH_PORT : hostPort;
+ this.userName = userName;
+ this.userPassword = userPassword;
+ this.connectionTimeout = connectionTimeout;
+ }
+
+ public SSHConfiguration(String targetIPAddress, int port,
+ String userName, String userPassword,
+ int connectionTimeout) {
+ super();
+ this.targetIPAddress = targetIPAddress;
+ this.targetPort = port < 0 ? SSH_PORT : port;
+ this.userName = userName;
+ this.userPassword = userPassword;
+ this.connectionTimeout = connectionTimeout;
+ }
+
+ public SSHConfiguration(String targetIPAddress, String userName,
+ int connectionTimeout) {
+ super();
+ this.targetIPAddress = targetIPAddress;
+ this.userName = userName;
+ this.connectionTimeout = connectionTimeout;
+ }
+
+ public SSHConfiguration() {
+ }
+
+ public SSHConfiguration(SSHConfiguration from) {
+ this(from.getTargetIPAddress(), from.getTargetPort(), from.getUserName(), from.getUserPassword(), from.getConnectionTimeout());
+ }
+
+ /**
+ * Construct information from a URI whose host information contains the host,
+ * port, username, and password.
+ * @param uri
+ */
+ public SSHConfiguration(URI uri) {
+ this.targetIPAddress = uri.getHost();
+ this.targetPort = uri.getPort();
+ if (targetPort < 0) {
+ targetPort = SSH_PORT;
+ }
+ this.userName = uri.getUserInfo();
+ if (userName == null) {
+ userName = "unknown";
+ }
+ int idx = userName.indexOf(':');
+ if (idx >= 0) {
+ this.userPassword = userName.substring(idx + 1);
+ this.userName = userName.substring(0, idx);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + targetPort;
+ result = prime * result
+ + ((targetIPAddress == null) ? 0 : targetIPAddress.hashCode());
+ result = prime * result
+ + ((userName == null) ? 0 : userName.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SSHConfiguration other = (SSHConfiguration) obj;
+ if (targetPort != other.targetPort)
+ return false;
+ if (targetIPAddress == null) {
+ if (other.targetIPAddress != null)
+ return false;
+ } else if (!targetIPAddress.equals(other.targetIPAddress))
+ return false;
+ if (userName == null) {
+ if (other.userName != null)
+ return false;
+ } else if (!userName.equals(other.userName))
+ return false;
+ return true;
+ }
+
+ public String getTargetIPAddress() {
+ return targetIPAddress;
+ }
+ public void setTargetIPAddress(String targetIPAddress) {
+ this.targetIPAddress = targetIPAddress;
+ }
+
+ public int getTargetPort() {
+ return targetPort;
+ }
+
+ public void setTargetPort(int port) {
+ if (port < 0)
+ port = SSH_PORT;
+ this.targetPort = port;
+ }
+
+ public String getHostIPAddress() {
+ return hostIPAddress;
+ }
+ public void setHostIPAddress(String address) {
+ this.hostIPAddress = address;
+ }
+
+ public int getHostPort() {
+ return hostPort;
+ }
+
+ public void setHostPort(int port) {
+ if (port < 0)
+ port = SSH_PORT;
+ this.hostPort = port;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+ public String getUserPassword() {
+ return userPassword;
+ }
+ public void setUserPassword(String userPassword) {
+ this.userPassword = userPassword;
+ }
+
+ /**
+ * Timeout in seconds for "ssh" based commands.
+ * @return
+ */
+ public int getConnectionTimeout() {
+ return connectionTimeout;
+ }
+
+ /**
+ * Timeout in seconds for "ssh" based commands.
+ */
+ public void setConnectionTimeout(int connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ }
+
+ /**
+ * Get the URI for the information recorded here (except timeout)
+ * @return
+ */
+ public URI getURI() {
+ String userInfo;
+ if (userName != null) {
+ if (userPassword != null)
+ userInfo = userName + ":" + userPassword + "@";
+ else
+ userInfo = userName + "@";
+ } else {
+ userInfo = "";
+ }
+ return URI.create("ssh://" + userInfo + targetIPAddress + ":" + targetPort);
+ }
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ui/ESboxSSHPreferencePage.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ui/ESboxSSHPreferencePage.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ui/ESboxSSHPreferencePage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ssh.ui;
+
+import org.eclipse.jface.preference.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+
+
+/**
+ * General preference page for SSH
+ *
+ * @author eswartz
+ */
+public class ESboxSSHPreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private StringFieldEditor feSshUserName = null;
+ private StringFieldEditor feSshDestFolder;
+ private IntegerFieldEditor feSshConnectionTimeout;
+
+ /**
+ * The constructor
+ */
+ public ESboxSSHPreferencePage() {
+ super(GRID);
+ setPreferenceStore(CorePlugin.getDefault().getPreferenceStore());
+ setDescription("Options configuring SSH");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ public void createFieldEditors() {
+
+ feSshUserName = new StringFieldEditor(
+ ESboxPreferenceConstants.SSH_USERNAME.toString(),
+ "Username for device access:",
+ getFieldEditorParent());
+
+ feSshDestFolder = new StringFieldEditor(
+ ESboxPreferenceConstants.SSH_DEST_FOLDER.toString(),
+ "Destination folder for executable:",
+ getFieldEditorParent());
+
+ feSshConnectionTimeout = new IntegerFieldEditor(
+ ESboxPreferenceConstants.SSH_CONNECTION_TIMEOUT.toString(),
+ "Connection timeout:",
+ getFieldEditorParent());
+
+ // make these strings manageable
+ int width;
+ GC gc = new GC(getFieldEditorParent().getShell());
+ width = gc.getAdvanceWidth('m') * 32;
+ gc.dispose();
+
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.widthHint = width;
+ feSshUserName.getTextControl(getFieldEditorParent()).setLayoutData(gridData);
+
+ gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.widthHint = width;
+ feSshDestFolder.getTextControl(getFieldEditorParent()).setLayoutData(gridData);
+
+ addField(feSshUserName);
+ addField(feSshDestFolder);
+ addField(feSshConnectionTimeout);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ // Nothing to do
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ui/SSHPreferenceUtils.java
===================================================================
--- trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ui/SSHPreferenceUtils.java (rev 0)
+++ trunk/common/org.maemo.esbox.ssh/src/org/maemo/esbox/ssh/ui/SSHPreferenceUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ssh.ui;
+
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.maemo.esbox.internal.ssh.Activator;
+
+/**
+ * @author eswartz
+ *
+ */
+public class SSHPreferenceUtils {
+ /**
+ * Preference page ID
+ */
+ public static final String PREFERENCEPAGE_ID_ESBOX = Activator.PLUGIN_ID + ".esboxPreferencePage";
+ public static final String PREFERENCEPAGE_ID_ESBOX_SSH = Activator.PLUGIN_ID + ".esboxPreferencePage.ssh";
+
+ /**
+ * Display the global SSH preference panel.
+ * Note this must be called in UI thread.
+ *
+ * @param shell
+ */
+ static public void showGlobalSSHPanel(Shell shell) {
+
+ PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
+ shell,
+ PREFERENCEPAGE_ID_ESBOX_SSH,
+ new String[] {
+ PREFERENCEPAGE_ID_ESBOX,
+ PREFERENCEPAGE_ID_ESBOX_SSH,
+ },
+ null);
+ dialog.open();
+ }
+
+}
Property changes on: trunk/common/org.maemo.esbox.ui
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/common/org.maemo.esbox.ui/.classpath
===================================================================
--- trunk/common/org.maemo.esbox.ui/.classpath (rev 0)
+++ trunk/common/org.maemo.esbox.ui/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/org.maemo.esbox.ui/.project
===================================================================
--- trunk/common/org.maemo.esbox.ui/.project (rev 0)
+++ trunk/common/org.maemo.esbox.ui/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/org.maemo.esbox.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/org.maemo.esbox.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/common/org.maemo.esbox.ui/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:54:17 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/common/org.maemo.esbox.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/org.maemo.esbox.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/org.maemo.esbox.ui/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Core UI Plug-in
+Bundle-SymbolicName: org.maemo.esbox.ui;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-CoreActivator: org.maemo.esbox.ui.noexport.UIActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.eclipse.core.resources;bundle-version="3.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.ui,
+ org.maemo.esbox.ui.actions,
+ org.maemo.esbox.ui.common,
+ org.maemo.esbox.ui.dialogs,
+ org.maemo.esbox.ui.env,
+ org.maemo.esbox.ui.preferences
+Bundle-Activator: org.maemo.esbox.internal.ui.UIActivator
Added: trunk/common/org.maemo.esbox.ui/build.properties
===================================================================
--- trunk/common/org.maemo.esbox.ui/build.properties (rev 0)
+++ trunk/common/org.maemo.esbox.ui/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
Added: trunk/common/org.maemo.esbox.ui/icons/full/etool16/execenv.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.ui/icons/full/etool16/execenv.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.ui/icons/full/obj16/buildconsole.gif
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.ui/icons/full/obj16/buildconsole.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.ui/icons/full/obj16/keylock_misc.gif
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.ui/icons/full/obj16/keylock_misc.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.ui/icons/full/obj16/lib_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/common/org.maemo.esbox.ui/icons/full/obj16/lib_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/common/org.maemo.esbox.ui/plugin.xml
===================================================================
--- trunk/common/org.maemo.esbox.ui/plugin.xml (rev 0)
+++ trunk/common/org.maemo.esbox.ui/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension point="org.eclipse.ui.views">
+ <category
+ id="org.maemo.esbox.ui.view"
+ name="ESbox"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ name="ESbox"
+ class="org.maemo.esbox.ui.preferences.ESboxPreferencesPage"
+ id="org.maemo.esbox.ui.esboxPreferencePage">
+ </page>
+ <page
+ category="org.maemo.esbox.ui.esboxPreferencePage"
+ class="org.maemo.esbox.ui.preferences.ESboxTargetPreferencesPage"
+ id="org.maemo.esbox.ui.esboxPreferencePage.targets"
+ name="Installed Targets">
+ </page>
+ <page
+ category="org.maemo.esbox.ui.esboxPreferencePage"
+ class="org.maemo.esbox.ui.preferences.ESboxEnvPreferencePage"
+ id="org.maemo.esbox.ui.esboxPreferencePage.env"
+ name="Environment">
+ </page>
+ <page
+ name="Gazpacho"
+ category="org.maemo.esbox.ui.esboxPreferencePage"
+ class="org.maemo.esbox.ui.preferences.ESboxGazpachoPreferencePage"
+ id="org.maemo.esbox.ui.esboxPreferencePage.gazpacho">
+ </page>
+ <page
+ name="X Server"
+ category="org.maemo.esbox.ui.esboxPreferencePage"
+ class="org.maemo.esbox.ui.preferences.ESboxXServerPreferencePage"
+ id="org.maemo.esbox.ui.esboxPreferencePage.xserver">
+ </page>
+ </extension>
+
+</plugin>
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/internal/ui/UIActivator.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/internal/ui/UIActivator.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/internal/ui/UIActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,146 @@
+package org.maemo.esbox.internal.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.ui";
+
+ // The shared instance
+ private static UIActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public UIActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return UIActivator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ // The plugin registry
+ private static ImageRegistry imageRegistry = new ImageRegistry(Display.getDefault());
+
+ public static Image getImage(String path) {
+ ImageDescriptor descriptor = imageRegistry.getDescriptor(path);
+ if (descriptor == null) {
+ descriptor = getImageDescriptor(path);
+ imageRegistry.put(path, descriptor);
+ }
+ return imageRegistry.get(path);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxBuildTargetProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxBuildTargetProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxBuildTargetProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.ui;
+
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.graphics.Image;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.ui.UIActivator;
+
+public class ESboxBuildTargetProvider extends LabelProvider implements ITreeContentProvider {
+ static final Image IMG_TARGET = UIActivator.getImage("icons/full/obj16/buildconsole.gif");
+ static final Image IMG_SDK = UIActivator.getImage("icons/full/obj16/lib_obj.gif");
+
+ public ESboxBuildTargetProvider() {
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return SDKFactory.getInstance().getSDKs().toArray();
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof ISDK)
+ return ((ISDK) parentElement).getSDKTargets();
+ return new Object[0];
+ }
+
+ public Object getParent(Object element) {
+ if (element instanceof ISDKTarget)
+ return ((ISDKTarget) element).getSDK();
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof ISDK) {
+ return ((ISDK) element).getDisplayName();
+ } else if (element instanceof ISDKTarget) {
+ ISDKTarget target = (ISDKTarget) element;
+ return target.getDisplayName();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof ISDK)
+ return IMG_SDK;
+ else
+ return IMG_TARGET;
+ }
+
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxBuildTargetUI.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxBuildTargetUI.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxBuildTargetUI.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ui;
+
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class ESboxBuildTargetUI {
+
+ /** Default style is BORDER, SINGLE, V_SCROLL */
+ public static final int DEFAULT_STYLE = SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL;
+
+ /**
+ * Create a tree viewer allowing selection of one SDK target.
+ * You need to set the layout data on the Tree and invoke TreeViewer#setInput(new Object())
+ * after any selection listeners
+ * are registered.
+ * @param parent
+ * @param style tree viewer style bits
+ * @see #DEFAULT_STYLE
+ * @return new TreeViewer
+ */
+ public static TreeViewer createConfiguredBuildTargetViewer(Composite parent, int style) {
+ TreeViewer targetTree = new TreeViewer(parent, style);
+ ESboxBuildTargetProvider provider = new ESboxBuildTargetProvider();
+ targetTree.setContentProvider(provider);
+ targetTree.setLabelProvider(provider);
+ targetTree.setAutoExpandLevel(2);
+
+ Tree tree = targetTree.getTree();
+
+ tree.setLinesVisible(true);
+ tree.setHeaderVisible(false);
+
+ return targetTree;
+ }
+
+ public interface IBuildTargetCheckedListener {
+ void buildTargetChecked(Object selectedElement, Object[] checkedElements);
+ }
+
+ /**
+ * Create a tree viewer allowing selection of one or more SDK targets.
+ * You need to set the layout data on the Tree and invoke TreeViewer#setInput(new Object())
+ * after any selection listeners
+ * are registered.
+ * @param parent
+ * @param style tree viewer style bits
+ * @see #DEFAULT_STYLE
+ * @return new TreeViewer
+ */
+ public static CheckboxTreeViewer createConfiguredBuildTargetCheckboxViewer(Composite parent, int style) {
+ final CheckboxTreeViewer targetTree = new CheckboxTreeViewer(parent, style);
+ ESboxBuildTargetProvider provider = new ESboxBuildTargetProvider();
+ targetTree.setContentProvider(provider);
+ targetTree.setLabelProvider(provider);
+ targetTree.setAutoExpandLevel(2);
+
+ Tree tree = targetTree.getTree();
+
+ tree.setLinesVisible(true);
+ tree.setHeaderVisible(false);
+ return targetTree;
+ }
+
+ /**
+ * Setup the standard selection behavior for a target tree viewer which holds SDK at the root
+ * and SDK targets as children. The selected item is the "active" configuration, so we ensure
+ * that a checked item is selected where it makes sense.
+ * @param treeViewer
+ * @param listener the listener to react to changes in the check state
+ */
+ public static void setupStandardBuildTargetCheckboxViewer(
+ final CheckboxTreeViewer targetTree,
+ final IBuildTargetCheckedListener listener) {
+ targetTree.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) targetTree.getSelection();
+ Object selected = null;
+ if (!structuredSelection.isEmpty())
+ selected = structuredSelection.iterator().next();
+
+ ISDKTarget target = null;
+ boolean checked = event.getChecked();
+ if (event.getElement() instanceof ISDK) {
+ ISDK sdk = (ISDK) event.getElement();
+ targetTree.setSubtreeChecked(sdk, checked);
+ if (checked) {
+ // select the first target if none is selected yet
+ ISDKTarget[] targets = sdk.getSDKTargets();
+ if (targets.length > 0)
+ target = targets[0];
+ }
+ } else if (event.getElement() instanceof ISDKTarget) {
+ if (checked) {
+ // select this target if none is selected yet
+ target = (ISDKTarget) event.getElement();
+ }
+ }
+
+ Object[] checkedElements = targetTree.getCheckedElements();
+
+ // if we enable check state on an item, and the selected item
+ // was on an unchecked field, then make the newly checked field the selected one
+ if (target != null && event.getChecked()) {
+ int checkedSelectedIndex = checkedElements.length;
+ while (--checkedSelectedIndex >= 0) {
+ if (!checkedElements[checkedSelectedIndex].equals(target)
+ && checkedElements[checkedSelectedIndex].equals(selected)) {
+ break;
+ }
+ }
+ if (checkedSelectedIndex < 0) {
+ // select this one by default
+ targetTree.setSelection(new StructuredSelection(target), true);
+ }
+ }
+
+ if (listener != null) {
+ listener.buildTargetChecked(target, targetTree.getCheckedElements());
+ }
+ }
+
+ });
+ }
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxExecutionEnvironmentProvider.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxExecutionEnvironmentProvider.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxExecutionEnvironmentProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.ui;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.graphics.Image;
+import org.maemo.esbox.core.execEnv.ExecutionEnvironmentFactory;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+import org.maemo.esbox.internal.ui.UIActivator;
+
+import java.util.*;
+
+public class ESboxExecutionEnvironmentProvider extends LabelProvider implements ITreeContentProvider {
+ private Object[] envArray;
+ private Image execEnvImg;
+
+ public ESboxExecutionEnvironmentProvider() {
+ ArrayList<IExecutionEnvironment> envs =
+ new ArrayList<IExecutionEnvironment>(ExecutionEnvironmentFactory.getInstance().getExecutionEnvironments());
+ Collections.sort(envs, new Comparator<IExecutionEnvironment>() {
+
+ public int compare(IExecutionEnvironment o1,
+ IExecutionEnvironment o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+
+ });
+ envArray = envs.toArray();
+ }
+
+ public void dispose() {
+ if (execEnvImg != null)
+ execEnvImg.dispose();
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return envArray;
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ return new Object[0];
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+
+ @Override
+ public String getText(Object element) {
+ return ((IExecutionEnvironment) element).getName();
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (execEnvImg == null) {
+ ImageDescriptor imageDescriptor = UIActivator.getImageDescriptor("icons/full/etool16/execenv.png");
+ if (imageDescriptor != null) {
+ execEnvImg = imageDescriptor.createImage();
+ }
+ }
+ return execEnvImg;
+ }
+
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxExecutionEnvironmentUI.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxExecutionEnvironmentUI.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/ESboxExecutionEnvironmentUI.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ui;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class ESboxExecutionEnvironmentUI {
+ /** Default style is BORDER, SINGLE, V_SCROLL */
+ public static final int DEFAULT_STYLE = SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL;
+
+ /**
+ * Create a tree viewer allowing selection of an execution environment.
+ * You need to set the layout data on the Tree and invoke TreeViewer#setInput(new Object())
+ * after any selection listeners
+ * are registered.
+ * @param parent
+ * @param style tree viewer style bits
+ * @see #DEFAULT_STYLE
+ * @return new TreeViewer
+ */
+ public static TreeViewer createConfiguredExecutionEnvironmentViewer(Composite parent, int style) {
+ TreeViewer targetTree = new TreeViewer(parent, style);
+ ESboxExecutionEnvironmentProvider provider = new ESboxExecutionEnvironmentProvider();
+ targetTree.setContentProvider(provider);
+ targetTree.setLabelProvider(provider);
+ targetTree.setAutoExpandLevel(1);
+
+ Tree tree = targetTree.getTree();
+
+ tree.setLinesVisible(false);
+ tree.setHeaderVisible(false);
+
+ return targetTree;
+ }
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/IPreferenceConstants.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/IPreferenceConstants.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/IPreferenceConstants.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ui;
+
+import org.maemo.esbox.internal.ui.UIActivator;
+
+/**
+ * @author eswartz
+ *
+ */
+public interface IPreferenceConstants {
+ public static final String ESBOX_PREFERENCE_GROUP_ID = UIActivator.PLUGIN_ID + ".esboxPreferencePage";
+ public static final String ESBOX_PREFERENCE_TARGETS_ID = ESBOX_PREFERENCE_GROUP_ID + ".targets";
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/actions/ESboxAction.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/actions/ESboxAction.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/actions/ESboxAction.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.ui.actions;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ *
+ */
+public abstract class ESboxAction implements IWorkbenchWindowActionDelegate {
+
+ private ISelection selection;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init(IWorkbenchWindow window) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ }
+
+ protected IResource extractSelection() {
+ if(!(selection instanceof IStructuredSelection))
+ return null;
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ Object element = ss.getFirstElement();
+ if(element instanceof IResource)
+ return (IResource)element;
+ if(!(element instanceof IAdaptable))
+ return null;
+ IAdaptable adaptable = (IAdaptable)element;
+ Object adapter = adaptable.getAdapter (IResource.class);
+ IResource resource = (IResource)adapter;
+ return resource;
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/ComboDialogField.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/ComboDialogField.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/ComboDialogField.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2000 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.ui.common;
+
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+
+/**
+ *
+ */
+public class ComboDialogField extends DialogField {
+
+ private String fText;
+ private int fSelectionIndex;
+ private String[] fItems;
+ private Combo fComboControl;
+ private ModifyListener fModifyListener;
+ private int fFlags;
+
+ public ComboDialogField(int flags) {
+ super();
+ fText= ""; //$NON-NLS-1$
+ fItems= new String[0];
+ fFlags= flags;
+ fSelectionIndex= -1;
+ }
+
+ // ------- layout helpers
+
+ /*
+ * @see DialogField#doFillIntoGrid
+ */
+ public Control[] doFillIntoGrid(Composite parent, int nColumns) {
+ assertEnoughColumns(nColumns);
+
+ Label label= getLabelControl(parent);
+ label.setLayoutData(gridDataForLabel(1));
+ Combo combo= getComboControl(parent);
+ combo.setLayoutData(gridDataForCombo(nColumns - 1));
+
+ return new Control[] { label, combo };
+ }
+
+ /*
+ * @see DialogField#getNumberOfControls
+ */
+ public int getNumberOfControls() {
+ return 2;
+ }
+
+ protected static GridData gridDataForCombo(int span) {
+ GridData gd= new GridData();
+ gd.horizontalAlignment= GridData.FILL;
+ gd.grabExcessHorizontalSpace= false;
+ gd.horizontalSpan= span;
+ return gd;
+ }
+
+ // ------- focus methods
+
+ /*
+ * @see DialogField#setFocus
+ */
+ public boolean setFocus() {
+ if (isOkToUse(fComboControl)) {
+ fComboControl.setFocus();
+ }
+ return true;
+ }
+
+ // ------- ui creation
+
+ /**
+ * Creates or returns the created combo control.
+ * @param parent The parent composite or <code>null</code> when the widget has
+ * already been created.
+ */
+ public Combo getComboControl(Composite parent) {
+ if (fComboControl == null) {
+ assertCompositeNotNull(parent);
+ fModifyListener= new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ doModifyText(e);
+ }
+ };
+ SelectionListener selectionListener= new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ doSelectionChanged(e);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) { }
+ };
+
+ fComboControl= new Combo(parent, fFlags);
+ // moved up due to 1GEUNW2
+ fComboControl.setItems(fItems);
+ if (fSelectionIndex != -1) {
+ fComboControl.select(fSelectionIndex);
+ } else {
+ fComboControl.setText(fText);
+ }
+ fComboControl.setFont(parent.getFont());
+ fComboControl.addModifyListener(fModifyListener);
+ fComboControl.addSelectionListener(selectionListener);
+ fComboControl.setEnabled(isEnabled());
+ }
+ return fComboControl;
+ }
+
+ protected void doModifyText(ModifyEvent e) {
+ if (isOkToUse(fComboControl)) {
+ fText= fComboControl.getText();
+ fSelectionIndex= fComboControl.getSelectionIndex();
+ }
+ dialogFieldChanged();
+ }
+
+ protected void doSelectionChanged(SelectionEvent e) {
+ if (isOkToUse(fComboControl)) {
+ fItems= fComboControl.getItems();
+ fText= fComboControl.getText();
+ fSelectionIndex= fComboControl.getSelectionIndex();
+ }
+ dialogFieldChanged();
+ }
+
+ // ------ enable / disable management
+
+ /*
+ * @see DialogField#updateEnableState
+ */
+ protected void updateEnableState() {
+ super.updateEnableState();
+ if (isOkToUse(fComboControl)) {
+ fComboControl.setEnabled(isEnabled());
+ }
+ }
+
+ // ------ text access
+
+ /**
+ * Gets the combo items.
+ */
+ public String[] getItems() {
+ return fItems;
+ }
+
+ /**
+ * Sets the combo items. Triggers a dialog-changed event.
+ */
+ public void setItems(String[] items) {
+ fItems= items;
+ if (isOkToUse(fComboControl)) {
+ fComboControl.setItems(items);
+ }
+ dialogFieldChanged();
+ }
+
+ /**
+ * Gets the text.
+ */
+ public String getText() {
+ return fText;
+ }
+
+ /**
+ * Sets the text. Triggers a dialog-changed event.
+ */
+ public void setText(String text) {
+ fText= text;
+ if (isOkToUse(fComboControl)) {
+ fComboControl.setText(text);
+ } else {
+ dialogFieldChanged();
+ }
+ }
+
+ /**
+ * Selects an item.
+ */
+ public void selectItem(int index) {
+ if (isOkToUse(fComboControl)) {
+ fComboControl.select(index);
+ } else {
+ if (index >= 0 && index < fItems.length) {
+ fText= fItems[index];
+ fSelectionIndex= index;
+ }
+ }
+ dialogFieldChanged();
+ }
+
+ public int getSelectionIndex() {
+ return fSelectionIndex;
+ }
+
+
+ /**
+ * Sets the text without triggering a dialog-changed event.
+ */
+ public void setTextWithoutUpdate(String text) {
+ fText= text;
+ if (isOkToUse(fComboControl)) {
+ fComboControl.removeModifyListener(fModifyListener);
+ fComboControl.setText(text);
+ fComboControl.addModifyListener(fModifyListener);
+ }
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/DialogField.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/DialogField.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/DialogField.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.ui.common;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+
+/**
+ *
+ */
+public class DialogField {
+
+ private Label fLabel;
+ protected String fLabelText;
+
+ private IDialogFieldListener fDialogFieldListener;
+
+ private boolean fEnabled;
+
+ public DialogField() {
+ fEnabled= true;
+ fLabel= null;
+ fLabelText= ""; //$NON-NLS-1$
+ }
+
+ /**
+ * Sets the label of the dialog field.
+ */
+ public void setLabelText(String labeltext) {
+ fLabelText= labeltext;
+ }
+
+ // ------ change listener
+
+ /**
+ * Defines the listener for this dialog field.
+ */
+ public final void setDialogFieldListener(IDialogFieldListener listener) {
+ fDialogFieldListener= listener;
+ }
+
+ /**
+ * Programatical invocation of a dialog field change.
+ */
+ public void dialogFieldChanged() {
+ if (fDialogFieldListener != null) {
+ fDialogFieldListener.dialogFieldChanged(this);
+ }
+ }
+
+ // ------- focus management
+
+ /**
+ * Tries to set the focus to the dialog field.
+ * Returns <code>true</code> if the dialog field can take focus.
+ * To be reimplemented by dialog field implementors.
+ */
+ public boolean setFocus() {
+ return false;
+ }
+
+ /**
+ * Posts <code>setFocus</code> to the display event queue.
+ */
+ public void postSetFocusOnDialogField(Display display) {
+ if (display != null) {
+ display.asyncExec(
+ new Runnable() {
+ public void run() {
+ setFocus();
+ }
+ }
+ );
+ }
+ }
+
+ // ------- layout helpers
+
+ /**
+ * Creates all controls of the dialog field and fills it to a composite.
+ * The composite is assumed to have <code>MGridLayout</code> as
+ * layout.
+ * The dialog field will adjust its controls' spans to the number of columns given.
+ * To be reimplemented by dialog field implementors.
+ */
+ public Control[] doFillIntoGrid(Composite parent, int nColumns) {
+ assertEnoughColumns(nColumns);
+
+ Label label= getLabelControl(parent);
+ label.setLayoutData(gridDataForLabel(nColumns));
+
+ return new Control[] { label };
+ }
+
+ /**
+ * Returns the number of columns of the dialog field.
+ * To be reimplemented by dialog field implementors.
+ */
+ public int getNumberOfControls() {
+ return 1;
+ }
+
+ protected static GridData gridDataForLabel(int span) {
+ GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan= span;
+ return gd;
+ }
+
+ // ------- ui creation
+
+ /**
+ * Creates or returns the created label widget.
+ * @param parent The parent composite or <code>null</code> if the widget has
+ * already been created.
+ */
+ public Label getLabelControl(Composite parent) {
+ if (fLabel == null) {
+ assertCompositeNotNull(parent);
+
+ fLabel= new Label(parent, SWT.LEFT | SWT.WRAP);
+ fLabel.setFont(parent.getFont());
+ fLabel.setEnabled(fEnabled);
+ if (fLabelText != null && !"".equals(fLabelText)) { //$NON-NLS-1$
+ fLabel.setText(fLabelText);
+ } else {
+ // XXX: to avoid a 16 pixel wide empty label - revisit
+ fLabel.setText("."); //$NON-NLS-1$
+ fLabel.setVisible(false);
+ }
+ }
+ return fLabel;
+ }
+
+ /**
+ * Creates a spacer control.
+ * @param parent The parent composite
+ */
+ public static Control createEmptySpace(Composite parent) {
+ return createEmptySpace(parent, 1);
+ }
+
+ /**
+ * Creates a spacer control with the given span.
+ * The composite is assumed to have <code>MGridLayout</code> as
+ * layout.
+ * @param parent The parent composite
+ */
+ public static Control createEmptySpace(Composite parent, int span) {
+ Label label= new Label(parent, SWT.LEFT);
+ GridData gd= new GridData();
+ gd.horizontalAlignment= GridData.BEGINNING;
+ gd.grabExcessHorizontalSpace= false;
+ gd.horizontalSpan= span;
+ gd.horizontalIndent= 0;
+ gd.widthHint= 0;
+ gd.heightHint= 0;
+ label.setLayoutData(gd);
+ return label;
+ }
+
+ /**
+ * Tests is the control is not <code>null</code> and not disposed.
+ */
+ protected final boolean isOkToUse(Control control) {
+ return (control != null) && !(control.isDisposed());
+ }
+
+ // --------- enable / disable management
+
+ /**
+ * Sets the enable state of the dialog field.
+ */
+ public final void setEnabled(boolean enabled) {
+ if (enabled != fEnabled) {
+ fEnabled= enabled;
+ updateEnableState();
+ }
+ }
+
+ /**
+ * Called when the enable state changed.
+ * To be extended by dialog field implementors.
+ */
+ protected void updateEnableState() {
+ if (fLabel != null) {
+ fLabel.setEnabled(fEnabled);
+ }
+ }
+
+ /**
+ * Gets the enable state of the dialog field.
+ */
+ public final boolean isEnabled() {
+ return fEnabled;
+ }
+
+ protected final void assertCompositeNotNull(Composite comp) {
+ Assert.isNotNull(comp, "uncreated control requested with composite null"); //$NON-NLS-1$
+ }
+
+ protected final void assertEnoughColumns(int nColumns) {
+ Assert.isTrue(nColumns >= getNumberOfControls(), "given number of columns is too small"); //$NON-NLS-1$
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/IDialogFieldListener.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/IDialogFieldListener.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/IDialogFieldListener.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2000 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.ui.common;
+
+
+/**
+ *
+ */
+public interface IDialogFieldListener {
+
+ void dialogFieldChanged(DialogField field);
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/LayoutUtil.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/LayoutUtil.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/LayoutUtil.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,131 @@
+package org.maemo.esbox.ui.common;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class LayoutUtil {
+
+ /**
+ * Calculates the number of columns needed by field editors
+ */
+ public static int getNumberOfColumns(DialogField[] editors) {
+ int nCulumns= 0;
+ for (int i= 0; i < editors.length; i++) {
+ nCulumns= Math.max(editors[i].getNumberOfControls(), nCulumns);
+ }
+ return nCulumns;
+ }
+
+ /**
+ * Creates a composite and fills in the given editors.
+ * @param labelOnTop Defines if the label of all fields should be on top of the fields
+ */
+ public static void doDefaultLayout(Composite parent, DialogField[] editors, boolean labelOnTop) {
+ doDefaultLayout(parent, editors, labelOnTop, 0, 0, 0, 0);
+ }
+
+ /**
+ * Creates a composite and fills in the given editors.
+ * @param labelOnTop Defines if the label of all fields should be on top of the fields
+ * @param minWidth The minimal width of the composite
+ * @param minHeight The minimal height of the composite
+ */
+ public static void doDefaultLayout(Composite parent, DialogField[] editors, boolean labelOnTop, int minWidth, int minHeight) {
+ doDefaultLayout(parent, editors, labelOnTop, minWidth, minHeight, 0, 0);
+ }
+
+ /**
+ * Creates a composite and fills in the given editors.
+ * @param labelOnTop Defines if the label of all fields should be on top of the fields
+ * @param minWidth The minimal width of the composite
+ * @param minHeight The minimal height of the composite
+ * @param marginWidth The margin width to be used by the composite
+ * @param marginHeight The margin height to be used by the composite
+ * @deprecated
+ */
+ @Deprecated
+ public static void doDefaultLayout(Composite parent, DialogField[] editors, boolean labelOnTop, int minWidth, int minHeight, int marginWidth, int marginHeight) {
+ int nCulumns= getNumberOfColumns(editors);
+ Control[][] controls= new Control[editors.length][];
+ for (int i= 0; i < editors.length; i++) {
+ controls[i]= editors[i].doFillIntoGrid(parent, nCulumns);
+ }
+ if (labelOnTop) {
+ nCulumns--;
+ modifyLabelSpans(controls, nCulumns);
+ }
+ GridLayout layout= new GridLayout();
+ if (marginWidth != SWT.DEFAULT) {
+ layout.marginWidth= marginWidth;
+ }
+ if (marginHeight != SWT.DEFAULT) {
+ layout.marginHeight= marginHeight;
+ }
+ layout.numColumns= nCulumns;
+ parent.setLayout(layout);
+ }
+
+ private static void modifyLabelSpans(Control[][] controls, int nCulumns) {
+ for (int i= 0; i < controls.length; i++) {
+ setHorizontalSpan(controls[i][0], nCulumns);
+ }
+ }
+
+ /**
+ * Sets the span of a control. Assumes that GridData is used.
+ */
+ public static void setHorizontalSpan(Control control, int span) {
+ Object ld= control.getLayoutData();
+ if (ld instanceof GridData) {
+ ((GridData)ld).horizontalSpan= span;
+ } else if (span != 1) {
+ GridData gd= new GridData();
+ gd.horizontalSpan= span;
+ control.setLayoutData(gd);
+ }
+ }
+
+ /**
+ * Sets the width hint of a control. Assumes that GridData is used.
+ */
+ public static void setWidthHint(Control control, int widthHint) {
+ Object ld= control.getLayoutData();
+ if (ld instanceof GridData) {
+ ((GridData)ld).widthHint= widthHint;
+ }
+ }
+
+ /**
+ * Sets the heigthHint hint of a control. Assumes that GridData is used.
+ */
+ public static void setHeightHint(Control control, int heigthHint) {
+ Object ld= control.getLayoutData();
+ if (ld instanceof GridData) {
+ ((GridData)ld).heightHint= heigthHint;
+ }
+ }
+
+ /**
+ * Sets the horizontal indent of a control. Assumes that GridData is used.
+ */
+ public static void setHorizontalIndent(Control control, int horizontalIndent) {
+ Object ld= control.getLayoutData();
+ if (ld instanceof GridData) {
+ ((GridData)ld).horizontalIndent= horizontalIndent;
+ }
+ }
+
+ /**
+ * Sets the horizontal indent of a control. Assumes that GridData is used.
+ */
+ public static void setHorizontalGrabbing(Control control) {
+ Object ld= control.getLayoutData();
+ if (ld instanceof GridData) {
+ ((GridData)ld).grabExcessHorizontalSpace= true;
+ }
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/PixelConverter.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/PixelConverter.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/PixelConverter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,47 @@
+package org.maemo.esbox.ui.common;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.widgets.Control;
+
+public class PixelConverter {
+
+ private FontMetrics fFontMetrics;
+
+ public PixelConverter(Control control) {
+ GC gc = new GC(control);
+ gc.setFont(control.getFont());
+ fFontMetrics= gc.getFontMetrics();
+ gc.dispose();
+ }
+
+ /**
+ * @see Dialog#convertHeightInCharsToPixels(FontMetrics, int)
+ */
+ public int convertHeightInCharsToPixels(int chars) {
+ return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars);
+ }
+
+ /**
+ * @see Dialog#convertHorizontalDLUsToPixels(FontMetrics, int)
+ */
+ public int convertHorizontalDLUsToPixels(int dlus) {
+ return Dialog.convertHorizontalDLUsToPixels(fFontMetrics, dlus);
+ }
+
+ /**
+ * @see Dialog#convertVerticalDLUsToPixels(FontMetrics, int)
+ */
+ public int convertVerticalDLUsToPixels(int dlus) {
+ return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
+ }
+
+ /**
+ * @see Dialog#convertWidthInCharsToPixels(FontMetrics, int)
+ */
+ public int convertWidthInCharsToPixels(int chars) {
+ return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/SWTUtil.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/SWTUtil.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/SWTUtil.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,91 @@
+package org.maemo.esbox.ui.common;
+
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DragSource;
+import org.eclipse.swt.dnd.DropTarget;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Utility class to simplify access to some SWT resources.
+ */
+public class SWTUtil {
+
+ /**
+ * Returns the standard display to be used. The method first checks, if
+ * the thread calling this method has an associated disaply. If so, this
+ * display is returned. Otherwise the method returns the default display.
+ */
+ public static Display getStandardDisplay() {
+ Display display;
+ display= Display.getCurrent();
+ if (display == null)
+ display= Display.getDefault();
+ return display;
+ }
+
+ /**
+ * Returns the shell for the given widget. If the widget doesn't represent
+ * a SWT object that manage a shell, <code>null</code> is returned.
+ *
+ * @return the shell for the given widget
+ */
+ public static Shell getShell(Widget widget) {
+ if (widget instanceof Control)
+ return ((Control)widget).getShell();
+ if (widget instanceof Caret)
+ return ((Caret)widget).getParent().getShell();
+ if (widget instanceof DragSource)
+ return ((DragSource)widget).getControl().getShell();
+ if (widget instanceof DropTarget)
+ return ((DropTarget)widget).getControl().getShell();
+ if (widget instanceof Menu)
+ return ((Menu)widget).getParent().getShell();
+ if (widget instanceof ScrollBar)
+ return ((ScrollBar)widget).getParent().getShell();
+
+ return null;
+ }
+
+
+ /**
+ * Returns a width hint for a button control.
+ */
+ public static int getButtonWidthHint(Button button) {
+ if (button.getFont().equals(JFaceResources.getDefaultFont()))
+ button.setFont(JFaceResources.getDialogFont());
+ PixelConverter converter= new PixelConverter(button);
+ int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+ }
+
+ /**
+ * Sets width for the button control.
+ * <b>Note:</b> This is a NOP if the button's layout data is not
+ * an instance of <code>GridData</code>.
+ *
+ * @param button a button for which to set the dimension hint
+ */
+ public static void setButtonDimensionHint(Button button) {
+ Assert.isNotNull(button);
+ Object gd= button.getLayoutData();
+ if (gd instanceof GridData) {
+ ((GridData)gd).widthHint= getButtonWidthHint(button);
+ }
+ }
+
+ public static int getTableHeightHint(Table table, int rows) {
+ if (table.getFont().equals(JFaceResources.getDefaultFont()))
+ table.setFont(JFaceResources.getDialogFont());
+ int result= table.getItemHeight() * rows + table.getHeaderHeight();
+ if (table.getLinesVisible())
+ result+= table.getGridLineWidth() * (rows - 1);
+ return result;
+ }
+
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/StatusInfo.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/StatusInfo.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/StatusInfo.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,137 @@
+package org.maemo.esbox.ui.common;
+
+import org.eclipse.core.runtime.IStatus;
+import org.maemo.esbox.internal.ui.UIActivator;
+
+/**
+ * A settable IStatus
+ * Can be an error, warning, info or ok. For error, info and warning states,
+ * a message describes the problem
+ */
+public class StatusInfo implements IStatus {
+
+ public static final IStatus OK_STATUS= new StatusInfo();
+
+ private String fStatusMessage;
+ private int fSeverity;
+
+ /**
+ * Creates a status set to OK (no message)
+ */
+ public StatusInfo() {
+ this(OK, null);
+ }
+
+ /**
+ * Creates a status .
+ * @param severity The status severity: ERROR, WARNING, INFO and OK.
+ * @param message The message of the status. Applies only for ERROR,
+ * WARNING and INFO.
+ */
+ public StatusInfo(int severity, String message) {
+ fStatusMessage= message;
+ fSeverity= severity;
+ }
+
+ /**
+ * @see IStatus#getChildren()
+ */
+ public IStatus[] getChildren() {
+ return new IStatus[0];
+ }
+ /**
+ * @see IStatus#getCode()
+ */
+ public int getCode() {
+ return fSeverity;
+ }
+ /**
+ * @see IStatus#getException()
+ */
+ public Throwable getException() {
+ return null;
+ }
+ /**
+ * @see IStatus#getMessage
+ */
+ public String getMessage() {
+ return fStatusMessage;
+ }
+ /**
+ * @see IStatus#getPlugin()
+ */
+ public String getPlugin() {
+ return UIActivator.PLUGIN_ID;
+ }
+ /**
+ * @see IStatus#getSeverity()
+ */
+ public int getSeverity() {
+ return fSeverity;
+ }
+ public boolean isError() {
+ return fSeverity == IStatus.ERROR;
+ }
+ public boolean isInfo() {
+ return fSeverity == IStatus.INFO;
+ }
+ /**
+ * @see IStatus#isMultiStatus()
+ */
+ public boolean isMultiStatus() {
+ return false;
+ }
+ public boolean isOK() {
+ return fSeverity == IStatus.OK;
+ }
+ public boolean isWarning() {
+ return fSeverity == IStatus.WARNING;
+ }
+ /**
+ * @see IStatus#matches(int)
+ */
+ public boolean matches(int severityMask) {
+ return (fSeverity & severityMask) != 0;
+ }
+ public void setError(String errorMessage) {
+ fStatusMessage= errorMessage;
+ fSeverity= IStatus.ERROR;
+ }
+ public void setInfo(String infoMessage) {
+ fStatusMessage= infoMessage;
+ fSeverity= IStatus.INFO;
+ }
+ public void setOK() {
+ fStatusMessage= null;
+ fSeverity= IStatus.OK;
+ }
+ public void setWarning(String warningMessage) {
+ fStatusMessage= warningMessage;
+ fSeverity= IStatus.WARNING;
+ }
+
+ /**
+ * Returns a string representation of the status, suitable
+ * for debugging purposes only.
+ */
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("StatusInfo "); //$NON-NLS-1$
+ if (fSeverity == OK) {
+ buf.append("OK"); //$NON-NLS-1$
+ } else if (fSeverity == ERROR) {
+ buf.append("ERROR"); //$NON-NLS-1$
+ } else if (fSeverity == WARNING) {
+ buf.append("WARNING"); //$NON-NLS-1$
+ } else if (fSeverity == INFO) {
+ buf.append("INFO"); //$NON-NLS-1$
+ } else {
+ buf.append("severity="); //$NON-NLS-1$
+ buf.append(fSeverity);
+ }
+ buf.append(": "); //$NON-NLS-1$
+ buf.append(fStatusMessage);
+ return buf.toString();
+ }
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/StringDialogField.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/StringDialogField.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/common/StringDialogField.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.ui.common;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+
+/**
+ *
+ */
+public class StringDialogField extends DialogField {
+
+ private String fText;
+ private Text fTextControl;
+ private ModifyListener fModifyListener;
+
+ public StringDialogField() {
+ super();
+ fText= ""; //$NON-NLS-1$
+ }
+
+ // ------- layout helpers
+
+ /*
+ * @see DialogField#doFillIntoGrid
+ */
+ public Control[] doFillIntoGrid(Composite parent, int nColumns) {
+ assertEnoughColumns(nColumns);
+
+ Label label= getLabelControl(parent);
+ label.setLayoutData(gridDataForLabel(1));
+ Text text= getTextControl(parent);
+ text.setLayoutData(gridDataForText(nColumns - 1));
+
+ return new Control[] { label, text };
+ }
+
+ /*
+ * @see DialogField#getNumberOfControls
+ */
+ public int getNumberOfControls() {
+ return 2;
+ }
+
+ protected static GridData gridDataForText(int span) {
+ GridData gd= new GridData();
+ gd.horizontalAlignment= GridData.FILL;
+ gd.grabExcessHorizontalSpace= true;
+ gd.horizontalSpan= span;
+ return gd;
+ }
+
+ // ------- focus methods
+
+ /*
+ * @see DialogField#setFocus
+ */
+ public boolean setFocus() {
+ if (isOkToUse(fTextControl)) {
+ fTextControl.setFocus();
+ fTextControl.setSelection(0, fTextControl.getText().length());
+ }
+ return true;
+ }
+
+ // ------- ui creation
+
+ /**
+ * Creates or returns the created text control.
+ * @param parent The parent composite or <code>null</code> when the widget has
+ * already been created.
+ */
+ public Text getTextControl(Composite parent) {
+ if (fTextControl == null) {
+ assertCompositeNotNull(parent);
+ fModifyListener= new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ doModifyText(e);
+ }
+ };
+
+ fTextControl= new Text(parent, SWT.SINGLE | SWT.BORDER);
+ // moved up due to 1GEUNW2
+ fTextControl.setText(fText);
+ fTextControl.setFont(parent.getFont());
+ fTextControl.addModifyListener(fModifyListener);
+
+ fTextControl.setEnabled(isEnabled());
+ }
+ return fTextControl;
+ }
+
+ protected void doModifyText(ModifyEvent e) {
+ if (isOkToUse(fTextControl)) {
+ fText= fTextControl.getText();
+ }
+ dialogFieldChanged();
+ }
+
+ // ------ enable / disable management
+
+ /*
+ * @see DialogField#updateEnableState
+ */
+ protected void updateEnableState() {
+ super.updateEnableState();
+ if (isOkToUse(fTextControl)) {
+ fTextControl.setEnabled(isEnabled());
+ }
+ }
+
+ // ------ text access
+
+ /**
+ * Gets the text. Can not be <code>null</code>
+ */
+ public String getText() {
+ return fText;
+ }
+
+ /**
+ * Sets the text. Triggers a dialog-changed event.
+ */
+ public void setText(String text) {
+ fText= text;
+ if (isOkToUse(fTextControl)) {
+ fTextControl.setText(text);
+ } else {
+ dialogFieldChanged();
+ }
+ }
+
+ /**
+ * Sets the text without triggering a dialog-changed event.
+ */
+ public void setTextWithoutUpdate(String text) {
+ fText= text;
+ if (isOkToUse(fTextControl)) {
+ fTextControl.removeModifyListener(fModifyListener);
+ fTextControl.setText(text);
+ fTextControl.addModifyListener(fModifyListener);
+ }
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/DialogUtils.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/DialogUtils.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/DialogUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ui.dialogs;
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class DialogUtils {
+
+ /**
+ * Get an appropriate shell for UI.
+ * @return
+ */
+ public static Shell getShell() {
+ final IWorkbench workbench;
+ try {
+ workbench = PlatformUI.getWorkbench();
+ } catch (IllegalStateException e) {
+ return null;
+ }
+
+ final IWorkbenchWindow[] windows = { null };
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ windows[0] = workbench.getActiveWorkbenchWindow();
+ }
+
+ });
+ if (windows[0] == null)
+ return null;
+
+ return windows[0].getShell();
+ }
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/PasswordInputDialog.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/PasswordInputDialog.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/PasswordInputDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *
+ *******************************************************************************/
+
+package org.maemo.esbox.ui.dialogs;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.internal.ui.UIActivator;
+
+/**
+ *
+ */
+public class PasswordInputDialog extends Dialog {
+
+ protected Image keyLockImage;
+
+ /**
+ * The title of the dialog.
+ */
+ protected String title;
+
+ /**
+ * The message to display, or <code>null</code> if none.
+ */
+ protected String message;
+
+ /**
+ * The input value; the empty string by default.
+ */
+ protected String value = "";
+
+ /**
+ * Ok button widget.
+ */
+ protected Button okButton;
+
+ /**
+ * Input text widget.
+ */
+ protected Text passwordField;
+
+ /**
+ * Error message label widget.
+ */
+ private Text errorMessageText;
+
+ /**
+ * Construtor.
+ * @param shell the shell.
+ * @param dialogTitle the title of the dialog.
+ * @param dialogMessage the message of the dialog.
+ */
+ public PasswordInputDialog(Shell shell, String dialogTitle,
+ String dialogMessage) {
+ super(shell);
+ this.title = dialogTitle;
+ this.message = dialogMessage;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ if (title != null)
+ shell.setText(title);
+ }
+
+ /*
+ * (non-Javadoc) Method declared on Dialog.
+ */
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.OK_ID) {
+ value = passwordField.getText();
+ } else {
+ value = null;
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createButtonsForButtonBar(Composite parent) {
+ // create OK and Cancel buttons by default
+ okButton = createButton(parent, IDialogConstants.OK_ID,
+ IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID,
+ IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ /*
+ * (non-Javadoc) Method declared on Dialog.
+ */
+ protected Control createDialogArea(Composite parent) {
+ Composite top = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+
+ top.setLayout(layout);
+ top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite imageComposite = new Composite(top, SWT.NONE);
+ layout = new GridLayout();
+ imageComposite.setLayout(layout);
+ imageComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+
+ Composite main = new Composite(top, SWT.NONE);
+ layout = new GridLayout();
+ layout.numColumns = 3;
+ main.setLayout(layout);
+ main.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label imageLabel = new Label(imageComposite, SWT.NONE);
+ keyLockImage = UIActivator.getImageDescriptor("./icons/full/obj16/keylock_misc.gif").createImage();
+ imageLabel.setImage(keyLockImage);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ imageLabel.setLayoutData(data);
+
+ // create message
+ if (message != null) {
+ Label messageLabel = new Label(main, SWT.WRAP);
+ messageLabel.setText(message);
+ data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ data.horizontalSpan = 3;
+ data.widthHint = 150;
+ messageLabel.setLayoutData(data);
+ }
+
+ Label separator = new Label(main,SWT.NONE);
+ data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ data.horizontalSpan = 3;
+ separator.setText("");
+ separator.setLayoutData(data);
+
+ createPasswordFields(main);
+
+ errorMessageText = new Text(main, SWT.READ_ONLY);
+ errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL));
+ errorMessageText.setBackground(errorMessageText.getDisplay()
+ .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+
+ applyDialogFont(main);
+
+ return main;
+ }
+
+ /**
+ * Creates the three widgets that represent the password entry area.
+ * @param parent the parent of the widgets
+ */
+ protected void createPasswordFields(Composite parent) {
+ new Label(parent, SWT.NONE).setText("Password: "); //$NON-NLS-1$
+
+ passwordField = new Text(parent, SWT.BORDER | SWT.PASSWORD);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
+ passwordField.setLayoutData(data);
+ }
+
+ /**
+ * Return the password inserted by the user.
+ * @return the password inserted by the user or <code>null</code> if user canceled
+ */
+ public String getPassword() {
+ return value;
+ }
+
+ /**
+ * Sets or clears the error message.
+ * If not <code>null</code>, the OK button is disabled.
+ *
+ * @param errorMessage
+ * the error message, or <code>null</code> to clear
+ */
+ public void setErrorMessage(String errorMessage) {
+ errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$
+ okButton.setEnabled(errorMessage == null);
+ errorMessageText.getParent().update();
+ }
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/SelectSDKTargetDialog.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/SelectSDKTargetDialog.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/SelectSDKTargetDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.ui.dialogs;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.ui.ESboxBuildTargetUI;
+
+/**
+ * This dialog allows the user to select an SDK target.
+ * @author eswartz
+ *
+ */
+public class SelectSDKTargetDialog extends Dialog {
+
+ private TreeViewer targetTree;
+ private ISDKTarget sdkTarget;
+ private String label;
+
+ public SelectSDKTargetDialog(Shell parentShell, String label) {
+ super(parentShell);
+ this.label = label;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText("Select SDK target");
+ }
+
+ @Override
+ protected Point getInitialSize() {
+ return new Point(300, 500);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+
+ Composite parentComposite = (Composite) super.createDialogArea(parent);
+
+ Composite contents = new Composite(parentComposite, SWT.NONE);
+ contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Label clabel = new Label(contents, SWT.NONE);
+ clabel.setText(label);
+ clabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+
+ targetTree = ESboxBuildTargetUI.createConfiguredBuildTargetViewer(contents, ESboxBuildTargetUI.DEFAULT_STYLE);
+
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.horizontalSpan = 2;
+ targetTree.getTree().setLayoutData(gd);
+
+ targetTree.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) targetTree.getSelection();
+ if (selection.isEmpty()) {
+ sdkTarget = null;
+ } else {
+ Object element = selection.getFirstElement();
+ if (element instanceof ISDKTarget)
+ sdkTarget = (ISDKTarget) element;
+ else
+ sdkTarget = null;
+ }
+ getButton(IDialogConstants.OK_ID).setEnabled(sdkTarget != null);
+ }
+
+ });
+
+ targetTree.setInput(new Object());
+
+ targetTree.addOpenListener(new IOpenListener() {
+
+ public void open(OpenEvent event) {
+ buttonPressed(IDialogConstants.OK_ID);
+ }
+
+ });
+ Dialog.applyDialogFont(parentComposite);
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(
+ 6, 6).generateLayout(contents);
+ return parentComposite;
+ }
+
+ /** Run the dialog and get the target that was selected,
+ * or <code>null</code> if the user canceled. */
+ public ISDKTarget selectTarget() {
+ if (open() == IDialogConstants.OK_ID)
+ return sdkTarget;
+ else
+ return null;
+ }
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/TimeTriggeredProgressMonitorDialog.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/TimeTriggeredProgressMonitorDialog.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/dialogs/TimeTriggeredProgressMonitorDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.ui.dialogs;
+
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * The TimeTriggeredProgressMonitorDialog is a progress monitor dialog that only
+ * opens if the runnable provided exceeds the specified long operation time.
+ *
+ * @since 3.1
+ */
+public class TimeTriggeredProgressMonitorDialog extends ProgressMonitorDialog {
+
+ /**
+ * The time considered to be the long operation time.
+ */
+ private int longOperationTime;
+
+ /**
+ * The time at which the dialog should be opened.
+ */
+ private long triggerTime = -1;
+
+ /**
+ * Whether or not we've already opened a dialog.
+ */
+ private boolean dialogOpened = false;
+
+ /**
+ * Wrappered monitor so we can check ticks and open the dialog when
+ * appropriate
+ */
+ private IProgressMonitor wrapperedMonitor;
+
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param parent
+ * the parent of the dialog
+ * @param longOperationTime
+ * the time (in milliseconds) considered to be a long enough
+ * execution time to warrant opening a dialog.
+ */
+ public TimeTriggeredProgressMonitorDialog(Shell parent,
+ int longOperationTime) {
+ super(parent);
+ setOpenOnRun(false);
+ this.longOperationTime = longOperationTime;
+ }
+
+ /**
+ * Create a monitor for the receiver that wrappers the superclasses monitor.
+ *
+ */
+ public void createWrapperedMonitor() {
+ wrapperedMonitor = new IProgressMonitor() {
+
+ IProgressMonitor superMonitor = TimeTriggeredProgressMonitorDialog.super
+ .getProgressMonitor();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#beginTask(java.lang.String,
+ * int)
+ */
+ public void beginTask(String name, int totalWork) {
+ superMonitor.beginTask(name, totalWork);
+ checkTicking();
+ }
+
+ /**
+ * Check if we have ticked in the last 800ms.
+ */
+ private void checkTicking() {
+ if (triggerTime < 0) {
+ triggerTime = System.currentTimeMillis() + longOperationTime;
+ }
+ if (!dialogOpened && System.currentTimeMillis() > triggerTime) {
+ open();
+ dialogOpened = true;
+ }
+ }
+
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#done()
+ */
+ public void done() {
+ superMonitor.done();
+ checkTicking();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#internalWorked(double)
+ */
+ public void internalWorked(double work) {
+ superMonitor.internalWorked(work);
+ checkTicking();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#isCanceled()
+ */
+ public boolean isCanceled() {
+ return superMonitor.isCanceled();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#setCanceled(boolean)
+ */
+ public void setCanceled(boolean value) {
+ superMonitor.setCanceled(value);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#setTaskName(java.lang.String)
+ */
+ public void setTaskName(String name) {
+ superMonitor.setTaskName(name);
+ checkTicking();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#subTask(java.lang.String)
+ */
+ public void subTask(String name) {
+ superMonitor.subTask(name);
+ checkTicking();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#worked(int)
+ */
+ public void worked(int work) {
+ superMonitor.worked(work);
+ checkTicking();
+
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.ProgressMonitorDialog#getProgressMonitor()
+ */
+ public IProgressMonitor getProgressMonitor() {
+ if (wrapperedMonitor == null) {
+ createWrapperedMonitor();
+ }
+ return wrapperedMonitor;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.operations.IRunnableContext#run(boolean, boolean, IRunnableWithProgress)
+ */
+ public void run(final boolean fork, final boolean cancelable,
+ final IRunnableWithProgress runnable) throws InvocationTargetException,
+ InterruptedException {
+ final InvocationTargetException[] invokes = new InvocationTargetException[1];
+ final InterruptedException[] interrupt = new InterruptedException[1];
+ Runnable dialogWaitRunnable = new Runnable() {
+ public void run() {
+ try {
+ TimeTriggeredProgressMonitorDialog.super.run(fork, cancelable, runnable);
+ } catch (InvocationTargetException e) {
+ invokes[0] = e;
+ } catch (InterruptedException e) {
+ interrupt[0]= e;
+ }
+ }
+ };
+ final Display display = Display.getDefault();
+ if (display == null) {
+ return;
+ }
+ //show a busy cursor until the dialog opens
+ BusyIndicator.showWhile(display, dialogWaitRunnable);
+ if (invokes[0] != null) {
+ throw invokes[0];
+ }
+ if (interrupt[0] != null) {
+ throw interrupt[0];
+ }
+ }
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/EnvironmentTab.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/EnvironmentTab.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/EnvironmentTab.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,484 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007, 2008 Keith Seitz and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Keith Seitz (keiths at redhat.com) - initial implementation
+ * IBM Corporation - integration and code cleanup
+ * Ed Swartz (Nokia) - adapted for ESbox and for proper use of content provider
+ *******************************************************************************/
+package org.maemo.esbox.ui.env;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.*;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.env.*;
+
+import java.text.MessageFormat;
+
+/**
+ * Launch configuration tab for configuring an environment block
+ */
+public class EnvironmentTab extends Composite {
+
+ /**
+ * @param parent
+ * @param description
+ */
+ public EnvironmentTab(Composite parent, String description) {
+ super(parent, SWT.NONE);
+
+ GridLayout layout = new GridLayout(2, false);
+ setLayout(layout);
+
+ // Create main composite
+ Composite mainComposite = new Composite(this, SWT.NONE);
+ mainComposite.setLayout(new GridLayout(2, false));
+ mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB);
+
+ // Create label, add it to the parent to align the right side buttons with the top of the table
+ createLabel(mainComposite, description, 2);
+
+ createEnvironmentTable(mainComposite);
+ createTableButtons(mainComposite);
+
+ Dialog.applyDialogFont(mainComposite);
+ }
+
+ protected TableViewer environmentTable;
+ protected String[] envTableColumnHeaders = {
+ "Variable",
+ "Value"
+ };
+ protected static final String P_VARIABLE = "variable"; //$NON-NLS-1$
+ protected static final String P_VALUE = "value"; //$NON-NLS-1$
+ protected Button envAddButton;
+ protected Button envEditButton;
+ protected Button envRemoveButton;
+ private Button envUndefButton;
+
+ /**
+ * Content provider for the environment table
+ */
+ protected class IEnvironmentVariableContentProvider implements IStructuredContentProvider {
+ public Object[] getElements(Object inputElement) {
+ IEnvironmentVariableBlock block = (IEnvironmentVariableBlock) inputElement;
+ return block.getVariables();
+ }
+ public void dispose() {
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if (newInput == null){
+ return;
+ }
+ if (viewer instanceof TableViewer){
+ TableViewer tableViewer = (TableViewer) viewer;
+ if (tableViewer.getTable().isDisposed()) {
+ return;
+ }
+ tableViewer.setComparator(new ViewerComparator() {
+ public int compare(Viewer iviewer, Object e1, Object e2) {
+ if (e1 == null) {
+ return -1;
+ } else if (e2 == null) {
+ return 1;
+ } else {
+ return ((IEnvironmentVariable)e1).getName().compareToIgnoreCase(((IEnvironmentVariable)e2).getName());
+ }
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Label provider for the environment table
+ */
+ public class IEnvironmentVariableLabelProvider extends LabelProvider implements ITableLabelProvider, ITableFontProvider {
+ public String getColumnText(Object element, int columnIndex) {
+ String result = null;
+ if (element != null) {
+ IEnvironmentVariable var = (IEnvironmentVariable) element;
+ switch (columnIndex) {
+ case 0: // variable
+ result = var.getName();
+ break;
+ case 1: // value
+ result = var.getValue();
+ if (result == null)
+ return "<undefined>";
+ break;
+ }
+ }
+ return result;
+ }
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return null; // TODO
+ }
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
+ */
+ public Font getFont(Object element, int columnIndex) {
+ if (element != null) {
+ IEnvironmentVariable var = (IEnvironmentVariable) element;
+ switch (columnIndex) {
+ case 1: // value
+ if (var.getValue() == null) {
+ return JFaceResources.getFontRegistry().getItalic(
+ JFaceResources.DIALOG_FONT);
+ }
+ break;
+ }
+ }
+ return null;
+ }
+ }
+
+ private Label createLabel(Composite parent, String text, int hspan) {
+ Label l = new Label(parent, SWT.NONE);
+ l.setFont(parent.getFont());
+ l.setText(text);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = hspan;
+ gd.grabExcessHorizontalSpace = false;
+ l.setLayoutData(gd);
+ return l;
+ }
+
+ /**
+ * Creates a Composite widget
+ * @param parent the parent composite to add this composite to
+ * @param font the font to set on the control
+ * @param columns the number of columns within the composite
+ * @param hspan the horizontal span the composite should take up on the parent
+ * @param fill the style for how this composite should fill into its parent
+ * @param marginwidth the width of the margin to place on the sides of the composite (default is 5, specified by GridLayout)
+ * @param marginheight the height of the margin to place o the top and bottom of the composite
+ * @return the new composite
+ * @since 3.3
+ */
+ private Composite createComposite(Composite parent, Font font, int columns, int hspan, int fill, int marginwidth, int marginheight) {
+ Composite g = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(columns, false);
+ layout.marginWidth = marginwidth;
+ layout.marginHeight = marginheight;
+ g.setLayout(layout);
+ g.setFont(font);
+ GridData gd = new GridData(fill);
+ gd.horizontalSpan = hspan;
+ g.setLayoutData(gd);
+ return g;
+ }
+
+ /**
+ * Creates and returns a new push button with the given
+ * label and/or image.
+ *
+ * @param parent parent control
+ * @param label button label or <code>null</code>
+ * @param image image of <code>null</code>
+ *
+ * @return a new push button
+ */
+ private Button createPushButton(Composite parent, String label, Image image) {
+ Button button = new Button(parent, SWT.PUSH);
+ button.setFont(parent.getFont());
+ if (image != null) {
+ button.setImage(image);
+ }
+ if (label != null) {
+ button.setText(label);
+ }
+ GridData gd = new GridData();
+ button.setLayoutData(gd);
+ setButtonDimensionHint(button);
+ return button;
+ }
+
+ /**
+ * Returns a width hint for a button control.
+ */
+ private int getButtonWidthHint(Button button) {
+ button.setFont(JFaceResources.getDialogFont());
+ PixelConverter converter = new PixelConverter(button);
+ int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+ }
+
+ /**
+ * Sets width and height hint for the button control.
+ * <b>Note:</b> This is a NOP if the button's layout data is not
+ * an instance of <code>GridData</code>.
+ *
+ * @param the button for which to set the dimension hint
+ */
+ private void setButtonDimensionHint(Button button) {
+ Assert.isNotNull(button);
+ Object gd = button.getLayoutData();
+ if (gd instanceof GridData) {
+ ((GridData)gd).widthHint = getButtonWidthHint(button);
+ ((GridData)gd).horizontalAlignment = GridData.FILL;
+ }
+ }
+
+ /**
+ * Creates and configures the table that displayed the key/value
+ * pairs that comprise the environment.
+ * @param parent the composite in which the table should be created
+ */
+ protected void createEnvironmentTable(Composite parent) {
+ Font font = parent.getFont();
+ // Create table composite
+ Composite tableComposite = createComposite(parent, font, 1, 1, GridData.FILL_BOTH, 0, 0);
+ // Create table
+ environmentTable = new TableViewer(tableComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
+ Table table = environmentTable.getTable();
+ table.setLayout(new GridLayout());
+ table.setLayoutData(new GridData(GridData.FILL_BOTH));
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ table.setFont(font);
+ environmentTable.setContentProvider(new IEnvironmentVariableContentProvider());
+ environmentTable.setLabelProvider(new IEnvironmentVariableLabelProvider());
+ environmentTable.setColumnProperties(new String[] {P_VARIABLE, P_VALUE});
+ environmentTable.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ handleTableSelectionChanged(event);
+ }
+ });
+ environmentTable.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ if (!environmentTable.getSelection().isEmpty()) {
+ handleEnvEditButtonSelected();
+ }
+ }
+ });
+ // Create columns
+ final TableColumn tc1 = new TableColumn(table, SWT.NONE, 0);
+ tc1.setText(envTableColumnHeaders[0]);
+ final TableColumn tc2 = new TableColumn(table, SWT.NONE, 1);
+ tc2.setText(envTableColumnHeaders[1]);
+ final Table tref = table;
+ final Composite comp = tableComposite;
+ tableComposite.addControlListener(new ControlAdapter() {
+ public void controlResized(ControlEvent e) {
+ Rectangle area = comp.getClientArea();
+ Point size = tref.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ ScrollBar vBar = tref.getVerticalBar();
+ int width = area.width - tref.computeTrim(0,0,0,0).width - 2;
+ if (size.y > area.height + tref.getHeaderHeight()) {
+ Point vBarSize = vBar.getSize();
+ width -= vBarSize.x;
+ }
+ Point oldSize = tref.getSize();
+ if (oldSize.x > area.width) {
+ tc1.setWidth(width/2-1);
+ tc2.setWidth(width - tc1.getWidth());
+ tref.setSize(area.width, area.height);
+ } else {
+ tref.setSize(area.width, area.height);
+ tc1.setWidth(width/2-1);
+ tc2.setWidth(width - tc1.getWidth());
+ }
+ }
+ });
+ }
+
+ /**
+ * Responds to a selection changed event in the environment table
+ * @param event the selection change event
+ */
+ protected void handleTableSelectionChanged(SelectionChangedEvent event) {
+ int size = ((IStructuredSelection)event.getSelection()).size();
+ envEditButton.setEnabled(size == 1);
+ envRemoveButton.setEnabled(size > 0);
+ envUndefButton.setEnabled(size > 0);
+ }
+
+ /**
+ * Creates the add/edit/remove buttons for the environment table
+ * @param parent the composite in which the buttons should be created
+ */
+ protected void createTableButtons(Composite parent) {
+ // Create button composite
+ Composite buttonComposite = createComposite(parent, parent.getFont(), 1, 1, GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_END, 0, 0);
+
+ // Create buttons
+ envAddButton = createPushButton(buttonComposite, "New", null);
+ envAddButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ handleEnvAddButtonSelected();
+ }
+ });
+ envEditButton = createPushButton(buttonComposite, "Edit", null);
+ envEditButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ handleEnvEditButtonSelected();
+ }
+ });
+ envEditButton.setEnabled(false);
+ envUndefButton = createPushButton(buttonComposite, "Undefine", null);
+ envUndefButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ handleEnvUndefineButtonSelected();
+ }
+ });
+ envUndefButton.setEnabled(false);
+ envRemoveButton = createPushButton(buttonComposite, "Remove", null);
+ envRemoveButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ handleEnvRemoveButtonSelected();
+ }
+ });
+ envRemoveButton.setEnabled(false);
+ }
+
+ /**
+ * Adds a new environment variable to the table.
+ */
+ protected void handleEnvAddButtonSelected() {
+ VariableInputDialog dialog = new VariableInputDialog(getShell(),
+ "Add variable",
+ "Name",
+ "",
+ "");
+
+ if (dialog.open() != Window.OK) {
+ return;
+ }
+
+ String name = dialog.getName();
+ String value = dialog.getValue();
+
+ if (name != null && value != null && name.length() > 0) {
+ addVariable(new EnvironmentVariable(name.trim(), value.trim()));
+ }
+ }
+
+ /**
+ * Attempts to add the given variable. Returns whether the variable
+ * was added or not (as when the user answers not to overwrite an
+ * existing variable).
+ * @param variable the variable to add
+ * @return whether the variable was added
+ */
+ protected boolean addVariable(IEnvironmentVariable variable) {
+ String name = variable.getName();
+
+ IEnvironmentVariableBlock block = (IEnvironmentVariableBlock) environmentTable.getInput();
+
+ IEnvironmentVariable existing = block.getVariable(name);
+ if (existing != null) {
+ boolean overWrite = MessageDialog.openQuestion(getShell(),
+ "Overwrite variable?",
+ MessageFormat.format("Variable ''{0}'' already exists; overwrite?", name));
+ if (!overWrite) {
+ return false;
+ }
+ }
+ block.define(variable.getName(), variable.getValue());
+ updatePane();
+ return true;
+ }
+
+ /**
+ * Creates an editor for the value of the selected environment variable.
+ */
+ private void handleEnvEditButtonSelected() {
+ IStructuredSelection sel = (IStructuredSelection) environmentTable.getSelection();
+ IEnvironmentVariable var = (IEnvironmentVariable) sel.getFirstElement();
+ if (var == null) {
+ return;
+ }
+ String originalName = var.getName();
+ String value = var.getValue();
+ if (value == null)
+ value = "";
+
+ VariableInputDialog dialog = new VariableInputDialog(getShell(), "Edit variable",
+ "Name", originalName, value);
+
+ dialog.focusOnValue();
+
+ if (dialog.open() != Window.OK) {
+ return;
+ }
+ String name = dialog.getName();
+ value = dialog.getValue();
+ if (!originalName.equals(name)) {
+ if (addVariable(new EnvironmentVariable(name, value))) {
+ environmentTable.remove(var);
+ }
+ } else {
+ var.setValue(value);
+ environmentTable.update(var, null);
+ updatePane();
+ }
+ }
+
+ /**
+ * Removes the selected environment variable from the table.
+ */
+ private void handleEnvRemoveButtonSelected() {
+ IStructuredSelection sel = (IStructuredSelection) environmentTable.getSelection();
+ IEnvironmentVariableBlock block = (IEnvironmentVariableBlock) environmentTable.getInput();
+ for (Object obj : sel.toList()) {
+ IEnvironmentVariable var = (IEnvironmentVariable) obj;
+ block.remove(var);
+ }
+ updatePane();
+ }
+
+ /**
+ * Undefines the selected environment variables in the table.
+ */
+ private void handleEnvUndefineButtonSelected() {
+ IStructuredSelection sel = (IStructuredSelection) environmentTable.getSelection();
+ environmentTable.getControl().setRedraw(false);
+ for (Object obj : sel.toList()) {
+ IEnvironmentVariable var = (IEnvironmentVariable) obj;
+ var.setValue(null);
+ }
+ environmentTable.getControl().setRedraw(true);
+ updatePane();
+ }
+
+ public void initializeFrom(IEnvironmentVariableBlock envBlock) {
+ // make a copy for the input
+ IEnvironmentVariableBlock copy = new EnvironmentVariableBlock();
+ for (IEnvironmentVariable variable : envBlock.getVariables()) {
+ copy.define(variable.getName(), variable.getValue());
+ }
+ environmentTable.setInput(copy);
+ }
+
+ public void performApply(IEnvironmentVariableBlock envBlock) {
+ envBlock.clear();
+
+ IEnvironmentVariableBlock copy = (IEnvironmentVariableBlock) environmentTable.getInput();
+ for (IEnvironmentVariable variable : copy.getVariables()) {
+ envBlock.define(variable.getName(), variable.getValue());
+ }
+ }
+
+ protected void updatePane() {
+ environmentTable.refresh();
+ }
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/PixelConverter.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/PixelConverter.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/PixelConverter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.ui.env;
+
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.widgets.Control;
+
+public class PixelConverter {
+
+ private FontMetrics fFontMetrics;
+
+ public PixelConverter( Control control ) {
+ GC gc = new GC( control );
+ gc.setFont( control.getFont() );
+ setFontMetrics( gc.getFontMetrics() );
+ gc.dispose();
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int)
+ */
+ public int convertHeightInCharsToPixels( int chars ) {
+ return Dialog.convertHeightInCharsToPixels( getFontMetrics(), chars );
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.DialogPage#convertHorizontalDLUsToPixels(int)
+ */
+ public int convertHorizontalDLUsToPixels( int dlus ) {
+ return Dialog.convertHorizontalDLUsToPixels( getFontMetrics(), dlus );
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.DialogPage#convertVerticalDLUsToPixels(int)
+ */
+ public int convertVerticalDLUsToPixels( int dlus ) {
+ return Dialog.convertVerticalDLUsToPixels( getFontMetrics(), dlus );
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int)
+ */
+ public int convertWidthInCharsToPixels( int chars ) {
+ return Dialog.convertWidthInCharsToPixels( getFontMetrics(), chars );
+ }
+
+ private FontMetrics getFontMetrics() {
+ return this.fFontMetrics;
+ }
+
+ private void setFontMetrics( FontMetrics fontMetrics ) {
+ this.fFontMetrics = fontMetrics;
+ }
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/VariableInputDialog.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/VariableInputDialog.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/env/VariableInputDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ui.env;
+
+import org.eclipse.jface.dialogs.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Dialog that allows editing a name and value for an environment variable.
+ * @author eswartz
+ *
+ */
+public class VariableInputDialog extends InputDialog {
+
+ private Text valueText;
+ protected String value;
+ private boolean doFocusOnValue;
+
+ /**
+ * @param parentShell
+ * @param title
+ */
+ protected VariableInputDialog(Shell parentShell, String title, String message, final String initialName, String initialValue) {
+ super(parentShell, title, message, initialName, new IInputValidator() {
+
+ public String isValid(String newText) {
+ if (newText.length() == 0)
+ return "Variable name must be non-empty";
+ return null;
+ }
+
+ });
+
+ doFocusOnValue = false;
+ value = initialValue;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ Label valueLabel = new Label(composite, SWT.WRAP);
+ valueLabel.setText("Value");
+ valueLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ valueLabel.setLayoutData(data);
+ valueLabel.setFont(parent.getFont());
+
+ valueText = new Text(composite, getInputTextStyle());
+ valueText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL));
+ valueText.setText(value);
+ valueText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ value = valueText.getText();
+ }
+
+ });
+
+ getShell().addShellListener(new ShellAdapter() {
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.ShellAdapter#shellActivated(org.eclipse.swt.events.ShellEvent)
+ */
+ @Override
+ public void shellActivated(ShellEvent e) {
+ if (doFocusOnValue) {
+ getText().setSelection(0, 0);
+ valueText.forceFocus();
+ valueText.setSelection(0, -1);
+ }
+ doFocusOnValue = false;
+ }
+ });
+ return composite;
+ }
+
+
+ public String getName() {
+ return super.getValue();
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ *
+ */
+ public void focusOnValue() {
+ doFocusOnValue = true;
+ }
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxEnvPreferencePage.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxEnvPreferencePage.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxEnvPreferencePage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.ui.preferences;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.maemo.esbox.core.env.EnvironmentVariableManager;
+import org.maemo.esbox.core.env.IEnvironmentVariableBlock;
+import org.maemo.esbox.internal.ui.UIActivator;
+import org.maemo.esbox.ui.env.EnvironmentTab;
+
+/**
+ *
+ */
+public class ESboxEnvPreferencePage extends PreferencePage implements
+IWorkbenchPreferencePage {
+
+ private EnvironmentTab envPane;
+ private EnvironmentVariableManager envManager = EnvironmentVariableManager.getInstance();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ envPane = new EnvironmentTab(parent, "Edit the environment variables passed to programs launched by ESbox.");
+
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.minimumWidth = 600;
+ envPane.setLayoutData(gridData);
+
+ envPane.initializeFrom(envManager.getGlobalEnvironmentBlock());
+ return envPane;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ @Override
+ protected void performDefaults() {
+ envManager.startup();
+ envPane.initializeFrom(envManager.getGlobalEnvironmentBlock());
+ super.performDefaults();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performOk()
+ */
+ @Override
+ public boolean performOk() {
+ IEnvironmentVariableBlock envBlock = envManager.getGlobalEnvironmentBlock();
+ envPane.performApply(envBlock);
+ try {
+ envManager.save();
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().logError("Failed to save global environment (take shelter!)", e);
+ }
+ return true;
+ }
+
+
+}
\ No newline at end of file
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxGazpachoPreferencePage.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxGazpachoPreferencePage.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxGazpachoPreferencePage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Paulo Romulo (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ui.preferences;
+
+import org.eclipse.jface.preference.*;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+
+
+/**
+ * Preference page for Gazpacho
+ *
+ * @author romulo
+ */
+public class ESboxGazpachoPreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ /**
+ * Field for using the X command
+ */
+ private BooleanFieldEditor feUseXhostCmd = null;
+
+ /**
+ * Field for the X command
+ */
+ private StringFieldEditor feXhostCmd = null;
+
+ /**
+ * Field for Gazpacho command
+ */
+ private StringFieldEditor feGazpachoCmd = null;
+
+ /**
+ * The constructor
+ */
+ public ESboxGazpachoPreferencePage() {
+ super(GRID);
+ setPreferenceStore(CorePlugin.getDefault().getPreferenceStore());
+ setDescription("Preferences for Running Gazpacho User Interface Editor:");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ public void createFieldEditors() {
+ Composite oParent = getFieldEditorParent();
+
+ feGazpachoCmd =
+ new StringFieldEditor(ESboxPreferenceConstants.GAZPACHO_COMMAND.toString(),
+ "Command to start Gazpacho:",
+ oParent);
+
+ feUseXhostCmd =
+ new BooleanFieldEditor(ESboxPreferenceConstants.USE_X_HOST.toString(),
+ "Use 'xhost' command starting Gazpacho in Maemo",
+ oParent);
+
+ feXhostCmd =
+ new StringFieldEditor(ESboxPreferenceConstants.X_HOST_CMD.toString(),
+ "Command template for starting Xhost:",
+ oParent);
+
+ addField(feGazpachoCmd);
+ addField(feUseXhostCmd);
+ addField(feXhostCmd);
+
+ initializeValues();
+ }
+
+ /**
+ * Initializes the field values
+ */
+ private void initializeValues() {
+ IPreferenceStore store = getPreferenceStore();
+ store.setDefault(ESboxPreferenceConstants.GAZPACHO_COMMAND.toString(), "/usr/bin/gazpacho");
+ store.setDefault(ESboxPreferenceConstants.USE_X_HOST.toString(), true);
+ store.setDefault(ESboxPreferenceConstants.X_HOST_CMD.toString(), "DISPLAY=:0");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ // Nothing to do
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxMachinePreferencesPage.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxMachinePreferencesPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxMachinePreferencesPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.ui.preferences;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.maemo.esbox.core.CorePlugin;
+
+
+/**
+ * This page allows the user to select the machine to use
+ */
+public class ESboxMachinePreferencesPage extends PreferencePage implements
+IWorkbenchPreferencePage {
+
+ /**
+ * Constructs a new TargetPreferencePage.
+ */
+ public ESboxMachinePreferencesPage() {
+ setTitle("Build Machine Configuration");
+ setPreferenceStore(CorePlugin.getDefault().getPreferenceStore());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(final Composite parent) {
+
+ return new Composite(parent, SWT.NONE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxPreferencesPage.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxPreferencesPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxPreferencesPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Paulo Romulo (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.ui.preferences;
+
+import org.eclipse.jface.preference.*;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+
+
+/**
+ * General preference page for ESbox
+ *
+ * @author romulo
+ */
+public class ESboxPreferencesPage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private BooleanFieldEditor feCommandLogging;
+ private FileFieldEditor feCommandLoggingPath;
+ private StringFieldEditor feTerminalCommand;
+
+ /**
+ * The constructor
+ */
+ public ESboxPreferencesPage() {
+ super(GRID);
+ setPreferenceStore(CorePlugin.getDefault().getPreferenceStore());
+ setDescription("General options for ESbox");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ public void createFieldEditors() {
+ feTerminalCommand = new StringFieldEditor(
+ ESboxPreferenceConstants.TERMINAL_COMMAND.toString(),
+ "'Launch shell' command pattern",
+ getFieldEditorParent());
+
+ feCommandLogging = new BooleanFieldEditor(
+ ESboxPreferenceConstants.LOG_COMMANDS.toString(),
+ "Log scratchbox commands?",
+ getFieldEditorParent());
+
+ feCommandLoggingPath = new FileFieldEditor(
+ ESboxPreferenceConstants.LOG_COMMANDS_PATH.toString(),
+ "Path for command log:",
+ getFieldEditorParent()) {
+ @Override
+ public String getErrorMessage() {
+ // never fail, even if file doesn't exist
+ return null;
+ }
+ };
+
+ // make this string manageable
+ GC gc = new GC(getFieldEditorParent().getShell());
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.widthHint = gc.getAdvanceWidth('m') * 32;
+ gc.dispose();
+ feTerminalCommand.getTextControl(getFieldEditorParent()).setLayoutData(gridData);
+
+ addField(feTerminalCommand);
+ addField(feCommandLogging);
+ addField(feCommandLoggingPath);
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ super.propertyChange(event);
+
+ Text textControl = feCommandLoggingPath.getTextControl(getFieldEditorParent());
+ textControl.setEnabled(feCommandLogging.getBooleanValue());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ // Nothing to do
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxTargetPreferencesPage.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxTargetPreferencesPage.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxTargetPreferencesPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,350 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG)
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.ui.preferences;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.*;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.ui.UIActivator;
+import org.maemo.esbox.ui.*;
+import org.maemo.esbox.ui.common.PixelConverter;
+import org.maemo.esbox.ui.common.SWTUtil;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.*;
+import java.util.List;
+
+/**
+ * The preference page for the global SDK & target configuration. This
+ * has the add/remove commands.
+ * @author romulo
+ * @author eswartz
+ */
+public class ESboxTargetPreferencesPage extends PreferencePage implements
+IWorkbenchPreferencePage {
+ /**
+ * Button for new target creation
+ */
+ protected Button buttonNew;
+
+ /**
+ * Button for delete targets
+ */
+ protected Button buttonRemove;
+
+ /**
+ * Table of targets
+ */
+ private TreeViewer treeViewer;
+
+ protected ISDKTarget selectedTarget;
+
+ /**
+ * Constructs a new TargetPreferencePage.
+ */
+ public ESboxTargetPreferencesPage() {
+ setTitle("Installed SDKs and Targets");
+ setPreferenceStore(UIActivator.getDefault().getPreferenceStore());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(final Composite parent) {
+ Composite labelPane = new Composite(parent, SWT.NONE);
+ labelPane.setLayout(new GridLayout());
+ labelPane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label information = new Label(labelPane, SWT.NONE);
+ information.setText("Add or remove Scratchbox targets from the system.");
+ /*Label separator =*/ new Label(labelPane, SWT.HORIZONTAL);
+ Label label = new Label(labelPane, SWT.NONE);
+ label.setText("Targets");
+
+ Composite control = new Composite(parent, SWT.NONE);
+ GridLayout controlLayout = new GridLayout(2, false);
+
+ controlLayout.marginHeight = 0;
+ controlLayout.marginWidth = 0;
+
+ control.setLayout(controlLayout);
+ control.setLayoutData(new GridData(GridData.FILL_BOTH
+ | GridData.GRAB_VERTICAL));
+
+
+ // Create the target tree
+ Composite treePane = new Composite(control, SWT.NONE);
+ GridLayout tablePaneLayout = new GridLayout();
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+
+ tablePaneLayout.marginHeight = 0;
+ tablePaneLayout.marginWidth = 0;
+
+ treePane.setLayout(tablePaneLayout);
+ treePane.setLayoutData(gridData);
+
+ treeViewer = ESboxBuildTargetUI.createConfiguredBuildTargetViewer(
+ treePane, ESboxBuildTargetUI.DEFAULT_STYLE);
+
+ treeViewer.setInput(new Object());
+
+ gridData = new GridData(GridData.FILL_BOTH);
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.grabExcessVerticalSpace = true;
+ //gridData.heightHint = SWTUtil.getTableHeightHint(treeViewer.get, 8);
+ gridData.widthHint = new PixelConverter(parent).convertWidthInCharsToPixels(60);
+
+ treeViewer.getTree().setLayoutData(gridData);
+
+ treeViewer.setSelection(StructuredSelection.EMPTY);
+
+ // listen for changes to target
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ setMessage(null);
+
+ Object element = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ if (element instanceof ISDKTarget) {
+ ISDKTarget target = (ISDKTarget) element;
+ selectedTarget = target;
+ } else {
+ selectedTarget = null;
+ }
+ if (buttonRemove != null)
+ buttonRemove.setEnabled(getSDKManageTargetAdapter(selectedTarget) != null);
+ setValid(true);
+ }
+
+ });
+
+ // Create the button pane
+
+ Composite buttonPane = new Composite(control, SWT.NONE);
+ GridLayout buttonPaneLayout = new GridLayout();
+
+ buttonPaneLayout.marginHeight = 0;
+ buttonPaneLayout.marginWidth = 0;
+
+ buttonPane.setLayout(buttonPaneLayout);
+ buttonPane
+ .setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+
+ // New button
+ buttonNew = new Button(buttonPane, SWT.PUSH);
+ buttonNew.setText("New");
+
+ gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.widthHint = SWTUtil.getButtonWidthHint(buttonNew);
+ buttonNew.setLayoutData(gridData);
+
+ buttonNew.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ displayTargetWizard(parent.getShell());
+ }
+ });
+
+ // Remove button
+ buttonRemove = new Button(buttonPane, SWT.PUSH);
+ buttonRemove.setText("Remove");
+ buttonRemove.setEnabled(false);
+
+ gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.widthHint = SWTUtil.getButtonWidthHint(buttonRemove);
+ buttonRemove.setLayoutData(gridData);
+ buttonRemove.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ removeSDKTarget();
+ }
+ });
+
+ // Refresh button
+ Button refreshButton = new Button(buttonPane, SWT.PUSH);
+ refreshButton.setText("Refresh");
+ gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.widthHint = SWTUtil.getButtonWidthHint(buttonRemove);
+ refreshButton.setLayoutData(gridData);
+ refreshButton.addSelectionListener(new SelectionAdapter() {
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException,
+ InterruptedException {
+ for (ISDK sdk : SDKFactory.getInstance().getSDKs()) {
+ ISDKManageTargetAdapter adapter = getSDKManageTargetAdapter(sdk);
+ if (adapter != null)
+ adapter.prepareRefresh();
+ }
+ SDKFactory.getInstance().refresh(monitor);
+ }
+
+ });
+ } catch (Exception e2) {
+ UIActivator.getErrorLogger().logAndShowError("Failed to refresh SDKs", e2);
+ }
+ treeViewer.refresh();
+ }
+ });
+
+ return control;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ // Nothing to do
+ }
+
+ /**
+ * Displays the target wizard, so that the user can create new targets.
+ *
+ * @param composite the parent composite.
+ */
+ private void displayTargetWizard(Shell shell) {
+ // first, present a choice of which SDKs to install to
+
+ ISDKManageTargetAdapter adapter = chooseSDKToManage(shell);
+ if (adapter == null)
+ return;
+
+ List<ISDKTarget> installed = new ArrayList<ISDKTarget>();
+ IStatus status = adapter.installSDKTargets(shell, installed);
+
+ if (!status.isOK() && status.getSeverity() != IStatus.CANCEL) {
+ UIActivator.getErrorLogger().logAndShowError(status.getMessage(), status.getException());
+ }
+
+ treeViewer.setInput(new Object());
+ treeViewer.setSelection(new StructuredSelection(installed));
+
+ }
+
+ /**
+ * Choose a manageable SDK from a dialog and return its adapter.
+ * @param shell
+ * @return an {@link ISDKManageTargetAdapter} or <code>null</code>
+ */
+ private ISDKManageTargetAdapter chooseSDKToManage(Shell shell) {
+ // always ask what scratchbox to support... it's not obvious the selected target is meaningful
+ //if (selectedTarget != null ) ...
+
+ ISDK sdk = chooseSdk();
+ if (sdk == null)
+ return null;
+
+ return (ISDKManageTargetAdapter) sdk.getAdapter(ISDKManageTargetAdapter.class);
+ }
+
+ /** Choose which SDK to target */
+ private ISDK chooseSdk() {
+
+ List<ISDK> sdks = new ArrayList<ISDK>(SDKFactory.getInstance().getSDKs());
+ List<String> labelList = new ArrayList<String>();
+
+ int last = 0;
+ for (Iterator<ISDK> iter = sdks.iterator(); iter.hasNext(); ) {
+ ISDK sdk = iter.next();
+ if (sdk.getAdapter(ISDKManageTargetAdapter.class) != null) {
+ labelList.add(sdk.getName());
+ } else {
+ iter.remove();
+ }
+ }
+
+ last = labelList.size();
+
+ if (last == 0) {
+ MessageDialog.openError(getShell(), "Cannot install",
+ "Cannot install targets for any of the detected SDKs");
+ return null;
+ }
+
+ labelList.add(IDialogConstants.CANCEL_LABEL);
+
+ String[] labels = (String[]) labelList.toArray(new String[labelList.size()]);
+ MessageDialog dialog = new MessageDialog(getShell(),
+ "Select SDK",
+ null,
+ "Add a target for which SDK?",
+ MessageDialog.QUESTION,
+ labels,
+ last
+ );
+
+ int choice = dialog.open();
+ if (choice == last)
+ return null;
+
+ return sdks.get(choice);
+ }
+
+ private ISDKManageTargetAdapter getSDKManageTargetAdapter(ISDKTarget sdkTarget) {
+ if (sdkTarget == null)
+ return null;
+ return (ISDKManageTargetAdapter)
+ sdkTarget.getSDK().getAdapter(ISDKManageTargetAdapter.class);
+ }
+
+ private ISDKManageTargetAdapter getSDKManageTargetAdapter(ISDK sdk) {
+ if (sdk == null)
+ return null;
+ return (ISDKManageTargetAdapter)
+ sdk.getAdapter(ISDKManageTargetAdapter.class);
+ }
+
+ /**
+ *
+ */
+ private void removeSDKTarget() {
+ ISDKManageTargetAdapter manageTargetAdapter = getSDKManageTargetAdapter(selectedTarget);
+ if (manageTargetAdapter == null)
+ return;
+
+ IStatus status = manageTargetAdapter.removeSDKTarget(getShell(), selectedTarget);
+
+ if (status.getSeverity() != IStatus.ERROR) {
+ treeViewer.setInput(new Object());
+ treeViewer.setSelection(StructuredSelection.EMPTY);
+ } else {
+ UIActivator.getErrorLogger().logAndShowError(status.getMessage(), status.getException());
+ }
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxXServerPreferencePage.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxXServerPreferencePage.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/ESboxXServerPreferencePage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Paulo Romulo (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.ui.preferences;
+
+import org.eclipse.jface.preference.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+
+
+/**
+ * The preference page for X server
+ *
+ * @author romulo
+ */
+public class ESboxXServerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, IPreferencePage {
+
+ private StringFieldEditor xServerSyntax = null;
+
+ /**
+ * The constructor
+ */
+ public ESboxXServerPreferencePage() {
+ super(GRID);
+ setPreferenceStore(CorePlugin.getDefault().getPreferenceStore());
+ setDescription("Preferences for Running Graphical Programs inside Scratchbox:");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ public void createFieldEditors() {
+ xServerSyntax = new StringFieldEditor(
+ ESboxPreferenceConstants.DISPLAY_X_COMMAND.toString(),
+ "Command template for X server:",
+ getFieldEditorParent());
+
+ // make this string manageable
+ GC gc = new GC(getFieldEditorParent().getShell());
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.widthHint = gc.getAdvanceWidth('m') * 32;
+ gc.dispose();
+ xServerSyntax.getTextControl(getFieldEditorParent()).setLayoutData(gridData);
+
+ addField(xServerSyntax);
+
+ initializeValues();
+ }
+
+ /**
+ * Initializes the values of the fields
+ */
+ private void initializeValues() {
+ IPreferenceStore store = getPreferenceStore();
+ xServerSyntax.setStringValue(store.getDefaultString(ESboxPreferenceConstants.DISPLAY_X_COMMAND.toString()));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
+ */
+ @Override
+ public boolean performOk() {
+ IPreferenceStore store = getPreferenceStore();
+ store.setValue(ESboxPreferenceConstants.DISPLAY_X_COMMAND.toString(), xServerSyntax.getStringValue());
+ return super.performOk();
+ };
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ // Nothing to do
+ }
+
+}
Added: trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/SDKPreferencesPageUtils.java
===================================================================
--- trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/SDKPreferencesPageUtils.java (rev 0)
+++ trunk/common/org.maemo.esbox.ui/src/org/maemo/esbox/ui/preferences/SDKPreferencesPageUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,14 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.ui.preferences;
+
+
+/**
+ * @author eswartz
+ *
+ */
+public class SDKPreferencesPageUtils {
+
+
+}
Property changes on: trunk/cpp/org.maemo.esbox.cpp-feature
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/cpp/org.maemo.esbox.cpp-feature/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp-feature/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp-feature/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.cpp-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp-feature/build.properties
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp-feature/build.properties (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp-feature/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3 @@
+bin.includes = feature.xml,\
+ license.html,\
+ licenses/
Added: trunk/cpp/org.maemo.esbox.cpp-feature/feature.xml
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp-feature/feature.xml (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp-feature/feature.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.maemo.esbox.cpp"
+ label="ESbox C/C++ Support Feature"
+ version="1.5.0.qualifier"
+ provider-name="INdT / Nokia">
+
+ <description>
+ C/C++ base support for the ESbox project. This layers a project
+and build model on top of CDT and the Redhat Autotools for Eclipse
+project, provides launch support for local and remote applications
+using either the old CDI interface or the new DSF interface to
+gdb, and provides valgrind/oprofile launch support.
+ </description>
+
+ <copyright>
+ Copyright (c) 2007-2008 INdT, (c) 2007-2008 Nokia. All rights
+reserved.
+ </copyright>
+
+ <license url="http://www.eclipse.org/legal/epl-v10.html">
+ For legal terms, see the Eclipse Public License.
+ </license>
+
+ <url>
+ <update label="Update Site for ESbox project" url="http://esbox.garage.maemo.org/update"/>
+ </url>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.maemo.esbox.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.project.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.core" version="5.0.1" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.debug.core" version="5.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.debug.mi.core" version="5.0.1" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.debug.mi.ui" version="5.0.1" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.launch" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.variables" version="3.2.100" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.launch" version="5.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.debug.ui" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.debug.ui" version="5.0.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.cpp.launch" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.analysis.launch" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.debug.core" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.expressions" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.make.core" version="5.0.1" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.managedbuilder.core" version="5.0.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.linux.packages.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.linux.packages.ui" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.project.ui" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.make.ui" version="5.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.ui" version="5.0.1" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.cpp.project.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui.ide" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.ui" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.managedbuilder.ui" version="5.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui.editors" version="3.4.0" match="greaterOrEqual"/>
+ </requires>
+
+ <plugin
+ id="org.maemo.esbox.cpp.launch"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.cpp.launch.analysis"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.cpp.launch.cdi.gdb"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.cpp.launch.dsf.gdb"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.cpp.project.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.cpp.project.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Added: trunk/cpp/org.maemo.esbox.cpp-feature/license.html
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp-feature/license.html (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp-feature/license.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+<html>
+<head>
+<title>ESbox License</title>
+</head>
+
+<body>
+<h2>ESbox Software User Agreement</h2>
+<p>16<sup>th</sup> April, 2008</p>
+
+<h3>ESbox</h3>
+
+<p>ESbox is licensed under the terms of the <a href="licenses/epl-v10.html">Eclipse Public License v1.0</a>.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>ESbox has a set of open source templates to help the development of applications. Such templates are distributed
+under <a href="licenses/COPYING.LESSER">LGPL license.</a></p>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THIS CONTENT.</p>
+
+</body>
+</html>
Added: trunk/cpp/org.maemo.esbox.cpp-feature/licenses/COPYING
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp-feature/licenses/COPYING (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp-feature/licenses/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/cpp/org.maemo.esbox.cpp-feature/licenses/COPYING.LESSER
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp-feature/licenses/COPYING.LESSER (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp-feature/licenses/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/cpp/org.maemo.esbox.cpp-feature/licenses/epl-v10.html
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp-feature/licenses/epl-v10.html (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp-feature/licenses/epl-v10.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ at font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+ at page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/cpp/org.maemo.esbox.cpp.launch/.classpath
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/.classpath (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/cpp/org.maemo.esbox.cpp.launch/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.cpp.launch</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.launch/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:28:44 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/cpp/org.maemo.esbox.cpp.launch/META-INF/MANIFEST.MF
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox C/C++ Launch Plug-in
+Bundle-SymbolicName: org.maemo.esbox.cpp.launch;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.cpp.launch.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.eclipse.cdt.core;bundle-version="5.0.1",
+ org.eclipse.cdt.debug.core;bundle-version="5.0.0",
+ org.eclipse.cdt.debug.mi.core;bundle-version="5.0.1",
+ org.eclipse.cdt.debug.mi.ui;bundle-version="5.0.1",
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.eclipse.core.variables;bundle-version="3.2.100",
+ org.eclipse.cdt.launch;bundle-version="5.0.0",
+ org.eclipse.debug.ui;bundle-version="3.4.0",
+ org.eclipse.cdt.debug.ui;bundle-version="5.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.cpp.launch,
+ org.maemo.esbox.cpp.launch.local,
+ org.maemo.esbox.cpp.launch.remote,
+ org.maemo.esbox.cpp.launch.ui
Added: trunk/cpp/org.maemo.esbox.cpp.launch/build.properties
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/build.properties (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/cpp/org.maemo.esbox.cpp.launch/plugin.xml
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/plugin.xml (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.cdt.debug.ui.CDebuggerPage">
+ <debuggerPage
+ class="org.maemo.esbox.cpp.launch.ui.ESboxGDBDebuggerPage"
+ debuggerID="esboxGDBDebugger"
+ id="esboxGDBDebuggerPage">
+ </debuggerPage>
+ <debuggerPage
+ class="org.maemo.esbox.cpp.launch.ui.ESboxGDBServerDebuggerPage"
+ debuggerID="esboxGDBServerDebugger"
+ id="esboxGDBServerDebuggerPage">
+ </debuggerPage>
+ <debuggerPage
+ class="org.maemo.esbox.cpp.launch.ui.ESboxGDBServerDebuggerPage"
+ debuggerID="esboxGDBRemoteDebugger"
+ id="esboxGDBRemoteDebuggerPage">
+ </debuggerPage>
+ </extension>
+
+</plugin>
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/AbstractLaunchShortcut.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/AbstractLaunchShortcut.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/AbstractLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch;
+
+import java.util.ArrayList;
+
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
+import org.eclipse.cdt.launch.internal.CApplicationLaunchShortcut;
+import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.cpp.launch.Activator;
+import org.maemo.esbox.launch.*;
+
+/**
+ * Base for ESbox specific launch shortcut.
+ */
+public abstract class AbstractLaunchShortcut extends CApplicationLaunchShortcut {
+
+ /**
+ * Locate a configuration to relaunch for the given type. If one cannot be found, create one.
+ *
+ * @return a re-useable config or <code>null</code> if none
+ */
+ protected ILaunchConfiguration findLaunchConfiguration(IBinary bin, String mode) {
+ ILaunchConfiguration configuration = null;
+ ILaunchConfigurationType configType = getCLaunchConfigType();
+ ArrayList<ILaunchConfiguration> candidateConfigs = new ArrayList<ILaunchConfiguration>(0);
+ try {
+ ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configType);
+ candidateConfigs = new ArrayList<ILaunchConfiguration>(configs.length);
+ for (int i = 0; i < configs.length; i++) {
+ ILaunchConfiguration config = configs[i];
+ if (canReuseLaunchConfiguration(bin, config))
+ candidateConfigs.add(config);
+ }
+ } catch (CoreException e) {
+ LaunchUIPlugin.log(e);
+ }
+
+ // If there are no existing configs associated with the IBinary, create one.
+ // If there is exactly one config associated with the IBinary, return it.
+ // Otherwise, if there is more than one config associated with the IBinary, prompt the
+ // user to choose one.
+ int candidateCount = candidateConfigs.size();
+ if (candidateCount < 1) {
+ configuration = createConfiguration(bin);
+ } else if (candidateCount == 1) {
+ configuration = (ILaunchConfiguration) candidateConfigs.get(0);
+ } else {
+ // Prompt the user to choose a config. A null result means the user
+ // cancelled the dialog, in which case this method returns null,
+ // since cancelling the dialog should also cancel launching anything.
+ configuration = chooseConfiguration(candidateConfigs, mode);
+ }
+
+ return configuration;
+ }
+
+ /**
+ * Note this is not an override of the super class createConfiguration().
+ * @param bin
+ * @return ILaunchConfiguration
+ */
+ public ILaunchConfiguration createConfiguration(IBinary bin) {
+ ILaunchConfiguration config = null;
+ try {
+ String programName = bin.getResource().getProjectRelativePath().toString();
+ ILaunchConfigurationType configType = getCLaunchConfigType();
+
+ String configName = createLaunchConfigurationName(bin.getElementName(), bin.getCProject());
+
+ ILaunchConfigurationWorkingCopy wc =
+ configType.newInstance(null, getLaunchManager().generateUniqueLaunchConfigurationNameFrom(configName));
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programName);
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, bin.getCProject().getElementName());
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
+ wc.setAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+ ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
+
+ // Let subclass set its own special defaults.
+ setDefaultForLaunchConfiguration(wc);
+
+ config = wc.doSave();
+ } catch (CoreException ce) {
+ if (! ce.getStatus().equals(Status.CANCEL_STATUS))
+ Activator.getErrorLogger().logError("Failed to create launch configuration", ce);
+ }
+ return config;
+ }
+
+ /**
+ * Check if an existing launch configuration can be used to launch the given
+ * new binary file.<br>
+ *
+ * Subclass can extend the implementation by adding more launch type
+ * specific checks.
+ *
+ * @param binary
+ * @param existingConfig
+ * @return
+ */
+ protected boolean canReuseLaunchConfiguration(IBinary binary, ILaunchConfiguration existingConfig) {
+ IPath programPath = null;
+ IProject project = null;
+ String projectName = null;
+ try {
+ programPath = AbstractCLaunchDelegate.getProgramPath(existingConfig);
+ project = ESboxCppLaunchUtils.getProject(existingConfig);
+ if (project != null)
+ projectName = project.getName();
+ } catch (CoreException e) {
+ return false;
+ }
+
+ if (programPath == null || projectName == null)
+ return false;
+
+ // Check program name (with path)
+ IPath name = binary.getResource().getProjectRelativePath();
+ if (name == null)
+ return false;
+
+ if (! programPath.equals(name))
+ return false;
+
+ // Check project name
+ IProject binProject = binary.getCProject().getProject();
+ if (binProject == null || ! projectName.equals(binProject.getName()))
+ return false;
+
+ // Check SDKTarget.
+ ISDKTarget binTarget = ESboxLaunchUtils.getSDKTarget(binProject);
+ if (binTarget == null) // not esbox project.
+ return false;
+
+ if (! LaunchConfigurationData.isLaunchConfigurationApplicable(existingConfig, binTarget))
+ return false;
+
+ return true;
+ }
+
+ /**
+ * Get the launch configuration type this shortcut supports.
+ *
+ * Note super class has this method but it's private. So this is not an override.
+ * @return ILaunchConfigurationType
+ */
+ abstract protected ILaunchConfigurationType getCLaunchConfigType();
+
+ abstract protected void setDefaultForLaunchConfiguration(ILaunchConfigurationWorkingCopy config) throws CoreException;
+
+ abstract protected String createLaunchConfigurationName(String binFileName, ICProject project) throws CoreException;
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/BaseCDTGDBParameterAccessor.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/BaseCDTGDBParameterAccessor.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/BaseCDTGDBParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jun 19, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch;
+
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
+import org.eclipse.cdt.utils.spawner.ProcessFactory;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.internal.cpp.launch.Activator;
+import org.maemo.esbox.launch.*;
+import org.maemo.esbox.launch.core.AbstractLaunchParameterAccessor;
+import org.maemo.esbox.launch.core.IGDBParameterAccessor;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.*;
+
+/**
+ * Base implementation of {@link IGDBParameterAccessor} for regular CDT GDB launch that
+ * involves no Scratchbox. Note we put modifier "CDT" in the name because the
+ * underlying launch configuration has data from some CDT specific preference tabs, which
+ * are different from, say, DSF-based GDB launch configuration.<br>
+ *
+ * @author LWang
+ */
+public class BaseCDTGDBParameterAccessor
+ extends AbstractLaunchParameterAccessor
+ implements IGDBParameterAccessor {
+
+ /*
+ * Command line to start GDB.
+ */
+ protected List<String> fGdbCommandLine;
+
+ /*
+ * Path of the main executable to debug.
+ */
+ protected IPath fProgramPathInHostFS;
+
+ protected Boolean fAutoLoadSharedLib;
+
+ protected IPath fWorkingDirectory;
+
+ protected String fGDBInitFile;
+
+ protected List<String> fSharedLibPaths;
+
+ protected String[] fProgramArguments;
+
+
+ public BaseCDTGDBParameterAccessor(ILaunchConfiguration lc) {
+ super(lc);
+ }
+
+ public IProject getProject() {
+ try {
+ return ESboxCppLaunchUtils.getProject(getLaunchConfiguration());
+ } catch (CoreException e) {
+ return null;
+ }
+ }
+
+ public boolean autoLoadSharedLibrary() {
+ if (fAutoLoadSharedLib == null) {
+ boolean autolib = false; // default.
+ try {
+ autolib = getLaunchConfiguration().getAttribute(
+ IGDBServerMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB,
+ IGDBServerMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT);
+ } catch (CoreException e) {
+ }
+
+ fAutoLoadSharedLib = autolib;
+ }
+
+ return fAutoLoadSharedLib.booleanValue();
+ }
+
+ protected IPath getGDBPath() {
+ IPath retVal = new Path(IGDBServerMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
+ try {
+ retVal = new Path(getLaunchConfiguration().getAttribute(
+ IGDBServerMILaunchConfigurationConstants.ATTR_DEBUG_NAME,
+ IGDBServerMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT));
+ } catch (CoreException e) {
+ }
+ return retVal;
+ }
+
+ @Override
+ protected String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+ public List<String> getGDBCommandLine() {
+ if (fGdbCommandLine == null)
+ {
+ fGdbCommandLine = new ArrayList<String>();
+
+ // The goal here is to keep options to an absolute minimum.
+ // All configuration should be done in the launch sequence
+ // to allow for easy overriding.
+ fGdbCommandLine.add(getGDBPath().toOSString());
+ fGdbCommandLine.add("--interpreter"); //$NON-NLS-1$
+ fGdbCommandLine.add("mi"); //$NON-NLS-1$
+ // Don't read the gdbinit file here. It is read explicitly in
+ // the LaunchSequence to make it easier to customize.
+ fGdbCommandLine.add("--nx"); //$NON-NLS-1$
+ }
+
+ return fGdbCommandLine;
+ }
+
+ public String getGDBInitFile() throws CoreException {
+ if (fGDBInitFile == null) {
+ fGDBInitFile = getLaunchConfiguration().getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_GDB_INIT, ""); //$NON-NLS-1$
+ }
+
+ return fGDBInitFile;
+ }
+
+ public IPath getWorkingDirectoryFromUser() throws CoreException {
+ IPath path = null;
+ String location = getLaunchConfiguration().getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
+ (String)null);
+
+ if (location != null) {
+ String expandedLocation = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(location);
+ if (expandedLocation.length() > 0) {
+ path = new Path(expandedLocation);
+ }
+ }
+
+ return path;
+ }
+
+ public IPath getDefaultWorkingDirectory() throws CoreException {
+ // With CDT GDB implementation,
+ // default working dir is the project if this config has a project
+ IPath path = null;
+ ICProject cp = ESboxCppLaunchUtils.getCProject(getLaunchConfiguration());
+ if (cp != null) {
+ IProject p = cp.getProject();
+ path = p.getLocation();
+ }
+ else {
+ String msg = MessageFormat.format(
+ "Cannot determine the default working directory for the launch"+
+ " configuration ''{0}'' as it has no project associated.", getLaunchConfiguration().getName());
+ throw newCoreException(msg);
+ }
+
+ return path;
+ }
+
+ public IPath getWorkingDirectory() throws CoreException {
+ if (fWorkingDirectory == null) {
+
+ IPath path = getWorkingDirectoryFromUser();
+
+ if (path == null) {
+ path = getDefaultWorkingDirectory();
+ }
+ assert(path != null);
+
+ // some validation, which should have been done by preference tab code.
+ //
+ if (path.isAbsolute()) {
+ File dir = new File(path.toOSString());
+ if (! dir.isDirectory()) {
+ throw newCoreException(
+ MessageFormat.format("The working directory ''{0}'' is not a directory.", path.toPortableString()));
+ }
+ } else {
+ IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
+ if (res instanceof IContainer && res.exists()) {
+ path = res.getLocation();
+ }
+
+ // Relative but not found in workspace.
+ throw newCoreException(
+ MessageFormat.format("The working directory ''{0}'' is not found.", path.toPortableString()));
+ }
+
+ fWorkingDirectory = path;
+ }
+
+ return fWorkingDirectory;
+ }
+
+ public String[] getProgramArguments() throws CoreException {
+ if (fProgramArguments == null) {
+ fProgramArguments = ESboxCppLaunchUtils.getProgramArgumentsArray(getLaunchConfiguration());
+ }
+
+ return fProgramArguments;
+ }
+
+ public IPath getProgramPathInHostFileSystem() throws CoreException {
+ if (fProgramPathInHostFS == null) {
+ String pathStr = ESboxLaunchUtils.getProgramFullPath(getLaunchConfiguration());
+ IPath programPath = null;
+ if (pathStr != null && pathStr.length() > 0)
+ programPath = new Path(pathStr);
+ else {
+ String msg = MessageFormat.format(
+ "No main program is specified for the launch configuration ''{0}''.",
+ getLaunchConfiguration().getName());
+ throw newCoreException(msg);
+ }
+
+ if (!programPath.isAbsolute()) {
+ IFile wsProgramPath = getProject().getFile(programPath);
+ programPath = wsProgramPath.getLocation();
+ }
+
+ if (!programPath.toFile().exists()) {
+ String msg = MessageFormat.format(
+ "The program file ''{0}'' does not exist.", pathStr);
+ throw newCoreException(msg);
+ }
+
+ fProgramPathInHostFS = programPath;
+ }
+
+ return fProgramPathInHostFS;
+ }
+
+ public IPath getProgramPathInBuildtimeFileSystem() throws CoreException {
+ return getProgramPathInHostFileSystem();
+ }
+
+ public IPath getProgramPathInRuntimeFileSystem() throws CoreException {
+ return getProgramPathInBuildtimeFileSystem();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<String> getSharedLibraryPaths() throws CoreException {
+ if (fSharedLibPaths == null) {
+ fSharedLibPaths = getLaunchConfiguration().getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH,
+ new ArrayList<String>(0));
+ }
+
+ return fSharedLibPaths;
+ }
+
+ public Process launchGDB() throws CoreException {
+ List<String> gdbCmdLine = getGDBCommandLine();
+ String[] commandLine = gdbCmdLine.toArray(new String[gdbCmdLine.size()]);
+
+ Process proc = null;
+ try {
+ proc = ProcessFactory.getFactory().exec(commandLine);
+ } catch (IOException e) {
+ throw new CoreException(new Status(IStatus.ERROR, getPluginID(), -1,
+ "Error in launching gdb command: " + gdbCmdLine.toString(),
+ e));
+ }
+
+ return proc;
+ }
+
+ public Properties getEnvironmentAsProperty() throws CoreException {
+ return ESboxCppLaunchUtils.getEnvironmentAsProperty(getLaunchConfiguration());
+ }
+
+ @Override
+ protected String getProjectName(ILaunchConfiguration launchConfiguration) throws CoreException {
+ // Note the CDT specific attribute ID.
+ return getLaunchConfiguration().getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
+ }
+
+ public boolean debuggerConnectionIsTCP() throws CoreException {
+ try {
+ return getLaunchConfiguration().getAttribute(
+ IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP,
+ true);
+ }
+ catch (Exception e) {
+ throw newCoreException("Failed to get target connection type.");
+ }
+ }
+
+ public String getTargetIPAddress() throws CoreException {
+ try {
+ return getLaunchConfiguration().getAttribute(
+ IGDBServerMILaunchConfigurationConstants.ATTR_HOST,
+ IESboxCDTLaunchConfigurationConstants.DEFAULT_TARGET_NAME );
+ }
+ catch (Exception e) {
+ throw newCoreException("Failed to get target IP address.");
+ }
+ }
+
+ public int getTargetIPPort() throws CoreException {
+ try {
+ return Integer.parseInt(getLaunchConfiguration().getAttribute(
+ IGDBServerMILaunchConfigurationConstants.ATTR_PORT,
+ IESboxCDTLaunchConfigurationConstants.DEFAULT_GDBSERVER_PORT_NUMBER));
+ }
+ catch (Exception e) {
+ throw newCoreException("Failed to get target TCP/IP port number.");
+ }
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPLocalGDBParameterAccessor.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPLocalGDBParameterAccessor.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPLocalGDBParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,309 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 28, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.launch;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.cpp.launch.Activator;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.core.*;
+
+import java.text.MessageFormat;
+import java.util.*;
+
+/**
+ * Launch parameter accessor for local launch of an ESbox CPP project.
+ * This will work for both CDT GDB and DSF GDB debuggers. So instead of subclassing
+ * base CDT GDBParameterAccessor or DSF one, we just take one of them as
+ * a parameter.
+ *
+ * @author LWang
+ *
+ */
+public class CPPLocalGDBParameterAccessor
+ extends AbstractLaunchParameterAccessor
+ implements IGDBParameterAccessor, IESboxLaunchParameterAccessor {
+
+
+ private IGDBParameterAccessor fOriginal;
+
+ private ISDKTarget fSDKTarget = null;
+
+ private List<String> fSboxGdbCommandLine;
+
+ private IPath fSboxProgramPath;
+
+ private IPath fSboxWorkingDirectory;
+
+ private String fSboxGDBInitFile;
+
+ private List<String> fSboxSharedLibPaths;
+
+ /**
+ * The "original" is either base CDT GDB parameter accessor or base
+ * DSF GDB parameter accessor.
+ *
+ * @param configuration
+ * @param exePath
+ * @throws CoreException - if the project of the configuration is not ESbox project.
+ */
+ public CPPLocalGDBParameterAccessor(ILaunchConfiguration configuration,
+ IGDBParameterAccessor original) throws CoreException {
+ super(configuration);
+
+ fOriginal = original;
+
+ fSDKTarget = ESboxLaunchUtils.getSDKTarget(configuration);
+
+ if (fSDKTarget == null) {
+ String msg = MessageFormat.format(
+ "The project for launch configuration ''{0}'' is not an ESBox project.",
+ configuration.getName());
+ throw newCoreException(msg);
+ }
+ }
+
+ /**
+ * This gives client a way to access original parameters from launch configuration.
+ * @return
+ */
+ public IGDBParameterAccessor getOriginal() {
+ return fOriginal;
+ }
+
+ public List<String> getGDBCommandLine() {
+ if (fSboxGdbCommandLine == null) {
+ List<String> cmdLine = getOriginal().getGDBCommandLine();
+
+ // covert the command line so that gdb will be launched in Scratchbox.
+ //
+ if (fSDKTarget != null) {
+ IProcessLauncherFactory factory = fSDKTarget.getProcessLauncherFactory();
+ IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(factory, null, cmdLine);
+ cmdLine = launcher.getLaunchCommandArguments();
+ }
+
+ fSboxGdbCommandLine = cmdLine;
+ }
+
+ return fSboxGdbCommandLine;
+ }
+
+ public String getGDBInitFile() throws CoreException {
+ // init file, if any, needs be accessible from scratchbox.
+ if (fSboxGDBInitFile == null) {
+ String initFile = getOriginal().getGDBInitFile();
+ if (initFile != null && initFile.length() > 0)
+ try {
+ fSboxGDBInitFile = convertToSboxPath(initFile);
+ } catch (ESboxException e) {
+ String msg = MessageFormat.format(
+ "The gdb init file ''{0}'' is not visiable in scratchbox.",
+ initFile);
+ throw newCoreException(msg, e);
+ }
+ }
+
+ return fSboxGDBInitFile;
+ }
+
+ public IPath getDefaultWorkingDirectory() throws CoreException {
+ // For ESbox local launch, the default WD is the path of the exe file.
+ //
+ // Note the path returned should be on host file system.
+ //
+ IPath progPath = null;
+ try {
+ progPath = getProgramPathInHostFileSystem();
+ }
+ catch (CoreException e) {
+ String msg = MessageFormat.format(
+ "Cannot determine the default working directory for the launch"+
+ " configuration ''{0}''.",
+ getLaunchConfiguration().getName());
+ throw newCoreException(msg, e);
+ }
+
+ return progPath.removeLastSegments(1);
+ }
+
+ public IPath getWorkingDirectory() throws CoreException {
+ if (fSboxWorkingDirectory == null) {
+ IPath path = getWorkingDirectoryFromUser();
+
+ if (path == null) {
+ path = getDefaultWorkingDirectory();
+ }
+ assert(path != null);
+
+ try {
+ fSboxWorkingDirectory = convertToSboxPath(path);
+ } catch (ESboxException e) {
+ String msg = MessageFormat.format(
+ "The working directory ''{0}'' is not visible in scratchbox.",
+ path.toPortableString());
+ throw newCoreException(msg);
+ }
+ }
+
+ return fSboxWorkingDirectory;
+ }
+
+ public IPath getProgramPathInHostFileSystem() throws CoreException {
+ return getOriginal().getProgramPathInHostFileSystem();
+ }
+
+ public IPath getProgramPathInBuildtimeFileSystem() throws CoreException {
+ if (fSboxProgramPath == null) {
+ IPath hostProgram = getProgramPathInHostFileSystem();
+ try {
+ fSboxProgramPath = convertToSboxPath(hostProgram);
+ } catch (ESboxException e) {
+ String msg = MessageFormat.format(
+ "The program ''{0}'' is not visible in scratchbox.",
+ hostProgram.toPortableString());
+ throw newCoreException(msg, e);
+ }
+ }
+
+ return fSboxProgramPath;
+ }
+
+ public IPath getProgramPathInRuntimeFileSystem() throws CoreException {
+ // same as build-time one.
+ return getProgramPathInBuildtimeFileSystem();
+ }
+
+ public List<String> getSharedLibraryPaths() throws CoreException {
+ if (fSboxSharedLibPaths == null) {
+ List<String> basePaths = getOriginal().getSharedLibraryPaths();
+
+ fSboxSharedLibPaths = new ArrayList<String>(basePaths.size());
+
+ for (String p : basePaths) {
+ try {
+ fSboxSharedLibPaths.add(convertToSboxPath(p));
+ } catch (ESboxException e) {
+ String msg = MessageFormat.format(
+ "The shared library path ''{0}'' is not visible in scratchbox.",
+ p);
+ throw newCoreException(msg, e);
+ }
+ }
+ }
+
+ return fSboxSharedLibPaths;
+ }
+
+ /**
+ * Convert a path in host file system to a path in Scratchbox.
+ *
+ * @param p
+ * @return
+ * @throws ESboxException
+ */
+ protected IPath convertToSboxPath(IPath p) throws ESboxException {
+ if (fSDKTarget != null && p != null && p.isAbsolute()) {
+ p = fSDKTarget.convertHostToTargetPath(p);
+ }
+
+ return p;
+ }
+
+ protected String convertToSboxPath(String p) throws ESboxException {
+ if (p == null)
+ return p;
+
+ IPath pa = new Path(p);
+
+ pa = convertToSboxPath(pa);
+
+ return pa.toPortableString();
+ }
+
+ public Process launchGDB() throws CoreException {
+ List<String> cmdLine = getOriginal().getGDBCommandLine();
+
+ String message = null;
+
+ // Launch the base GDB command line in Scratchbox.
+ //
+ if (fSDKTarget != null) {
+ IProcessLauncherFactory factory = fSDKTarget.getProcessLauncherFactory();
+ IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(factory, null, cmdLine);
+ try {
+ return launcher.createProcess();
+ } catch (ESboxException e) {
+ message = "Error launching GDB in scratchbox: " + e.getLocalizedMessage();
+ throw newCoreException(message, e);
+ }
+ }
+ else {
+ message = "The project is not a Scratchbox project";
+ throw newCoreException(message);
+ }
+ }
+
+ public ISDKTarget getSDKTarget() {
+ return fSDKTarget;
+ }
+
+ public IMachine getMachine() {
+ return fSDKTarget.getSDK().getMachine();
+ }
+
+ @Override
+ protected String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+ public boolean autoLoadSharedLibrary() throws CoreException {
+ return getOriginal().autoLoadSharedLibrary();
+ }
+
+ public Properties getEnvironmentAsProperty() throws CoreException {
+ return getOriginal().getEnvironmentAsProperty();
+ }
+
+ public String[] getProgramArguments() throws CoreException {
+ return getOriginal().getProgramArguments();
+ }
+
+ public IPath getWorkingDirectoryFromUser() throws CoreException {
+ return getOriginal().getWorkingDirectoryFromUser();
+ }
+
+ @Override
+ protected String getProjectName(ILaunchConfiguration launchConfiguration)
+ throws CoreException {
+ // Note the CDT specific attribute ID.
+ return getLaunchConfiguration().getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
+ }
+
+ public boolean debuggerConnectionIsTCP() throws CoreException {
+ return fOriginal.debuggerConnectionIsTCP();
+ }
+
+ public String getTargetIPAddress() throws CoreException {
+ return fOriginal.getTargetIPAddress();
+ }
+
+ public int getTargetIPPort() throws CoreException {
+ return fOriginal.getTargetIPPort();
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPLocalLaunchProxy.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPLocalLaunchProxy.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPLocalLaunchProxy.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. July 24, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.cpp.launch.Activator;
+import org.maemo.esbox.launch.adapters.IGdbServerSupportAdapter;
+import org.maemo.esbox.launch.core.*;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+/**
+ * launch proxy for local launch of CPP program. The proxy works for both DSF
+ * and CDI based GDB launch.
+ *
+ * @author LWang.
+ */
+public class CPPLocalLaunchProxy extends AbstractLocalLaunchProxy {
+
+ protected CPPLocalGDBParameterAccessor fLPA = null;
+
+ /**
+ * The "original" is the accessor to get original data from the launch configuration,
+ * which is either a CDT GDB launch configuration or DSF GDB launch configuration. The only
+ * difference between those two are some UI option IDs.
+ *
+ * @param config
+ * @param original
+ * @throws CoreException - e.g. the underlying project is not ESbox project.
+ */
+ public CPPLocalLaunchProxy(ILaunchConfiguration config,
+ IGDBParameterAccessor original) throws CoreException {
+ super(config);
+
+ fLPA = new CPPLocalGDBParameterAccessor(config, original);
+ }
+
+ public String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+ public ILaunchParameterAccessor getLaunchParameterAccessor() {
+ return fLPA;
+ }
+
+ /**
+ * Start GDB server for local debug of ESbox project.
+ * This is to launch GDB server on the main program of the underlying launch configuration.
+ *
+ * @param monitor
+ * @return
+ * @throws CoreException
+ */
+ public Process startGDBServer(IProgressMonitor monitor) throws CoreException {
+
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+ String errMsg;
+
+ String commandGdbServer = getGDBServerCommandPattern(
+ fLPA.getSDKTarget());
+
+ if (commandGdbServer.length() == 0) {
+ errMsg = "Failed to get GDBServer command pattern from Scratchbox property file.";
+ errorLogger.logError(errMsg, null);
+ throw newCoreException(errMsg);
+ }
+ // populate gdbserver command
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("IP", fLPA.getTargetIPAddress());
+ substitutor.define("PORT", "" + fLPA.getTargetIPPort());
+
+ commandGdbServer = substitutor.substitute(commandGdbServer);
+
+ // Get the parameters for launching the debugged program.
+ ProcessRunnerParameters info = createProgramLauncherParameters();
+
+ // Then just prepend the gdbserver command to the command line
+ List<String> cmdLine = info.getCommandLine();
+ cmdLine.addAll(0, CommandLineArguments.createFromCommandLine(commandGdbServer));
+
+ info.setSendToConsole(true);
+ info.setConsoleName("Launch");
+
+ Process process;
+ try {
+ process = doRun(info);
+ } catch (CoreException e1) {
+ throw newCoreException("Failed to launch gdbserver.\n" + CommandLineArguments.toCommandLine(info.getCommandLine()), e1);
+ }
+
+ /*
+ * The command to start gdbserver won't finish until gdbserver quits (debug session ends).
+ * Here we wait some time and check to make sure it hasn't aborted abnormally.
+ */
+ try {
+ Thread.sleep(2000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ int exitCode = 255;
+
+ try {
+ exitCode = process.exitValue();
+ } catch (IllegalThreadStateException e) {
+ // not terminated yet, meaning it's running fine.
+ exitCode = 0;
+ }
+
+ if (exitCode != 0)
+ {
+ errMsg = MessageFormat.format(
+ "Starting gdbserver failed with exit code {0}.\nCommand line: {1}",
+ exitCode,
+ CommandLineArguments.toCommandLine(info.getCommandLine())
+ );
+ errorLogger.logError(errMsg, null);
+ throw newCoreException(errMsg, null);
+ }
+
+ return process;
+ }
+
+ /**
+ * Get the command pattern to launch gdbserver with the given executable
+ * @param sdkTarget
+ * @return String in the form <gdbserver> ${IP}:${PORT} (where IP or PORT are optional)
+ */
+ protected String getGDBServerCommandPattern(ISDKTarget sdkTarget) {
+ IGdbServerSupportAdapter gdbServerSupportAdapter = (IGdbServerSupportAdapter) sdkTarget.getAdapter(IGdbServerSupportAdapter.class);
+ if (gdbServerSupportAdapter == null) {
+ return "gdbserver ${IP}:${PORT}";
+ }
+ return gdbServerSupportAdapter.getGDBServerCommandPattern();
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPRemoteGDBParameterAccessor.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPRemoteGDBParameterAccessor.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPRemoteGDBParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 28, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.launch;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.internal.cpp.launch.Activator;
+import org.maemo.esbox.launch.*;
+import org.maemo.esbox.launch.core.IGDBParameterAccessor;
+import org.maemo.esbox.launch.core.IRemoteLaunchParameterAccessor;
+
+import java.text.MessageFormat;
+
+/**
+ * Launch parameter accessor for ESbox project remote launch.
+ * Note this will work for both CDT and DSF GDB launch.
+ *
+ * @author LWang
+ *
+ */
+public class CPPRemoteGDBParameterAccessor
+ extends CPPLocalGDBParameterAccessor
+ implements IRemoteLaunchParameterAccessor {
+
+ private ILaunchProtocol fProtocol = null;
+
+ private IPath fRemoteProgramPath;
+
+ private IPath fRemoteWorkingDir;
+
+ /**
+ * @param lc
+ * @throws CoreException - if the given launch configuration has no remote connection specified.
+ */
+ public CPPRemoteGDBParameterAccessor(ILaunchConfiguration lc,
+ IGDBParameterAccessor original) throws CoreException {
+ super(lc, original);
+
+ fProtocol = LaunchProtocolFactory.getInstance().getLaunchProtocol(lc);
+ }
+
+ public ILaunchProtocol getLaunchProtocol() {
+ return fProtocol;
+ }
+
+ // Get program path on remote target.
+ @Override
+ public IPath getProgramPathInRuntimeFileSystem() throws CoreException {
+ if (fRemoteProgramPath == null) {
+ // Get exe host path first
+ IPath exeHostPath = getProgramPathInHostFileSystem();
+
+ IPath devPath = fProtocol.getFileLocationOnTarget(exeHostPath);
+ if (devPath == null) {
+ String msg = MessageFormat.format(
+ "Cannot determine location of the program ''{0}'' on the target device.\n" +
+ "Please ensure it is downloaded to the target via the Download pane.",
+ exeHostPath);
+ Activator.getErrorLogger().logError(msg, null);
+ throw newCoreException(msg);
+ }
+
+ fRemoteProgramPath = devPath;
+ }
+
+ return fRemoteProgramPath;
+ }
+
+
+ @Override
+ public IPath getDefaultWorkingDirectory() throws CoreException {
+ // For remote launch, the default WD is path of the exe on device.
+ //
+ IPath devPath = null;
+ try {
+ devPath = getProgramPathInRuntimeFileSystem();
+ }
+ catch (CoreException e) {
+ String msg = "Cannot determine the default working directory for the program.\n"+
+ "Reason: " + e.getLocalizedMessage();
+ Activator.getErrorLogger().logError(msg, null);
+ throw newCoreException(msg);
+ }
+ assert(devPath != null);
+
+ return devPath.removeLastSegments(1);
+ }
+
+ // Get working dir in remote device/machine.
+ @Override
+ public IPath getWorkingDirectory() throws CoreException {
+ if (fRemoteWorkingDir == null) {
+
+ IPath path = getWorkingDirectoryFromUser();
+
+ if (path == null) {
+ // This will throw exception if default cannot be determined.
+ path = getDefaultWorkingDirectory();
+ assert(path != null);
+ }
+
+ // user specifies a path or we have default.
+ // Now we assume it's a path on remote device/machine. So no much validation can we do until
+ // we have access to the remote file system.
+ // Now we only require the path be absolute.
+ if (! path.isAbsolute()) {
+ String msg = MessageFormat.format(
+ "The working directory ''{0}'' on remote device is not absolute.",
+ path.toPortableString());
+
+ throw newCoreException(msg);
+ }
+
+ fRemoteWorkingDir = path;
+ }
+
+ return fRemoteWorkingDir;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.CPPLocalGDBParameterAccessor#getMachine()
+ */
+ @Override
+ public IMachine getMachine() {
+ return fProtocol.getDeviceMachine();
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPRemoteLaunchProxy.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPRemoteLaunchProxy.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CPPRemoteLaunchProxy.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 29, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.cpp.launch.Activator;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.core.*;
+
+import java.io.*;
+import java.util.List;
+
+/**
+ * launch proxy for remote launch of CPP program. The proxy works for both DSF
+ * and CDI based GDB launch.
+ *
+ * @author LWang.
+ */
+public class CPPRemoteLaunchProxy extends AbstractRemoteLaunchProxy {
+
+ private CPPRemoteGDBParameterAccessor fLPA = null;
+
+ /**
+ * The "original" is the accessor to get original data from the launch configuration,
+ * which is either a CDT GDB launch configuration or DSF GDB launch configuration. The only
+ * difference between those two are some UI option IDs.
+ *
+ * @param launchConfiguration
+ * @throws CoreException
+ */
+ public CPPRemoteLaunchProxy(ILaunchConfiguration launchConfiguration,
+ IGDBParameterAccessor original) throws CoreException {
+ super(launchConfiguration);
+
+ fLPA = new CPPRemoteGDBParameterAccessor(launchConfiguration, original);
+ }
+
+ public ILaunchParameterAccessor getLaunchParameterAccessor() {
+ return fLPA;
+ }
+
+ public String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+ public Process startGDBServer(IProgressMonitor monitor) throws CoreException {
+
+ ISDKTarget sdkTarget = fLPA.getSDKTarget();
+
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+
+ String errMsg = null;
+
+ String commandGdbServer = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SBOX_GDB_REMOTE);
+
+ if (commandGdbServer.length() == 0) {
+ errMsg = "Configuration error: empty SBOX_GDB_REMOTE pattern";
+ errorLogger.logError(errMsg, null);
+ throw newCoreException(errMsg);
+ }
+
+ // populate gdbserver command
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("IP", fLPA.getTargetIPAddress());
+ substitutor.define("PORT", "" + fLPA.getTargetIPPort());
+
+ commandGdbServer = substitutor.substitute(commandGdbServer);
+
+ // Get the parameters for launching the debugged program.
+ ProcessLauncherParameters info = createProgramLauncherParameters();
+
+ // Then just prepend the gdbserver command to the command line
+ List<String> cmdLine = info.getCommandLine();
+ cmdLine.addAll(0, CommandLineArguments.createFromCommandLine(commandGdbServer));
+
+ String finalCommandLine = CommandLineArguments.toCommandLine(info.getCommandLine());
+
+ // Log to console
+ MessageConsole debuggerConsole = ESboxLaunchUtils.getLaunchLogConsole(getLaunchConfiguration());
+ final MessageConsoleStream consoleStream = debuggerConsole.newMessageStream();
+
+ consoleStream.println("Start gdbserver on device: " + finalCommandLine);
+
+ final Process process;
+
+ try {
+ process = doRun(info);
+ } catch (CoreException e1) {
+ throw newCoreException("Failed to launch gdbserver.\n" + finalCommandLine, e1);
+ }
+
+ /*
+ * The command to start gdbserver won't finish until gdbserver quits (debug session ends).
+ * Here we wait until it launches successfully or fails.
+ */
+ final String[] errorMessages = {""};
+
+ final boolean[] succeed = new boolean[1];
+ succeed[0] = false;
+
+ Thread syncStartup = new Thread("Start gdbserver") { //$NON-NLS-1$
+ public void run() {
+ try {
+ String line;
+ InputStream stream = process.getErrorStream(); // gdbserver oupput is on Error stream !
+ Reader r = new InputStreamReader(stream);
+ BufferedReader reader = new BufferedReader(r);
+
+ while ((line = reader.readLine()) != null) {
+
+ consoleStream.println(line);
+
+ line = line.trim();
+ errorMessages[0] += line + '\n';
+
+ // Error case#1: message from gdbserver:
+ // "Cannot exec ./maemopad: No such file or directory.
+ // Child exited with retcode = 7f"
+ if (line.contains("Child exit")) //$NON-NLS-1$
+ break;
+
+ // Error case #2:
+ // Can't bind address: Address already in use.
+ // Exiting
+ if (line.contains("Can't bind")) //$NON-NLS-1$
+ {
+ errorMessages[0] += "* It's usually because another gdbserver instance is running\n" +
+ " and listening on the same port number.";
+ break;
+ }
+
+ // If we get output line containing this, gdbserver is started successfully.
+ if (line.contains("Listening on port")) { //$NON-NLS-1$
+ succeed[0] = true;
+ break;
+ }
+ }
+ } catch (Exception e) {
+ // Do nothing, ignore the errors
+ }
+ }
+ };
+ syncStartup.start();
+
+ int timepass = 0;
+ int launchTimeout = 16000; // in milliseconds
+
+ monitor.beginTask("", 17);
+
+ for (timepass = 0; timepass < launchTimeout; timepass += 1000) {
+ if (syncStartup.isAlive()) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ monitor.worked(1);
+
+ if (monitor.isCanceled())
+ throw new CoreException(Status.CANCEL_STATUS);
+ } else {
+ break;
+ }
+ }
+
+ monitor.done();
+
+ if (syncStartup.isAlive()) {
+ // Timeout waiting for expected output text from gdbserver.
+ try {
+ syncStartup.interrupt();
+ syncStartup.join(1000);
+
+ errorMessages[0] = "Time out starting gdbserver. \n" +
+ "It's usually because the device is not connected or " +
+ "the connection (network, SSH, etc.) is not set up well.";
+ syncStartup.interrupt();
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+
+ if (! succeed[0])
+ {
+ process.destroy(); // kill it thus no lingering gdbserver exits.
+
+ errMsg = "Command Failed:"+ finalCommandLine + "\n" + errorMessages[0];
+ throw newCoreException(errMsg, // this will appear in the detail pane of error dialog.
+ new Exception("Failed to start gdbserver on device.")); // this message will appear in main pane
+ }
+
+ return process;
+ }
+
+ /**
+ * XXX: This is a hack to handle bug 7152, where gdbserver is not killed as expected
+ * over SSH.
+ */
+ public void stopGDBServer(String executable) {
+ try {
+ ProcessLauncherParameters parameters = new ProcessLauncherParameters();
+ parameters.getCommandLine().addAll(CommandLineArguments.createFromArray(
+ new String[] { "killall", "-9", "gdbserver", executable }));
+ doRun(parameters);
+ } catch (CoreException e) {
+ // ignore
+ }
+
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CppLaunchConfigurationData.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CppLaunchConfigurationData.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/CppLaunchConfigurationData.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar 3, 2008
+ * Raul Herbster (UFCG)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.mi.core.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.*;
+import org.maemo.esbox.core.process.EnvironmentProperties;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.cpp.launch.Activator;
+import org.maemo.esbox.launch.*;
+
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Encapsulation of operations on launch configuration data, especially
+ * those specific to ESbox debugger.
+ *
+ * @see ESboxLaunchUtils is similar but more focused on general data.
+ *
+ * XXX: this knowledge should be moved to the maemosdk side and/or placed in adapters;
+ * it's not generic C/C++ knowledge
+ * @author LWang.
+ *
+ */
+public class CppLaunchConfigurationData implements IESboxCDTLaunchConfigurationConstants {
+
+ static public void setDefaults(ILaunchConfigurationWorkingCopy configuration, String configTypeID) {
+
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(configuration);
+ if (sdkTarget == null) // not esbox project, bail.
+ return;
+
+ //boolean isSBox2 = sdkTarget instanceof IScratchbox2SDKTarget;
+
+ // Currently we only support either ARM or x86 target.
+ //boolean targetingARM = sdkTarget.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL);
+
+ // determine default from the platforms known to use the script
+ boolean runStandaloneDefault = ESboxLaunchUtils.getRunStandaloneDefault(sdkTarget);
+
+ //-------- Common to all (maemo local / remote, Valgrind, OProfile, ...---------
+
+ // Remember the SDK and SDKTarget in the configuration.
+ //
+ configuration.setAttribute(ATTR_SDK_NAME, LaunchConfigurationData.getUniqueSDKName(sdkTarget.getSDK()));
+ configuration.setAttribute(ATTR_SDK_TARGET_NAME, sdkTarget.getName());
+
+ //-------- Common defaults ----------------
+ //
+ if (configTypeID.equals(CONFIG_TYPE_MAEMOLOCAL) ||
+ configTypeID.equals(CONFIG_TYPE_MAEMOLOCAL_DSF) ||
+ configTypeID.equals(CONFIG_TYPE_MAEMOREMOTE) ||
+ configTypeID.equals(CONFIG_TYPE_MAEMOREMOTE_DSF)) {
+
+ // add default source locator for program built in Scratchbox.
+ //
+ try {
+ ESboxCppLaunchUtils.addSboxDefaultSourceMapping(configuration);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError(
+ "Failed to add default Scratchbox source mapping in launch config: " + configuration.getName(), e);
+ }
+
+ // Turn this off so that GDB debugging (esp. stepping) won't be interrupted by the
+ // shared lib load events. E.g. with this on, stepping often ends up in weird
+ // status (esp. in x86 emulation).
+ // TODO: look at handling of the those events later.
+ // .................. LWang, 02/19/08
+ configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false);
+
+ /* this seems to work now -- revalidate
+ // TMP_HACK: we need ARM gdb but "sb2 -m maemo gdb" launches x86 gdb.
+ // TODO: Revisit after we have better solution from sbox2.
+ //
+ if (isSBox2 && targetingARM)
+ {
+ IPath rootstrapPath = ((IScratchboxSDKTarget) sdkTarget).getRootstrapPath();
+ if (rootstrapPath != null) {
+ IPath gdbPath = rootstrapPath.append("/usr/bin/gdb");
+ if (gdbPath.toFile().exists()) {
+ configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbPath.toPortableString());
+ }
+ }
+ }
+ */
+ }
+
+ Properties defaultEnv = sdkTarget.getProcessLauncherFactory().getStandardEnvironment();
+
+ //---------- Maemo Local debug specific --------------------------------
+ //
+ if (configTypeID.equals(CONFIG_TYPE_MAEMOLOCAL) ||
+ configTypeID.equals(CONFIG_TYPE_MAEMOLOCAL_DSF)) {
+
+ if (configTypeID.equals(CONFIG_TYPE_MAEMOLOCAL)) { // for CDI debugger only
+ // Default debugger is "ESbox gdbserver Local Debugger", which
+ // applies to both arm and x86 application debug.
+ configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID,
+ DEBUGGER_ID_GDBSERVERLOCAL);
+
+ configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY,
+ MIPlugin.getDefault().getCommandFactoryManager().getDefaultDescriptor(DEBUGGER_ID_GDBSERVERLOCAL).getIdentifier() );
+ }
+
+ configuration.setAttribute(ATTR_RUN_STANDALONE, runStandaloneDefault);
+
+ // default: debug over TCP/IP with GDB communicating with gdbserver in emulator.
+ //
+ configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, true );
+ configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, DEFAULT_LOCAL_HOST);
+ configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, DEFAULT_GDBSERVER_PORT_NUMBER);
+
+ // Replace native env.
+ configuration.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
+
+ // For applications using D-Bus, this env variable must be set.
+ //
+ /*
+ String[] envStrs = {
+ "DISPLAY=:2.0",
+ "DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/session_bus_socket"
+ };
+ Properties defaultEnv = EnvironmentProperties.createFromEnvp(envStrs);*/
+
+ configuration.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map<Object, Object>) defaultEnv);
+ }
+
+ //---------- Maemo Remote debug specific --------------------------------
+ //
+ else if (configTypeID.equals(CONFIG_TYPE_MAEMOREMOTE) ||
+ configTypeID.equals(CONFIG_TYPE_MAEMOREMOTE_DSF)) {
+
+ if (configTypeID.equals(CONFIG_TYPE_MAEMOREMOTE)) { // for CDI debugger only, not for DSF
+ configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID,
+ DEBUGGER_ID_GDBSERVERREMOTE);
+
+ configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY,
+ MIPlugin.getDefault().getCommandFactoryManager().getDefaultDescriptor(DEBUGGER_ID_GDBSERVERREMOTE).getIdentifier() );
+ }
+
+ configuration.setAttribute(ATTR_RUN_STANDALONE, runStandaloneDefault);
+
+ // default: debug over TCP/IP with GDB communicating with gdbserver.
+ //
+ configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, true );
+ configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, DEFAULT_TARGET_NAME);
+ configuration.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, DEFAULT_GDBSERVER_PORT_NUMBER);
+
+ // For our remote debug, don't pass any host env vars to device program/command.
+ // Instead, add those required by default.
+ configuration.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
+
+ //XXX: remove once we add IMachine for remote machines
+ String[] envStrs = {
+ "DISPLAY=:0.0",
+ "DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/session_bus_socket"
+ };
+ defaultEnv = EnvironmentProperties.createFromEnvp(envStrs);
+
+ configuration.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map<Object, Object>) defaultEnv);
+
+ // Set defaults for download method (i.e. launch protocols) related attributes.
+ LaunchProtocolFactory.getInstance().setDefaults(configuration);
+ }
+
+ //---------- OProfile specific --------------------------------
+ //
+ else if (configTypeID.equals(CONFIG_TYPE_OPROFILE)) {
+
+ configuration.setAttribute(ATTR_RUN_STANDALONE, runStandaloneDefault);
+
+ // For our remote debug, don't pass any host env vars to device program/command.
+ // Instead, add those required by default.
+ configuration.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
+
+ //XXX: remove once we add IMachine for remote machines
+ String[] envStrs = {
+ "DISPLAY=:0.0",
+ "DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/session_bus_socket"
+ };
+ defaultEnv = EnvironmentProperties.createFromEnvp(envStrs);
+
+ configuration.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map<Object, Object>) defaultEnv);
+
+ // Set defaults for download method (i.e. launch protocols) related attributes.
+ LaunchProtocolFactory.getInstance().setDefaults(configuration);
+ }
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ESboxAbstractLaunchDelegate.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ESboxAbstractLaunchDelegate.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ESboxAbstractLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Apr 9, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.ICDIDebugger2;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.ICDebugConfiguration;
+import org.eclipse.cdt.debug.core.cdi.CDIException;
+import org.eclipse.cdt.debug.core.cdi.ICDISession;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions;
+import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
+import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IProcess;
+import org.maemo.esbox.internal.cpp.launch.Activator;
+import org.maemo.esbox.launch.ESboxDebuggerStatus;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+
+/**
+ * Base launch delegate that handles common tasks for all ESbox launch delegates.<br>
+ *
+ * See reference implementation:
+ * org.eclipse.cdt.launch.internal.LocalCDILaunchDelegate
+ *
+ * @author LWang.
+ */
+public abstract class ESboxAbstractLaunchDelegate extends AbstractCLaunchDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.launch.AbstractCLaunchDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void launch( ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor ) throws CoreException {
+
+ ESboxLaunchUtils.logLaunchSessionStart(config);
+
+ if ( monitor == null ) {
+ monitor = new NullProgressMonitor();
+ }
+ if ( mode.equals( ILaunchManager.RUN_MODE ) ) {
+ runApplication( config, launch, monitor );
+ }
+ if ( mode.equals( ILaunchManager.DEBUG_MODE ) ) {
+ launchDebugger( config, launch, monitor );
+ }
+ }
+
+ /**
+ * Run (not debug) the application. <br>
+ *
+ * Subclass is required to implement this.
+ *
+ */
+ abstract protected void runApplication(ILaunchConfiguration config, ILaunch launch,
+ IProgressMonitor monitor) throws CoreException;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.launch.AbstractCLaunchDelegate#getPluginID()
+ */
+ @Override
+ protected String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+ protected ICDISession createCDISession(ILaunchConfiguration config,
+ ILaunch launch, ICDebugConfiguration debugConfig,
+ IProgressMonitor monitor) throws CoreException {
+
+ ICDIDebugger2 debugger = null;
+ try {
+ debugger = (ICDIDebugger2) debugConfig.createDebugger();
+ }
+ catch (ClassCastException e) {
+ }
+
+ if (debugger == null)
+ // This should not happen as our debuggers are all ICDIDebugger2.
+ throw new CoreException(new ESboxDebuggerStatus("Only ICDIDebugger2 debugger is supported !."));
+
+ IPath path = verifyProgramPath(config);
+ File exeFile = path != null ? path.toFile() : null;
+ return debugger.createSession(launch, exeFile, monitor);
+ }
+
+ private void launchDebugger( ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor ) throws CoreException {
+ monitor.beginTask( "Launching debugger", 10 ); //$NON-NLS-1$
+ if ( monitor.isCanceled() ) {
+ return;
+ }
+ try {
+ String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
+ if ( debugMode.equals( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN ) ) {
+ launchRegularDebugSession( config, launch, monitor );
+ }
+ if ( debugMode.equals( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH ) ) {
+ throw new CoreException(new ESboxDebuggerStatus("Attach debug is not supported."));
+ }
+ if ( debugMode.equals( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE ) ) {
+ throw new CoreException(new ESboxDebuggerStatus("Core file debug is not supported."));
+ }
+ }
+ finally {
+ monitor.done();
+ }
+ }
+
+ protected void launchRegularDebugSession( ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor ) throws CoreException {
+
+ ICDISession dsession = null;
+ try {
+ IPath exePath = verifyProgramPath( config );
+ ICProject project = verifyCProject( config );
+ IBinaryObject exeFile = null;
+ if ( exePath != null ) {
+ exeFile = verifyBinary( project, exePath );
+ }
+
+ ICDebugConfiguration debugConfig = getDebugConfig( config );
+
+ setDefaultSourceLocator( launch, config );
+
+ monitor.subTask("Initiating debug session");
+ dsession = createCDISession( config, launch,
+ debugConfig, new SubProgressMonitor(monitor, 6));
+
+ monitor.worked( 6 );
+
+ setDebugRuntimeOptions( config, dsession );
+ monitor.worked( 1 );
+
+ boolean stopInMain = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false );
+ String stopSymbol = null;
+ if ( stopInMain )
+ stopSymbol = launch.getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
+ ICDITarget[] targets = dsession.getTargets();
+ for( int i = 0; i < targets.length; i++ ) {
+ Process process = targets[i].getProcess();
+ IProcess iprocess = null;
+ if ( process != null ) {
+ iprocess = DebugPlugin.newProcess( launch, process, renderProcessLabel( exePath.toPortableString() ), getDefaultProcessMap() );
+ }
+ CDIDebugModel.newDebugTarget( launch, project.getProject(), targets[i], renderTargetLabel( debugConfig ), iprocess, exeFile, true, false, stopSymbol, true );
+ }
+ }
+ catch( CoreException e ) {
+ try {
+ if ( dsession != null )
+ dsession.terminate();
+ }
+ catch( CDIException e1 ) {
+ // ignore
+ }
+ throw e;
+ }
+ finally {
+ monitor.done();
+ }
+ }
+
+ private void setDebugRuntimeOptions( ILaunchConfiguration config, ICDISession session ) throws CoreException {
+
+ // This will get env vars from launch config preference, plus (if launch config
+ // preference indicates "append") host PC env vars.
+ Properties env = getEnvironmentAsProperty( config );
+
+ // Do we need to add the "ESbox env" ?
+ // No.
+ // The "ESbox env" contains those from the global "ESbox=>Environment" preference panel,
+ // and the "system env" (see readStandardEnvironment() in Scratchbox2ProcessLauncherFactory
+ // and Scratchbox2ProcessLauncherFactory) if the "ESbox=>Environment" panel indicates "append".
+ // We don't need those for launching the application.... 04/22/08
+ //
+ // env.putAll(sdkTarget.getProcessLauncherFactory().getStandardEnvironment());
+ // get path without validation, since it might be remote
+
+ // get the working directory from the launch config, using executable's path
+ // if not specified.
+ //IPath exePath = verifyProgramPath(config);
+ //ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(config);
+ //IPath wd = getConvertedWorkingDirectory(config, exePath, sdkTarget);
+
+ String arguments[] = getProgramArgumentsArray( config );
+ try {
+ ICDITarget[] dtargets = session.getTargets();
+ for( int i = 0; i < dtargets.length; ++i ) {
+ ICDIRuntimeOptions opt = dtargets[i].getRuntimeOptions();
+ opt.setArguments( arguments );
+ // this doesn't actually seem to be used anywhere. We want to avoid doing this, especially
+ // for remote launches, where the directory might not exist on the host.
+ //opt.setWorkingDirectory(wd.toPortableString());
+ opt.setEnvironment(env);
+ }
+ }
+ catch( CDIException e ) {
+ abort( "Failed to set program arguments, environment or working directory.", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR ); //$NON-NLS-1$
+ }
+ }
+
+ protected CoreException newCoreException(String mesg) {
+ return new CoreException(Activator.createErrorStatus(mesg, null));
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ESboxCppLaunchUtils.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ESboxCppLaunchUtils.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ESboxCppLaunchUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,309 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API. 02/17/2008
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch;
+
+import com.nokia.cpp.internal.api.utils.core.Pair;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.settings.model.*;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
+import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
+import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
+import org.eclipse.cdt.launch.LaunchUtils;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.ISourceLocator;
+import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.EnvironmentProperties;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.api.core.machine.IFileSystemMappingImpl;
+import org.maemo.esbox.internal.cpp.launch.Activator;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+
+import java.util.*;
+
+/**
+ * @author LWang.
+ * @author eswartz
+ *
+ */
+public class ESboxCppLaunchUtils extends LaunchUtils {
+
+ /**
+ * Copied from org.eclipse.cdt.launch.AbstractCLaunchDelegate.
+ * Don't know why CDT does not put it as public API... LWang. 02/18/08
+ *
+ * Return the save environment variables in the configuration. The array
+ * does not include the default environment of the target. array[n] :
+ * name=value
+ * @throws CoreException
+ */
+ @SuppressWarnings({ "unchecked", "deprecation" })
+ public static String[] getEnvironment(ILaunchConfiguration config) throws CoreException {
+ try {
+ // Migrate old env settings to new.
+ Map map = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map)null);
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ if (map != null) {
+ wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_MAP, (Map)null);
+ config = wc.doSave();
+ }
+ boolean append = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ENVIROMENT_INHERIT, true);
+ wc.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, append);
+ } catch (CoreException e) {
+ }
+ String[] array = DebugPlugin.getDefault().getLaunchManager().getEnvironment(config);
+ if (array == null) {
+ return new String[0];
+ }
+ return array;
+ }
+
+ /**
+ * @param config
+ * @return
+ * @throws CoreException
+ */
+ public static Properties getEnvironmentAsProperty(ILaunchConfiguration config) throws CoreException {
+ String[] envp = getEnvironment(config);
+ return EnvironmentProperties.createFromEnvp(envp);
+ }
+
+ static public void addSourceMappingToLaunch(
+ IPath sdkTargetPath,
+ IPath hostPath,
+ String mappingName, // name of the source mapping in Sources tab in launch config dialog.
+ ILaunchConfigurationWorkingCopy configuration) throws CoreException {
+ String memento = null;
+ String type = null;
+
+ memento = configuration.getAttribute(
+ ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
+ type = configuration.getAttribute(
+ ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String) null);
+ if (type == null) {
+ type = configuration.getType().getSourceLocatorId();
+ }
+ if (type == null) {
+ Activator.getErrorLogger().logError(
+ "FIXME: not registering a source locator for this project",
+ null);
+ return;
+ }
+ ILaunchManager launchManager = DebugPlugin.getDefault()
+ .getLaunchManager();
+ ISourceLocator locator = launchManager.newSourceLocator(type);
+ if (locator instanceof AbstractSourceLookupDirector) {
+ AbstractSourceLookupDirector director = (AbstractSourceLookupDirector) locator;
+ if (memento == null) {
+ // Bug 7291: Do not add the default source mapping container, since this
+ // uses host-specific paths, which will trigger a lot of warnings in gdb.
+ // We need the paths converted to scratchbox. Since, for the moment,
+ // we only consider the case of the source mappings that our debugger explicitly
+ // adds, this is sufficient for now.
+ // TODO: In the future, we need to remap the source lookup/locator at the point of use inside the debugger.
+ director.initializeParticipants();
+ //director.initializeDefaults(configuration);
+ } else {
+ director.initializeFromMemento(memento, configuration);
+ }
+
+ addSourceMappingToDirector(sdkTargetPath, hostPath, mappingName,
+ director);
+
+ configuration.setAttribute(
+ ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, director
+ .getMemento());
+ configuration.setAttribute(
+ ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, director
+ .getId());
+ }
+ }
+
+ public static void addSourceMappingToDirector(
+ IPath missingPath,
+ IPath newSourcePath,
+ String mappingName, // name of the source mapping in Sources tab in launch config dialog.
+ AbstractSourceLookupDirector director) throws CoreException {
+
+ ArrayList<ISourceContainer> containerList = new ArrayList<ISourceContainer>(Arrays.asList(director
+ .getSourceContainers()));
+
+ boolean hasFoundMappings = false;
+
+ MappingSourceContainer foundMappings = null;
+
+ for (Iterator<ISourceContainer> iter = containerList.iterator(); iter.hasNext()
+ && !hasFoundMappings;) {
+ ISourceContainer container = iter.next();
+ if (container instanceof MappingSourceContainer) {
+ hasFoundMappings = container.getName().equals(mappingName);
+ if (hasFoundMappings)
+ foundMappings = (MappingSourceContainer) container;
+ }
+ }
+
+ if (!hasFoundMappings) {
+ foundMappings = new MappingSourceContainer(mappingName);
+ foundMappings.init(director);
+ containerList.add(foundMappings);
+ }
+
+ foundMappings.addMapEntry(new MapEntrySourceContainer(missingPath,
+ newSourcePath));
+ director.setSourceContainers((ISourceContainer[]) containerList
+ .toArray(new ISourceContainer[containerList.size()]));
+ }
+
+ public static ICProject getCProject(ILaunchConfiguration configuration) throws CoreException {
+ IProject project = ESboxCppLaunchUtils.getProject(configuration);
+ ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project);
+ if (cProject != null && cProject.exists()) {
+ return cProject;
+ }
+ return null;
+ }
+
+ /**
+ * This is a Scratchbox specific utility. It adds a source locator in the given
+ * launch config which maps interesting directories to their Scratchbox
+ * locations on host file system so that debugger can locate source files of
+ * a binary built in Scratchbox.
+ *
+ * XXX: this should be moved to the maemosdk side
+ */
+ static public void addSboxDefaultSourceMapping(ILaunchConfigurationWorkingCopy configuration) throws CoreException {
+
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(configuration);
+ if (sdkTarget == null) // not ESbox project.
+ return;
+
+ String projectName = AbstractCLaunchDelegate.getProjectName(configuration);
+ if (projectName != null) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ IPath projectRoot = project.getLocation();
+ IPath projectPath = projectRoot;
+ IPath sboxPath;
+ try {
+ sboxPath = sdkTarget.convertHostToTargetPath(projectPath);
+ } catch (ESboxException e) {
+ throw new CoreException(Activator.createErrorStatus(null, e));
+ }
+ addSourceMappingToLaunch(
+ sboxPath,
+ projectPath,
+ ESboxLaunchUtils.sboxMappingsContainerName,
+ configuration);
+
+ // For bug 7291, we should add an empty project path to the mappings as well,
+ // with the assumption that the cwd is active when building a project, since
+ // the disassembly view passes relative paths through the source locator.
+ //
+ // XXX: to really fix this means to fix MapEntrySourceContainer to deal with
+ // relative paths (see MapEntrySourceContainer#findSourceElements and
+ // MappingSourceContainer#findSourceElements)
+
+ // default to project root
+ addSourceMappingToLaunch(
+ new Path(""),
+ projectPath,
+ ESboxLaunchUtils.sboxMappingsContainerName,
+ configuration);
+
+ // Add all known source entries as well, with the assumption that
+ // the user will set them up for nested subprojects.
+ // XXX: document this assumption; otherwise, it means the disassembler
+ // won't find sources inside projects with nested Makefiles
+ //
+ // (I don't want to add every single subdirectory, since it's unlikely
+ // we'll build from all of them and it will just slow down the debugger,
+ // but that's an alternative if this isn't the best way to fix the problem.)
+ //
+ ICProjectDescription prjDes = CoreModel.getDefault().getProjectDescription(project, false);
+ ICConfigurationDescription activeConfiguration = prjDes.getActiveConfiguration();
+ if (activeConfiguration != null) {
+ ICSourceEntry[] sourceEntries = activeConfiguration.getSourceEntries();
+ for (ICSourceEntry entry : sourceEntries) {
+ IPath entryPath = entry.getFullPath();
+ if (entryPath != null && entryPath.segmentCount() > 1) {
+ IPath projectLocation = ResourcesPlugin.getWorkspace().getRoot().getFile(entryPath).getLocation();
+ addSourceMappingToLaunch(
+ new Path(""),
+ projectLocation,
+ ESboxLaunchUtils.sboxMappingsContainerName,
+ configuration);
+ }
+ }
+ }
+ }
+
+ // TODO: In the future this should include only the paths known to possibly contain
+ // source, e.g., gcc's system include paths, and other include paths
+ // recorded in the C/C++ indexer settings;
+ // for now, we want to be sure not to leave anything out, so we include
+ // every path which doesn't have an obvious mapping with respect to its siblings.
+ try {
+ IFileSystemMappingImpl mappingImpl = (IFileSystemMappingImpl) sdkTarget.getMachineToSDKTargetFileSystemMapping();
+ for (Pair<IPath, IPath> interestingPath : mappingImpl.getHostToTargetRootMappings()) {
+ IPath machinePath = sdkTarget.getHostToMachineFileSystemMapping().convertTargetToHostPath(interestingPath.first);
+ if (machinePath != null) {
+ addSourceMappingToLaunch(
+ interestingPath.second,
+ machinePath,
+ ESboxLaunchUtils.sboxMappingsContainerName,
+ configuration);
+ }
+ }
+ } catch (ClassCastException e) {
+ // XXX: hack
+ Activator.getErrorLogger().logAndShowError("Unable to initialize source mappings for this launch", e);
+ }
+ }
+
+ public static String getProgramName(ILaunchConfiguration configuration) throws CoreException {
+ String programName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
+ if (programName == null) {
+ // XXX: refactor this, this comes from the python launch config constants, but we don't want to add a dependency on python here
+ programName = configuration.getAttribute("org.eclipse.ui.externaltools" + ".ATTR_LOCATION", "");
+ }
+ return programName;
+ }
+
+ /**
+ * Get the project referenced by the launch configuration
+ * @param configuration
+ * @return IProject or <code>null</code>
+ * @throws CoreException
+ */
+ public static IProject getProject(ILaunchConfiguration configuration) throws CoreException {
+ String projectName;
+ projectName = configuration.getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
+ if (projectName.length() == 0) {
+ // XXX: refactor this, this comes from the python launch config constants, but we don't want to add a dependency on python here
+ projectName = configuration.getAttribute("org.python.pydev.debug.ATTR_PROJECT", "");
+ }
+ if (projectName.length() > 0) {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ }
+ return null;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalLaunchShortcut.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalLaunchShortcut.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ling Wang (Nokia)
+*******************************************************************************/
+
+package org.maemo.esbox.cpp.launch.local;
+
+import java.text.MessageFormat;
+
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.cpp.launch.AbstractLaunchShortcut;
+import org.maemo.esbox.cpp.launch.CppLaunchConfigurationData;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+/**
+ *
+ */
+public class ESboxLocalLaunchShortcut extends AbstractLaunchShortcut {
+
+ @Override
+ protected ILaunchConfigurationType getCLaunchConfigType() {
+ return getLaunchManager().getLaunchConfigurationType(IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOLOCAL);
+ }
+
+ @Override
+ protected void setDefaultForLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy config) throws CoreException {
+
+ CppLaunchConfigurationData.setDefaults(config, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOLOCAL);
+ }
+
+ @Override
+ protected String createLaunchConfigurationName(String binFileName,
+ ICProject project) throws CoreException {
+
+ String format = "{0} ({1}-local)";
+
+ String configName = binFileName;
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(project.getProject());
+
+ if (sdkTarget != null) {
+ configName = MessageFormat.format(format, binFileName, sdkTarget.getName());
+ }
+
+ return configName;
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalRunLaunchConfigurationTabGroup.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalRunLaunchConfigurationTabGroup.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalRunLaunchConfigurationTabGroup.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.local;
+
+import org.eclipse.cdt.launch.ui.CArgumentsTab;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+import org.maemo.esbox.cpp.launch.CppLaunchConfigurationData;
+import org.maemo.esbox.cpp.launch.ui.ESboxCDebuggerTab;
+import org.maemo.esbox.cpp.launch.ui.ESboxCMainTab;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+/**
+ *
+ */
+public class ESboxLocalRunLaunchConfigurationTabGroup extends
+ AbstractLaunchConfigurationTabGroup {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new ESboxCMainTab(),
+ new CArgumentsTab(),
+ new EnvironmentTab(),
+ new ESboxCDebuggerTab(false),
+ new SourceLookupTab(),
+ new CommonTab() };
+ setTabs(tabs);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // This delegate to all tabs in the group by default
+ super.setDefaults(configuration);
+
+ CppLaunchConfigurationData.setDefaults(configuration, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOLOCAL);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalRunLaunchDelegate.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalRunLaunchDelegate.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/local/ESboxLocalRunLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.launch.local;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.cpp.launch.*;
+import org.maemo.esbox.launch.core.IGDBParameterAccessor;
+import org.maemo.esbox.launch.core.ILaunchProxy;
+
+/**
+ *
+ */
+public class ESboxLocalRunLaunchDelegate extends ESboxAbstractLaunchDelegate {
+
+ private ILaunchProxy fLaunchProxy = null;
+
+ protected ILaunchProxy createLaunchProxy(ILaunchConfiguration configuration) throws CoreException {
+ // This is CDT/CDI GDB launch.
+ IGDBParameterAccessor original = new BaseCDTGDBParameterAccessor(configuration);
+
+ return new CPPLocalLaunchProxy(configuration, original);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.launch.ESboxAbstractLaunchDelegate#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public boolean preLaunchCheck(ILaunchConfiguration configuration,
+ String mode, IProgressMonitor monitor) throws CoreException {
+
+ // ask super to do common check
+ if (!super.preLaunchCheck(configuration, mode, monitor))
+ return false;
+
+ fLaunchProxy = createLaunchProxy(configuration);
+
+ return fLaunchProxy.preLaunchCheck(mode, monitor);
+ }
+
+ @Override
+ public boolean finalLaunchCheck(ILaunchConfiguration configuration,
+ String mode, IProgressMonitor monitor) throws CoreException {
+
+ if (! super.finalLaunchCheck(configuration, mode, monitor))
+ return false;
+
+ assert(configuration.equals(fLaunchProxy.getLaunchConfiguration()));
+
+ return fLaunchProxy.finalLaunchCheck(mode, monitor);
+ }
+
+ @Override
+ protected void runApplication(ILaunchConfiguration config, ILaunch launch,
+ IProgressMonitor monitor) throws CoreException {
+
+ assert(config.equals(fLaunchProxy.getLaunchConfiguration()));
+
+ fLaunchProxy.runApplication(launch, monitor);
+ }
+
+}
\ No newline at end of file
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteLaunchShortcut.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteLaunchShortcut.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.launch.remote;
+
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jface.window.Window;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.cpp.launch.AbstractLaunchShortcut;
+import org.maemo.esbox.cpp.launch.CppLaunchConfigurationData;
+import org.maemo.esbox.launch.*;
+import org.maemo.esbox.launch.ui.DownloadMethodSelectionDialog;
+
+import java.text.MessageFormat;
+
+/**
+ *
+ */
+public class ESboxRemoteLaunchShortcut extends AbstractLaunchShortcut {
+
+ String fDownloadMethod = null;
+
+ @Override
+ protected ILaunchConfigurationType getCLaunchConfigType() {
+ return getLaunchManager().getLaunchConfigurationType(IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOREMOTE);
+ }
+
+ @Override
+ protected void setDefaultForLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy config) throws CoreException {
+
+ CppLaunchConfigurationData.setDefaults(config, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOREMOTE);
+
+ if (fDownloadMethod != null)
+ config.setAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_DOWNLOAD_METHOD, fDownloadMethod);
+ }
+
+ @Override
+ protected String createLaunchConfigurationName(String binFileName,
+ ICProject project) throws CoreException {
+
+ fDownloadMethod = chooseDownloadMethod();
+ if (fDownloadMethod == null || fDownloadMethod.length() == 0)
+ throw new CoreException(Status.CANCEL_STATUS);
+
+ // binName (SDKTargetName-DownloadMethodName)
+ String format = "{0} ({1}-{2})"; //$NON-NLS-1$
+
+ String configName = binFileName;
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(project.getProject());
+
+ if (sdkTarget == null)
+ return configName;
+
+ configName = MessageFormat.format(format,
+ binFileName,
+ sdkTarget.getName(),
+ fDownloadMethod.contains("SSH") ? "SSH" : "SBRSH");
+
+ return configName;
+ }
+
+ /**
+ * Dialog asking user to choose the download method for remote debug.
+ *
+ * @return String -- download method.
+ */
+ private String chooseDownloadMethod() {
+ DownloadMethodSelectionDialog dialog = new DownloadMethodSelectionDialog(getShell());
+ if (dialog.open() == Window.OK) {
+ Object[] result = dialog.getResult();
+ if(result.length > 0) {
+ return (String)result[0];
+ }
+ }
+ return null;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteRunLaunchConfigurationTabGroup.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteRunLaunchConfigurationTabGroup.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteRunLaunchConfigurationTabGroup.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.remote;
+
+import org.eclipse.cdt.launch.ui.CArgumentsTab;
+import org.eclipse.cdt.launch.ui.CDebuggerTab;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+import org.maemo.esbox.cpp.launch.CppLaunchConfigurationData;
+import org.maemo.esbox.cpp.launch.ui.ESboxRemoteCMainTab;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+import org.maemo.esbox.launch.ui.ESboxDownloadTab;
+
+/**
+ *
+ */
+public class ESboxRemoteRunLaunchConfigurationTabGroup extends
+ AbstractLaunchConfigurationTabGroup {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new ESboxRemoteCMainTab(),
+ new CArgumentsTab(),
+ new EnvironmentTab(),
+ new CDebuggerTab(false),
+ new ESboxDownloadTab(),
+ new SourceLookupTab(),
+ new CommonTab() };
+ setTabs(tabs);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // This delegate to all tabs in the group by default
+ super.setDefaults(configuration);
+
+ CppLaunchConfigurationData.setDefaults(configuration, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOREMOTE);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteRunLaunchDelegate.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteRunLaunchDelegate.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteRunLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT. (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.launch.remote;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.cpp.launch.BaseCDTGDBParameterAccessor;
+import org.maemo.esbox.cpp.launch.CPPRemoteLaunchProxy;
+import org.maemo.esbox.cpp.launch.local.ESboxLocalRunLaunchDelegate;
+import org.maemo.esbox.launch.core.IGDBParameterAccessor;
+import org.maemo.esbox.launch.core.ILaunchProxy;
+
+/**
+ * Launch delegate for remote on-device debug/run.
+ */
+public class ESboxRemoteRunLaunchDelegate extends ESboxLocalRunLaunchDelegate {
+
+ @Override
+ protected ILaunchProxy createLaunchProxy(ILaunchConfiguration configuration) throws CoreException {
+ // This is CDT/CDI GDB launch.
+ IGDBParameterAccessor original = new BaseCDTGDBParameterAccessor(configuration);
+
+ return new CPPRemoteLaunchProxy(configuration, original);
+ }
+}
\ No newline at end of file
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCDebuggerTab.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCDebuggerTab.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCDebuggerTab.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.ui;
+
+import org.eclipse.cdt.launch.ui.CDebuggerTab;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+/**
+ *
+ *
+ */
+public class ESboxCDebuggerTab extends CDebuggerTab {
+
+ public static final String DEFAULT_DEBUGGER = "esboxGDBServerDebugger";
+
+ public ESboxCDebuggerTab(boolean attachMode) {
+ super(attachMode);
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration config) {
+ setInitializing(true);
+ super.initializeFrom(config);
+ String id = DEFAULT_DEBUGGER;
+ loadDebuggerComboBox(config, id);
+ initializeCommonControls(config);
+ setInitializing(false);
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCMainTab.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCMainTab.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCMainTab.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.ui;
+
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
+import org.eclipse.cdt.utils.pty.PTY;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.internal.cpp.launch.Activator;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+/**
+ *
+ *
+ */
+public class ESboxCMainTab extends ESboxCMainTabBase {
+
+ protected Button fRunStandaloneButton;
+
+ @Override
+ protected void createTerminalOption(Composite parent, int colSpan) {
+ Composite mainComp = new Composite(parent, SWT.NONE);
+ GridLayout mainLayout = new GridLayout();
+ mainLayout.numColumns = 1;
+ mainLayout.marginHeight = 0;
+ mainLayout.marginWidth = 0;
+ mainComp.setLayout(mainLayout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = colSpan;
+ mainComp.setLayoutData(gd);
+
+ fTerminalButton = createCheckButton(mainComp, LaunchMessages.getString("CMainTab.UseTerminal")); //$NON-NLS-1$
+ fTerminalButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fTerminalButton.setEnabled(PTY.isSupported());
+
+ fRunStandaloneButton = createCheckButton(mainComp, "Run with \"run-standalone.sh\" script"); //$NON-NLS-1$
+ fRunStandaloneButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fRunStandaloneButton.setSelection(IESboxCDTLaunchConfigurationConstants.RUN_STANDALONE_DEFAULT);
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy config) {
+ // TODO Auto-generated method stub
+ super.performApply(config);
+ config.setAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE, fRunStandaloneButton.getSelection());
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration config) {
+ // TODO Auto-generated method stub
+ super.initializeFrom(config);
+ updateRunStandaloneFromConfig(config);
+ }
+
+ protected void updateRunStandaloneFromConfig(ILaunchConfiguration config) {
+ try {
+ boolean isRunStandalone = config.getAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE,
+ IESboxCDTLaunchConfigurationConstants.RUN_STANDALONE_DEFAULT);
+ fRunStandaloneButton.setSelection(isRunStandalone);
+ } catch (CoreException e) {
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+ errorLogger.logAndShowError("ESbox error", e);
+ }
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ super.setDefaults(config);
+ ESboxLaunchUtils.setRunStandaloneDefault(config,
+ IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCMainTabBase.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCMainTabBase.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxCMainTabBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.launch.ui;
+
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
+import org.eclipse.cdt.launch.ui.CMainTab;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.cpp.launch.CppLaunchConfigurationData;
+import org.maemo.esbox.cpp.launch.ESboxCppLaunchUtils;
+import org.maemo.esbox.launch.*;
+
+/**
+ * This main tab UI subclass replaces the "Browse..." for binary behavior with
+ * one that actually starts in a sensible location.
+ * <p>
+ * TODO: sync with Python launch tab group which can handle making a launch config containing the project and SDK target name
+ * @author eswartz
+ *
+ */
+public class ESboxCMainTabBase extends CMainTab {
+
+ public ESboxCMainTabBase() {
+ super(true);
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy config) {
+ /*
+ * The PerformApply() is called whenever an option is changed by user
+ * (regardless of validity of the change) or when the Apply/Debug button
+ * is pressed.
+ */
+ if (! isValid(config)) // user change not even valid, bail out.
+ return;
+
+ /* Here we try to make sure when the "project" option is
+ * changed, correct defaults are filled for all other options.
+ */
+ IProject oldProj = null;
+ try {
+ oldProj = ESboxCppLaunchUtils.getProject(config);
+ } catch (CoreException e) {
+ oldProj = null;
+ }
+
+ super.performApply(config);
+
+ ICProject newCProject = getCProject();
+ if (newCProject != null) {
+ IProject newProj = newCProject.getProject();
+
+ /*
+ * A different project is selected by user. Reload defaults for the
+ * whole launch config. This is to fix the bug that a launch config
+ * created without proper selection in Project View does not work
+ * even after user fills each option correctly.
+ *
+ * This means all other settings changed by user (if any) will get
+ * lost, which is kind of rude. But in practice, changing project of
+ * a well configured launch config is very rare, which may only be
+ * done by extreme users.
+ */
+ if (! newProj.equals(oldProj)) {
+
+ if (ESboxLaunchUtils.getSDKTarget(newProj) == null) // not an ESBox project
+ return;
+
+ String configType = null;
+ try {
+ configType = config.getType().getIdentifier();
+ } catch (CoreException e) {
+ }
+
+ if (configType == null || configType.length() == 0)
+ return;
+
+ // Fill in defaults.
+ CppLaunchConfigurationData.setDefaults(config, configType);
+
+ // Make sure all tabs are filled with the defaults.
+ ILaunchConfigurationTab tabs[] = getLaunchConfigurationDialog().getTabs();
+ for (ILaunchConfigurationTab t : tabs) {
+ t.initializeFrom(config);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isValid(ILaunchConfiguration config) {
+ if (! super.isValid(config))
+ return false;
+
+ // Only allow ESbox project for ESbox launch configurations.
+
+ // The validity of "name" and "project" has been checked above.
+ String name = fProjText.getText().trim();
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(project);
+
+ if (sdkTarget == null) {
+ setErrorMessage("Project is not an ESbox project.");
+ return false;
+ }
+
+ return true;
+ }
+
+ protected void handleBinaryBrowseButtonSelected() {
+ final ICProject cproject = getCProject();
+ if (cproject == null) {
+ MessageDialog.openInformation(getShell(), LaunchMessages.getString("CMainTab.Project_required"), //$NON-NLS-1$
+ LaunchMessages.getString("CMainTab.Enter_project_before_browsing_for_program")); //$NON-NLS-1$
+ return;
+ }
+
+ String existing = fProgText.getText();
+ FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN);
+ if (existing.length() > 0)
+ fileDialog.setFileName(existing);
+ else {
+ IProject project = cproject.getProject();
+ // note: don't append the supposed binary name here,
+ // since if it doesn't exist (which is likely if the user is here!)
+ // then GNOME will revert to $HOME
+ fileDialog.setFileName(project.getLocation().toPortableString());
+ }
+
+ String text= fileDialog.open();
+ if (text != null) {
+ fProgText.setText(text);
+ }
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxGDBDebuggerPage.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxGDBDebuggerPage.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxGDBDebuggerPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.launch.ui;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ESboxGDBDebuggerPage extends org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage {
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxGDBServerDebuggerPage.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxGDBServerDebuggerPage.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxGDBServerDebuggerPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Apr 21, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.ui;
+
+import org.eclipse.cdt.debug.mi.internal.ui.GDBServerDebuggerPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This class is just intended to hiding some controls in the CDT
+ * StandardGDBDebuggerPage.
+ *
+ * @author LWang.
+ *
+ */
+public class ESboxGDBServerDebuggerPage extends GDBServerDebuggerPage {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.internal.ui.StandardGDBDebuggerPage#createCommandFactoryCombo(org.eclipse.swt.widgets.Composite)
+ */
+ // The ESbox debugger supports only one command set (the "Standard (Linux)" one).
+ // See: ESboxMICommandFactory
+ // Also this option is hard for user to understand. So we hide it.
+ // .............. 04/21/08
+ @Override
+ protected void createCommandFactoryCombo(Composite parent) {
+ fCommandFactoryCombo = new Combo( parent, SWT.READ_ONLY | SWT.DROP_DOWN );
+ fCommandFactoryCombo.setVisible(false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.internal.ui.StandardGDBDebuggerPage#createProtocolCombo(org.eclipse.swt.widgets.Composite)
+ */
+ // We only need to support the latest mi version, namely mi2 which is
+ // supported by gdb 6.x and later.
+ // Also this option is hard for user to understand. So we hide it.
+ // .............. 04/21/08
+ @Override
+ protected void createProtocolCombo(Composite parent) {
+ fProtocolCombo = new Combo( parent, SWT.READ_ONLY | SWT.DROP_DOWN );
+ fProtocolCombo.setVisible(false);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxRemoteCMainTab.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxRemoteCMainTab.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/ui/ESboxRemoteCMainTab.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.internal.cpp.launch.Activator;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+/**
+ *
+ */
+public class ESboxRemoteCMainTab extends ESboxCMainTabBase {
+
+ protected Button fRunStandaloneButton;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.launch.ui.CMainTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent); // create standard CMainTab stuff.
+
+ // These are ESBox addition
+ createESBoxGroup((Composite)getControl(), 1);
+ }
+
+ private void createESBoxGroup(Composite parent, int colSpan) {
+
+ Composite mainComp = new Composite(parent, SWT.NONE);
+ GridLayout mainLayout = new GridLayout();
+ mainLayout.numColumns = 1;
+ mainLayout.marginHeight = 0;
+ mainLayout.marginWidth = 0;
+ mainComp.setLayout(mainLayout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = colSpan;
+ mainComp.setLayoutData(gd);
+
+ fRunStandaloneButton = createCheckButton(mainComp, "Run with \"run-standalone.sh\" script"); //$NON-NLS-1$
+ fRunStandaloneButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fRunStandaloneButton.setSelection(IESboxCDTLaunchConfigurationConstants.RUN_STANDALONE_DEFAULT);
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy config) {
+ super.performApply(config);
+ config.setAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE, fRunStandaloneButton.getSelection());
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration config) {
+ super.initializeFrom(config);
+
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+
+ try {
+ boolean isRunStandalone = config.getAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE,
+ IESboxCDTLaunchConfigurationConstants.RUN_STANDALONE_DEFAULT);
+ fRunStandaloneButton.setSelection(isRunStandalone);
+ } catch (CoreException e) {
+ errorLogger.logError("Failed to get launch config attribute: " + IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE, e);
+ }
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ super.setDefaults(config);
+ ESboxLaunchUtils.setRunStandaloneDefault(config,
+ IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/internal/cpp/launch/Activator.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/internal/cpp/launch/Activator.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/internal/cpp/launch/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,131 @@
+package org.maemo.esbox.internal.cpp.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.cpp.launch";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch.analysis
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.classpath
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.classpath (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.cpp.launch.analysis</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:30:49 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/META-INF/MANIFEST.MF
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox C/C++ Launch Analysis Plug-in
+Bundle-SymbolicName: org.maemo.esbox.cpp.launch.analysis;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.cpp.launch.analysis.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.cpp.launch;bundle-version="1.5.0",
+ org.eclipse.cdt.core;bundle-version="5.0.1",
+ org.eclipse.cdt.launch;bundle-version="5.0.0",
+ org.eclipse.debug.ui;bundle-version="3.4.0",
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.maemo.esbox.analysis.launch;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.cpp.launch.analysis.oprofile,
+ org.maemo.esbox.cpp.launch.analysis.valgrind,
+ org.maemo.esbox.cpp.launch.analysis.valgrind.ui
+Import-Package: org.eclipse.ui
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/build.properties
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/build.properties (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/local_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/local_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/oprofile_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/oprofile_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/remote_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/remote_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/valgrind_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/icons/full/obj16/valgrind_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/plugin.xml
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/plugin.xml (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ id="ESboxLaunchConfigType"
+ name="ESbox Launch Configuration Type"
+ point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ delegate="org.maemo.esbox.cpp.launch.analysis.oprofile.OProfileLaunchDelegate"
+ id="esboxOprofileLaunchType"
+ modes="run"
+ name="Remote OProfile Profiler"
+ public="true"
+ sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+ </launchConfigurationType>
+ <launchConfigurationType
+ delegate="org.maemo.esbox.cpp.launch.analysis.valgrind.ValgrindLaunchDelegate"
+ id="esboxValgrindLaunchType"
+ modes="run"
+ name="Local Valgrind Profiler"
+ public="true"
+ sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+ </launchConfigurationType>
+
+ </extension>
+ <extension
+ id="EsboxLaunchConfigTabGroup"
+ name="Esbox Launch Configuration Tab Group"
+ point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ class="org.maemo.esbox.cpp.launch.analysis.oprofile.OProfileLaunchConfigurationTabGroup"
+ id="oprofileLaunchTabGroup"
+ type="esboxOprofileLaunchType">
+ </launchConfigurationTabGroup>
+ <launchConfigurationTabGroup
+ class="org.maemo.esbox.cpp.launch.analysis.valgrind.ValgrindLaunchConfigurationTabGroup"
+ id="valgrindLaunchTabGroup"
+ type="esboxValgrindLaunchType">
+ </launchConfigurationTabGroup>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ configTypeID="esboxOprofileLaunchType"
+ icon="icons/full/obj16/oprofile_obj.png"
+ id="oprofileLaunchTypeImage">
+ </launchConfigurationTypeImage>
+ <launchConfigurationTypeImage
+ configTypeID="esboxValgrindLaunchType"
+ icon="icons/full/obj16/valgrind_obj.png"
+ id="valgrindLaunchTypeImage">
+ </launchConfigurationTypeImage>
+
+ </extension>
+
+ <extension
+ point="org.eclipse.debug.ui.launchShortcuts">
+ <shortcut
+ class="org.maemo.esbox.cpp.launch.analysis.oprofile.OProfileLaunchShortcut"
+ icon="icons/full/obj16/oprofile_obj.png"
+ id="maemoOProfileShortcut"
+ label="Remote OProfile Profiler"
+ modes="run">
+ <contextualLaunch>
+ <enablement>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <and>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.cpp.isCProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isRemoteTarget">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isARMELTarget">
+ </test>
+ <or>
+ <instanceof
+ value="org.eclipse.cdt.core.model.IBinary">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.cdt.core.model.ICProject">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isExecutable">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isCProject">
+ </test>
+ <and>
+ <instanceof
+ value="org.eclipse.ui.IFileEditorInput">
+ </instanceof>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <adapt
+ type="org.eclipse.cdt.core.model.ICElement">
+ </adapt>
+ </adapt>
+ </and>
+ </or>
+ </and>
+ </iterate>
+ </with></enablement>
+ <contextLabel
+ label="Remote OProfile Profiler"
+ mode="run">
+ </contextLabel></contextualLaunch>
+ </shortcut>
+ <shortcut
+ class="org.maemo.esbox.cpp.launch.analysis.valgrind.ValgrindLaunchShortcut"
+ icon="icons/full/obj16/valgrind_obj.png"
+ id="maemoValgrindShortcut"
+ label="Local Valgrind Memory Profiler"
+ modes="run">
+ <contextualLaunch>
+ <enablement>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <and>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.cpp.isCProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isEmulatorTarget">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isX86Target">
+ </test>
+ <or>
+ <instanceof
+ value="org.eclipse.cdt.core.model.IBinary">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.cdt.core.model.ICProject">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isExecutable">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isCProject">
+ </test>
+ <and>
+ <instanceof
+ value="org.eclipse.ui.IFileEditorInput">
+ </instanceof>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <adapt
+ type="org.eclipse.cdt.core.model.ICElement">
+ </adapt>
+ </adapt>
+ </and>
+ </or>
+ </and>
+ </iterate>
+ </with></enablement>
+ <contextLabel
+ label="Local Valgrind Memory Profiler"
+ mode="run">
+ </contextLabel></contextualLaunch>
+ </shortcut>
+
+ </extension>
+</plugin>
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchConfigurationTabGroup.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchConfigurationTabGroup.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchConfigurationTabGroup.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.analysis.oprofile;
+
+import org.eclipse.cdt.launch.ui.CArgumentsTab;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.maemo.esbox.cpp.launch.CppLaunchConfigurationData;
+import org.maemo.esbox.cpp.launch.ui.ESboxCMainTab;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+import org.maemo.esbox.launch.ui.ESboxDownloadTab;
+
+/**
+ *
+ */
+public class OProfileLaunchConfigurationTabGroup extends
+ AbstractLaunchConfigurationTabGroup {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new ESboxCMainTab(),
+ new CArgumentsTab(),
+ new EnvironmentTab(),
+ new ESboxDownloadTab()
+ };
+
+ setTabs(tabs);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // This delegate to all tabs in the group by default
+ super.setDefaults(configuration);
+
+ CppLaunchConfigurationData.setDefaults(configuration, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_OPROFILE);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchDelegate.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchDelegate.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.analysis.oprofile;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.analysis.launch.OProfileRemoteLaunchProxy;
+import org.maemo.esbox.cpp.launch.BaseCDTGDBParameterAccessor;
+import org.maemo.esbox.cpp.launch.CPPRemoteLaunchProxy;
+import org.maemo.esbox.cpp.launch.remote.ESboxRemoteRunLaunchDelegate;
+import org.maemo.esbox.launch.core.IGDBParameterAccessor;
+import org.maemo.esbox.launch.core.ILaunchProxy;
+
+/**
+ * This delegate will start OProfile data collecting on device,
+ * launch the application, stop the collecting and run OProfile
+ * report.
+ */
+public class OProfileLaunchDelegate extends ESboxRemoteRunLaunchDelegate {
+
+ @Override
+ protected ILaunchProxy createLaunchProxy(ILaunchConfiguration configuration) throws CoreException {
+ // This is CDT/CDI GDB launch.
+ IGDBParameterAccessor original = new BaseCDTGDBParameterAccessor(configuration);
+ ILaunchProxy appLaunchProxy = new CPPRemoteLaunchProxy(configuration, original);
+
+ return new OProfileRemoteLaunchProxy(configuration, appLaunchProxy);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchShortcut.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchShortcut.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/OProfileLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.analysis.oprofile;
+
+import java.text.MessageFormat;
+
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.maemo.esbox.cpp.launch.AbstractLaunchShortcut;
+import org.maemo.esbox.cpp.launch.CppLaunchConfigurationData;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+/**
+ *
+ */
+public class OProfileLaunchShortcut extends AbstractLaunchShortcut {
+
+ @Override
+ protected ILaunchConfigurationType getCLaunchConfigType() {
+ //the ID of the configuration type that we want to link with.
+ return getLaunchManager().getLaunchConfigurationType(IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_OPROFILE);
+ }
+
+ @Override
+ protected void setDefaultForLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy config) throws CoreException {
+ CppLaunchConfigurationData.setDefaults(config, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_OPROFILE);
+ }
+
+ @Override
+ protected String createLaunchConfigurationName(String binFileName,
+ ICProject project) {
+
+ String format = "{0} (OProfile)";
+
+ String configName = MessageFormat.format(format, binFileName);
+
+ return configName;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/ui/OProfileMainTab.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/ui/OProfileMainTab.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/oprofile/ui/OProfileMainTab.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.analysis.oprofile.ui;
+
+import org.eclipse.cdt.utils.pty.PTY;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.cpp.launch.ui.ESboxCMainTabBase;
+import org.maemo.esbox.internal.cpp.launch.analysis.Activator;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+/**
+ *
+ */
+public class OProfileMainTab extends ESboxCMainTabBase {
+
+ protected Button fRunStandaloneButton;
+ protected Button fCopyButton;
+ protected Text fLocalMountPoint;
+ protected Text fRemoteMountPoint;
+
+ @Override
+ protected void createTerminalOption(Composite parent, int colSpan) {
+ createTexts(parent);
+
+ Composite mainComp = new Composite(parent, SWT.NONE);
+ GridLayout mainLayout = new GridLayout();
+ mainLayout.numColumns = 1;
+ mainLayout.marginHeight = 0;
+ mainLayout.marginWidth = 0;
+ mainComp.setLayout(mainLayout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = colSpan;
+ mainComp.setLayoutData(gd);
+
+ fTerminalButton = createCheckButton(mainComp, "Use terminal"); //$NON-NLS-1$
+ fTerminalButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fTerminalButton.setEnabled(PTY.isSupported());
+
+ fRunStandaloneButton = createCheckButton(mainComp, "Run with \"run-standalone.sh\" script"); //$NON-NLS-1$
+ fRunStandaloneButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fRunStandaloneButton.setSelection(IESboxCDTLaunchConfigurationConstants.RUN_STANDALONE_DEFAULT);
+
+ fCopyButton = createCheckButton(mainComp, "Copy binary to local mount point"); //$NON-NLS-1$
+ fCopyButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fCopyButton.setSelection(IESboxCDTLaunchConfigurationConstants.COPY_BINS_DEFAULT);
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy config) {
+ // TODO Auto-generated method stub
+ super.performApply(config);
+ config.setAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE, fRunStandaloneButton.getSelection());
+ config.setAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_COPY_BINS, fCopyButton.getSelection());
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration config) {
+ // TODO Auto-generated method stub
+ super.initializeFrom(config);
+ updateFromConfig(config);
+
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(config);
+ String sbrshBinPath = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SBRSH_SELECTED_BIN_PATH);
+
+ String localMounPoint = "";
+ String remoteMounPoint = "";
+ if (!sbrshBinPath.equals("")) {
+ String tokens[] = sbrshBinPath.split("#");
+ localMounPoint = tokens[1];
+ remoteMounPoint = tokens[2];
+ setMessage(null);
+ } else {
+ setMessage("There is no selected binary path in the Workspace > ESbox > Sbrsh preferences.");
+ }
+
+ fLocalMountPoint.setText(localMounPoint);
+ fRemoteMountPoint.setText(remoteMounPoint);
+ }
+
+ protected void updateFromConfig(ILaunchConfiguration config) {
+ try {
+ boolean isRunStandalone = config.getAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE,
+ IESboxCDTLaunchConfigurationConstants.RUN_STANDALONE_DEFAULT);
+ fRunStandaloneButton.setSelection(isRunStandalone);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to read run standalone option", e);
+ }
+
+ try {
+ boolean copyBinaries = config.getAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_COPY_BINS,
+ IESboxCDTLaunchConfigurationConstants.COPY_BINS_DEFAULT);
+ fRunStandaloneButton.setSelection(copyBinaries);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to read copy binaries option", e);
+ }
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ super.setDefaults(config);
+ ESboxLaunchUtils.setRunStandaloneDefault(config,
+ IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE);
+ config.setAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_COPY_BINS,
+ IESboxCDTLaunchConfigurationConstants.COPY_BINS_DEFAULT);
+ }
+
+ protected void createTexts(Composite parent) {
+ Composite entriesGroup = new Composite(parent, SWT.NONE);
+ entriesGroup.setLayout(new GridLayout(5, false));
+ entriesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 4;
+ data.minimumWidth = 240;
+
+ Label labelLocal = new Label(entriesGroup,SWT.NONE);
+ labelLocal.setText("Local Mount Point:");
+ fLocalMountPoint = new Text(entriesGroup, SWT.BORDER | SWT.READ_ONLY);
+ fLocalMountPoint.setLayoutData(data);
+ fLocalMountPoint.setFont(parent.getFont());
+ fLocalMountPoint.setEditable(false);
+
+ Label labelRemote = new Label(entriesGroup,SWT.NONE);
+ labelRemote.setText("Remote Mount Point:");
+ fRemoteMountPoint = new Text(entriesGroup, SWT.BORDER | SWT.READ_ONLY);
+ fRemoteMountPoint.setLayoutData(data);
+ fRemoteMountPoint.setFont(parent.getFont());
+ fRemoteMountPoint.setEditable(false);
+ }
+
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchConfigurationTabGroup.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchConfigurationTabGroup.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchConfigurationTabGroup.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.analysis.valgrind;
+
+import org.eclipse.cdt.launch.ui.CArgumentsTab;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.maemo.esbox.cpp.launch.ui.ESboxCMainTab;
+
+/**
+ *
+ */
+public class ValgrindLaunchConfigurationTabGroup extends
+ AbstractLaunchConfigurationTabGroup {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new ESboxCMainTab(),
+ new CArgumentsTab(),
+ new EnvironmentTab()
+ };
+ setTabs(tabs);
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchDelegate.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchDelegate.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.analysis.valgrind;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.analysis.launch.ValgrindLocalLaunchProxy;
+import org.maemo.esbox.cpp.launch.*;
+import org.maemo.esbox.launch.core.IGDBParameterAccessor;
+import org.maemo.esbox.launch.core.ILaunchProxy;
+
+/**
+ * Launch Valgrind for CPP application.
+ */
+public class ValgrindLaunchDelegate extends ESboxAbstractLaunchDelegate {
+
+ private ILaunchProxy fLaunchProxy;
+
+ protected ILaunchProxy createLaunchProxy(ILaunchConfiguration configuration) throws CoreException {
+ // This is CDT/CDI GDB launch.
+ IGDBParameterAccessor original = new BaseCDTGDBParameterAccessor(configuration);
+ ILaunchProxy appLaunchProxy = new CPPLocalLaunchProxy(configuration, original);
+
+ return new ValgrindLocalLaunchProxy(configuration, appLaunchProxy);
+ }
+
+ @Override
+ public boolean preLaunchCheck(ILaunchConfiguration configuration,
+ String mode, IProgressMonitor monitor) throws CoreException {
+ if (!super.preLaunchCheck(configuration, mode, monitor))
+ return false;
+
+ fLaunchProxy = createLaunchProxy(configuration);
+
+ return fLaunchProxy.preLaunchCheck(mode, monitor);
+ }
+
+ @Override
+ public boolean finalLaunchCheck(ILaunchConfiguration configuration,
+ String mode, IProgressMonitor monitor) throws CoreException {
+
+ if (! super.finalLaunchCheck(configuration, mode, monitor))
+ return false;
+
+ assert(configuration.equals(fLaunchProxy.getLaunchConfiguration()));
+
+ return fLaunchProxy.finalLaunchCheck(mode, monitor);
+ }
+
+ @Override
+ protected void runApplication(ILaunchConfiguration configuration, ILaunch launch,
+ IProgressMonitor monitor) throws CoreException {
+
+ assert(configuration.equals(fLaunchProxy.getLaunchConfiguration()));
+
+ fLaunchProxy.runApplication(launch, monitor);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchShortcut.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchShortcut.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ValgrindLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ling Wang (Nokia)
+*******************************************************************************/
+package org.maemo.esbox.cpp.launch.analysis.valgrind;
+
+import java.text.MessageFormat;
+
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.maemo.esbox.cpp.launch.AbstractLaunchShortcut;
+import org.maemo.esbox.cpp.launch.CppLaunchConfigurationData;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+/**
+ *
+ */
+public class ValgrindLaunchShortcut extends AbstractLaunchShortcut {
+
+ @Override
+ protected ILaunchConfigurationType getCLaunchConfigType() {
+ //the ID of the configuration type that we want to link with.
+ return getLaunchManager().getLaunchConfigurationType(IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_VALGRIND);
+ }
+
+ @Override
+ protected void setDefaultForLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy config) throws CoreException {
+ CppLaunchConfigurationData.setDefaults(config, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_VALGRIND);
+ }
+
+ @Override
+ protected String createLaunchConfigurationName(String binFileName,
+ ICProject project) {
+
+ String format = "{0} (Valgrind)";
+
+ String configName = MessageFormat.format(format, binFileName);
+
+ return configName;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ui/ValgrindMainTab.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ui/ValgrindMainTab.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/cpp/launch/analysis/valgrind/ui/ValgrindMainTab.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.analysis.valgrind.ui;
+
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
+import org.eclipse.cdt.utils.pty.PTY;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.maemo.esbox.cpp.launch.ui.ESboxCMainTabBase;
+import org.maemo.esbox.internal.cpp.launch.analysis.Activator;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+/**
+ *
+ */
+public class ValgrindMainTab extends ESboxCMainTabBase {
+
+ protected Button fRunStandaloneButton;
+
+ @Override
+ protected void createTerminalOption(Composite parent, int colSpan) {
+ Composite mainComp = new Composite(parent, SWT.NONE);
+ GridLayout mainLayout = new GridLayout();
+ mainLayout.numColumns = 1;
+ mainLayout.marginHeight = 0;
+ mainLayout.marginWidth = 0;
+ mainComp.setLayout(mainLayout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = colSpan;
+ mainComp.setLayoutData(gd);
+
+ fTerminalButton = createCheckButton(mainComp, LaunchMessages.getString("CMainTab.UseTerminal")); //$NON-NLS-1$
+ fTerminalButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fTerminalButton.setEnabled(PTY.isSupported());
+
+ fRunStandaloneButton = createCheckButton(mainComp, "Run with \"run-standalone.sh\" script"); //$NON-NLS-1$
+ fRunStandaloneButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fRunStandaloneButton.setSelection(false);
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy config) {
+ // TODO Auto-generated method stub
+ super.performApply(config);
+ config.setAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE, fRunStandaloneButton.getSelection());
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration config) {
+ // TODO Auto-generated method stub
+ super.initializeFrom(config);
+ updateRunStandaloneFromConfig(config);
+ }
+
+ protected void updateRunStandaloneFromConfig(ILaunchConfiguration config) {
+ try {
+ boolean isRunStandalone = config.getAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE,
+ IESboxCDTLaunchConfigurationConstants.RUN_STANDALONE_DEFAULT);
+ fRunStandaloneButton.setSelection(isRunStandalone);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to read run standalone option", e);
+ }
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ super.setDefaults(config);
+ ESboxLaunchUtils.setRunStandaloneDefault(config,
+ IESboxCDTLaunchConfigurationConstants.ATTR_RUN_STANDALONE);
+ }
+}
+
Added: trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal/cpp/launch/analysis/Activator.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal/cpp/launch/analysis/Activator.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.analysis/src/org/maemo/esbox/internal/cpp/launch/analysis/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,131 @@
+package org.maemo.esbox.internal.cpp.launch.analysis;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.cpp.launch.analysis";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.classpath
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.classpath (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.cpp.launch.cdi.gdb</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:29:29 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/META-INF/MANIFEST.MF
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox C/C++ Launch CDI GDB Plug-in
+Bundle-SymbolicName: org.maemo.esbox.cpp.launch.cdi.gdb;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.cpp.launch.cdi.gdb.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.cpp.launch;bundle-version="1.5.0",
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.eclipse.cdt.debug.mi.core;bundle-version="5.0.1",
+ org.eclipse.debug.core;bundle-version="3.4.0",
+ org.eclipse.cdt.debug.core;bundle-version="5.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.cpp.launch.cdi.gdb
+Import-Package: org.eclipse.cdt.core,
+ org.eclipse.ui
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/build.properties
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/build.properties (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons/full/obj16/local_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons/full/obj16/local_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons/full/obj16/remote_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/icons/full/obj16/remote_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/plugin.xml
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/plugin.xml (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.cdt.debug.mi.core.commandFactories">
+ <commandFactory
+ class="org.maemo.esbox.cpp.launch.cdi.gdb.ESboxMICommandFactory"
+ debuggerID="esboxGDBRemoteDebugger"
+ id="org.maemo.esbox.launch.standardLinuxCommandFactory"
+ miVersions="mi2"
+ name="Standard (Linux)"
+ platforms="linux,win32">
+ </commandFactory>
+ <commandFactory
+ class="org.maemo.esbox.cpp.launch.cdi.gdb.ESboxMICommandFactory"
+ debuggerID="esboxGDBServerDebugger"
+ id="org.maemo.esbox.launch.standardLinuxCommandFactory"
+ miVersions="mi2"
+ name="Standard (Linux)"
+ platforms="linux,win32">
+ </commandFactory>
+ </extension>
+ <extension
+ point="org.eclipse.cdt.debug.core.CDebugger">
+ <debugger
+ class="org.maemo.esbox.cpp.launch.cdi.gdb.ESboxGDBServerLocalDebugger"
+ cpu="*"
+ id="esboxGDBServerDebugger"
+ modes="run"
+ name="ESbox gdbserver Local Debugger"
+ platform="*">
+ </debugger>
+ <debugger
+ class="org.maemo.esbox.cpp.launch.cdi.gdb.ESboxGDBServerRemoteDebugger"
+ cpu="*"
+ id="esboxGDBRemoteDebugger"
+ modes="run"
+ name="ESbox gdbserver Debugger on Device"
+ platform="*">
+ </debugger>
+ </extension>
+
+
+ <extension
+ id="ESboxLaunchConfigType"
+ name="ESbox Launch Configuration Type"
+ point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ delegate="org.maemo.esbox.cpp.launch.local.ESboxLocalRunLaunchDelegate"
+ id="esboxLocalLaunchType"
+ modes="run,debug"
+ name="Maemo Local Application"
+ public="true"
+ sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"/>
+ <launchConfigurationType
+ delegate="org.maemo.esbox.cpp.launch.remote.ESboxRemoteRunLaunchDelegate"
+ id="esboxRemoteLaunchType"
+ modes="run,debug"
+ name="Maemo Remote Application"
+ public="true"
+ sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+ </launchConfigurationType>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ configTypeID="esboxLocalLaunchType"
+ icon="icons/full/obj16/local_obj.png"
+ id="esboxLocalLaunchImage"/>
+ <launchConfigurationTypeImage
+ configTypeID="esboxRemoteLaunchType"
+ icon="icons/full/obj16/remote_obj.png"
+ id="esboxRemoteLaunchImage">
+ </launchConfigurationTypeImage>
+ </extension>
+ <extension
+ id="EsboxLaunchConfigTabGroup"
+ name="Esbox Launch Configuration Tab Group"
+ point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ class="org.maemo.esbox.cpp.launch.local.ESboxLocalRunLaunchConfigurationTabGroup"
+ id="esboxLocalRunLaunchTabGroup"
+ type="esboxLocalLaunchType"/>
+ <launchConfigurationTabGroup
+ class="org.maemo.esbox.cpp.launch.remote.ESboxRemoteRunLaunchConfigurationTabGroup"
+ id="esboxRemoteRunLaunchTabGroup"
+ type="esboxRemoteLaunchType">
+ </launchConfigurationTabGroup>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchShortcuts">
+ <shortcut
+ class="org.maemo.esbox.cpp.launch.local.ESboxLocalLaunchShortcut"
+ icon="icons/full/obj16/local_obj.png"
+ id="maemoLocalShortcut"
+ label="Maemo Local Application"
+ modes="run,debug">
+ <contextualLaunch>
+ <enablement>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <and>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.cpp.isCProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isEmulatorTarget">
+ </test>
+ <or>
+ <instanceof
+ value="org.eclipse.cdt.core.model.IBinary">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.cdt.core.model.ICProject">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isExecutable">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isCProject">
+ </test>
+ <and>
+ <instanceof
+ value="org.eclipse.ui.IFileEditorInput">
+ </instanceof>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <adapt
+ type="org.eclipse.cdt.core.model.ICElement">
+ </adapt>
+ </adapt>
+ </and>
+ </or>
+ </and>
+ </iterate>
+ </with>
+ </enablement>
+ <contextLabel
+ label="Maemo Local Application"
+ mode="run"/>
+ <contextLabel
+ label="Maemo Local Application"
+ mode="debug"/>
+ </contextualLaunch>
+ </shortcut>
+ <shortcut
+ class="org.maemo.esbox.cpp.launch.remote.ESboxRemoteLaunchShortcut"
+ icon="icons/full/obj16/remote_obj.png"
+ id="maemoRemoteShortcut"
+ label="Maemo Remote Application"
+ modes="run,debug">
+ <contextualLaunch>
+ <enablement>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <and>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.cpp.isCProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isRemoteTarget">
+ </test>
+ <or>
+ <instanceof
+ value="org.eclipse.cdt.core.model.IBinary">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.cdt.core.model.ICProject">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isExecutable">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isCProject">
+ </test>
+ <and>
+ <instanceof
+ value="org.eclipse.ui.IFileEditorInput">
+ </instanceof>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <adapt
+ type="org.eclipse.cdt.core.model.ICElement">
+ </adapt>
+ </adapt>
+ </and>
+
+ </or>
+ </and>
+ </iterate>
+ </with>
+ </enablement>
+ <contextLabel
+ label="Maemo Remote Application"
+ mode="run"/>
+ <contextLabel
+ label="Maemo Remote Application"
+ mode="debug"/>
+ </contextualLaunch>
+ </shortcut>
+ </extension>
+
+</plugin>
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESBoxGDBServerCDIDebugger2.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESBoxGDBServerCDIDebugger2.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESBoxGDBServerCDIDebugger2.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Apr 18, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.cdi.gdb;
+
+import org.eclipse.cdt.debug.mi.core.*;
+import org.eclipse.cdt.debug.mi.core.cdi.Session;
+import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
+import org.eclipse.cdt.debug.mi.core.command.MIGDBSet;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.cpp.launch.cdi.gdb.Activator;
+import org.maemo.esbox.launch.*;
+
+import java.io.File;
+
+/**
+ * @author LWang.
+ *
+ */
+public abstract class ESBoxGDBServerCDIDebugger2 extends GDBServerCDIDebugger2 {
+
+ private IPath sboxExePath;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.core.AbstractGDBCDIDebugger#createGDBSession(org.eclipse.debug.core.ILaunch, java.io.File, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ // This override does ESbox special tasks like download file, start gdbserver, etc.
+ //
+ @Override
+ protected Session createGDBSession(ILaunch launch, File executable,
+ IProgressMonitor monitor) throws CoreException {
+
+ ILaunchConfiguration config = launch.getLaunchConfiguration();
+ if (config == null)
+ throw newCoreException("Wow, Failed to get launch configuration from the launch !", null);
+
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(config);
+
+ // The option does not offer value to users. Already removed from UI.
+ boolean startGdbserver = IESboxCDTLaunchConfigurationConstants.START_GDB_SERVER_DEFAULT;
+
+ try {
+ startGdbserver = config.getAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_START_GDB_SERVER,
+ IESboxCDTLaunchConfigurationConstants.START_GDB_SERVER_DEFAULT);
+ } catch (CoreException e) {
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+ errorLogger.logAndShowError("Failed to read GDB launch configuration data", e);
+ }
+
+ // 1. download files
+ //
+ monitor.subTask("Downloading files");
+ downloadFiles(config, new SubProgressMonitor(monitor, 50));
+
+ // 2. Start gdbserver
+ //
+ Process gdbServer = null;
+
+ if (startGdbserver) {
+ monitor.subTask("Starting gdbserver");
+ gdbServer = startGDBServer(config, executable, new SubProgressMonitor(monitor, 50));
+ }
+
+ // 3. Convert "executable" path to Scratchbox one and save off for eventual
+ // call to #getRunArguments().
+ // OLDINFO: as the following call
+ // to super.createGDBSession() will launch gdb, which should be launched
+ // in scratchbox for us. See ESboxMICommandFactory.createMIprocess().
+ try {
+ sboxExePath = sdkTarget.convertHostToTargetPath(new Path(executable.getAbsolutePath()));
+ } catch (ESboxException e) {
+ throw newCoreException("This executable file is not visible in scratchbox: " + executable.getAbsolutePath(), null);
+ }
+
+ // 4. call super to do common part, including launching gdb.
+
+ // Note we need to Kill gdbserver if launching gdb fails.
+ Session s = null;
+ try {
+ // XXX CDTBUG: we pass NULL for the executable because MIPlugin forcibly uses File#getAbsolutePath() on it, which doesn't work for cross-compilation
+ // see #getRunArguments()
+ s = super.createGDBSession(launch, null, monitor);
+ }
+ catch (CoreException e) {
+ throw e;
+ }
+ catch (Exception e) { // unchecked exception
+ throw newCoreException(e);
+ }
+ finally {
+ if (s == null && gdbServer != null) {
+ killGDBServer(config, gdbServer, executable);
+ }
+ }
+
+ return s;
+ }
+
+ protected String[] getRunArguments( ILaunchConfiguration config ) throws CoreException {
+ return new String[]{ getWorkingDirectory( config ), getCommandFile( config ),
+ sboxExePath.toPortableString() };
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2#getCommandFactory(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ protected CommandFactory getCommandFactory(ILaunchConfiguration config)
+ throws CoreException {
+
+ CommandFactory cf = super.getCommandFactory(config);
+
+ // Our CommandFactory needs SDKTarget
+ if (cf instanceof ESboxMICommandFactory) {
+ ((ESboxMICommandFactory)cf).setSDKTarget(ESboxLaunchUtils.getSDKTarget(config));
+ }
+
+ return cf;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.core.GDBServerCDIDebugger2#doStartSession(org.eclipse.debug.core.ILaunch, org.eclipse.cdt.debug.mi.core.cdi.Session, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void doStartSession(ILaunch launch, Session session,
+ IProgressMonitor monitor) throws CoreException {
+
+ super.doStartSession(launch, session, monitor);
+
+ /*
+ * GDB characteristics:
+ * 1) The "step" command only stops at the first
+ * instruction of a source line.
+ * 2) "set step-mode on" This command causes the step command to stop at
+ * the first instruction of a function which contains no debug line
+ * information rather than stepping over it.
+ *
+ * With on-device debug, when we StepIn a function that has no symbol
+ * (e.g. "Hildon::init();"), it takes _long_ time (scores of seconds)
+ * before the stepping finally ends at next source line. That's very bad
+ * experience. So I tried to send "set set-mode on" to gdb so that
+ * Stepping in a function does real StepIn even if the function has no
+ * symbols.
+ *
+ * It works with emulator debug (x86 gdbserver & ARM qemu-arm), but
+ * unfortunately not with on-device debug (arm gdbserver). Seems
+ * it's ARM gdbserver bug.
+ * TODO: revisit when needed.
+ *
+ * ............... LWang. 04/23/08
+ */
+ MISession miSession = getMISession(session);
+ MIGDBSet cmd = miSession.getCommandFactory().createMIGDBSet(new String[]{"step-mode", "on"}); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ miSession.postCommand(cmd);
+ cmd.getMIInfo();
+ } catch (MIException e) {
+ // it's ok even if the command fails.
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Download files for debug, if needed.
+ *
+ * @param config
+ * @param monitor
+ * @throws CoreException
+ */
+ abstract protected void downloadFiles(ILaunchConfiguration config,
+ IProgressMonitor monitor) throws CoreException;
+ /**
+ * Launch gdbserver. Client must implement this.
+ *
+ * @param config
+ * @param executable
+ * @param monitor
+ * @return
+ * @throws CoreException
+ */
+ abstract protected Process startGDBServer(
+ ILaunchConfiguration config,
+ File executable,
+ IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Forcibly kill gdb and its executable (in case they're hung).
+ * @param gdbProcess
+ * @param executable
+ */
+ abstract protected void killGDBServer(ILaunchConfiguration config, Process gdbProcess, File executable);
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxGDBServerLocalDebugger.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxGDBServerLocalDebugger.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxGDBServerLocalDebugger.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Apr 21, 2008
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.cdi.gdb;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.cpp.launch.BaseCDTGDBParameterAccessor;
+import org.maemo.esbox.cpp.launch.CPPLocalLaunchProxy;
+import org.maemo.esbox.launch.core.*;
+
+import java.io.File;
+
+/**
+ * @author LWang.
+ *
+ */
+public class ESboxGDBServerLocalDebugger extends ESBoxGDBServerCDIDebugger2 {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.mi.core.ESBoxGDBServerCDIDebugger2#downloadFiles(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void downloadFiles(ILaunchConfiguration config,
+ IProgressMonitor monitor) throws CoreException {
+ // No download needed for local debug.
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.mi.core.ESBoxGDBServerCDIDebugger2#startGDBServer(org.eclipse.debug.core.ILaunchConfiguration, java.io.File, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected Process startGDBServer(ILaunchConfiguration config,
+ File executable, IProgressMonitor monitor) throws CoreException {
+
+ // Now resort to our launch proxy...08/03/08
+ IGDBParameterAccessor basePA = new BaseCDTGDBParameterAccessor(config);
+ CPPLocalLaunchProxy proxy = new CPPLocalLaunchProxy(config, basePA);
+
+ return proxy.startGDBServer(monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.mi.core.ESBoxGDBServerCDIDebugger2#killGDBServer(java.lang.Process, java.io.File)
+ */
+ @Override
+ protected void killGDBServer(ILaunchConfiguration config, Process gdbProcess, File executable) {
+ gdbProcess.destroy();
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxGDBServerRemoteDebugger.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxGDBServerRemoteDebugger.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxGDBServerRemoteDebugger.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Apr 21, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.cdi.gdb;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.cpp.launch.BaseCDTGDBParameterAccessor;
+import org.maemo.esbox.cpp.launch.CPPRemoteLaunchProxy;
+import org.maemo.esbox.launch.core.IGDBParameterAccessor;
+
+import java.io.File;
+
+/**
+ * Remote (on-device) debug specific operations.
+ *
+ * @author LWang.
+ *
+ */
+public class ESboxGDBServerRemoteDebugger extends ESBoxGDBServerCDIDebugger2 {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.mi.core.ESBoxGDBServerCDIDebugger2#downloadFiles(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void downloadFiles(ILaunchConfiguration config,
+ IProgressMonitor monitor) throws CoreException {
+
+ // Use launch proxy now... 08/03/08
+ getLaunchProxy(config).downloadFiles(monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.mi.core.ESBoxGDBServerCDIDebugger2#startGDBServer(org.eclipse.debug.core.ILaunchConfiguration, java.io.File, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected Process startGDBServer(ILaunchConfiguration config,
+ File executable, IProgressMonitor monitor) throws CoreException {
+
+ // Now resort to our launch proxy...08/03/08
+ return getLaunchProxy(config).startGDBServer(monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.mi.core.ESBoxGDBServerCDIDebugger2#killGDBServer(java.lang.Process, java.io.File)
+ */
+ @Override
+ protected void killGDBServer(ILaunchConfiguration config, Process gdbProcess, File executable) {
+ gdbProcess.destroy();
+
+ // XXX: hack before bug 7152 is fixed
+ try {
+ getLaunchProxy(config).stopGDBServer(executable.getName());
+ } catch (CoreException e) {
+ // ignore
+ }
+ }
+
+ private CPPRemoteLaunchProxy getLaunchProxy(ILaunchConfiguration config) throws CoreException {
+ // don't cache the proxy as a member of the class.
+ IGDBParameterAccessor basePA = new BaseCDTGDBParameterAccessor(config);
+ CPPRemoteLaunchProxy proxy = new CPPRemoteLaunchProxy(config, basePA);
+
+ return proxy;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxMICommandFactory.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxMICommandFactory.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/cpp/launch/cdi/gdb/ESboxMICommandFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Apr 18, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.cdi.gdb;
+
+import org.eclipse.cdt.debug.mi.core.*;
+import org.eclipse.cdt.debug.mi.core.command.factories.linux.StandardLinuxCommandFactory;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+import java.io.*;
+
+/**
+ * This command factory manages both MI commands and the command to start GDB.
+ * The main purpose of the ESbox derive is to start GDB in Scratchbox.
+ *
+ * @author LWang.
+ * @author eswartz Modified to support remote launches
+ *
+ */
+public class ESboxMICommandFactory extends StandardLinuxCommandFactory {
+
+ // This is needed to start GDB in scratchbox.
+ ISDKTarget fSDKTarget = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.core.command.CommandFactory#createMIProcess(java.lang.String[], int, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public MIProcess createMIProcess(String[] args, int launchTimeout,
+ IProgressMonitor monitor) throws IOException {
+ // Start GDB under scratchbox.
+
+ if (fSDKTarget == null)
+ return super.createMIProcess(args, launchTimeout, monitor);
+
+ return new MIProcessAdapter(args, launchTimeout, monitor) {
+ final int ONE_SECOND = 1000;
+ /**
+ * XXX CDTBUG: Override this stupid function which assumes processes are launched locally, and copy the rest of its guts as well.
+ * <p>
+ * Do some basic synchronisation, gdb may take some time to load for
+ * whatever reasons and we need to be able to let the user bailout.
+ *
+ * @param args
+ * @return Process
+ * @throws IOException
+ */
+ protected Process getGDBProcess(String[] args, int launchTimeout, IProgressMonitor monitor) throws IOException {
+ IProcessLauncher launcher = fSDKTarget.getProcessLauncherFactory().createProcessLaunchHandler(
+ null, CommandLineArguments.createFromArray(args),
+ null);
+ Process process;
+ try {
+ process = launcher.createProcess();
+ } catch (ESboxException e1) {
+ throw (IOException) new IOException().initCause(e1);
+ }
+
+ final Process pgdb = process;
+ Thread syncStartup = new Thread("GDB Start") { //$NON-NLS-1$
+ public void run() {
+ try {
+ String line;
+ InputStream stream = pgdb.getInputStream();
+ Reader r = new InputStreamReader(stream);
+ BufferedReader reader = new BufferedReader(r);
+ while ((line = reader.readLine()) != null) {
+ line = line.trim();
+ //System.out.println("GDB " + line);
+ if (line.endsWith("(gdb)")) { //$NON-NLS-1$
+ break;
+ }
+ }
+ } catch (Exception e) {
+ // Do nothing, ignore the errors
+ }
+ }
+ };
+ syncStartup.start();
+
+ int timepass = 0;
+ if (launchTimeout <= 0) {
+ // Simulate we are waiting forever.
+ launchTimeout = Integer.MAX_VALUE;
+ }
+
+ // To respect the IProgressMonitor we can not use wait/notify
+ // instead we have to loop and check for the monitor to allow to cancel the thread.
+ // The monitor is check every 1 second delay;
+ for (timepass = 0; timepass < launchTimeout; timepass += ONE_SECOND) {
+ if (syncStartup.isAlive() && !monitor.isCanceled()) {
+ try {
+ Thread.sleep(ONE_SECOND);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ } else {
+ break;
+ }
+ }
+ try {
+ syncStartup.interrupt();
+ syncStartup.join(ONE_SECOND);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ if (monitor.isCanceled()) {
+ pgdb.destroy();
+ throw new OperationCanceledException();
+ } else if (timepass > launchTimeout) {
+ pgdb.destroy();
+ String message = MIPlugin.getResourceString("src.GDBDebugger.Error_launch_timeout"); //$NON-NLS-1$
+ throw new IOException(message);
+ }
+ return pgdb;
+ }
+
+ };
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.core.command.CommandFactory#getWorkingDirectory(java.io.File)
+ */
+ @Override
+ public String getWorkingDirectory(File cwd) {
+ // This method is supposed to provide "-cd" option for starting gdb.
+ // See implementation of the method in parent.
+ // Special to ESBox: As we'll start GDB in scratchbox, we need to
+ // convert the working directory to Scratchbox path.
+ //
+ if (fSDKTarget != null) {
+ IPath wdInSbox = new Path("");
+ try {
+ wdInSbox = fSDKTarget.convertHostToTargetPath(new Path(cwd.getAbsolutePath()));
+
+ } catch (ESboxException e) {
+ // The Working direcotry is not in scratchbox. Should not happen.
+ // ignore.
+ }
+ return "--cd=" + wdInSbox.toPortableString();
+ } else {
+ return super.getWorkingDirectory(cwd);
+ }
+ }
+
+
+ public void setSDKTarget(ISDKTarget sdkTarget) {
+ fSDKTarget = sdkTarget;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp/launch/cdi/gdb/Activator.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp/launch/cdi/gdb/Activator.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.cdi.gdb/src/org/maemo/esbox/internal/cpp/launch/cdi/gdb/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,130 @@
+package org.maemo.esbox.internal.cpp.launch.cdi.gdb;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.cpp.launch.cdi.gdb";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.classpath
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.classpath (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.cpp.launch.dsf.gdb</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:30:12 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/META-INF/MANIFEST.MF
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox C/C++ Launch DSF GDB Plug-in
+Bundle-SymbolicName: org.maemo.esbox.cpp.launch.dsf.gdb;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.cpp.launch.dsf.gdb.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.cpp.launch;bundle-version="1.5.0",
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.eclipse.cdt.launch;bundle-version="5.0.0",
+ org.eclipse.debug.ui;bundle-version="3.4.0",
+ org.eclipse.dd.dsf;bundle-version="1.1.0",
+ org.eclipse.dd.gdb;bundle-version="1.1.0",
+ org.eclipse.dd.gdb.ui;bundle-version="1.1.0",
+ org.eclipse.cdt.debug.core;bundle-version="5.0.0",
+ org.eclipse.cdt.core;bundle-version="5.0.1"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.cdt.core,
+ org.eclipse.ui
+Export-Package: org.maemo.esbox.cpp.launch.dsf.gdb,
+ org.maemo.esbox.cpp.launch.dsf.gdb.launch,
+ org.maemo.esbox.cpp.launch.dsf.gdb.service,
+ org.maemo.esbox.cpp.launch.dsf.gdb.ui
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/build.properties
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/build.properties (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons/full/obj16/local_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons/full/obj16/local_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons/full/obj16/remote_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/icons/full/obj16/remote_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/plugin.xml
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/plugin.xml (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ class="org.maemo.esbox.cpp.launch.dsf.gdb.ui.LocalLaunchConfigurationTabGroup"
+ id="org.maemo.esbox.debug.dsf.gdb.localLaunchConfigurationTabGroup"
+ type="org.maemo.esbox.debug.dsf.gdb.localLaunchType">
+ </launchConfigurationTabGroup>
+ <launchConfigurationTabGroup
+ class="org.maemo.esbox.cpp.launch.dsf.gdb.ui.RemoteLaunchConfigurationTabGroup"
+ id="org.maemo.esbox.debug.dsf.gdb.remoteLaunchConfigurationTabGroup"
+ type="org.maemo.esbox.debug.dsf.gdb.remoteLaunchType">
+ </launchConfigurationTabGroup>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ configTypeID="org.maemo.esbox.debug.dsf.gdb.localLaunchType"
+ icon="icons/full/obj16/local_obj.png"
+ id="org.maemo.esbox.debug.dsf.gdb.localLaunchTypeImage">
+ </launchConfigurationTypeImage>
+ <launchConfigurationTypeImage
+ configTypeID="org.maemo.esbox.debug.dsf.gdb.remoteLaunchType"
+ icon="icons/full/obj16/remote_obj.png"
+ id="org.maemo.esbox.debug.dsf.gdb.remoteLaunchTypeImage">
+ </launchConfigurationTypeImage>
+ </extension>
+
+ <extension
+ point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ delegate="org.maemo.esbox.cpp.launch.dsf.gdb.launch.LocalLaunchDelegate"
+ id="org.maemo.esbox.debug.dsf.gdb.localLaunchType"
+ modes="run,debug"
+ name="Maemo Local Application (DSF)"
+ public="true"
+ sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+ </launchConfigurationType>
+ <launchConfigurationType
+ delegate="org.maemo.esbox.cpp.launch.dsf.gdb.launch.RemoteLaunchDelegate"
+ id="org.maemo.esbox.debug.dsf.gdb.remoteLaunchType"
+ modes="run,debug"
+ name="Maemo Remote Application (DSF)"
+ public="true"
+ sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+ </launchConfigurationType>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchShortcuts">
+ <shortcut
+ class="org.maemo.esbox.cpp.launch.dsf.gdb.launch.LocalLaunchShortcut"
+ icon="icons/full/obj16/local_obj.png"
+ id="org.maemo.esbox.debug.dsf.gdb.localLaunchShortcut"
+ label="Maemo Local Application (DSF)"
+ modes="run,debug">
+ <contextualLaunch>
+ <enablement>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <and>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.cpp.isCProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isEmulatorTarget">
+ </test>
+ <or>
+ <instanceof
+ value="org.eclipse.cdt.core.model.IBinary">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.cdt.core.model.ICProject">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isExecutable">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isCProject">
+ </test>
+ <and>
+ <instanceof
+ value="org.eclipse.ui.IFileEditorInput">
+ </instanceof>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <adapt
+ type="org.eclipse.cdt.core.model.ICElement">
+ </adapt>
+ </adapt>
+ </and>
+ </or>
+ </and>
+ </iterate>
+ </with>
+ </enablement>
+ <contextLabel
+ label="Maemo Local Application (DSF)"
+ mode="run">
+ </contextLabel>
+ <contextLabel
+ label="Maemo Local Application (DSF)"
+ mode="debug">
+ </contextLabel>
+ </contextualLaunch>
+ </shortcut>
+ <shortcut
+ class="org.maemo.esbox.cpp.launch.dsf.gdb.launch.RemoteLaunchShortcut"
+ icon="icons/full/obj16/remote_obj.png"
+ id="org.maemo.esbox.debug.dsf.gdb.remoteLaunchShortcut"
+ label="Maemo Remote Application (DSF)"
+ modes="run,debug">
+ <contextualLaunch>
+ <enablement>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <and>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.cpp.isCProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isRemoteTarget">
+ </test>
+ <or>
+ <instanceof
+ value="org.eclipse.cdt.core.model.IBinary">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.cdt.core.model.ICProject">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isExecutable">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isCProject">
+ </test>
+ <and>
+ <instanceof
+ value="org.eclipse.ui.IFileEditorInput">
+ </instanceof>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <adapt
+ type="org.eclipse.cdt.core.model.ICElement">
+ </adapt>
+ </adapt>
+ </and>
+ </or>
+ </and>
+ </iterate>
+ </with>
+ </enablement>
+ <contextLabel
+ label="Maemo Remote Application (DSF)"
+ mode="run">
+ </contextLabel>
+ <contextLabel
+ label="Maemo Remote Application (DSF)"
+ mode="debug">
+ </contextLabel>
+ </contextualLaunch>
+ </shortcut>
+ </extension>
+</plugin>
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/DsfLaunchConfigurationData.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/DsfLaunchConfigurationData.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/DsfLaunchConfigurationData.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jun 26, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.maemo.esbox.cpp.launch.CppLaunchConfigurationData;
+
+/**
+ * @author LWang.
+ *
+ */
+public class DsfLaunchConfigurationData extends CppLaunchConfigurationData {
+
+ static public void setDefaults(ILaunchConfigurationWorkingCopy configuration, String configTypeID) {
+
+ // DSF debugger specific.
+
+ // Currently use this for both emulator and device debug.
+ configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID,
+ DEBUGGER_ID_DD_GDBSERVERDEBUGGER);
+ configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+ IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
+
+ //---------- Maemo Local debug specific --------------------------------
+ //
+ if (configTypeID.equals(CONFIG_TYPE_MAEMOLOCAL_DSF)) {
+ // default: debug over TCP/IP with GDB communicating with gdbserver in emulator.
+ // Note: these attribute keys are from DSF, see
+ // org.eclipse.dd.gdb.internal.ui.launching.TCPSettingsBlock
+ // vs. counterpart from CDT.
+ //
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, true );
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, DEFAULT_LOCAL_HOST);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, DEFAULT_GDBSERVER_PORT_NUMBER);
+ }
+
+ //---------- Maemo Remote debug specific --------------------------------
+ //
+ else if (configTypeID.equals(CONFIG_TYPE_MAEMOREMOTE_DSF)) {
+ // default: debug over TCP/IP with GDB communicating with gdbserver.
+ //
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, true );
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, DEFAULT_TARGET_NAME);
+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, DEFAULT_GDBSERVER_PORT_NUMBER);
+ }
+
+ // Now call ESBox counterpart to do the common stuff.
+ CppLaunchConfigurationData.setDefaults(configuration, configTypeID);
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/BaseDSFGDBParameterAccessor.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/BaseDSFGDBParameterAccessor.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/BaseDSFGDBParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jun 19, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.cpp.launch.BaseCDTGDBParameterAccessor;
+import org.maemo.esbox.internal.cpp.launch.dsf.gdb.Activator;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Base implementation of {@link IGDBLaunchParameterAccessor} for DSF GDB. Note
+ * the only thing special for DSF (vs. CDI) is some options are from DSF specific
+ * launch configuration tab.<br>
+ * <br>
+ *
+ * @author LWang
+ */
+public class BaseDSFGDBParameterAccessor extends BaseCDTGDBParameterAccessor {
+
+
+ public BaseDSFGDBParameterAccessor(ILaunchConfiguration lc) {
+ super(lc);
+ }
+
+ @Override
+ protected String getPluginID() {
+ return Activator.getUniqueIdentifier();
+ }
+
+
+ public boolean autoLoadSharedLibrary() {
+ if (fAutoLoadSharedLib == null) {
+ boolean autolib = false; // default.
+ try {
+ autolib = getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB,
+ IGDBLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT);
+ } catch (CoreException e) {
+ }
+
+ fAutoLoadSharedLib = autolib;
+ }
+
+ return fAutoLoadSharedLib.booleanValue();
+ }
+
+ protected IPath getGDBPath() {
+ IPath retVal = new Path(IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
+ try {
+ retVal = new Path(getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
+ IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT));
+ } catch (CoreException e) {
+ }
+ return retVal;
+ }
+
+ public List<String> getGDBCommandLine() {
+ if (fGdbCommandLine == null)
+ {
+ fGdbCommandLine = new ArrayList<String>();
+
+ // The goal here is to keep options to an absolute minimum.
+ // All configuration should be done in the launch sequence
+ // to allow for easy overriding.
+ fGdbCommandLine.add(getGDBPath().toOSString());
+ fGdbCommandLine.add("--interpreter"); //$NON-NLS-1$
+ fGdbCommandLine.add("mi"); //$NON-NLS-1$
+ // Don't read the gdbinit file here. It is read explicitly in
+ // the LaunchSequence to make it easier to customize.
+ fGdbCommandLine.add("--nx"); //$NON-NLS-1$
+ }
+
+ return fGdbCommandLine;
+ }
+
+ public String getGDBInitFile() throws CoreException {
+ if (fGDBInitFile == null) {
+ fGDBInitFile = getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, ""); //$NON-NLS-1$
+ }
+
+ return fGDBInitFile;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<String> getSharedLibraryPaths() throws CoreException {
+ if (fSharedLibPaths == null) {
+ fSharedLibPaths = getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH,
+ new ArrayList<String>(0));
+ }
+
+ return fSharedLibPaths;
+ }
+
+ public boolean debuggerConnectionIsTCP() throws CoreException {
+ try {
+ return getLaunchConfiguration().getAttribute(
+ IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
+ true);
+ }
+ catch (Exception e) {
+ throw newCoreException("Failed to get target connection type.");
+ }
+ }
+
+ public String getTargetIPAddress() throws CoreException {
+ try {
+ return getLaunchConfiguration().getAttribute(
+ IGDBLaunchConfigurationConstants.ATTR_HOST,
+ IESboxCDTLaunchConfigurationConstants.DEFAULT_TARGET_NAME );
+ }
+ catch (Exception e) {
+ throw newCoreException("Failed to get target IP address.");
+ }
+ }
+
+ public int getTargetIPPort() throws CoreException {
+ try {
+ return Integer.parseInt(getLaunchConfiguration().getAttribute(
+ IGDBLaunchConfigurationConstants.ATTR_PORT,
+ IESboxCDTLaunchConfigurationConstants.DEFAULT_GDBSERVER_PORT_NUMBER ));
+ }
+ catch (Exception e) {
+ throw newCoreException("Failed to get target TCP/IP port number.");
+ }
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/ESboxGDBLauncher.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/ESboxGDBLauncher.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/ESboxGDBLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jun 19, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.dd.gdb.internal.provisional.launching.BaseGDBLauncher;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.ESboxException;
+
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.cpp.launch.dsf.gdb.Activator;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * GDB parameters retrieved from a launch configuration but converted to
+ * Scratchbox relative.
+ *
+ */
+public class ESboxGDBLauncher extends BaseGDBLauncher {
+
+ private ISDKTarget fSDKTarget = null;
+
+ private List<String> fSboxGdbCommandLine;
+
+ private IPath fSboxProgramPath;
+
+ private IPath fSboxGDBWorkingDirectory;
+
+ private String fSboxGDBInitFile;
+
+ private List<String> fSboxSharedLibPaths;
+
+ public ESboxGDBLauncher(ILaunchConfiguration lc, IPath exePath) {
+ super(lc, exePath);
+
+ fSDKTarget = ESboxLaunchUtils.getSDKTarget(lc);
+ }
+
+ @Override
+ public List<String> getGDBCommandLine() {
+ if (fSboxGdbCommandLine == null) {
+ List<String> cmdLine = super.getGDBCommandLine();
+
+ // covert the command line so that gdb will be launched in Scratchbox.
+ //
+ if (fSDKTarget != null) {
+ IProcessLauncherFactory factory = fSDKTarget.getProcessLauncherFactory();
+ IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(factory, null, cmdLine);
+ cmdLine = launcher.getLaunchCommandArguments();
+ }
+
+ fSboxGdbCommandLine = cmdLine;
+ }
+
+ return fSboxGdbCommandLine;
+ }
+
+ @Override
+ public String getGDBInitFile() throws CoreException {
+ // init file, if any, needs be accessible from scratchbox.
+ if (fSboxGDBInitFile == null) {
+ String initFile = super.getGDBInitFile();
+ if (initFile != null && initFile.length() > 0)
+ fSboxGDBInitFile = convertToSboxPath(initFile);
+ }
+
+ return fSboxGDBInitFile;
+ }
+
+ @Override
+ public IPath getWorkingDirectory() throws CoreException {
+ if (fSboxGDBWorkingDirectory == null)
+ fSboxGDBWorkingDirectory = convertToSboxPath(super.getWorkingDirectory());
+
+ return fSboxGDBWorkingDirectory;
+ }
+
+ @Override
+ public IPath getProgramPath() {
+ if (fSboxProgramPath == null)
+ fSboxProgramPath = convertToSboxPath(super.getProgramPath());
+
+ return fSboxProgramPath;
+ }
+
+ @Override
+ public List<String> getSharedLibraryPaths() throws CoreException {
+ if (fSboxSharedLibPaths == null) {
+ List<String> basePaths = super.getSharedLibraryPaths();
+
+ fSboxSharedLibPaths = new ArrayList<String>(basePaths.size());
+
+ for (String p : basePaths)
+ fSboxSharedLibPaths.add(convertToSboxPath(p));
+ }
+
+ return fSboxSharedLibPaths;
+ }
+
+ /**
+ * Convert a path in host file system to a path in Scratchbox.
+ *
+ * @param p
+ * @return
+ */
+ private IPath convertToSboxPath(IPath p) {
+ if (fSDKTarget != null && p != null && p.isAbsolute()) {
+ try {
+ p = fSDKTarget.convertHostToTargetPath(p);
+ } catch (ESboxException e) {
+ // ignore.
+ }
+ }
+
+ return p;
+ }
+
+ private String convertToSboxPath(String p) {
+ if (p == null)
+ return p;
+
+ IPath pa = new Path(p);
+
+ pa = convertToSboxPath(pa);
+
+ return pa.toPortableString();
+ }
+
+ @Override
+ public Process launchGDB() throws CoreException {
+ List<String> cmdLine = super.getGDBCommandLine();
+
+ String message = null;
+
+ // Launch the base GDB command line in Scratchbox.
+ //
+ if (fSDKTarget != null) {
+ IProcessLauncherFactory factory = fSDKTarget.getProcessLauncherFactory();
+ IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(factory, null, cmdLine);
+ try {
+ return launcher.createProcess();
+ } catch (ESboxException e) {
+ message = "Error launching GDB in scratchbox";
+ throw new CoreException(Activator.createErrorStatus(message, e));
+ }
+ }
+ else {
+ message = "The project is not a Scratchbox project";
+ throw new CoreException(Activator.createErrorStatus(message, null));
+ }
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/LocalLaunchDelegate.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/LocalLaunchDelegate.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/LocalLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. May 14, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.dd.dsf.concurrent.Sequence;
+import org.eclipse.dd.gdb.internal.provisional.launching.*;
+import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
+import org.eclipse.debug.core.*;
+import org.maemo.esbox.cpp.launch.CPPLocalLaunchProxy;
+import org.maemo.esbox.cpp.launch.dsf.gdb.service.LocalServicesLaunchSequence;
+import org.maemo.esbox.launch.core.IGDBParameterAccessor;
+import org.maemo.esbox.launch.core.ILaunchProxy;
+
+
+/**
+ * @author LWang
+ *
+ */
+public class LocalLaunchDelegate extends GdbLaunchDelegate {
+
+ private ILaunchProxy fLaunchProxy = null;
+
+ protected ILaunchProxy createLaunchProxy(ILaunchConfiguration configuration) throws CoreException {
+ // This is DSF GDB launch configuration.
+ IGDBParameterAccessor original = new BaseDSFGDBParameterAccessor(configuration);
+
+ return new CPPLocalLaunchProxy(configuration, original);
+ }
+
+ @Override
+ public boolean preLaunchCheck(ILaunchConfiguration config, String mode,
+ IProgressMonitor monitor) throws CoreException {
+ // Common check
+ if (! super.preLaunchCheck(config, mode, monitor))
+ return false;
+
+ fLaunchProxy = createLaunchProxy(config);
+
+ return fLaunchProxy.preLaunchCheck(mode, monitor);
+ }
+
+ @Override
+ public boolean finalLaunchCheck(ILaunchConfiguration configuration,
+ String mode, IProgressMonitor monitor) throws CoreException {
+
+ if (! super.finalLaunchCheck(configuration, mode, monitor))
+ return false;
+
+ assert(configuration.equals(fLaunchProxy.getLaunchConfiguration()));
+
+ return fLaunchProxy.finalLaunchCheck(mode, monitor);
+ }
+
+ // Override just to add Run support which is not supported by DSF at this moment.
+ // ............. LWang. 07/10/08
+ @Override
+ public void launch(ILaunchConfiguration config, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
+
+ if (mode.equals(ILaunchManager.DEBUG_MODE))
+ super.launch(config, mode, launch, monitor);
+ else if (mode.equals(ILaunchManager.RUN_MODE)) {
+ if ( monitor == null ) {
+ monitor = new NullProgressMonitor();
+ }
+
+ runApplication( config, launch, monitor );
+ }
+ }
+
+ protected void runApplication(ILaunchConfiguration config, ILaunch launch,
+ IProgressMonitor monitor) throws CoreException {
+
+ assert(config.equals(fLaunchProxy.getLaunchConfiguration()));
+
+ fLaunchProxy.runApplication(launch, monitor);
+ }
+
+ // This override is intended for our special operations on launch
+ // such as downloading and starting gdbserver.
+ //
+ @Override
+ protected Sequence getServiceLaunchSequence(GdbLaunch launch, IGDBLauncher gdbParameters, SessionType type, boolean attach) {
+ return new LocalServicesLaunchSequence(launch.getSession(), launch, gdbParameters, type, attach);
+ }
+
+ @Override
+ protected IGDBLauncher getGDBLauncher(ILaunchConfiguration config,
+ IPath exePath) {
+ return new ESboxGDBLauncher(config, exePath);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/LocalLaunchShortcut.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/LocalLaunchShortcut.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/LocalLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 9, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb.launch;
+
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.ILaunchShortcut;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.cpp.launch.AbstractLaunchShortcut;
+import org.maemo.esbox.cpp.launch.dsf.gdb.DsfLaunchConfigurationData;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+import java.text.MessageFormat;
+
+/**
+ * @author LWang.
+ *
+ */
+public class LocalLaunchShortcut extends AbstractLaunchShortcut implements
+ ILaunchShortcut {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.launch.AbstractLaunchShortcut#createLaunchConfigurationName(java.lang.String, org.eclipse.cdt.core.model.ICProject)
+ */
+ @Override
+ protected String createLaunchConfigurationName(String binFileName,
+ ICProject project) throws CoreException {
+
+ String format = "{0} ({1}-local-DSF)";
+
+ String configName = binFileName;
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(project.getProject());
+
+ if (sdkTarget != null) {
+ configName = MessageFormat.format(format, binFileName, sdkTarget.getName());
+ }
+
+ return configName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.launch.AbstractLaunchShortcut#getCLaunchConfigType()
+ */
+ @Override
+ protected ILaunchConfigurationType getCLaunchConfigType() {
+ return getLaunchManager().getLaunchConfigurationType(IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOLOCAL_DSF);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.launch.AbstractLaunchShortcut#setDefaultForLaunchConfiguration(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ protected void setDefaultForLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy config) throws CoreException {
+ DsfLaunchConfigurationData.setDefaults(config, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOLOCAL_DSF);
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchDelegate.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchDelegate.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. May 15, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb.launch;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.dd.dsf.concurrent.Sequence;
+import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
+import org.eclipse.dd.gdb.internal.provisional.launching.IGDBLauncher;
+import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.cpp.launch.CPPRemoteLaunchProxy;
+import org.maemo.esbox.cpp.launch.dsf.gdb.service.RemoteServicesLaunchSequence;
+import org.maemo.esbox.launch.core.IGDBParameterAccessor;
+import org.maemo.esbox.launch.core.ILaunchProxy;
+
+
+/**
+ * For remote launch. Need downloading file in the LaunchSequence.
+ */
+public class RemoteLaunchDelegate extends LocalLaunchDelegate {
+
+ protected ILaunchProxy createLaunchProxy(ILaunchConfiguration configuration) throws CoreException {
+ // This is DSF GDB launch configuration.
+ IGDBParameterAccessor original = new BaseDSFGDBParameterAccessor(configuration);
+
+ return new CPPRemoteLaunchProxy(configuration, original);
+ }
+
+ @Override
+ protected Sequence getServiceLaunchSequence(GdbLaunch launch, IGDBLauncher gdbParameters, SessionType type, boolean attach) {
+ return new RemoteServicesLaunchSequence(launch.getSession(), launch, gdbParameters, type, attach);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchShortcut.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchShortcut.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 9, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb.launch;
+
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.ILaunchShortcut;
+import org.eclipse.jface.window.Window;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.cpp.launch.AbstractLaunchShortcut;
+import org.maemo.esbox.cpp.launch.dsf.gdb.DsfLaunchConfigurationData;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+import org.maemo.esbox.launch.ui.DownloadMethodSelectionDialog;
+
+import java.text.MessageFormat;
+
+/**
+ * @author LWang.
+ *
+ */
+public class RemoteLaunchShortcut extends AbstractLaunchShortcut implements
+ ILaunchShortcut {
+
+ private String fDownloadMethod = null;
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.launch.AbstractLaunchShortcut#createLaunchConfigurationName(java.lang.String, org.eclipse.cdt.core.model.ICProject)
+ */
+ @Override
+ protected String createLaunchConfigurationName(String binFileName,
+ ICProject project) throws CoreException {
+
+ fDownloadMethod = chooseDownloadMethod();
+ if (fDownloadMethod == null || fDownloadMethod.length() == 0)
+ throw new CoreException(Status.CANCEL_STATUS);
+
+ // binName (SDKTargetName-DownloadMethodNaem)
+ String format = "{0} ({1}-{2} DSF)"; //$NON-NLS-1$
+
+ String configName = binFileName;
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(project.getProject());
+
+ if (sdkTarget == null)
+ return configName;
+
+ configName = MessageFormat.format(format,
+ binFileName,
+ sdkTarget.getName(),
+ fDownloadMethod.contains("SSH") ? "SSH" : "SBRSH");
+
+ return configName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.launch.AbstractLaunchShortcut#getCLaunchConfigType()
+ */
+ @Override
+ protected ILaunchConfigurationType getCLaunchConfigType() {
+ return getLaunchManager().getLaunchConfigurationType(IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOREMOTE_DSF);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.launch.AbstractLaunchShortcut#setDefaultForLaunchConfiguration(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ protected void setDefaultForLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy config) throws CoreException {
+ DsfLaunchConfigurationData.setDefaults(config, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOREMOTE_DSF);
+ }
+
+ /**
+ * Dialog asking user to choose the download method for remote debug.
+ *
+ * @return String -- download method.
+ */
+ private String chooseDownloadMethod() {
+ DownloadMethodSelectionDialog dialog = new DownloadMethodSelectionDialog(getShell());
+ if (dialog.open() == Window.OK) {
+ Object[] result = dialog.getResult();
+ if(result.length > 0) {
+ return (String)result[0];
+ }
+ }
+ return null;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/ESboxFinalLaunchSequence.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/ESboxFinalLaunchSequence.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/ESboxFinalLaunchSequence.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jun 17, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb.service;
+
+import org.eclipse.dd.dsf.concurrent.DsfExecutor;
+import org.eclipse.dd.gdb.internal.provisional.launching.FinalLaunchSequence;
+import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
+import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
+
+/**
+ * @author LWang.
+ *
+ */
+public class ESboxFinalLaunchSequence extends FinalLaunchSequence {
+
+ public ESboxFinalLaunchSequence(DsfExecutor executor, GdbLaunch launch,
+ SessionType sessionType, boolean attach) {
+ super(executor, launch, sessionType, attach);
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/LocalServicesLaunchSequence.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/LocalServicesLaunchSequence.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/LocalServicesLaunchSequence.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. May 14, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb.service;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.dd.dsf.concurrent.RequestMonitor;
+import org.eclipse.dd.dsf.service.DsfSession;
+import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
+import org.eclipse.dd.gdb.internal.provisional.launching.IGDBLauncher;
+import org.eclipse.dd.gdb.internal.provisional.launching.ServicesLaunchSequence;
+import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.cpp.launch.CPPLocalLaunchProxy;
+import org.maemo.esbox.cpp.launch.dsf.gdb.launch.BaseDSFGDBParameterAccessor;
+import org.maemo.esbox.internal.cpp.launch.dsf.gdb.Activator;
+import org.maemo.esbox.launch.core.IGDBParameterAccessor;
+
+
+/**
+ * This subclass is mainly for starting our own ESboxGDBControl that will start GDB
+ * in Scratchbox.
+ * Also I put the extra two steps downloading and starting gdbserver in the sequence.
+ *
+ * @author LWang
+ *
+ */
+public class LocalServicesLaunchSequence extends ServicesLaunchSequence {
+
+ private Step fSteps[] = null;
+ protected ILaunchConfiguration fLaunchConfig;
+ protected IGDBLauncher fGDBParameters;
+
+ /**
+ * @param session
+ * @param launch
+ * @param execPath
+ */
+ public LocalServicesLaunchSequence(DsfSession session, GdbLaunch launch,
+ IGDBLauncher gdbParameters, SessionType type, boolean attach) {
+ super(session, launch, gdbParameters, type, attach);
+
+ fLaunchConfig = launch.getLaunchConfiguration();
+ fGDBParameters = gdbParameters;
+ }
+
+ @Override
+ public Step[] getSteps() {
+ if (fSteps == null) {
+ Step[] fExtraSteps = new Step[] {
+ new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ try {
+ downloadFiles(fLaunchConfig, getProgressMonitor());
+ } catch (CoreException e) {
+ requestMonitor.setStatus(e.getStatus());
+ }
+ requestMonitor.done();
+ }
+ },
+ new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ // start gdbserver
+ try {
+ startGDBServer(fLaunchConfig, fGDBParameters, getProgressMonitor());
+ } catch (CoreException e) {
+ requestMonitor.setStatus(e.getStatus());
+ }
+
+ requestMonitor.done();
+ }},
+ };
+
+ Step[] superSteps = super.getSteps();
+ fSteps = new Step[superSteps.length + fExtraSteps.length];
+
+ System.arraycopy(fExtraSteps, 0, fSteps, 0, fExtraSteps.length);
+ System.arraycopy(superSteps, 0, fSteps, fExtraSteps.length, superSteps.length);
+ }
+
+ return fSteps;
+ }
+
+ /**
+ * Download files for debug, if needed.
+ *
+ * @param config
+ * @param monitor
+ * @throws CoreException
+ */
+ protected void downloadFiles(ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
+ // do nothing for local debug.
+ }
+
+ /**
+ * @param config
+ * @param executable - path of the executable in Scratchbox
+ * @param monitor
+ * @return
+ * @throws CoreException
+ */
+ protected Process startGDBServer(ILaunchConfiguration config,
+ IGDBLauncher gdbParameters, IProgressMonitor monitor) throws CoreException {
+
+
+ // Now resort to our launch proxy...08/03/08
+ IGDBParameterAccessor basePA = new BaseDSFGDBParameterAccessor(config);
+ CPPLocalLaunchProxy proxy = new CPPLocalLaunchProxy(config, basePA);
+
+ return proxy.startGDBServer(monitor);
+ }
+
+ protected CoreException newCoreException( String message, Throwable exception ) {
+ int code = ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR;
+ String ID = Activator.getUniqueIdentifier();
+ MultiStatus status = new MultiStatus( ID, code, message, exception );
+ status.add( new Status( IStatus.ERROR, ID, code, exception == null ? new String() : exception.getLocalizedMessage(), exception ) );
+ return new CoreException( status );
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/RemoteServicesLaunchSequence.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/RemoteServicesLaunchSequence.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/service/RemoteServicesLaunchSequence.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. May 15, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb.service;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.dd.dsf.service.DsfSession;
+import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
+import org.eclipse.dd.gdb.internal.provisional.launching.IGDBLauncher;
+import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.cpp.launch.CPPRemoteLaunchProxy;
+import org.maemo.esbox.cpp.launch.dsf.gdb.launch.BaseDSFGDBParameterAccessor;
+import org.maemo.esbox.launch.core.IGDBParameterAccessor;
+
+/**
+ * @author LWang
+ *
+ */
+public class RemoteServicesLaunchSequence extends LocalServicesLaunchSequence {
+
+ public RemoteServicesLaunchSequence(DsfSession session, GdbLaunch launch,
+ IGDBLauncher gdbParameters, SessionType type, boolean attach) {
+ super(session, launch, gdbParameters, type, attach);
+ }
+
+ @Override
+ protected void downloadFiles(ILaunchConfiguration config,
+ IProgressMonitor monitor) throws CoreException {
+
+ // Use launch proxy now... 08/03/08
+ getLaunchProxy(config).downloadFiles(monitor);
+ }
+
+ @Override
+ protected Process startGDBServer(ILaunchConfiguration config,
+ IGDBLauncher gdbParameters, IProgressMonitor monitor) throws CoreException {
+
+ // Now resort to our launch proxy...08/03/08
+ return getLaunchProxy(config).startGDBServer(monitor);
+ }
+
+ private CPPRemoteLaunchProxy getLaunchProxy(ILaunchConfiguration config) throws CoreException {
+ IGDBParameterAccessor basePA = new BaseDSFGDBParameterAccessor(config);
+ CPPRemoteLaunchProxy proxy = new CPPRemoteLaunchProxy(config, basePA);
+
+ return proxy;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/ui/LocalLaunchConfigurationTabGroup.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/ui/LocalLaunchConfigurationTabGroup.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/ui/LocalLaunchConfigurationTabGroup.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. May 15, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb.ui;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.launch.ui.CArgumentsTab;
+import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
+import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
+import org.eclipse.dd.gdb.internal.ui.launching.CDebuggerTab;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+import org.maemo.esbox.cpp.launch.dsf.gdb.DsfLaunchConfigurationData;
+import org.maemo.esbox.cpp.launch.ui.ESboxCMainTab;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+
+
+/**
+ * @author LWang
+ *
+ */
+public class LocalLaunchConfigurationTabGroup extends
+ AbstractLaunchConfigurationTabGroup {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new ESboxCMainTab(),
+ new CArgumentsTab(),
+ new EnvironmentTab(),
+ new CDebuggerTab(SessionType.REMOTE, false), // note this is from org.eclipse.dd.gdb.ui, not the CDT one.
+ new SourceLookupTab(),
+ new CommonTab()
+ };
+ setTabs(tabs);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // This delegate to all tabs in the group by default
+ super.setDefaults(configuration);
+
+ // For ESbox debugger, we are using gdbserver thus deemed "remote".
+ configuration.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
+
+ DsfLaunchConfigurationData.setDefaults(configuration, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOLOCAL_DSF);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/ui/RemoteLaunchConfigurationTabGroup.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/ui/RemoteLaunchConfigurationTabGroup.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/ui/RemoteLaunchConfigurationTabGroup.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. May 15, 2008
+ *******************************************************************************/
+package org.maemo.esbox.cpp.launch.dsf.gdb.ui;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.launch.ui.CArgumentsTab;
+import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
+import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
+import org.eclipse.dd.gdb.internal.ui.launching.CDebuggerTab;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+import org.maemo.esbox.cpp.launch.dsf.gdb.DsfLaunchConfigurationData;
+import org.maemo.esbox.cpp.launch.ui.ESboxCMainTab;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
+import org.maemo.esbox.launch.ui.ESboxDownloadTab;
+
+
+/**
+ * @author LWang
+ *
+ */
+public class RemoteLaunchConfigurationTabGroup extends
+ AbstractLaunchConfigurationTabGroup {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new ESboxCMainTab(),
+ new CArgumentsTab(),
+ new EnvironmentTab(),
+ new CDebuggerTab(SessionType.REMOTE, false), // note this is from org.eclipse.dd.gdb.ui, not the CDT one.
+ new ESboxDownloadTab(),
+ new SourceLookupTab(),
+ new CommonTab()
+ };
+ setTabs(tabs);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // This delegate to all tabs in the group by default
+ super.setDefaults(configuration);
+
+ // For ESbox DSF debugger, we need this.
+ configuration.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
+
+ DsfLaunchConfigurationData.setDefaults(configuration, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOREMOTE_DSF);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp/launch/dsf/gdb/Activator.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp/launch/dsf/gdb/Activator.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/internal/cpp/launch/dsf/gdb/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,144 @@
+package org.maemo.esbox.internal.cpp.launch.dsf.gdb;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.debug.dsf.gdb";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ if (getDefault() == null) {
+ // If the default instance is not yet initialized,
+ // return a static identifier. This identifier must
+ // match the plugin id defined in plugin.xml
+ return PLUGIN_ID;
+ }
+ return getDefault().getBundle().getSymbolicName();
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.core
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/.classpath
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/.classpath (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.cpp.project.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:27:16 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox C/C++ Project Core
+Bundle-SymbolicName: org.maemo.esbox.cpp.project.core;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.cpp.project.core.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.eclipse.core.expressions;bundle-version="3.4.0",
+ org.eclipse.cdt.core;bundle-version="5.0.1",
+ org.eclipse.cdt.make.core;bundle-version="5.0.1",
+ org.eclipse.core.variables;bundle-version="3.2.100",
+ org.eclipse.cdt.managedbuilder.core;bundle-version="5.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.cpp.project.core
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/build.properties
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/build.properties (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/plugin.xml
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/plugin.xml (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.maemo.esbox.cpp.project.core.ESboxCppPropertyTester"
+ id="org.maemo.esbox.cpp.project.core.PropertyTester"
+ namespace="org.maemo.esbox.cpp"
+ properties="isCProject,isOldESboxProject"
+ type="org.eclipse.core.runtime.IAdaptable">
+ </propertyTester>
+ </extension>
+
+ <extension
+ id="ESboxCConfigurationDataProvider"
+ point="org.eclipse.cdt.core.CConfigurationDataProvider">
+ <provider
+ class="org.maemo.esbox.cpp.project.core.cdt.ESboxCConfigurationDataProvider"
+ conflictingNatures="com.nokia.carbide.cdt.builder.carbideCPPBuilderNature;org.indt.esbox.core.ESboxNature;org.maemo.esbox.python.project.core.ESboxPythonNature"
+ natures="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </provider>
+ </extension>
+ <!--
+ <extension
+ point="org.eclipse.cdt.ui.ConfigManager">
+ <manager
+ class="org.maemo.esbox.internal.project.ui.ESboxConfigManager">
+ </manager>
+ </extension>
+ -->
+ <extension
+ id="ESboxCppNature"
+ name="ESbox C/C++ Project Nature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+ class="org.maemo.esbox.cpp.project.core.ESboxCppProjectNature">
+ </run>
+ </runtime>
+ <requires-nature
+ id="org.eclipse.cdt.core.cnature">
+ </requires-nature>
+ <builder
+ id="org.maemo.esbox.cpp.project.core.esboxAutotoolsBuilder">
+ </builder>
+ </extension>
+ <extension
+ id="org.maemo.esbox.cpp.project.core.esboxAutotoolsBuilder"
+ name="ESbox Autotools Project Builder"
+ point="org.eclipse.core.resources.builders">
+ <builder
+ callOnEmptyDelta="false"
+ hasNature="true">
+ <run
+ class="org.maemo.esbox.cpp.project.core.ESboxAutotoolsBuilder">
+ </run>
+ </builder>
+ </extension>
+ <extension id="esboxmake" name="CDT Makefile Builder under Scratchbox"
+ point="org.eclipse.cdt.core.CProject">
+ <cproject class="org.eclipse.cdt.make.internal.core.MakeProject"
+ natureID="org.maemo.esbox.cpp.project.core.ESboxCppNature"/>
+ </extension>
+ <extension
+ id="projectType.cpp"
+ name="C/C++ Project"
+ point="org.maemo.esbox.project.core.projectType">
+ <projectType
+ class="org.maemo.esbox.cpp.project.core.ESboxCppProjectType">
+ </projectType>
+ </extension>
+
+</plugin>
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/CdtConfigurationPropertyAccess.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/CdtConfigurationPropertyAccess.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/CdtConfigurationPropertyAccess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICStorageElement;
+import org.eclipse.core.runtime.CoreException;
+import org.maemo.esbox.core.IPersistentPropertyAccess;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+
+/**
+ * This represents the properties stored with a build configuration.
+ * This implementation does <b>not</b> persist properties on its own; it relies
+ * on the caller (who holds the {@link ICConfigurationDescription}) to do that.
+ * @author eswartz
+ *
+ */
+public class CdtConfigurationPropertyAccess implements IPersistentPropertyAccess {
+
+ private ICConfigurationDescription des;
+ private String storageId;
+
+ /**
+ *
+ */
+ public CdtConfigurationPropertyAccess(ICConfigurationDescription des, String category) {
+ this.des = des;
+ this.storageId = category;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.ESboxProjectProperties.IPropertyAccess#read(java.lang.String)
+ */
+ public String read(String propertyId) {
+ ICStorageElement storage = findOrCreateStorage();
+ if (storage != null)
+ return storage.getAttribute(propertyId);
+ else
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.ESboxProjectProperties.IPropertyAccess#write(java.lang.String, java.lang.String)
+ */
+ public void write(String propertyId, String value) {
+ ICStorageElement storage = findOrCreateStorage();
+ if (storage != null)
+ storage.setAttribute(propertyId, value);
+ }
+
+ /**
+ * Return the storage for the given resource
+ * @return storage element or <code>null</code> for serious error
+ */
+ private ICStorageElement findOrCreateStorage() {
+ ICStorageElement storage = null;
+ try {
+ // create if needed; we have conversion elsewhere
+ storage = des.getStorage(storageId, true);
+ } catch (CoreException e1) {
+ Activator.getErrorLogger().logError("Error retrieving CDT configuration property storage", e1);
+ }
+ return storage;
+ }
+
+}
\ No newline at end of file
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ConfigurationPropertyCategories.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ConfigurationPropertyCategories.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ConfigurationPropertyCategories.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+/**
+ * Categories to store settings.
+ * @author eswartz
+ *
+ */
+public abstract class ConfigurationPropertyCategories {
+ public static final String BUILD_CONFIG = "buildConfig";
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/CppScriptLauncher.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/CppScriptLauncher.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/CppScriptLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,558 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.*;
+
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+import org.maemo.esbox.project.core.ProjectManager;
+
+import java.io.*;
+import java.util.List;
+
+/**
+ * Common launchers for scripts used in C/C++
+ * @author kosola
+ * @author Raul Fernandes Herbster
+ * @author eswartz
+ */
+public class CppScriptLauncher {
+
+ private static CppScriptLauncher singleton = null;
+
+ /**
+ * Constructor
+ */
+ private CppScriptLauncher() {
+ }
+
+ public static synchronized CppScriptLauncher getInstance() {
+ if (singleton == null)
+ singleton = new CppScriptLauncher();
+ return singleton;
+ }
+
+ /**
+ * Kill all instances of a given process
+ * @param processName executable name
+ * @param processLabel the user-visible name for the process
+ * @throws ScratchboxException
+ */
+ public void killProcess(IMachine machine, String processName, String processLabel) throws ESboxException {
+
+ List<IProcess> processes = machine.getProcessLister().getProcesses(new ProcessFilterCmdLineRegexp(".*" + processName + ".*"));
+ for (IProcess process : processes) {
+ try {
+ process.terminate();
+ } catch (IOException e) {
+ throw new ESboxException("Error killing " + processName, e);
+ }
+ }
+ }
+
+ /**
+ * Method that run command autogen.sh for the project
+ * @param project
+ * @throws ESboxException
+ */
+ public void runAutogen(IProject project) throws ESboxException {
+ runAutogen(project, null, null);
+ }
+
+ /**
+ * Method that runs command autogen.sh and waits if a progress monitor
+ * is supplied.
+ *
+ * @param project
+ * @param monitor if null, do not wait; else wait and report progress through the monitor
+ * @param path if <code>null</code> use the project path, else override to run autogen elsewhere
+ * @return exit code, if monitor is not null
+ */
+ public int runAutogen(IProject project, IProgressMonitor monitor, IPath path) throws ESboxException {
+ ensureBuildMachine(project, null);
+ return runScript(path != null ? path : project.getLocation(),
+ "./autogen.sh", "Running automake script (autogen.sh) [" + project.getName() + "]",
+ "Error running script autogen.sh", monitor, project);
+ }
+
+ /**
+ * run ./configure for the project
+ *
+ * @param project
+ * @throws ESboxException
+ */
+ public void runConfigure(IProject project) throws ESboxException {
+ runConfigure(project, null, null);
+ }
+
+ /**
+ * Method that run command ./configure and wait if a progress monitor
+ * is supplied.
+ *
+ * @param project
+ * @param monitor if null, do not wait; else wait and report progress through the monitor
+ * @param path if <code>null</code>, use the project location, else override the directory
+ * @return exit code, if monitor is not null
+ * @throws ESboxException
+ */
+ public int runConfigure(IProject project, IProgressMonitor monitor, IPath path) throws ESboxException {
+ ensureBuildMachine(project, null);
+ return runScript(path != null ? path : project.getLocation(),
+ "./configure", "Running automake script (configure) [" + project.getName() + "]",
+ "Error running script configure", monitor, project);
+ }
+
+ /**
+ * This method ensures that a Makefile exists in the project, by running autogen or configure
+ * as needed. It also rebuilds Makefiles if configure has changed, or rebuilds configure
+ * if configure.ac or autogen.sh has changed.
+ *
+ * @param project
+ * @param monitor if null, do not wait; else wait and report progress through the monitor
+ * @param path if <code>null</code> use the project path, else override to run scripts elsewhere
+ * @param makefileName the name of the makefile to look for, or <code>null</code> for "Makefile"
+ */
+ public void runEstablishAutoMakefiles(IProject project, IProgressMonitor monitor, IPath path,
+ String makefileName) throws ESboxException {
+
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ monitor.beginTask("", 3);
+
+ // make sure machine is available
+ ensureBuildMachine(project, new SubProgressMonitor(monitor, 1));
+
+ if (path == null)
+ path = project.getLocation();
+
+ if (makefileName == null)
+ makefileName = "Makefile";
+
+ boolean triedToAutomake = false;
+
+ // XXX: the project is assumed to be visible to the remote machine, so we don't translate or use IFileStore here
+ File autogen_sh = path.append("autogen.sh").toFile();
+ File configure_ac = path.append("configure.ac").toFile();
+ File configure = path.append("configure").toFile();
+ File makefile_am = path.append(makefileName + ".am").toFile();
+ File makefile = path.append(makefileName).toFile();
+
+ boolean runAutogen = false;
+
+ if (autogen_sh.exists() &&
+ ((configure.exists() && autogen_sh.lastModified() > configure.lastModified())
+ || (makefile.exists() && autogen_sh.lastModified() > makefile.lastModified()))) {
+ // timestamps out of date (note: depend on last-generated files, not the _ac or _am
+ // ones, since autogen doesn't modify the _ac or _am files)
+ runAutogen = true;
+ } else if (configure_ac.exists() && configure.exists() && configure_ac.lastModified() > configure.lastModified()) {
+ // timestamps out of date
+ runAutogen = true;
+ } else if (configure_ac.exists() && !configure.exists()) {
+ // configure must be created
+ runAutogen = true;
+ }
+
+ boolean failedAutogen = false;
+ if (runAutogen) {
+ IProgressMonitor subMonitor = monitor != null ?
+ new SubProgressMonitor(monitor, 1) : new NullProgressMonitor();
+
+ // see if autogen.sh exists
+ if (autogen_sh.exists()) {
+ if (runAutogen(project, subMonitor, path) != 0) {
+ failedAutogen = true;
+ }
+ triedToAutomake = true;
+ } else if (configure_ac.exists()){
+ // run autoconf
+ if (runScript(path, "autoconf", "Running autoconf [" + project.getName() + "]",
+ "Error autoconfiguring project", subMonitor, project) != 0) {
+ failedAutogen = true;
+ }
+ triedToAutomake = true;
+ } else {
+ // um... either the logic is wrong or the user deleted the file in between
+ }
+ } else {
+ if (monitor != null)
+ monitor.worked(1);
+ }
+
+ boolean runConfigure = false;
+
+ if (!failedAutogen) {
+ if (configure.exists() && makefile.exists() && configure.lastModified() > makefile.lastModified()) {
+ // timestamps out of date
+ runConfigure = true;
+ } else if (makefile_am.exists() && makefile.exists() && makefile_am.lastModified() > makefile.lastModified()) {
+ // timestamps out of date
+ runConfigure = true;
+ } else if (configure.exists() && !makefile.exists()) {
+ // must create makefile
+ runConfigure = true;
+ }
+ }
+
+ boolean failedConfigure = false;
+
+ if (runConfigure) {
+ // run configure
+ IProgressMonitor subMonitor = monitor != null ?
+ new SubProgressMonitor(monitor, 1) : new NullProgressMonitor();
+
+ // configure exists, so run it
+ if (runConfigure(project, subMonitor, path) != 0) {
+ failedConfigure = true;
+ }
+ triedToAutomake = true;
+ } else {
+ if (monitor != null)
+ monitor.worked(1);
+ }
+
+
+ // final check
+ if (failedConfigure || failedAutogen) {
+ String message = "Autogen or configure ran with errors.\nCheck the Console for autotools messages.";
+ throw new ESboxException(message);
+
+ } else if (!makefile.exists()) {
+ String message = "Cannot find or create " + makefileName + " in project '" + project.getName() + "'.\n";
+ if (triedToAutomake)
+ message += "\nCheck the Console for autotools messages.";
+ throw new ESboxException(message);
+ }
+
+ monitor.done();
+
+ }
+
+ /**
+ * This doesn't invoke any code, but deletes any generated automake files
+ * so that they will be re-run in the future.
+ * @param project
+ */
+ public void resetAutomakeState(IProject project, String makefileName) {
+ if (makefileName == null)
+ makefileName = "Makefile";
+
+ // make sure the outside build state hasn't changed in the meantime
+ try {
+ project.refreshLocal(IProject.DEPTH_ONE, new NullProgressMonitor());
+ } catch (CoreException e1) {
+ Activator.getErrorLogger().logError("Error refreshing project", e1);
+ }
+
+ // see if generated files exist
+ IFile configure_ac = project.getFile("configure.ac");
+ IFile configure = project.getFile("configure");
+ IFile makefile = project.getFile(makefileName);
+
+ if (configure_ac.exists()) {
+ try {
+ // it is an automake project
+ if (configure.exists())
+ configure.delete(true, new NullProgressMonitor());
+ if (makefile.exists())
+ makefile.delete(true, new NullProgressMonitor());
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Error deleting generated automake files", e);
+ }
+ } else {
+ // hmm... touch the Makefile. This isn't nice for SCM but it's all we can do besides
+ // deleting the executable, which is no nicer.
+ if (makefile.exists()) {
+ try {
+ makefile.touch(new NullProgressMonitor());
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Error touching Makefile", e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Validate that the project appears to be an autotools or Makefile project.
+ * @param project
+ * @return true if some key files were found.
+ */
+ public boolean validateAutomakeState(IProject project, String makefileName) {
+ if (makefileName == null)
+ makefileName = "Makefile";
+
+ // see if generated files exist
+ IFile autogen_sh = project.getFile("autogen.sh");
+ IFile configure_ac = project.getFile("configure.ac");
+ IFile configure = project.getFile("configure");
+ IFile makefile = project.getFile(makefileName);
+
+ return autogen_sh.exists() || makefile.exists() || configure.exists() || configure_ac.exists();
+ }
+
+ /**
+ * Run 'scriptname' in 'path' location with 'wait' for 'project'.
+ * Once complete, refreshes the project.
+ * @param path
+ * @param scriptname the script, with "./" if needed
+ * @param comment
+ * @param errormessage
+ * @param monitor if not null, wait for progress to finish
+ * @param project
+ * @return exit code (if monitor is not null)
+ */
+ private int runScript(IPath path, String scriptname, final String comment,
+ String errormessage, IProgressMonitor monitor, final IProject project) throws ESboxException {
+ verifyFiles(new IPath[] { path.append(scriptname) });
+
+ IPath wd = path;
+
+ final ISDKTarget sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
+ IPath wdInScratchbox = sdkTarget.convertHostToTargetPath(wd);
+
+ IProcessLauncherFactory launcherFactory = sdkTarget.getProcessLauncherFactory();
+
+ final IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ launcherFactory, wdInScratchbox,
+ scriptname);
+
+ final Process process = processLauncher.createProcess();
+
+ final MessageConsole console = CorePlugin.getDefault().getConsole(
+ true,
+ sdkTarget,
+ comment);
+
+
+ if (monitor == null) {
+ WorkspaceJob job = new WorkspaceJob(comment) {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ monitor.beginTask("", 2);
+ monitor.subTask(comment);
+ try {
+ processLauncher.redirectToConsole(console);
+ try {
+ while (true) {
+ if (monitor.isCanceled()) {
+ process.destroy();
+ return Status.CANCEL_STATUS;
+ }
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ try {
+ process.exitValue();
+ break;
+ } catch (IllegalThreadStateException e) {
+ // still running
+ }
+ monitor.worked(1);
+ }
+ } finally {
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ } finally {
+ monitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.setRule(project);
+ job.schedule();
+ return -1;
+ } else {
+ final int[] exits = { -1 };
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+
+ public void run(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("", 2);
+ monitor.subTask(comment);
+ try {
+ OutputStream out = console.newOutputStream();
+ exits[0] = processLauncher.waitAndRead(out, out, new SubProgressMonitor(monitor, 1));
+ project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
+ } finally {
+ monitor.done();
+ }
+ }
+
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(
+ runnable,
+ project,
+ 0,
+ monitor);
+ } catch (OperationCanceledException e) {
+ // ignore
+ } catch (Exception e) {
+ throw new ESboxException(e);
+ }
+ return exits[0];
+ }
+ }
+
+ /**
+ * Create a job which will build a debian package in the project's directory. Waits for completion.
+ * @return IStatus status of build
+ */
+ public void createDebianPackage(final IProject project, IProgressMonitor monitor) throws ESboxException {
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ monitor.subTask("Creating package");
+
+ IPath path = project.getLocation();
+
+ verifyFiles(new IPath[] { path.append("debian"),
+ path.append("debian/changelog"),
+ path.append("debian/control"),
+ path.append("debian/rules") });
+
+ ISDKTarget target = ProjectManager.getInstance().getSDKTarget(project);
+
+ IProcessLauncherFactory launcherFactory = target.getProcessLauncherFactory();
+
+ String cmd = "dpkg-buildpackage -rfakeroot -d";
+
+ // launch command inside Scratchbox
+ final IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ launcherFactory, target.convertHostToTargetPath(path),
+ CommandLineArguments.createFromCommandLine(cmd));
+
+ Process sbp = processLauncher.createProcess();
+
+ processLauncher.redirectToConsole(true, null, "Making Debian package [" + project.getName() + "]");
+
+ monitor.worked(1);
+
+ int exit;
+ try {
+ exit = waitForProcess(sbp, monitor);
+ if (exit != 0) {
+ throw new ESboxException("Package creation failed; see Console (exit code " + exit + ")");
+ }
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch (CoreException e) {
+ throw new ESboxException(e);
+ }
+ } catch (InterruptedException e1) {
+ throw new ESboxException("Package creation interrupted");
+ }
+
+ monitor.done();
+
+ }
+
+ /**
+ * Wait for a running process to complete, allowing user to cancel (which kills the process)
+ * @param process the process
+ * @param monitor a progress monitor
+ * @return exit code
+ * @throws InterruptedException if process is canceled
+ */
+ public int waitForProcess(Process process, IProgressMonitor monitor) throws InterruptedException {
+ while (true) {
+ // wait a while to avoid polling
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ throw e;
+ }
+
+ try {
+ // see if the process terminated yet
+ return process.exitValue();
+ } catch (IllegalThreadStateException e) {
+ // thrown by #exitValue() when not finished, good
+ }
+
+ // see if user canceled
+ if (monitor.isCanceled()) {
+ process.destroy();
+ throw new InterruptedException();
+ }
+ }
+ }
+
+ private void verifyFiles(IPath[] files) throws ESboxException {
+ for (IPath file : files) {
+ if (!file.toFile().exists())
+ throw new ESboxException("File " + file.toPortableString()
+ + " does not exist");
+ }
+ }
+
+ /**
+ * Build a Debian package in the background.
+ * @param project
+ */
+ public void runCreateDebianPackage(final IProject project) {
+ WorkspaceJob job = new WorkspaceJob("Creating Debian package") {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ createDebianPackage(project, monitor);
+ } catch (ESboxException e) {
+ return Activator.createErrorStatus("Failed to create Debian package", e);
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
+ }
+
+
+
+ /**
+ * Make sure the build machine associated with the project is alive.
+ * This must be called from the UI thread or some other top-level caller,
+ * since it can deadlock.
+ * @param project
+ * @param monitor
+ */
+ public void ensureBuildMachine(IProject project,
+ IProgressMonitor monitor) throws ESboxException {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ ISDK sdk = ProjectManager.getInstance().getSDK(project);
+ if (sdk == null)
+ throw new ESboxException("Invalid SDK for project: " + project);
+ IMachine machine = sdk.getMachine();
+ IStatus status = MachineManager.getInstance().acquireMachine(machine, monitor);
+ if (!status.isOK())
+ throw new ESboxException(status.getMessage(), status.getException());
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxAutotoolsBuilder.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxAutotoolsBuilder.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxAutotoolsBuilder.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.cdt.make.core.IMakeBuilderInfo;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+
+/**
+ * This builder overrides the old builder to ensure it has a unique identity
+ * from the obsolete old builder (which isn't just a "make" builder at all).
+ * @author eswartz
+ *
+ */
+public class ESboxAutotoolsBuilder extends ESboxOldMakeBuilder {
+ public final static String BUILDER_ID = Activator.PLUGIN_ID + ".esboxAutotoolsBuilder";
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.ESboxMakeBuilder#getBuilderId()
+ */
+ @Override
+ protected String getBuilderId() {
+ return BUILDER_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.MakeBuilder#shouldBuild(int, org.eclipse.cdt.make.core.IMakeBuilderInfo)
+ */
+ @Override
+ protected boolean shouldBuild(int kind, IMakeBuilderInfo info) {
+ return super.shouldBuild(kind, info);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxBuildConfigIndexerConfigurationSettings.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxBuildConfigIndexerConfigurationSettings.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxBuildConfigIndexerConfigurationSettings.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.cdt.core.model.*;
+import org.eclipse.cdt.core.settings.model.*;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+import org.maemo.esbox.project.core.*;
+
+import java.util.*;
+
+/**
+ * This class manages indexer settings in an ESbox project's build configurations.
+ * Upon "commit", changes are made to all the build configurations (the creator is expected
+ * to add this to the project).
+ * @author eswartz
+ *
+ */
+public class ESboxBuildConfigIndexerConfigurationSettings implements IIndexerConfigurationSettings {
+
+ // same for all entries in project
+ private final IPathEntry[] existingRawPathEntries;
+ // same for all entries in project
+ private List<ICSourceEntry> sourceEntries;
+
+ // per build config
+ private Map<String, List<ICLanguageSettingEntry>> languageEntries;
+ private IESboxBuildConfiguration[] buildConfigs;
+
+ /**
+ * Create indexer settings handler with the project to modify plus
+ * any existing path entries to apply (during conversion).
+ * @param projectHandle
+ * @param existingRawPathEntries
+ * @throws CoreException
+ */
+ public ESboxBuildConfigIndexerConfigurationSettings(
+ IESboxProjectHandle projectHandle, IPathEntry[] existingRawPathEntries) throws CoreException {
+ this.buildConfigs = projectHandle.getBuildConfigurations();
+ for (int idx = 0; idx < buildConfigs.length; idx++)
+ buildConfigs[idx] = projectHandle.editBuildConfiguration(buildConfigs[idx]);
+ this.existingRawPathEntries = existingRawPathEntries;
+ }
+
+ public void initialize(IProgressMonitor monitor) throws CoreException {
+
+ sourceEntries = new ArrayList<ICSourceEntry>();
+ languageEntries = new HashMap<String, List<ICLanguageSettingEntry>>();
+ for (IESboxBuildConfiguration config : buildConfigs) {
+ languageEntries.put(config.getId(), new ArrayList<ICLanguageSettingEntry>());
+ }
+
+ // add any existing entries (upon conversion)
+ if (existingRawPathEntries != null) {
+ for (IPathEntry entry : existingRawPathEntries) {
+ addRawPathEntry(entry);
+ }
+ }
+
+ }
+
+ /**
+ * Add an old-style raw path entry
+ * @param entry
+ * @return
+ */
+ private void addRawPathEntry(IPathEntry entry) {
+ switch (entry.getEntryKind()) {
+ case IPathEntry.CDT_INCLUDE:
+ for (IESboxBuildConfiguration config : buildConfigs) {
+ addTargetIncludePathForEntries(languageEntries.get(config.getId()), ((IIncludeEntry)entry).getFullIncludePath(), true);
+ }
+ return;
+ case IPathEntry.CDT_MACRO:
+ addMacroDefinition(((IMacroEntry) entry).getMacroName(), ((IMacroEntry) entry).getMacroValue());
+ return;
+ case IPathEntry.CDT_SOURCE:
+ addSourceFolder(entry.getPath());
+ return;
+ }
+ }
+
+ public void addSourceFolder(IPath path) {
+ path = path.makeAbsolute();
+
+ // don't add subfolder of existing path
+ for (ICSourceEntry entry : sourceEntries) {
+ if (entry.getKind() == ICSourceEntry.SOURCE_PATH
+ && entry.getFullPath().isPrefixOf(path)) {
+ return;
+ }
+ }
+ sourceEntries.add(new CSourceEntry(path, null, 0));
+ // was ICSettingEntry.VALUE_WORKSPACE_PATH));
+ }
+
+ public void addMacroDefinition(String macroName, String macroValue) {
+ for (IESboxBuildConfiguration config : buildConfigs) {
+ addMacroDefinitionForEntries(languageEntries.get(config.getId()), macroName, macroValue);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IIndexerConfigurationSettings#addMacroDefinition(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void addMacroDefinition(String configId, String macroName,
+ String macroValue) {
+ addMacroDefinitionForEntries(languageEntries.get(configId), macroName, macroValue);
+ }
+
+ /**
+ * @param languageEntries
+ * @param macroName
+ * @param macroValue
+ */
+ private void addMacroDefinitionForEntries(List<ICLanguageSettingEntry> languageEntries, String macroName, String macroValue) {
+ // update any duplicate
+ for (Iterator<ICLanguageSettingEntry> iter = languageEntries.iterator(); iter.hasNext(); ) {
+ ICLanguageSettingEntry entry = iter.next();
+ if (entry.getKind() == ICLanguageSettingEntry.MACRO
+ && ((ICMacroEntry) entry).getName().equals(macroName)) {
+ iter.remove();
+ break;
+ }
+ }
+
+ ICMacroEntry entry = new CMacroEntry(macroName, macroValue, 0);
+ languageEntries.add(entry);
+ }
+
+ public void addIncludePath(IPath path, boolean isSystemInclude) {
+
+ for (IESboxBuildConfiguration config : buildConfigs) {
+ addIncludePathForTargetAndEntries(config.getSDKTarget(), languageEntries.get(config.getId()), path, isSystemInclude);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IIndexerConfigurationSettings#addIncludePath(java.lang.String, org.eclipse.core.runtime.IPath, boolean)
+ */
+ public void addIncludePath(String configId, IPath path, boolean isSystemInclude) {
+ for (IESboxBuildConfiguration config : buildConfigs) {
+ if (config.getId().equals(configId)) {
+ addIncludePathForTargetAndEntries(config.getSDKTarget(), languageEntries.get(config.getId()), path, isSystemInclude);
+ break;
+ }
+ }
+ }
+
+ private void addIncludePathForTargetAndEntries(ISDKTarget sdkTarget, List<ICLanguageSettingEntry> languageEntries, IPath path, boolean isSystemInclude) {
+
+ IPath includePath;
+ try {
+ includePath = sdkTarget.convertTargetToHostPath(path, true);
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logError("Cannot resolve include path " + path + " for indexer", e);
+ return;
+ }
+
+ addTargetIncludePathForEntries(languageEntries, includePath, isSystemInclude);
+ }
+
+ /**
+ * @param includePath
+ * @param isSystemInclude
+ */
+ private void addTargetIncludePathForEntries(List<ICLanguageSettingEntry> languageEntries, IPath includePath, boolean isSystemInclude) {
+ // skip if duplicate
+ for (Iterator<ICLanguageSettingEntry> iter = languageEntries.iterator(); iter.hasNext(); ) {
+ ICLanguageSettingEntry entry = iter.next();
+ if (entry.getKind() == ICLanguageSettingEntry.INCLUDE_PATH) {
+ ICIncludePathEntry include = (ICIncludePathEntry) entry;
+ if (include.isLocal() == !isSystemInclude
+ && equalPath(((ICIncludePathEntry) entry).getLocation(), includePath)) {
+ return;
+ }
+ }
+ }
+
+ ICIncludePathEntry entry = new CIncludePathEntry(includePath,
+ isSystemInclude ? 0 : ICLanguageSettingEntry.LOCAL);
+ languageEntries.add(entry);
+ }
+
+ /**
+ * Compare paths more loosely than strings alone (the device case is not important, for instance)
+ * @param path1
+ * @param path2
+ * @return paths considered equal
+ */
+ private boolean equalPath(IPath path1, IPath path2) {
+ return path1.toFile().equals(path2.toFile());
+ }
+
+ public void commit(IProgressMonitor monitor) throws CoreException {
+ for (IESboxBuildConfiguration buildConfig_ : buildConfigs) {
+ ESboxCppBuildConfiguration buildConfig = (ESboxCppBuildConfiguration) buildConfig_;
+ List<ICLanguageSettingEntry> entries = languageEntries.get(buildConfig.getId());
+ buildConfig.setLanguageSettingEntries(
+ (ICLanguageSettingEntry[]) entries.toArray(
+ new ICLanguageSettingEntry[entries.size()]));
+ buildConfig.setSourceEntries(
+ (ICSourceEntry[]) sourceEntries.toArray(new ICSourceEntry[sourceEntries.size()]));
+ buildConfig.setChanged(true);
+ }
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppBuildConfigProjectCreatorConverter.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppBuildConfigProjectCreatorConverter.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppBuildConfigProjectCreatorConverter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
+import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.project.core.*;
+
+/**
+ * Creator for C/C++ configuration-based projects.
+ * @author eswartz
+ *
+ */
+public class ESboxCppBuildConfigProjectCreatorConverter extends ESboxCppProjectCreatorConverterBase {
+ // XXX: move this stuff to a common place
+ private static final String MAKE_CORE_CFG_SUPPORT_NATURE_ID = "org.eclipse.cdt.make.core.cfgSupportNature";
+
+ public ESboxCppBuildConfigProjectCreatorConverter() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ESboxProjectCreatorConverter#createProjectInfo(org.eclipse.core.resources.IProject)
+ */
+ @Override
+ protected IESboxProjectHandle createProjectHandle(IProject project) {
+ return ProjectManager.getInstance().getProjectType(ESboxCppProjectType.ID).createProjectHandle(project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.wizards.ESboxProjectCreator#addProjectNatures(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void addProjectNatures(IProgressMonitor monitor)
+ throws CoreException {
+ monitor.beginTask("", 8);
+ monitor.subTask("Setting natures");
+
+ if (!isCreating()) {
+ // remove natures for other builders
+ ScannerConfigNature.removeScannerConfigNature(project);
+ ManagedCProjectNature.removeManagedNature(project, new SubProgressMonitor(monitor, 1));
+ ESboxCppProjectNature.removeNature(project, MAKE_CORE_CFG_SUPPORT_NATURE_ID, new SubProgressMonitor(monitor, 1));
+ ESboxCppProjectNature.removeNature(project, OldESboxProjectNature.NATURE_ID, new SubProgressMonitor(monitor, 1));
+ ESboxCppProjectNature.removeCppNature(project, new SubProgressMonitor(monitor, 1));
+ } else {
+ monitor.worked(4);
+ }
+ CProjectNature.addCNature(project, new SubProgressMonitor(monitor, 1));
+ ESboxCppProjectNature.addCppNature(project, new SubProgressMonitor(monitor, 1));
+
+ monitor.done();
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.wizards.ESboxCppProjectCreator#loadIndexerSettings()
+ */
+ @Override
+ protected IIndexerConfigurationSettings loadIndexerSettings(IESboxProjectHandle projectHandle)
+ throws CoreException {
+ return new ESboxBuildConfigIndexerConfigurationSettings(projectHandle, rawPathEntries);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.wizards.ESboxCppProjectCreator#finalizeAfterTemplateOperations(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void finalizeAfterTemplateOperations(IProgressMonitor monitor)
+ throws CoreException {
+ super.finalizeAfterTemplateOperations(new SubProgressMonitor(monitor, 1));
+
+ // save the build configuration's changes after indexer info applied
+ projectHandle.save(new SubProgressMonitor(monitor, 1));
+ }
+
+
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppBuildConfiguration.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppBuildConfiguration.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppBuildConfiguration.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.cdt.core.settings.model.*;
+import org.maemo.esbox.project.core.ESboxBuildConfigurationBase;
+import org.maemo.esbox.project.core.ESboxBuildConfigurationParameters;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Implementation. We don't know the lifetimes of these objects, so don't store
+ * references to objects, just low level strings which can be used to
+ * look them up.
+ * @author eswartz
+ *
+ */
+public class ESboxCppBuildConfiguration extends ESboxBuildConfigurationBase {
+ /**
+ * Create new build configuration from project creator defaults
+ * @param projectHandle
+ * @param cfgDes
+ * @param parameters
+ */
+ public ESboxCppBuildConfiguration(ESboxCppProjectHandle projectHandle,
+ ICConfigurationDescription cfgDes, ESboxBuildConfigurationParameters parameters) {
+ super(projectHandle, parameters);
+ }
+
+ /**
+ * Save to the known configuration description
+ * @param cfgDes
+ */
+ public void save(ICConfigurationDescription cfgDes) {
+ save(new CdtConfigurationPropertyAccess(cfgDes, getCategory()));
+ }
+
+ /**
+ * Create a configuration from existing configuration.
+ */
+ public ESboxCppBuildConfiguration(ESboxCppProjectHandle projectHandle, ICConfigurationDescription cfgDes) {
+ super(projectHandle,
+ cfgDes.getId(),
+ cfgDes.getName(),
+ new CdtConfigurationPropertyAccess(cfgDes, getCategory()));
+ }
+
+ public static String getCategory() {
+ return "buildConfig";
+ }
+
+ /**
+ * @return
+ */
+ private ICConfigurationDescription getCConfiguration() {
+ if (projectHandle == null)
+ throw new IllegalStateException();
+ ICConfigurationDescription configuration =
+ ((ESboxCppProjectHandle) projectHandle).getCConfiguration(this);
+ if (configuration == null)
+ throw new IllegalArgumentException("build configuration not present in CDT project: "
+ + this);
+ return configuration;
+ }
+
+ public void setLanguageSettingEntries(ICLanguageSettingEntry[] array) {
+ ICLanguageSetting[] languageSettings = getCConfiguration().getRootFolderDescription().getLanguageSettings();
+ for (ICLanguageSetting languageSetting : languageSettings) {
+ int kinds = languageSetting.getSupportedEntryKinds();
+ for (int kind = 1; kind < kinds*2; kind <<= 1) {
+ if ((kinds & kind) != 0) {
+ ICLanguageSettingEntry[] kindEntries = filterEntriesByKind(array, kind);
+ languageSetting.setSettingEntries(kind, kindEntries);
+ }
+ }
+ }
+ }
+
+ private ICLanguageSettingEntry[] filterEntriesByKind(
+ ICLanguageSettingEntry[] array, int kind) {
+ List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
+ for (ICLanguageSettingEntry entry : array) {
+ if (entry.getKind() == kind)
+ entries.add(entry);
+ }
+ return (ICLanguageSettingEntry[]) entries
+ .toArray(new ICLanguageSettingEntry[entries.size()]);
+ }
+
+ public void setSourceEntries(ICSourceEntry[] array) {
+ getCConfiguration().getConfigurationData().setSourceEntries(array);
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppConfigHandler.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppConfigHandler.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppConfigHandler.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.dom.IPDOMManager;
+import org.maemo.esbox.project.core.ESboxConfigHandler;
+
+/**
+ * Configuration data for C++ projects
+ * @author eswartz
+ *
+ */
+public class ESboxCppConfigHandler extends ESboxConfigHandler {
+
+ private String indexerId;
+
+ /**
+ * Set a flag telling how to set up the indexer for this project.
+ * @param indexerId CDT indexer id, or <code>null</code> for workspace default
+ * @see CCorePlugin#INDEXER_UNIQ_ID
+ * @see IPDOMManager#ID_NO_INDEXER
+ * @see IPDOMManager#ID_FAST_INDEXER
+ * @see IPDOMManager#ID_FULL_INDEXER
+ */
+ public void setIndexerId(String indexerId) {
+ this.indexerId = indexerId;
+ }
+
+
+ /**
+ * Get the indexer id for this project.
+ * @return CDT indexer id, or <code>null</code> for workspace default
+ * @see CCorePlugin#INDEXER_UNIQ_ID
+ * @see IPDOMManager#ID_NO_INDEXER
+ * @see IPDOMManager#ID_FAST_INDEXER
+ * @see IPDOMManager#ID_FULL_INDEXER
+
+ */
+ public String getIndexerId() {
+ return indexerId;
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectCreatorConverterBase.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectCreatorConverterBase.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectCreatorConverterBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.dom.IPDOMManager;
+import org.eclipse.cdt.core.model.*;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.ProcessLauncherCreator;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+import org.maemo.esbox.project.core.*;
+
+import java.io.ByteArrayOutputStream;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * This class handles the basic C/C++ project creation tasks
+ * @author eswartz
+ *
+ */
+public abstract class ESboxCppProjectCreatorConverterBase extends ESboxProjectCreatorConverter {
+
+ protected IIndexerConfigurationSettings indexerSettings;
+ protected IPathEntry[] rawPathEntries;
+ private String originalIndexerId;
+
+ /**
+ *
+ */
+ public ESboxCppProjectCreatorConverterBase() {
+ super();
+ }
+
+ public IIndexerConfigurationSettings getProjectIndexerSettings() {
+ return indexerSettings;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.wizards.ESboxProjectCreator#createConcreteProject(org.eclipse.core.resources.IProjectDescription, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void createConcreteProject(IProjectDescription description,
+ IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("Creating project", 3);
+ if (description == null) {
+ // converting -- need to be drastic to snuff out existing CDT metadata (e.g. for a
+ // project converted to a make builder first)...
+
+ // first, remember any existing indexer data...
+ try {
+ rawPathEntries = CoreModel.getRawPathEntries(CoreModel.getDefault().create(project));
+ } catch (CoreException e) {
+
+ }
+
+ // TODO: find a cleaner way to do this
+ IFile cproject = project.getFile(".cproject");
+ if (cproject.exists()) {
+ cproject.delete(true, null);
+ project.close(null);
+ project.open(null);
+ }
+
+ // remove builders (ALL OF THEM) because they will re-add the natures
+ description = project.getDescription();
+ description.setBuildSpec(new ICommand[0]);
+ project.setDescription(description, new SubProgressMonitor(monitor, 1));
+ } else {
+ // create the project
+ project = CCorePlugin.getDefault().createCDTProject(description, project,
+ new SubProgressMonitor(monitor, 1));
+ }
+
+ // set up the natures
+ addProjectNatures(new SubProgressMonitor(monitor, 1));
+
+ monitor.done();
+ }
+
+ @Override
+ protected void initializeBeforeTemplateOperations(IProgressMonitor monitor)
+ throws CoreException {
+ monitor.beginTask("", 1);
+ monitor.subTask("Setting indexer");
+
+ ESboxCppTemplateProcessInfo.currentCppProjectCreatorConverter = this;
+
+ startGatheringIndexerSettings(projectHandle, monitor);
+
+ monitor.done();
+ }
+
+ /**
+ * @param monitor
+ * @throws CoreException
+ */
+ protected void startGatheringIndexerSettings(IESboxProjectHandle projectHandle, IProgressMonitor monitor)
+ throws CoreException {
+ // set the default indexer id to empty while we create the project
+ originalIndexerId = CCorePlugin.getIndexManager().getDefaultIndexerId();
+ CCorePlugin.getIndexManager().setDefaultIndexerId(IPDOMManager.ID_NO_INDEXER);
+
+ /*ICProject cProject =*/ CoreModel.getDefault().create(project);
+
+ indexerSettings = loadIndexerSettings(projectHandle);
+
+ indexerSettings.initialize(new SubProgressMonitor(monitor, 1));
+ }
+
+ /**
+ * Load the existing indexer settings for the project.
+ * @throws CoreException
+ */
+ abstract protected IIndexerConfigurationSettings loadIndexerSettings(IESboxProjectHandle projectHandle) throws CoreException;
+
+ @Override
+ protected void finalizeAfterTemplateOperations(IProgressMonitor monitor)
+ throws CoreException {
+
+ ESboxCppTemplateProcessInfo.currentCppProjectCreatorConverter = null;
+
+ finishGatheringIndexerSettings(projectHandle, monitor);
+ }
+
+ /**
+ * Finalize the settings gathered through template processes by
+ * augmenting them with compiler-specific information, and then
+ * commit them.
+ * @param monitor
+ * @throws CoreException
+ */
+ protected void finishGatheringIndexerSettings(IESboxProjectHandle projectHandle, IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("", 1);
+ monitor.subTask("Committing indexer settings");
+
+ try {
+ if (isCreating()) {
+ // add includes/macros used by compiler
+ for (IESboxBuildConfiguration config : projectHandle.getBuildConfigurations()) {
+ addCompilerIndexerInfo(config, new SubProgressMonitor(monitor, 1));
+ }
+ }
+
+ } finally {
+ try {
+ // commit indexer settings
+ indexerSettings.commit(new SubProgressMonitor(monitor, 1));
+ } finally {
+ // set the indexer id to the desired one, which starts indexing
+ ESboxCppConfigHandler configHandler = (ESboxCppConfigHandler) getConfigHandler();
+ String indexerId = configHandler.getIndexerId();
+ ICProject cProject = CoreModel.getDefault().create(project);
+ if (indexerId != null) {
+ CCorePlugin.getIndexManager().setIndexerId(cProject, indexerId);
+ }
+
+ // restore default
+ CCorePlugin.getIndexManager().setDefaultIndexerId(originalIndexerId);
+ }
+ }
+
+ monitor.done();
+ }
+
+ private void addCompilerIndexerInfo(IESboxBuildConfiguration config, IProgressMonitor monitor) {
+ if (config.getSDKTarget() == null)
+ return;
+
+ monitor.beginTask("", 1);
+ monitor.subTask("Gathering compiler include paths");
+
+ // add this just in case template doesn't
+ getProjectIndexerSettings().addIncludePath(new Path("/usr/include"),
+ true);
+
+ // TODO: for now, a hack -- this will change if gcc changes
+ IProcessLauncher launcher = ProcessLauncherCreator
+ .createProcessLauncher(config.getSDKTarget().getProcessLauncherFactory(), "gcc -v");
+ try {
+ launcher.createProcess();
+ } catch (ESboxException e) {
+ Activator.getErrorLogger()
+ .logError("Cannot launch 'gcc -v'", e);
+ }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ launcher.waitAndRead(out, err);
+
+ Pattern pattern = Pattern.compile("--prefix=(\\S+)");
+ Matcher matcher = pattern.matcher(out.toString() + err.toString());
+ if (matcher.find()) {
+ getProjectIndexerSettings().addIncludePath(config.getId(),
+ new Path(matcher.group(1)).append("usr/include"), true);
+ } else {
+ Activator.getErrorLogger().logError(
+ "Cannot determine gcc base directory", null);
+ }
+ monitor.worked(1);
+ monitor.done();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.wizards.ESboxProjectCreator#initializeConcreteProject(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void initializeConcreteProject(final IProgressMonitor monitor)
+ throws CoreException {
+ monitor.beginTask("", 1);
+ monitor.subTask("Initializing project");
+
+ if (isCreating()) {
+ runInitialScripts(new SubProgressMonitor(monitor, 1));
+ } else {
+ monitor.worked(1);
+ }
+
+ monitor.done();
+ }
+
+ protected void runInitialScripts(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("", 1);
+ monitor.subTask("Initializing project configuration");
+ try {
+ CppScriptLauncher.getInstance().runEstablishAutoMakefiles(
+ project,
+ new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL),
+ null,
+ null);
+ } catch (ESboxException e) {
+ throw new CoreException(Activator.createErrorStatus("Failed to run initial scripts", e));
+ }
+ monitor.done();
+ }
+
+ /**
+ * Add the project natures (or remove and add, when converting).
+ * @param monitor
+ * @throws CoreException
+ */
+ abstract protected void addProjectNatures(IProgressMonitor monitor)
+ throws CoreException;
+
+
+}
\ No newline at end of file
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectHandle.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectHandle.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectHandle.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,366 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ICDescriptor;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
+import org.eclipse.cdt.core.settings.model.util.CDataUtil;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.cpp.project.core.cdt.*;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+import org.maemo.esbox.project.core.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Implementation for C/C++ projects.
+ * @author eswartz
+ *
+ */
+public class ESboxCppProjectHandle extends ESboxProjectHandleBase implements IESboxProjectHandle {
+
+ private ICProjectDescription projectDescription;
+
+ /** This is non-null between any #create or #save operations */
+ private ICProjectDescription writableProjectDescription;
+
+ /**
+ * Make a handle for an existing project by reading the description
+ * @param project
+ */
+ public ESboxCppProjectHandle(IProject project) {
+ this(project, CoreModel.getDefault().getProjectDescription(project, false));
+ }
+
+ /**
+ * Make a handle for an existing or in-creation project by passing the description
+ * @param project
+ * @param des
+ */
+ public ESboxCppProjectHandle(IProject project, ICProjectDescription des) {
+ super(project);
+ this.projectDescription = des;
+ }
+
+
+ /**
+ * Load CDT's configurations and pick out those for ESbox
+ * @return
+ */
+ private List<ICConfigurationDescription> getMatchingCConfigurations(ICProjectDescription des) {
+ List<ICConfigurationDescription> configs = new ArrayList<ICConfigurationDescription>();
+
+ if (des != null) {
+ ICConfigurationDescription[] configurations = des.getConfigurations();
+ if (configurations != null) {
+ for (ICConfigurationDescription configuration : configurations) {
+ if (configuration.getBuildSystemId().equals(ESboxConfigurationData.ID)) {
+ configs.add(configuration);
+ }
+ }
+ }
+ }
+ return configs;
+
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectInfo#create()
+ */
+ public synchronized void create(IProgressMonitor monitor) throws CoreException {
+ // create the project description (e.g., .cproject)
+ ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project, true);
+
+ descriptor.saveProjectData();
+
+ // create the project description, which holds build configurations
+ if (writableProjectDescription == null)
+ throw new CoreException(Activator.createErrorStatus("No build configurations defined", null));
+
+ // and save all these changes into the project description
+ writableProjectDescription.setCdtProjectCreated();
+
+ // save the build configs
+ doSave(new SubProgressMonitor(monitor, 1));
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectInfo#createBuildConfiguration(org.maemo.esbox.project.core.ESboxBuildConfigurationParameters)
+ */
+ public synchronized IESboxBuildConfiguration createBuildConfiguration(
+ ESboxBuildConfigurationParameters parameters) throws CoreException {
+ if (writableProjectDescription == null) {
+ writableProjectDescription = CoreModel.getDefault().createProjectDescription(project, true, false);
+ }
+
+ // create new build configuration
+ CConfigurationData data = CDataUtil.createEmptyData(
+ ESboxCppBuildConfiguration.createId(parameters.getSdkName(), parameters.getSdkTargetName()),
+ parameters.getSdkTargetName(),
+ new ESboxDataFactory(),
+ true);
+
+ ICConfigurationDescription cfgDes = writableProjectDescription.createConfiguration(
+ ESboxCConfigurationDataProvider.CFG_DATA_PROVIDER_ID,
+ data);
+
+ // set up the CDT metadata for this project configuration (used to be on project descriptor itself)
+ cfgDes.create(CCorePlugin.BINARY_PARSER_UNIQ_ID,
+ CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID);
+
+ String[] errorParsers = CCorePlugin.getDefault().getAllErrorParsersIDs();
+ for (String errorParser : errorParsers) {
+ cfgDes.create(CCorePlugin.ERROR_PARSER_UNIQ_ID, errorParser);
+ }
+
+ // make our wrapper and set up metadata
+ ESboxCppBuildConfiguration buildConfiguration = new ESboxCppBuildConfiguration(this, cfgDes, parameters);
+ buildConfiguration.save(cfgDes);
+ return buildConfiguration;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectInfo#createBuildConfiguration(org.maemo.esbox.project.core.ESboxBuildConfigurationParameters, org.maemo.esbox.project.core.IESboxBuildConfiguration)
+ */
+ public synchronized IESboxBuildConfiguration createBuildConfiguration(
+ ESboxBuildConfigurationParameters parameters,
+ IESboxBuildConfiguration baseConfig) throws CoreException {
+
+ // make a fresh config if we're not basing it on anything
+ if (baseConfig == null)
+ return createBuildConfiguration(parameters);
+
+ ESboxBuildConfigurationParameters fullParameters = fillInBuildParameters(
+ parameters, baseConfig);
+
+ if (writableProjectDescription == null) {
+ writableProjectDescription = CoreModel.getDefault().createProjectDescription(project, true, false);
+ if (writableProjectDescription == null)
+ throw new CoreException(Activator.createErrorStatus("Cannot rewrite project description " + project.getName(), null));
+ }
+
+ // make a fresh config if we're basing it on a deleted configuration
+ ICConfigurationDescription baseConfiguration = getCConfiguration(baseConfig);
+ if (baseConfiguration == null)
+ return createBuildConfiguration(fullParameters);
+
+
+ ICConfigurationDescription cfgDes = writableProjectDescription.createConfiguration(
+ ESboxCppBuildConfiguration.createId(fullParameters.getSdkName(), fullParameters.getSdkTargetName()),
+ fullParameters.getSdkTargetName(),
+ baseConfiguration);
+ ESboxCppBuildConfiguration buildConfiguration = new ESboxCppBuildConfiguration(
+ this, cfgDes, fullParameters);
+ buildConfiguration.save(cfgDes);
+ return buildConfiguration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectInfo#save(org.maemo.esbox.project.core.IESboxBuildConfiguration, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void save(IProgressMonitor monitor) throws CoreException {
+ if (!project.exists())
+ throw new CoreException(Activator.createErrorStatus("Project does not exist", null));
+ if (writableProjectDescription == null)
+ return;
+
+ // get the project description for writing
+ doSave(monitor);
+ }
+
+ /**
+ * @return the writableProjectDescription
+ */
+ public ICProjectDescription getWritableProjectDescription() {
+ return writableProjectDescription;
+ }
+
+ /**
+ * @param monitor
+ * @param prjDes
+ * @param des
+ * @throws CoreException
+ */
+ private void doSave(IProgressMonitor monitor)
+ throws CoreException {
+ if (writableProjectDescription == null)
+ return;
+
+ CoreModel.getDefault().setProjectDescription(project, writableProjectDescription, true,
+ monitor);
+ projectDescription = CoreModel.getDefault().createProjectDescription(project, true);
+ if (projectDescription == null)
+ throw new CoreException(Activator.createErrorStatus("Project metadata saving failed", null));
+ writableProjectDescription = null;
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectInfo#getBuildConfigurations()
+ */
+ public synchronized IESboxBuildConfiguration[] getBuildConfigurations() {
+ ICProjectDescription prjDes = writableProjectDescription != null ? writableProjectDescription : projectDescription;
+
+ if (prjDes == null)
+ return new IESboxBuildConfiguration[0];
+
+ List<ICConfigurationDescription> configurations = getMatchingCConfigurations(prjDes);
+ List<IESboxBuildConfiguration> esboxBuildConfigs = new ArrayList<IESboxBuildConfiguration>();
+ for (ICConfigurationDescription cfgDes : configurations) {
+ IESboxBuildConfiguration config = wrapCConfiguration(prjDes, cfgDes.getId());
+ if (config != null) {
+ esboxBuildConfigs.add(config);
+ }
+ }
+ return (IESboxBuildConfiguration[]) esboxBuildConfigs
+ .toArray(new IESboxBuildConfiguration[esboxBuildConfigs.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectInfo#removeBuildConfiguration(org.maemo.esbox.project.core.IESboxBuildConfiguration)
+ */
+ public void removeBuildConfiguration(IESboxBuildConfiguration config) throws CoreException {
+ if (writableProjectDescription == null) {
+ writableProjectDescription = CoreModel.getDefault().createProjectDescription(project, true, false);
+ }
+ if (config.getProjectHandle() == null) {
+ throw new IllegalArgumentException("Removing non-added build configuration: " + config, null);
+ } else if (config.getProjectHandle() != this) {
+ throw new IllegalArgumentException("Removing build configuration for different project: " + config, null);
+ }
+ ((ESboxCppBuildConfiguration) config).setProjectHandle(null);
+ ICConfigurationDescription cfg = getCConfiguration(config);
+ if (cfg == null)
+ throw new IllegalArgumentException("build configuration not present in CDT project: " + config);
+
+ writableProjectDescription.removeConfiguration(cfg);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectInfo#getCurrentConfiguration()
+ */
+ public IESboxBuildConfiguration getCurrentConfiguration() {
+ // read from the persisted data, only
+ if (projectDescription == null)
+ return null;
+ ICConfigurationDescription cfg = projectDescription.getActiveConfiguration();
+ if (cfg == null)
+ return null;
+ if (cfg.getBuildSystemId().equals(ESboxConfigurationData.ID))
+ return new ESboxCppBuildConfiguration(this, cfg);
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectInfo#setCurrentConfiguration(org.maemo.esbox.project.core.IESboxBuildConfiguration)
+ */
+ public void setCurrentConfiguration(IESboxBuildConfiguration config) throws CoreException {
+ boolean changesPending = (writableProjectDescription != null);
+
+ if (writableProjectDescription == null) {
+ writableProjectDescription = CoreModel.getDefault().createProjectDescription(project, true, false);
+ if (writableProjectDescription == null) {
+ throw new CoreException(Activator.createErrorStatus("project does not have CDT metadata", null));
+ }
+ }
+ if (config.getProjectHandle() == null) {
+ throw new IllegalArgumentException("build configuration is not in project: " + config);
+ }
+
+ try {
+ ICConfigurationDescription cfg = getCConfiguration(config);
+ if (cfg == null) {
+ throw new CoreException(Activator.createErrorStatus("build config is not in CDT build configs: " + config, null));
+ }
+ writableProjectDescription.setActiveConfiguration(cfg);
+ if (!changesPending)
+ doSave(null);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to set active build configuration", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectInfo#findBuildConfiguration(java.lang.String)
+ */
+ public IESboxBuildConfiguration findBuildConfiguration(String id) {
+ return wrapCConfiguration(projectDescription, id);
+ }
+
+ /**
+ * @param projectDescription
+ * @param id
+ * @return
+ */
+ private IESboxBuildConfiguration wrapCConfiguration(ICProjectDescription projectDescription, String id) {
+ ICConfigurationDescription cfgDes = projectDescription.getConfigurationById(id);
+ if (cfgDes == null)
+ return null;
+ ESboxCppBuildConfiguration buildConfig = new ESboxCppBuildConfiguration(this, cfgDes);
+ return buildConfig;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectInfo#editBuildConfiguration(org.maemo.esbox.project.core.IESboxBuildConfiguration)
+ */
+ public IESboxBuildConfiguration editBuildConfiguration(
+ IESboxBuildConfiguration config) throws CoreException {
+ if (config == null || config.getProjectHandle() != this)
+ throw new IllegalArgumentException("configuration does not belong to project");
+ if (writableProjectDescription == null) {
+ writableProjectDescription = CoreModel.getDefault().createProjectDescription(project, true, false);
+ if (writableProjectDescription == null)
+ throw new CoreException(Activator.createErrorStatus("Cannot rewrite project description " + project.getName(), null));
+ }
+ return wrapCConfiguration(writableProjectDescription, config.getId());
+ }
+
+ /**
+ * Get the CDT configuration for this build configuration
+ * @param buildConfig
+ * @return {@link ICConfigurationDescription}, never <code>null</code> unless buildConfig is <code>null</code>
+ */
+ public ICConfigurationDescription getCConfiguration(IESboxBuildConfiguration buildConfig) {
+ if (buildConfig == null)
+ return null;
+
+ ICConfigurationDescription cfgDes;
+ if (writableProjectDescription != null)
+ cfgDes = writableProjectDescription.getConfigurationById(buildConfig.getId());
+ else
+ cfgDes = projectDescription.getConfigurationById(buildConfig.getId());
+
+ return cfgDes;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectHandle#clearBuildState()
+ */
+ public void clearBuildState() {
+ super.clearBuildState();
+
+ // now make sure when the build happens, it will actually do something
+ CppScriptLauncher.getInstance().resetAutomakeState(project, null);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectNature.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectNature.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectNature.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia) - new nature
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.cdt.make.core.*;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+
+/**
+ * ESbox C/C++ Configurations Nature class. This is used for the "new" project nature
+ * that supports build configurations. The old project nature still exists.
+ *
+ * This class has also some utility methods to add ESbox
+ * nature to a project.
+ */
+public class ESboxCppProjectNature extends MakeProjectNature {
+
+ private IProject project;
+ public static final String ESBOX_CPP_NATURE_ID = Activator.PLUGIN_ID
+ + ".ESboxCppNature";
+ //private static final String AUTOTOOLS_BUILDER_ID = ESboxAutotoolsBuilder.BUILDER_ID;
+ static final String AUTOTOOLS_BUILDER_ID = Activator.PLUGIN_ID + ".esboxAutotoolsBuilder";
+
+ /**
+ * Adds the ESbox project nature to a given project.
+ *
+ * @param project the project to add the nature.
+ * @param monitor a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ * @throws CoreException if something goes wrong.
+ */
+ public static void addCppNature(IProject project, IProgressMonitor monitor)
+ throws CoreException {
+ addNature(project, ESBOX_CPP_NATURE_ID, monitor);
+ }
+
+ /**
+ * Removes the ESbox project nature to a given project.
+ *
+ * @param project the project to add the nature.
+ * @param monitor a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ * @throws CoreException if something goes wrong.
+ */
+ public static void removeCppNature(IProject project,
+ IProgressMonitor monitor) throws CoreException {
+ removeNature(project, ESBOX_CPP_NATURE_ID, monitor);
+ }
+
+ /**
+ * Utility method for adding a nature to a project.
+ *
+ * @param project the project to add the nature
+ * @param natureId the id of the nature to assign to the project
+ * @param monitor a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ */
+ public static void addNature(IProject project, String natureId,
+ IProgressMonitor monitor) throws CoreException {
+ IProjectDescription description = project.getDescription();
+ if (description.hasNature(natureId))
+ return;
+ String[] ids = description.getNatureIds();
+ String[] newIds = new String[ids.length + 1];
+ System.arraycopy(ids, 0, newIds, 0, ids.length);
+ newIds[ids.length] = natureId;
+ description.setNatureIds(newIds);
+ project.setDescription(description, null);
+ }
+
+ /**
+ * Utility method for removing a project nature from a project.
+ *
+ * @param proj the project to remove the nature from
+ * @param natureId the nature id to remove
+ * @param monitor a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ */
+ public static void removeNature(IProject project, String natureId,
+ IProgressMonitor monitor) throws CoreException {
+ IProjectDescription description = project.getDescription();
+ if (!description.hasNature(natureId))
+ return;
+ String[] ids = description.getNatureIds();
+ for (int i = 0; i < ids.length; ++i) {
+ if (ids[i].equals(natureId)) {
+ String[] newIds = new String[ids.length - 1];
+ System.arraycopy(ids, 0, newIds, 0, i);
+ System.arraycopy(ids, i + 1, newIds, i, ids.length - i - 1);
+ description.setNatureIds(newIds);
+ project.setDescription(description, null);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.MakeProjectNature#addBuildSpec()
+ */
+ public void addBuildSpec() throws CoreException {
+ addToBuildSpec(getProject(), AUTOTOOLS_BUILDER_ID, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.MakeProjectNature#removeBuildSpec()
+ */
+ public void removeBuildSpec() throws CoreException {
+ removeFromBuildSpec(getProject(), AUTOTOOLS_BUILDER_ID, null);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#configure()
+ */
+ public void configure() throws CoreException {
+ addBuildSpec();
+
+ IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(), AUTOTOOLS_BUILDER_ID, false);
+ IMakeBuilderInfo projectInfo = MakeCorePlugin.createBuildInfo(getProject(), AUTOTOOLS_BUILDER_ID);
+
+ projectInfo.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "")); //$NON-NLS-1$
+ projectInfo.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
+
+ projectInfo.setUseDefaultBuildCmd(info.isDefaultBuildCmd());
+ projectInfo.setStopOnError(info.isStopOnError());
+
+ projectInfo.setAutoBuildEnable(info.isAutoBuildEnable());
+ projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, "")); //$NON-NLS-1$
+
+ projectInfo.setIncrementalBuildEnable(info.isIncrementalBuildEnabled());
+ projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, "")); //$NON-NLS-1$
+
+ projectInfo.setFullBuildEnable(info.isIncrementalBuildEnabled());
+
+ projectInfo.setCleanBuildEnable(info.isCleanBuildEnabled());
+ projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, "")); //$NON-NLS-1$
+
+ projectInfo.setErrorParsers(info.getErrorParsers());
+ projectInfo.setAppendEnvironment(info.appendEnvironment());
+ projectInfo.setEnvironment(info.getEnvironment());
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#deconfigure()
+ */
+ public void deconfigure() throws CoreException {
+ removeBuildSpec();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#getProject()
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
+ */
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ public static boolean isNatureInProject(IProject _project) {
+ if(_project != null && _project.isOpen()){
+ try {
+ IProjectNature nature = _project.getNature(ESBOX_CPP_NATURE_ID);
+ if(nature instanceof ESboxCppProjectNature){
+ return true;
+ }
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Could not read natures", e);
+ }
+ }
+ return false;
+ }
+}
+
\ No newline at end of file
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectType.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectType.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppProjectType.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.core.resources.IProject;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+import org.maemo.esbox.project.core.*;
+
+/**
+ * Project type for modern C/C++ projects.
+ * @author eswartz
+ *
+ */
+public class ESboxCppProjectType implements IESboxProjectType {
+
+ public static final String ID = Activator.PLUGIN_ID + ".projectType.cpp";
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectType#getId()
+ */
+ public String getId() {
+ return ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectType#createProjectInfo(org.eclipse.core.resources.IProject)
+ */
+ public IESboxProjectHandle createProjectHandle(IProject project) {
+ return new ESboxCppProjectHandle(project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectType#isProjectSupported(org.eclipse.core.resources.IProject)
+ */
+ public boolean isProjectSupported(IProject project) {
+ return ESboxCppProjectNature.isNatureInProject(project);
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppPropertyTester.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppPropertyTester.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppPropertyTester.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.core.expressions.IPropertyTester;
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.project.core.ProjectManager;
+
+/**
+ * Test properties of ESbox resources for use in UI filtering and activation
+ * <p>
+ * <li>isCProject -- tell if the current project is an ESbox C++ project
+ * <li>isOldESboxProject -- tell if the current project is an old-style ESbox project
+ *
+ * @author eswartz
+ *
+ */
+public class ESboxCppPropertyTester extends PropertyTester implements
+ IPropertyTester {
+
+ protected IProject getProject(Object receiver) {
+ IResource rsrc = null;
+ if (receiver instanceof IResource) {
+ rsrc = (IResource) receiver;
+ } else if (receiver instanceof IAdaptable) {
+ rsrc = (IResource) (((IAdaptable) receiver).getAdapter(IResource.class));
+ }
+ if (rsrc == null)
+ return null;
+ return rsrc.getProject();
+ }
+
+ protected ISDKTarget getSDKTarget(IProject project) {
+ try {
+ return ProjectManager.getInstance().getSDKTarget(project);
+ } catch (ESboxException e) {
+ return null;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ public boolean test(Object receiver, String property, Object[] args,
+ Object expectedValue) {
+
+ IProject project = getProject(receiver);
+ if (project != null) {
+ if (property.equals("isCProject")) {
+ return ESboxCppProjectNature.isNatureInProject(project);
+ }
+ if (property.equals("isESboxProject")) {
+ return ProjectManager.getInstance().isESboxProject(project);
+ }
+ }
+
+
+ return false;
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppTemplateProcessInfo.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppTemplateProcessInfo.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxCppTemplateProcessInfo.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+import org.maemo.esbox.project.core.ESboxTemplateProcessInfo;
+
+/**
+ * This class stores information used by template processes.
+ * <p>
+ * Sadly, CDT's template parameter map, which claims to be Object -> Object,
+ * is really String -> String, so we can't keep this data in the template parameter
+ * map as we'd like.
+ * <p>
+ * We rely on the presumption that only one wizard will be running at a time
+ * and store information here instead.
+ * @author eswartz
+ *
+ */
+public class ESboxCppTemplateProcessInfo extends ESboxTemplateProcessInfo {
+
+ public static ESboxCppProjectCreatorConverterBase currentCppProjectCreatorConverter;
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxDynamicVariableResolver.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxDynamicVariableResolver.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxDynamicVariableResolver.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.variables.IDynamicVariable;
+import org.eclipse.core.variables.IDynamicVariableResolver;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.*;
+import org.maemo.esbox.core.ESboxException;
+
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+import org.maemo.esbox.project.core.ProjectManager;
+
+import java.util.Iterator;
+
+/**
+ * Resolve variables defined in the org.eclipse.core.variables.dynamicVariables extension
+ * <p>
+ * TODO: this isn't used
+ * @author eswartz
+ *
+ */
+public class ESboxDynamicVariableResolver implements IDynamicVariableResolver {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.variables.IDynamicVariableResolver#resolveValue(org.eclipse.core.variables.IDynamicVariable, java.lang.String)
+ */
+ public String resolveValue(IDynamicVariable variable, String argument)
+ throws CoreException {
+ if (variable.getName().equals("sdk_target_root")) {
+ ISDKTarget sdkTarget = getSDKTargetFromProject();
+ return sdkTarget.getSDKTargetRoot().toPortableString();
+ }
+ if (variable.getName().equals("sbox_to_local_path")) {
+ ISDKTarget sdkTarget = getSDKTargetFromProject();
+ IPath localPath;
+ try {
+ localPath = sdkTarget.convertTargetToHostPath(new Path(argument));
+ } catch (ESboxException e) {
+ throw new CoreException(Activator.createErrorStatus("Error converting path", e));
+ }
+ return localPath.toPortableString();
+
+ }
+ return null;
+ }
+
+ /**
+ * @param variable
+ * @return
+ * @throws CoreException
+ */
+ private ISDKTarget getSDKTargetFromProject()
+ throws CoreException {
+ IResource resource = getSelectedResource();
+ if (resource == null)
+ throw new CoreException(Activator.createErrorStatus("Cannot determine current project", null));
+ IProject project = resource.getProject();
+ ISDKTarget sdkTarget;
+ try {
+ sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
+ } catch (ESboxException e) {
+ throw new CoreException(Activator.createErrorStatus("Error discovering build target for ESbox project: " + project.getName(), e));
+ }
+ return sdkTarget;
+ }
+
+ /**
+ * @return the currently selected resource, if known
+ */
+ private IResource getSelectedResource() {
+ if (Display.getCurrent() != null)
+ return getSelectedResource0();
+ else {
+ final IResource[] rsrcs = { null };
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ rsrcs[0] = getSelectedResource0();
+ }
+
+ });
+ return rsrcs[0];
+ }
+ }
+
+ /**
+ * Returns the currently selected resource from the active part, or <code>null</code> if one cannot be
+ * resolved.
+ * <p>
+ * Lifted from debugger internals :p
+ * @return the currently selected <code>IResource</code>, or <code>null</code> if none.
+ * @since 3.3
+ */
+ protected IResource getSelectedResource0() {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ IResource resource = null;
+ if(window != null) {
+ IWorkbenchPage page = window.getActivePage();
+ if(page != null) {
+ IWorkbenchPart part = page.getActivePart();
+ if(part instanceof IEditorPart) {
+ IEditorPart epart = (IEditorPart) part;
+ resource = (IResource) epart.getEditorInput().getAdapter(IResource.class);
+ }
+ else if(part != null) {
+ IWorkbenchPartSite site = part.getSite();
+ if(site != null) {
+ ISelectionProvider provider = site.getSelectionProvider();
+ if(provider != null) {
+ ISelection selection = provider.getSelection();
+ if(selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ if(!ss.isEmpty()) {
+ Iterator<?> iterator = ss.iterator();
+ while (iterator.hasNext() && resource == null) {
+ Object next = iterator.next();
+ resource = (IResource) Platform.getAdapterManager().getAdapter(next, IResource.class);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return resource;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxOldMakeBuilder.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxOldMakeBuilder.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/ESboxOldMakeBuilder.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,314 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ErrorParserManager;
+import org.eclipse.cdt.core.model.ICModelMarker;
+import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
+import org.eclipse.cdt.make.core.*;
+import org.eclipse.cdt.make.internal.core.MakeMessages;
+import org.eclipse.cdt.make.internal.core.StreamMonitor;
+import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerInfoConsoleParserFactory;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.Job;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+import org.maemo.esbox.project.core.ProjectManager;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * ESboxMakeBuilder
+ * Builder for standard ESbox projects. A builder launches an application and it is also has
+ * a nature associated with it, so that when a project is built, the builder associated is
+ * called automatically.
+ *
+ */
+ at SuppressWarnings("restriction")
+public class ESboxOldMakeBuilder extends MakeBuilder {
+
+ public final static String OLD_BUILDER_ID = "org.maemo.esbox.core.esboxMakeBuilder";
+ // XXX: clean up this dependency?
+ private static final String SCRATCHBOX_CONSOLE_ID = "org.maemo.esbox.cpp.project.ui.scratchboxConsole";
+
+ /**
+ * Constructor
+ */
+ public ESboxOldMakeBuilder() {
+
+ }
+
+ protected String getBuilderId() {
+ return OLD_BUILDER_ID;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.internal.events.InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
+ boolean bPerformBuild = true;
+
+ IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(args, getBuilderId());
+
+ if (!shouldBuild(kind, info)) {
+ return new IProject[0];
+ }
+ if (kind == IncrementalProjectBuilder.AUTO_BUILD) {
+ IResourceDelta delta = getDelta(getProject());
+ if (delta != null) {
+ IResource res = delta.getResource();
+ if (res != null) {
+ bPerformBuild = res.getProject().equals(getProject());
+ }
+ } else {
+ bPerformBuild = false;
+ }
+ }
+ if (bPerformBuild) {
+ boolean isClean = invokeMake(kind, info, monitor);
+ if (isClean) {
+ forgetLastBuiltState();
+ }
+ }
+ checkCancel(monitor);
+ return getProject().getReferencedProjects();
+ }
+
+ protected void clean(IProgressMonitor monitor) throws CoreException {
+ final IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(getProject(), getBuilderId());
+ if (shouldBuild(CLEAN_BUILD, info)) {
+ IResourceRuleFactory ruleFactory= ResourcesPlugin.getWorkspace().getRuleFactory();
+ final ISchedulingRule rule = ruleFactory.modifyRule(getProject());
+ Job backgroundJob = new Job("Standard Make Builder"){ //$NON-NLS-1$
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+
+ public void run(IProgressMonitor monitor) {
+ invokeMake(CLEAN_BUILD, info, monitor);
+ }
+ }, rule, IWorkspace.AVOID_UPDATE, monitor);
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ IStatus returnStatus = Status.OK_STATUS;
+ return returnStatus;
+ }
+
+
+ };
+
+ backgroundJob.setRule(rule);
+ backgroundJob.schedule();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.MakeBuilder#invokeMake(int, org.eclipse.cdt.make.core.IMakeBuilderInfo, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected boolean invokeMake(int kind, IMakeBuilderInfo info, IProgressMonitor monitor) {
+ boolean isClean = false;
+ IProject currProject = getProject();
+
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+ monitor.beginTask(MakeMessages.getString("MakeBuilder.Invoking_Make_Builder") + currProject.getName(), 100); //$NON-NLS-1$
+
+ try {
+ // make sure machine is available
+ CppScriptLauncher.getInstance().ensureBuildMachine(
+ currProject, new SubProgressMonitor(monitor, 1));
+
+ // make sure Makefile is available
+ CppScriptLauncher.getInstance().runEstablishAutoMakefiles(
+ currProject,
+ new SubProgressMonitor(monitor, 1),
+ null,
+ null);
+
+ IPath buildCommand = info.getBuildCommand();
+ if (buildCommand != null) {
+
+ ISDKTarget sdkTarget = ProjectManager.getInstance().getSDKTarget(currProject);
+
+ IConsole console = CCorePlugin.getDefault().getConsole(SCRATCHBOX_CONSOLE_ID);
+
+ console.start(currProject);
+
+ OutputStream cos = console.getOutputStream();
+
+ // remove all markers for this project
+ removeAllMarkers(currProject);
+
+ IPath workingDirectory = MakeBuilderUtil.getBuildDirectory(currProject, info);
+
+ String[] targets = getTargets(kind, info);
+ if (targets.length != 0 && targets[targets.length - 1].equals(info.getCleanBuildTarget())) //$NON-NLS-1$
+ isClean = true;
+
+ String errMsg = null;
+ IProcessLauncherFactory processLauncherFactory = sdkTarget.getProcessLauncherFactory();
+
+ // Set the environment
+ Properties envMap = new Properties();
+ if (info.appendEnvironment()) {
+ Properties environment = processLauncherFactory.getStandardEnvironment();
+ if (environment != null)
+ envMap.putAll(environment);
+ }
+ // Add variables from build info
+ envMap.putAll(info.getExpandedEnvironment());
+
+ IPath wdInSb = sdkTarget.convertHostToTargetPath(workingDirectory);
+
+ // add CWD and PWD since subprocesses may need it
+ envMap.put("CWD", wdInSb.toPortableString());
+ envMap.put("PWD", wdInSb.toPortableString());
+
+ String[] buildArguments = targets;
+ if (info.isDefaultBuildCmd()) {
+ if (!info.isStopOnError()) {
+ buildArguments = new String[targets.length + 1];
+ buildArguments[0] = "-k";
+ System.arraycopy(targets, 0, buildArguments, 1, targets.length);
+ }
+ } else {
+ String args = info.getBuildArguments();
+ if (args != null && !args.equals("")) {
+ List<String> newArgsList = CommandLineArguments.createFromCommandLine(args);
+ String[] newArgs = (String[]) newArgsList.toArray(new String[newArgsList
+ .size()]);
+ buildArguments = new String[targets.length + newArgs.length];
+ System.arraycopy(newArgs, 0, buildArguments, 0, newArgs.length);
+ System.arraycopy(targets, 0, buildArguments, newArgs.length, targets.length);
+ }
+ }
+
+ QualifiedName qName = new QualifiedName(Activator.PLUGIN_ID, "progressMonitor"); //$NON-NLS-1$
+
+ Integer last = (Integer)getProject().getSessionProperty(qName);
+ if (last == null) {
+ last = new Integer(100);
+ }
+
+ StreamMonitor streamMon = new StreamMonitor(new SubProgressMonitor(monitor, 100), cos, last.intValue());
+ ErrorParserManager epm = new ErrorParserManager(getProject(), workingDirectory, this, info.getErrorParsers());
+ epm.setOutputStream(streamMon);
+ OutputStream stdout = epm.getOutputStream();
+ OutputStream stderr = epm.getOutputStream();
+
+ // Sniff console output for scanner info
+ ConsoleOutputSniffer sniffer = ScannerInfoConsoleParserFactory.getMakeBuilderOutputSniffer(
+ stdout, stderr, getProject(), workingDirectory, null, this, null);
+
+ OutputStream consoleOut = (sniffer == null ? stdout : sniffer.getOutputStream());
+ OutputStream consoleErr = (sniffer == null ? stderr : sniffer.getErrorStream());
+
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine(buildCommand.toString());
+ CommandLineArguments.append(cmdLine, buildArguments);
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory,
+ wdInSb, cmdLine, envMap);
+
+ Process process = processLauncher.createProcess();
+ try {
+ // Close the input of the Process explicitly.
+ // We will never write to it.
+ process.getOutputStream().close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ // Before launching give visual cues via the monitor
+ monitor.subTask(MakeMessages.getString("MakeBuilder.Invoking_Command")
+ + CommandLineArguments.toCommandLine(
+ cmdLine)); //$NON-NLS-1$
+ int exit = processLauncher.waitAndRead(consoleOut, consoleErr,
+ new SubProgressMonitor(monitor, 0),
+ true);
+
+ // TODO: make this update the console's name instead
+ new PrintStream(consoleOut).println("\n*** exited with code " + exit);
+
+ monitor.subTask(MakeMessages.getString("MakeBuilder.Updating_project")); //$NON-NLS-1$
+
+ try {
+ // Do not allow the cancel of the refresh, since the builder is external
+ // to Eclipse, files may have been created/modified and we will be out-of-sync.
+ // The caveat is for hugue projects, it may take sometimes at every build.
+ currProject.refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ getProject().setSessionProperty(qName, !monitor.isCanceled() && !isClean ? new Integer(streamMon.getWorkDone()) : null);
+
+ if (errMsg != null) {
+ StringBuffer buf = new StringBuffer(buildCommand.toString() + " "); //$NON-NLS-1$
+ for (int i = 0; i < buildArguments.length; i++) {
+ buf.append(buildArguments[i]);
+ buf.append(' ');
+ }
+
+ String errorDesc = MakeMessages.getFormattedString("MakeBuilder.buildError", buf.toString()); //$NON-NLS-1$
+ buf = new StringBuffer(errorDesc);
+ buf.append(System.getProperty("line.separator", "\n"));
+ buf.append("(").append(errMsg).append(")");
+ cos.write(buf.toString().getBytes());
+ cos.flush();
+ }
+
+ stdout.close();
+ stderr.close();
+
+ consoleOut.close();
+ consoleErr.close();
+
+ monitor.subTask(MakeMessages.getString("MakeBuilder.Creating_Markers"));
+ epm.reportProblems();
+ cos.close();
+ }
+ } catch (Exception e) {
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+ errorLogger.logAndShowError("Make builder error", e);
+ } finally {
+ monitor.done();
+ }
+ return (isClean);
+ }
+
+ /**
+ * Remove all markers from the project.
+ * @param currProject the project to remove the markers.
+ * @throws CoreException if any problem occurrs while removing the markers from the project.
+ */
+ private void removeAllMarkers(IProject currProject) throws CoreException {
+ IWorkspace workspace = currProject.getWorkspace();
+
+ // remove all markers
+ IMarker[] markers = currProject.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
+ if (markers != null) {
+ workspace.deleteMarkers(markers);
+ }
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/OldESboxProjectNature.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/OldESboxProjectNature.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/OldESboxProjectNature.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.core;
+
+import org.eclipse.cdt.make.core.MakeProjectNature;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+
+/**
+ * Old (pre-1.5) ESbox Nature class. This class has also some utility methods to add ESbox
+ * nature to a project.
+ */
+public class OldESboxProjectNature extends MakeProjectNature {
+
+ private IProject project;
+
+
+
+ /*
+ * id of ESbox Project dee.nokia.esbox.plugin.core.ESbox
+ */
+ private static final String ESBOX_NATURE_ID = "org.indt.esbox.core.ESboxNature";
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.MakeProjectNature#addBuildSpec()
+ */
+ public void addBuildSpec() throws CoreException {
+ // removed
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.MakeProjectNature#removeBuildSpec()
+ */
+ public void removeBuildSpec() throws CoreException {
+ removeFromBuildSpec(getProject(), ESboxOldMakeBuilder.BUILDER_ID, null);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#configure()
+ */
+ public void configure() throws CoreException {
+ // removed
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#deconfigure()
+ */
+ public void deconfigure() throws CoreException {
+ removeBuildSpec();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#getProject()
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
+ */
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ public static boolean isNatureInProject(IProject _project) {
+ if(_project != null && _project.isOpen()){
+ try {
+ IProjectNature nature = _project.getNature(ESBOX_NATURE_ID);
+ if(nature instanceof OldESboxProjectNature){
+ return true;
+ }
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Cannot detect project nature", e);
+ }
+ }
+ return false;
+ }
+}
+
\ No newline at end of file
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxBuildData.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxBuildData.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxBuildData.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core.cdt;
+
+import org.eclipse.cdt.core.envvar.IEnvironmentContributor;
+import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultBuildData;
+import org.maemo.esbox.cpp.project.core.ESboxCppBuildConfiguration;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ESboxBuildData extends CDefaultBuildData {
+
+ private ESboxCppBuildConfiguration configuration;
+
+ /**
+ * @param configuration
+ */
+ public ESboxBuildData(ESboxCppBuildConfiguration configuration) {
+ super(Activator.PLUGIN_ID + "."
+ + configuration.getSDKName() + "."
+ + configuration.getSDKTargetName() + "."
+ + "BuildData",
+ null);
+ this.configuration = configuration;
+ setBuilderCWD(configuration.getProject().getLocation());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.CDataObject#getName()
+ */
+ @Override
+ public String getName() {
+ return configuration.getSDKTargetName() + " Build Data";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.CDataObject#isValid()
+ */
+ @Override
+ public boolean isValid() {
+ return configuration != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.CBuildData#getBuildEnvironmentContributor()
+ */
+ @Override
+ public IEnvironmentContributor getBuildEnvironmentContributor() {
+ /*
+ return new IEnvironmentContributor() {
+
+ public IEnvironmentVariable getVariable(String name,
+ IEnvironmentVariableManager provider) {
+ return null;
+ }
+
+ public IEnvironmentVariable[] getVariables(
+ IEnvironmentVariableManager provider) {
+ return null;
+ }
+
+ };*/
+ return null;
+ }
+
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxCConfigurationDataProvider.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxCConfigurationDataProvider.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxCConfigurationDataProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core.cdt;
+
+import org.eclipse.cdt.core.settings.model.*;
+import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
+import org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory;
+import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationDataProvider;
+import org.eclipse.cdt.core.settings.model.util.CDataSerializer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+
+/**
+ * Implementation of org.eclipse.cdt.core.CConfigurationDataProvider
+ * which allows for ESbox-specific build configurations.
+ * @author eswartz
+ *
+ */
+public class ESboxCConfigurationDataProvider extends CDefaultConfigurationDataProvider {
+ // XXX: remove from ESboxProjectProperties
+ static final String TARGET_NAME_PROPERTY = "targetName";
+
+ static final String ID_PROPERTY = "id";
+ static final String NAME_PROPERTY = "name";
+
+ static final String SDK_NAME_PROPERTY = "sdkName";
+
+ static final String EXECUTION_ENVIRONMENT_PROPERTY = "executionEnvironment";
+
+ public static final String CFG_DATA_PROVIDER_ID = Activator.PLUGIN_ID + ".ESboxCConfigurationDataProvider";
+
+ /**
+ *
+ */
+ public ESboxCConfigurationDataProvider() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationDataProvider#getDataFactory()
+ */
+ @Override
+ protected CDataFactory getDataFactory() {
+ return new ESboxDataFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationDataProvider#applyConfiguration(org.eclipse.cdt.core.settings.model.ICConfigurationDescription, org.eclipse.cdt.core.settings.model.ICConfigurationDescription, org.eclipse.cdt.core.settings.model.extension.CConfigurationData, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public CConfigurationData applyConfiguration(
+ ICConfigurationDescription des,
+ ICConfigurationDescription baseDescription,
+ CConfigurationData base, IProgressMonitor monitor)
+ throws CoreException {
+ ICStorageElement el = getStorageElement(des, true);
+ el.clear();
+ CDataSerializer serializer = getDataSerializer();
+ serializer.store(base, el);
+ return base;
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxConfigurationData.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxConfigurationData.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxConfigurationData.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core.cdt;
+
+import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
+import org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory;
+import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationData;
+import org.maemo.esbox.internal.cpp.project.core.Activator;
+
+/**
+ * This is the data CDT needs for a build configuration.
+ * @author eswartz
+ *
+ */
+public class ESboxConfigurationData extends CDefaultConfigurationData {
+ public static final String ID = Activator.PLUGIN_ID + ".ESboxCConfigurationDataProvider";
+
+ public ESboxConfigurationData(CDataFactory factory) {
+ super(factory);
+ }
+
+ public ESboxConfigurationData(String id, String name,
+ CConfigurationData base, CDataFactory factory, boolean clone) {
+ super(id, name, base, factory, clone);
+ }
+
+ public ESboxConfigurationData(String id, String name, CDataFactory factory) {
+ super(id, name, factory);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationData#getFactory()
+ */
+ @Override
+ public CDataFactory getFactory() {
+ return new ESboxDataFactory();
+ }
+
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxDataFactory.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxDataFactory.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxDataFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core.cdt;
+
+import org.eclipse.cdt.core.settings.model.extension.*;
+import org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory;
+import org.eclipse.cdt.core.settings.model.util.CDataUtil;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * This factory creates the data we want for our projects -- namely, we only care
+ * about per-project settings (not individual per-folder or per-file settings).
+ * @author eswartz
+ *
+ */
+public class ESboxDataFactory extends CDataFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory#createConfigurationdata(java.lang.String, java.lang.String, org.eclipse.cdt.core.settings.model.extension.CConfigurationData, boolean)
+ */
+ @Override
+ public CConfigurationData createConfigurationdata(String id, String name,
+ CConfigurationData base, boolean clone) {
+ if(clone){
+ id = base.getId();
+ } else if(id == null){
+ id = CDataUtil.genId(null);
+ }
+
+ return new ESboxConfigurationData(id, name, base, this, clone);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory#createFolderData(org.eclipse.cdt.core.settings.model.extension.CConfigurationData, org.eclipse.cdt.core.settings.model.extension.CFolderData, java.lang.String, boolean, org.eclipse.core.runtime.IPath)
+ */
+ @Override
+ public CFolderData createFolderData(CConfigurationData cfg,
+ CFolderData base, String id, boolean clone, IPath path) {
+ if(id == null)
+ id = clone ? base.getId() : CDataUtil.genId(cfg.getId());
+ if (path.segmentCount() == 0)
+ return new ESboxRootFolderData(cfg, base, id, clone, path);
+ return super.createFolderData(cfg, base, id, clone, path);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory#createTargetPlatformData(org.eclipse.cdt.core.settings.model.extension.CConfigurationData, org.eclipse.cdt.core.settings.model.extension.CTargetPlatformData, java.lang.String, java.lang.String, boolean)
+ */
+ @Override
+ public CTargetPlatformData createTargetPlatformData(CConfigurationData cfg,
+ CTargetPlatformData base, String id, String name, boolean clone) {
+ if(id == null)
+ id = clone ? base.getId() : CDataUtil.genId(cfg.getId());
+ ESboxTargetPlatformData data = new ESboxTargetPlatformData(id, base);
+ data.setName(name);
+ return data;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory#createLanguageData(org.eclipse.cdt.core.settings.model.extension.CConfigurationData, org.eclipse.cdt.core.settings.model.extension.CResourceData, org.eclipse.cdt.core.settings.model.extension.CLanguageData, java.lang.String, boolean)
+ */
+ @Override
+ public CLanguageData createLanguageData(CConfigurationData cfg,
+ CResourceData rcBase, CLanguageData base, String id, boolean clone) {
+ if(id == null)
+ id = clone ? base.getId() : CDataUtil.genId(rcBase.getId());
+ return new ESboxLanguageData(id, base);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory#createLanguageData(org.eclipse.cdt.core.settings.model.extension.CConfigurationData, org.eclipse.cdt.core.settings.model.extension.CResourceData, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String[], boolean)
+ */
+ @Override
+ public CLanguageData createLanguageData(CConfigurationData cfg,
+ CResourceData rcBase, String id, String name, String languageId,
+ int supportedEntryKinds, String[] rcTypes, boolean isContentTypes) {
+ if(id == null)
+ id = CDataUtil.genId(rcBase.getId());
+ ESboxLanguageData lData = new ESboxLanguageData(id, languageId, rcTypes, isContentTypes);
+ lData.setName(name);
+ lData.setSupportedKinds(supportedEntryKinds);
+ return lData;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory#link(org.eclipse.cdt.core.settings.model.extension.CDataObject, org.eclipse.cdt.core.settings.model.extension.CDataObject)
+ */
+ @Override
+ public void link(CDataObject parent, CDataObject child) {
+ if (child == null)
+ return;
+ super.link(parent, child);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxLanguageData.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxLanguageData.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxLanguageData.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core.cdt;
+
+import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
+import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultLanguageData;
+
+/**
+ * The implementation of language data for CDT.
+ * @author eswartz
+ *
+ */
+public class ESboxLanguageData extends CDefaultLanguageData {
+
+ /**
+ *
+ */
+ public ESboxLanguageData() {
+ super();
+ }
+
+ public ESboxLanguageData(String id, CLanguageData base) {
+ super(id, base);
+ }
+
+ public ESboxLanguageData(String id, String languageId, String[] ids,
+ boolean isContentTypes) {
+ super(id, languageId, ids, isContentTypes);
+ }
+
+ public void setName(String name) {
+ this.fName = name;
+ }
+
+ public void setSupportedKinds(int supportedEntryKinds) {
+ this.fSupportedKinds = supportedEntryKinds;
+ }
+
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxRootFolderData.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxRootFolderData.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxRootFolderData.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core.cdt;
+
+import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
+import org.eclipse.cdt.core.settings.model.extension.CFolderData;
+import org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory;
+import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultFolderData;
+import org.eclipse.core.runtime.IPath;
+
+public class ESboxRootFolderData extends CDefaultFolderData {
+
+ /**
+ * @param cfg
+ * @param factory
+ */
+ public ESboxRootFolderData(CConfigurationData cfg, CDataFactory factory) {
+ super(cfg, factory == null ? new ESboxDataFactory() : factory);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param id
+ * @param path
+ * @param cfg
+ * @param factory
+ */
+ public ESboxRootFolderData(String id, IPath path, CConfigurationData cfg,
+ CDataFactory factory) {
+ super(id, path, cfg, factory == null ? new ESboxDataFactory() : factory);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param id
+ * @param path
+ * @param base
+ * @param cfg
+ * @param factory
+ * @param clone
+ */
+ public ESboxRootFolderData(String id, IPath path, CFolderData base,
+ CConfigurationData cfg, CDataFactory factory, boolean clone) {
+ super(id, path, base, cfg, factory == null ? new ESboxDataFactory() : factory, clone);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param cfg
+ * @param base
+ * @param id
+ * @param clone
+ * @param path
+ */
+ public ESboxRootFolderData(CConfigurationData cfg, CFolderData base,
+ String id, boolean clone, IPath path) {
+ super(id, path, base, cfg, new ESboxDataFactory(), clone);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.settings.model.extension.impl.CDefaultFolderData#copyDataFrom(org.eclipse.cdt.core.settings.model.extension.CFolderData, boolean)
+ */
+ @Override
+ protected void copyDataFrom(CFolderData base, boolean clone) {
+ super.copyDataFrom(base, clone);
+
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxTargetPlatformData.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxTargetPlatformData.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/cpp/project/core/cdt/ESboxTargetPlatformData.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.core.cdt;
+
+import org.eclipse.cdt.core.settings.model.extension.CTargetPlatformData;
+import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultTargetPlatformData;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ESboxTargetPlatformData extends CDefaultTargetPlatformData {
+
+ public ESboxTargetPlatformData(String id, String name) {
+ super(id, name);
+ }
+
+ public ESboxTargetPlatformData(String id, CTargetPlatformData base) {
+ super(id, base);
+ }
+
+ /**
+ * @param name
+ */
+ public void setName(String name) {
+ this.fName = name;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal/cpp/project/core/Activator.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal/cpp/project/core/Activator.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.core/src/org/maemo/esbox/internal/cpp/project/core/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,183 @@
+package org.maemo.esbox.internal.cpp.project.core;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.settings.model.*;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.PlatformUI;
+import org.maemo.esbox.core.ErrorLogger;
+
+import org.maemo.esbox.cpp.project.core.ESboxCppProjectHandle;
+import org.maemo.esbox.cpp.project.core.ESboxCppProjectNature;
+import org.maemo.esbox.project.core.*;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.cpp.project.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ // watch for changes to active build configuration so
+ // we can rebuild the project properly
+ CoreModel.getDefault().addCProjectDescriptionListener(new ICProjectDescriptionListener() {
+
+ public void handleEvent(CProjectDescriptionEvent event) {
+ // make sure this is an ESbox project
+ IProject project = event.getProject();
+ if (project == null)
+ return;
+ if (project != null && ESboxCppProjectNature.isNatureInProject(project)) {
+ // see if the active config changed. make sure there was an old config though
+ if (event.getOldCProjectDescription() != null) {
+ ICConfigurationDescription newConfig = event.getNewCProjectDescription().getActiveConfiguration();
+ ICConfigurationDescription oldConfig = event.getOldCProjectDescription().getActiveConfiguration();
+ if (newConfig == null || oldConfig == null || !newConfig.getId().equals(oldConfig.getId())) {
+ IESboxProjectHandle projectHandle = new ESboxCppProjectHandle(project, event.getNewCProjectDescription());
+ IESboxBuildConfiguration oldBuildConfig = projectHandle.findBuildConfiguration(oldConfig.getId());
+ IESboxBuildConfiguration buildConfig = projectHandle.findBuildConfiguration(newConfig.getId());
+ if (buildConfig != null || oldBuildConfig != null) {
+ // notify any listeners
+ fireBuildConfigChanged(project, buildConfig);
+ }
+ }
+ }
+ }
+ }
+
+ },
+
+ CProjectDescriptionEvent.APPLIED);
+
+ }
+
+ /**
+ * Tell listeners that the build configuration changed
+ * @param project
+ * @param buildConfig
+ */
+ protected static void fireBuildConfigChanged(
+ IProject project, IESboxBuildConfiguration buildConfig) {
+ // we're the only listener now, so we just put our implementation here
+
+ // buildConfig might be null, so don't get handle from config
+
+ // also, project might be deleted by now, so handle error
+ IESboxProjectHandle projectHandle = ProjectManager.getInstance().getProjectHandle(project);
+ if (projectHandle != null) {
+ projectHandle.clearBuildState();
+ }
+
+ if (PlatformUI.isWorkbenchRunning()) {
+ try {
+ project.build(IncrementalProjectBuilder.CLEAN_BUILD, null);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to clean project on build configuration change", e);
+ }
+ }
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+}
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/.classpath
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/.classpath (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="copied"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.cpp.project.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:27:48 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox C/C++ Project UI Plug-in
+Bundle-SymbolicName: org.maemo.esbox.cpp.project.ui;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.cpp.project.ui.UIActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.linux.packages.core;bundle-version="1.5.0",
+ org.maemo.esbox.linux.packages.ui;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.ui;bundle-version="1.5.0",
+ org.eclipse.cdt.make.ui;bundle-version="5.0.0",
+ org.eclipse.cdt.ui;bundle-version="5.0.1",
+ org.eclipse.cdt.core;bundle-version="5.0.1",
+ org.maemo.esbox.cpp.project.core;bundle-version="1.5.0",
+ org.eclipse.cdt.make.core;bundle-version="5.0.1",
+ org.eclipse.ui.ide;bundle-version="3.4.0",
+ org.maemo.esbox.ui;bundle-version="1.5.0",
+ org.eclipse.cdt.managedbuilder.core;bundle-version="5.0.0",
+ org.eclipse.cdt.managedbuilder.ui;bundle-version="5.0.0",
+ org.eclipse.ui.editors;bundle-version="3.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.cpp.project.ui,
+ org.maemo.esbox.cpp.project.ui.processes,
+ org.maemo.esbox.cpp.project.ui.templateengine
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/build.properties
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/build.properties (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+source.. = src/,\
+ copied/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/ToolFactory.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/ToolFactory.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/ToolFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+package copiedFromJDT.core;
+
+import copiedFromJDT.core.compiler.IScanner;
+import copiedFromJDT.internal.compiler.classfmt.ClassFileConstants;
+import copiedFromJDT.internal.core.util.PublicScanner;
+
+/**
+ * Factory for creating various compiler tools, such as scanners, parsers and compilers.
+ * <p>
+ * This class provides static methods only; it is not intended to be instantiated or subclassed by clients.
+ * </p>
+ *
+ * @since 2.0
+ */
+public class ToolFactory {
+
+
+ public static IScanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean assertMode, boolean recordLineSeparator){
+
+ PublicScanner scanner = new PublicScanner(tokenizeComments, tokenizeWhiteSpace, false/*nls*/, assertMode ? ClassFileConstants.JDK1_4 : ClassFileConstants.JDK1_3/*sourceLevel*/, null/*taskTags*/, null/*taskPriorities*/, true/*taskCaseSensitive*/);
+ scanner.recordLineSeparator = recordLineSeparator;
+ return scanner;
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/CharOperation.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/CharOperation.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/CharOperation.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3411 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Luiz-Otavio Zorzella <zorzella at gmail dot com> - Improve CamelCase algorithm
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.core.compiler;
+
+import copiedFromJDT.internal.compiler.parser.ScannerHelper;
+
+/**
+ * This class is a collection of helper methods to manipulate char arrays.
+ * <p>
+ * This class is not intended to be instantiated or subclassed by clients.
+ * </p>
+ *
+ * @since 2.1
+ */
+public final class CharOperation {
+
+ /**
+ * Constant for an empty char array
+ */
+ public static final char[] NO_CHAR = new char[0];
+
+ /**
+ * Constant for an empty char array with two dimensions.
+ */
+ public static final char[][] NO_CHAR_CHAR = new char[0][];
+
+ /**
+ * Constant for an empty String array.
+ * @since 3.1
+ */
+ public static final String[] NO_STRINGS = new String[0];
+
+ /**
+ * Answers a new array with appending the suffix character at the end of the array.
+ * <br>
+ * <br>
+ * For example:<br>
+ * <ol>
+ * <li><pre>
+ * array = { 'a', 'b' }
+ * suffix = 'c'
+ * => result = { 'a', 'b' , 'c' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = null
+ * suffix = 'c'
+ * => result = { 'c' }
+ * </pre></li>
+ * </ol>
+ *
+ * @param array the array that is concanated with the suffix character
+ * @param suffix the suffix character
+ * @return the new array
+ */
+ public static final char[] append(char[] array, char suffix) {
+ if (array == null)
+ return new char[] { suffix };
+ int length = array.length;
+ System.arraycopy(array, 0, array = new char[length + 1], 0, length);
+ array[length] = suffix;
+ return array;
+ }
+
+ /**
+ * Append the given subarray to the target array starting at the given index in the target array.
+ * The start of the subarray is inclusive, the end is exclusive.
+ * Answers a new target array if it needs to grow, otherwise answers the same target array.
+ * <br>
+ * For example:<br>
+ * <ol>
+ * <li><pre>
+ * target = { 'a', 'b', '0' }
+ * index = 2
+ * array = { 'c', 'd' }
+ * start = 0
+ * end = 1
+ * => result = { 'a', 'b' , 'c' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * target = { 'a', 'b' }
+ * index = 2
+ * array = { 'c', 'd' }
+ * start = 0
+ * end = 1
+ * => result = { 'a', 'b' , 'c', '0', '0' , '0' } (new array)
+ * </pre></li>
+ * <li><pre>
+ * target = { 'a', 'b', 'c' }
+ * index = 1
+ * array = { 'c', 'd', 'e', 'f' }
+ * start = 1
+ * end = 4
+ * => result = { 'a', 'd' , 'e', 'f', '0', '0', '0', '0' } (new array)
+ * </pre></li>
+ * </ol>
+ *
+ * @param target the given target
+ * @param index the given index
+ * @param array the given array
+ * @param start the given start index
+ * @param end the given end index
+ *
+ * @return the new array
+ * @throws NullPointerException if the target array is null
+ */
+ public static final char[] append(char[] target, int index, char[] array, int start, int end) {
+ int targetLength = target.length;
+ int subLength = end-start;
+ int newTargetLength = subLength+index;
+ if (newTargetLength > targetLength) {
+ System.arraycopy(target, 0, target = new char[newTargetLength*2], 0, index);
+ }
+ System.arraycopy(array, start, target, index, subLength);
+ return target;
+ }
+
+ /**
+ * Answers the concatenation of the two arrays. It answers null if the two arrays are null.
+ * If the first array is null, then the second array is returned.
+ * If the second array is null, then the first array is returned.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * first = null
+ * second = null
+ * => result = null
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { { ' a' } }
+ * second = null
+ * => result = { { ' a' } }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = null
+ * second = { { ' a' } }
+ * => result = { { ' a' } }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { { ' b' } }
+ * second = { { ' a' } }
+ * => result = { { ' b' }, { ' a' } }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param first the first array to concatenate
+ * @param second the second array to concatenate
+ * @return the concatenation of the two arrays, or null if the two arrays are null.
+ */
+ public static final char[][] arrayConcat(char[][] first, char[][] second) {
+ if (first == null)
+ return second;
+ if (second == null)
+ return first;
+
+ int length1 = first.length;
+ int length2 = second.length;
+ char[][] result = new char[length1 + length2][];
+ System.arraycopy(first, 0, result, 0, length1);
+ System.arraycopy(second, 0, result, length1, length2);
+ return result;
+ }
+
+ /**
+ * Answers true if the pattern matches the given name using CamelCase rules, or false otherwise.
+ * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive.
+ * <br>
+ * CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term.
+ * This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized
+ * or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing
+ * in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
+ * uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field
+ * names follow the lower CamelCase convention.
+ * <br>
+ * The pattern may contain lowercase characters, which will be match in a case sensitive way. These characters must
+ * appear in sequence in the name. For instance, 'NPExcep' will match 'NullPointerException', but not 'NullPointerExCEPTION'
+ * or 'NuPoEx' will match 'NullPointerException', but not 'NoPointerException'.
+ * <br><br>
+ * Examples:
+ * <ol>
+ * <li><pre>
+ * pattern = { 'N', 'P', 'E' }
+ * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * pattern = { 'N', 'P', 'E' }
+ * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
+ * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
+ * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * pattern = { 'n', p', 'e' }
+ * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
+ * result => false
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param pattern the given pattern
+ * @param name the given name
+ * @return true if the pattern matches the given name, false otherwise
+ * @since 3.2
+ */
+ public static final boolean camelCaseMatch(char[] pattern, char[] name) {
+ if (pattern == null)
+ return true; // null pattern is equivalent to '*'
+ if (name == null)
+ return false; // null name cannot match
+
+ return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length);
+ }
+
+ /**
+ * Answers true if a sub-pattern matches the subpart of the given name using CamelCase rules, or false otherwise.
+ * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive.
+ * Can match only subset of name/pattern, considering end positions as non-inclusive.
+ * The subpattern is defined by the patternStart and patternEnd positions.
+ * <br>
+ * CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term.
+ * This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized
+ * or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing
+ * in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
+ * uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field
+ * names follow the lower CamelCase convention.
+ * <br>
+ * The pattern may contain lowercase characters, which will be match in a case sensitive way. These characters must
+ * appear in sequence in the name. For instance, 'NPExcep' will match 'NullPointerException', but not 'NullPointerExCEPTION'
+ * or 'NuPoEx' will match 'NullPointerException', but not 'NoPointerException'.
+ * <br><br>
+ * Examples:
+ * <ol>
+ * <li><pre>
+ * pattern = { 'N', 'P', 'E' }
+ * patternStart = 0
+ * patternEnd = 3
+ * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
+ * nameStart = 0
+ * nameEnd = 20
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * pattern = { 'N', 'P', 'E' }
+ * patternStart = 0
+ * patternEnd = 3
+ * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
+ * nameStart = 0
+ * nameEnd = 21
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
+ * patternStart = 0
+ * patternEnd = 6
+ * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
+ * nameStart = 0
+ * nameEnd = 20
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
+ * patternStart = 0
+ * patternEnd = 6
+ * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
+ * nameStart = 0
+ * nameEnd = 21
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * pattern = { 'n', p', 'e' }
+ * patternStart = 0
+ * patternEnd = 3
+ * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
+ * nameStart = 0
+ * nameEnd = 20
+ * result => false
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param pattern the given pattern
+ * @param patternStart the start index of the pattern, inclusive
+ * @param patternEnd the end index of the pattern, exclusive
+ * @param name the given name
+ * @param nameStart the start index of the name, inclusive
+ * @param nameEnd the end index of the name, exclusive
+ * @return true if a sub-pattern matches the subpart of the given name, false otherwise
+ * @since 3.2
+ */
+ public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd) {
+ if (name == null)
+ return false; // null name cannot match
+ if (pattern == null)
+ return true; // null pattern is equivalent to '*'
+ if (patternEnd < 0) patternEnd = pattern.length;
+ if (nameEnd < 0) nameEnd = name.length;
+
+ if (patternEnd <= patternStart) return nameEnd <= nameStart;
+ if (nameEnd <= nameStart) return false;
+ // check first pattern char
+ if (name[nameStart] != pattern[patternStart]) {
+ // first char must strictly match (upper/lower)
+ return false;
+ }
+
+ char patternChar, nameChar;
+ int iPattern = patternStart;
+ int iName = nameStart;
+
+ // Main loop is on pattern characters
+ while (true) {
+
+ iPattern++;
+ iName++;
+
+ if (iPattern == patternEnd) {
+ // We have exhausted pattern, so it's a match
+ return true;
+ }
+
+ if (iName == nameEnd){
+ // We have exhausted name (and not pattern), so it's not a match
+ return false;
+ }
+
+ // For as long as we're exactly matching, bring it on (even if it's a lower case character)
+ if ((patternChar = pattern[iPattern]) == name[iName]) {
+ continue;
+ }
+
+ // If characters are not equals, then it's not a match if patternChar is lowercase
+ if (patternChar < ScannerHelper.MAX_OBVIOUS) {
+ if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[patternChar] & ScannerHelper.C_UPPER_LETTER) == 0) {
+ return false;
+ }
+ }
+ else if (Character.isJavaIdentifierPart(patternChar) && !Character.isUpperCase(patternChar)) {
+ return false;
+ }
+
+ // patternChar is uppercase, so let's find the next uppercase in name
+ while (true) {
+ if (iName == nameEnd){
+ // We have exhausted name (and not pattern), so it's not a match
+ return false;
+ }
+
+ nameChar = name[iName];
+ if (nameChar < ScannerHelper.MAX_OBVIOUS) {
+ if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar] & (ScannerHelper.C_LOWER_LETTER | ScannerHelper.C_SPECIAL | ScannerHelper.C_DIGIT)) != 0) {
+ // nameChar is lowercase
+ iName++;
+ // nameChar is uppercase...
+ } else if (patternChar != nameChar) {
+ //.. and it does not match patternChar, so it's not a match
+ return false;
+ } else {
+ //.. and it matched patternChar. Back to the big loop
+ break;
+ }
+ }
+ else if (Character.isJavaIdentifierPart(nameChar) && !Character.isUpperCase(nameChar)) {
+ // nameChar is lowercase
+ iName++;
+ // nameChar is uppercase...
+ } else if (patternChar != nameChar) {
+ //.. and it does not match patternChar, so it's not a match
+ return false;
+ } else {
+ //.. and it matched patternChar. Back to the big loop
+ break;
+ }
+ }
+ // At this point, either name has been exhausted, or it is at an uppercase letter.
+ // Since pattern is also at an uppercase letter
+ }
+ }
+
+ /**
+ * Returns the char arrays as an array of Strings
+ *
+ * @param charArrays the char array to convert
+ * @return the char arrays as an array of Strings or null if the given char arrays is null.
+ * @since 3.0
+ */
+ public static String[] charArrayToStringArray(char[][] charArrays) {
+ if (charArrays == null)
+ return null;
+ int length = charArrays.length;
+ if (length == 0)
+ return NO_STRINGS;
+ String[] strings= new String[length];
+ for (int i= 0; i < length; i++)
+ strings[i]= new String(charArrays[i]);
+ return strings;
+ }
+
+ /**
+ * Returns the char array as a String
+
+ * @param charArray the char array to convert
+ * @return the char array as a String or null if the given char array is null.
+ * @since 3.0
+ */
+ public static String charToString(char[] charArray) {
+ if (charArray == null) return null;
+ return new String(charArray);
+ }
+
+ /**
+ * Answers a new array adding the second array at the end of first array.
+ * It answers null if the first and second are null.
+ * If the first array is null, then a new array char[][] is created with second.
+ * If the second array is null, then the first array is returned.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * first = null
+ * second = { 'a' }
+ * => result = { { ' a' } }
+ * </pre>
+ * <li><pre>
+ * first = { { ' a' } }
+ * second = null
+ * => result = { { ' a' } }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { { ' a' } }
+ * second = { ' b' }
+ * => result = { { ' a' } , { ' b' } }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param first the first array to concatenate
+ * @param second the array to add at the end of the first array
+ * @return a new array adding the second array at the end of first array, or null if the two arrays are null.
+ */
+ public static final char[][] arrayConcat(char[][] first, char[] second) {
+ if (second == null)
+ return first;
+ if (first == null)
+ return new char[][] { second };
+
+ int length = first.length;
+ char[][] result = new char[length + 1][];
+ System.arraycopy(first, 0, result, 0, length);
+ result[length] = second;
+ return result;
+ }
+ /**
+ * Compares the two char arrays lexicographically.
+ *
+ * Returns a negative integer if array1 lexicographically precedes the array2,
+ * a positive integer if this array1 lexicographically follows the array2, or
+ * zero if both arrays are equal.
+ *
+ * @param array1 the first given array
+ * @param array2 the second given array
+ * @return the returned value of the comparison between array1 and array2
+ * @throws NullPointerException if one of the arrays is null
+ * @since 3.3
+ */
+ public static final int compareTo(char[] array1, char[] array2) {
+ int length1 = array1.length;
+ int length2 = array2.length;
+ int min = Math.min(length1, length2);
+ for (int i = 0; i < min; i++) {
+ if (array1[i] != array2[i]) {
+ return array1[i] - array2[i];
+ }
+ }
+ return length1 - length2;
+ }
+ /**
+ * Compares the contents of the two arrays array and prefix. Returns
+ * <ul>
+ * <li>zero if the array starts with the prefix contents</li>
+ * <li>the difference between the first two characters that are not equal </li>
+ * <li>one if array length is lower than the prefix length and that the prefix starts with the
+ * array contents.</li>
+ * </ul>
+ * <p>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = null
+ * prefix = null
+ * => result = NullPointerException
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'a', 'b', 'c', 'd', 'e' }
+ * prefix = { 'a', 'b', 'c'}
+ * => result = 0
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'a', 'b', 'c', 'd', 'e' }
+ * prefix = { 'a', 'B', 'c'}
+ * => result = 32
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'd', 'b', 'c', 'd', 'e' }
+ * prefix = { 'a', 'b', 'c'}
+ * => result = 3
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'a', 'b', 'c', 'd', 'e' }
+ * prefix = { 'd', 'b', 'c'}
+ * => result = -3
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'a', 'a', 'c', 'd', 'e' }
+ * prefix = { 'a', 'e', 'c'}
+ * => result = -4
+ * </pre>
+ * </li>
+ * </ol>
+ * </p>
+ *
+ * @param array the given array
+ * @param prefix the given prefix
+ * @return the result of the comparison (>=0 if array>prefix)
+ * @throws NullPointerException if either array or prefix is null
+ */
+ public static final int compareWith(char[] array, char[] prefix) {
+ int arrayLength = array.length;
+ int prefixLength = prefix.length;
+ int min = Math.min(arrayLength, prefixLength);
+ int i = 0;
+ while (min-- != 0) {
+ char c1 = array[i];
+ char c2 = prefix[i++];
+ if (c1 != c2)
+ return c1 - c2;
+ }
+ if (prefixLength == i)
+ return 0;
+ return -1; // array is shorter than prefix (e.g. array:'ab' < prefix:'abc').
+ }
+
+ /**
+ * Answers the concatenation of the two arrays. It answers null if the two arrays are null.
+ * If the first array is null, then the second array is returned.
+ * If the second array is null, then the first array is returned.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * first = null
+ * second = { 'a' }
+ * => result = { ' a' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { ' a' }
+ * second = null
+ * => result = { ' a' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { ' a' }
+ * second = { ' b' }
+ * => result = { ' a' , ' b' }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param first the first array to concatenate
+ * @param second the second array to concatenate
+ * @return the concatenation of the two arrays, or null if the two arrays are null.
+ */
+ public static final char[] concat(char[] first, char[] second) {
+ if (first == null)
+ return second;
+ if (second == null)
+ return first;
+
+ int length1 = first.length;
+ int length2 = second.length;
+ char[] result = new char[length1 + length2];
+ System.arraycopy(first, 0, result, 0, length1);
+ System.arraycopy(second, 0, result, length1, length2);
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the three arrays. It answers null if the three arrays are null.
+ * If first is null, it answers the concatenation of second and third.
+ * If second is null, it answers the concatenation of first and third.
+ * If third is null, it answers the concatenation of first and second.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * first = null
+ * second = { 'a' }
+ * third = { 'b' }
+ * => result = { ' a', 'b' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * second = null
+ * third = { 'b' }
+ * => result = { ' a', 'b' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * second = { 'b' }
+ * third = null
+ * => result = { ' a', 'b' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = null
+ * second = null
+ * third = null
+ * => result = null
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * second = { 'b' }
+ * third = { 'c' }
+ * => result = { 'a', 'b', 'c' }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param first the first array to concatenate
+ * @param second the second array to concatenate
+ * @param third the third array to concatenate
+ *
+ * @return the concatenation of the three arrays, or null if the three arrays are null.
+ */
+ public static final char[] concat(
+ char[] first,
+ char[] second,
+ char[] third) {
+ if (first == null)
+ return concat(second, third);
+ if (second == null)
+ return concat(first, third);
+ if (third == null)
+ return concat(first, second);
+
+ int length1 = first.length;
+ int length2 = second.length;
+ int length3 = third.length;
+ char[] result = new char[length1 + length2 + length3];
+ System.arraycopy(first, 0, result, 0, length1);
+ System.arraycopy(second, 0, result, length1, length2);
+ System.arraycopy(third, 0, result, length1 + length2, length3);
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the two arrays inserting the separator character between the two arrays.
+ * It answers null if the two arrays are null.
+ * If the first array is null, then the second array is returned.
+ * If the second array is null, then the first array is returned.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * first = null
+ * second = { 'a' }
+ * separator = '/'
+ * => result = { ' a' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { ' a' }
+ * second = null
+ * separator = '/'
+ * => result = { ' a' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { ' a' }
+ * second = { ' b' }
+ * separator = '/'
+ * => result = { ' a' , '/', 'b' }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param first the first array to concatenate
+ * @param second the second array to concatenate
+ * @param separator the character to insert
+ * @return the concatenation of the two arrays inserting the separator character
+ * between the two arrays , or null if the two arrays are null.
+ */
+ public static final char[] concat(
+ char[] first,
+ char[] second,
+ char separator) {
+ if (first == null)
+ return second;
+ if (second == null)
+ return first;
+
+ int length1 = first.length;
+ if (length1 == 0)
+ return second;
+ int length2 = second.length;
+ if (length2 == 0)
+ return first;
+
+ char[] result = new char[length1 + length2 + 1];
+ System.arraycopy(first, 0, result, 0, length1);
+ result[length1] = separator;
+ System.arraycopy(second, 0, result, length1 + 1, length2);
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the three arrays inserting the sep1 character between the
+ * first two arrays and sep2 between the last two.
+ * It answers null if the three arrays are null.
+ * If the first array is null, then it answers the concatenation of second and third inserting
+ * the sep2 character between them.
+ * If the second array is null, then it answers the concatenation of first and third inserting
+ * the sep1 character between them.
+ * If the third array is null, then it answers the concatenation of first and second inserting
+ * the sep1 character between them.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * first = null
+ * sep1 = '/'
+ * second = { 'a' }
+ * sep2 = ':'
+ * third = { 'b' }
+ * => result = { ' a' , ':', 'b' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * sep1 = '/'
+ * second = null
+ * sep2 = ':'
+ * third = { 'b' }
+ * => result = { ' a' , '/', 'b' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * sep1 = '/'
+ * second = { 'b' }
+ * sep2 = ':'
+ * third = null
+ * => result = { ' a' , '/', 'b' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * sep1 = '/'
+ * second = { 'b' }
+ * sep2 = ':'
+ * third = { 'c' }
+ * => result = { ' a' , '/', 'b' , ':', 'c' }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param first the first array to concatenate
+ * @param sep1 the character to insert
+ * @param second the second array to concatenate
+ * @param sep2 the character to insert
+ * @param third the second array to concatenate
+ * @return the concatenation of the three arrays inserting the sep1 character between the
+ * two arrays and sep2 between the last two.
+ */
+ public static final char[] concat(
+ char[] first,
+ char sep1,
+ char[] second,
+ char sep2,
+ char[] third) {
+ if (first == null)
+ return concat(second, third, sep2);
+ if (second == null)
+ return concat(first, third, sep1);
+ if (third == null)
+ return concat(first, second, sep1);
+
+ int length1 = first.length;
+ int length2 = second.length;
+ int length3 = third.length;
+ char[] result = new char[length1 + length2 + length3 + 2];
+ System.arraycopy(first, 0, result, 0, length1);
+ result[length1] = sep1;
+ System.arraycopy(second, 0, result, length1 + 1, length2);
+ result[length1 + length2 + 1] = sep2;
+ System.arraycopy(third, 0, result, length1 + length2 + 2, length3);
+ return result;
+ }
+
+ /**
+ * Answers a new array with prepending the prefix character and appending the suffix
+ * character at the end of the array. If array is null, it answers a new array containing the
+ * prefix and the suffix characters.
+ * <br>
+ * <br>
+ * For example:<br>
+ * <ol>
+ * <li><pre>
+ * prefix = 'a'
+ * array = { 'b' }
+ * suffix = 'c'
+ * => result = { 'a', 'b' , 'c' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * prefix = 'a'
+ * array = null
+ * suffix = 'c'
+ * => result = { 'a', 'c' }
+ * </pre></li>
+ * </ol>
+ *
+ * @param prefix the prefix character
+ * @param array the array that is concanated with the prefix and suffix characters
+ * @param suffix the suffix character
+ * @return the new array
+ */
+ public static final char[] concat(char prefix, char[] array, char suffix) {
+ if (array == null)
+ return new char[] { prefix, suffix };
+
+ int length = array.length;
+ char[] result = new char[length + 2];
+ result[0] = prefix;
+ System.arraycopy(array, 0, result, 1, length);
+ result[length + 1] = suffix;
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the given array parts using the given separator between each
+ * part and appending the given name at the end.
+ * <br>
+ * <br>
+ * For example:<br>
+ * <ol>
+ * <li><pre>
+ * name = { 'c' }
+ * array = { { 'a' }, { 'b' } }
+ * separator = '.'
+ * => result = { 'a', '.', 'b' , '.', 'c' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * name = null
+ * array = { { 'a' }, { 'b' } }
+ * separator = '.'
+ * => result = { 'a', '.', 'b' }
+ * </pre></li>
+ * <li><pre>
+ * name = { ' c' }
+ * array = null
+ * separator = '.'
+ * => result = { 'c' }
+ * </pre></li>
+ * </ol>
+ *
+ * @param name the given name
+ * @param array the given array
+ * @param separator the given separator
+ * @return the concatenation of the given array parts using the given separator between each
+ * part and appending the given name at the end
+ */
+ public static final char[] concatWith(
+ char[] name,
+ char[][] array,
+ char separator) {
+ int nameLength = name == null ? 0 : name.length;
+ if (nameLength == 0)
+ return concatWith(array, separator);
+
+ int length = array == null ? 0 : array.length;
+ if (length == 0)
+ return name;
+
+ int size = nameLength;
+ int index = length;
+ while (--index >= 0)
+ if (array[index].length > 0)
+ size += array[index].length + 1;
+ char[] result = new char[size];
+ index = size;
+ for (int i = length - 1; i >= 0; i--) {
+ int subLength = array[i].length;
+ if (subLength > 0) {
+ index -= subLength;
+ System.arraycopy(array[i], 0, result, index, subLength);
+ result[--index] = separator;
+ }
+ }
+ System.arraycopy(name, 0, result, 0, nameLength);
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the given array parts using the given separator between each
+ * part and appending the given name at the end.
+ * <br>
+ * <br>
+ * For example:<br>
+ * <ol>
+ * <li><pre>
+ * name = { 'c' }
+ * array = { { 'a' }, { 'b' } }
+ * separator = '.'
+ * => result = { 'a', '.', 'b' , '.', 'c' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * name = null
+ * array = { { 'a' }, { 'b' } }
+ * separator = '.'
+ * => result = { 'a', '.', 'b' }
+ * </pre></li>
+ * <li><pre>
+ * name = { ' c' }
+ * array = null
+ * separator = '.'
+ * => result = { 'c' }
+ * </pre></li>
+ * </ol>
+ *
+ * @param array the given array
+ * @param name the given name
+ * @param separator the given separator
+ * @return the concatenation of the given array parts using the given separator between each
+ * part and appending the given name at the end
+ */
+ public static final char[] concatWith(
+ char[][] array,
+ char[] name,
+ char separator) {
+ int nameLength = name == null ? 0 : name.length;
+ if (nameLength == 0)
+ return concatWith(array, separator);
+
+ int length = array == null ? 0 : array.length;
+ if (length == 0)
+ return name;
+
+ int size = nameLength;
+ int index = length;
+ while (--index >= 0)
+ if (array[index].length > 0)
+ size += array[index].length + 1;
+ char[] result = new char[size];
+ index = 0;
+ for (int i = 0; i < length; i++) {
+ int subLength = array[i].length;
+ if (subLength > 0) {
+ System.arraycopy(array[i], 0, result, index, subLength);
+ index += subLength;
+ result[index++] = separator;
+ }
+ }
+ System.arraycopy(name, 0, result, index, nameLength);
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the given array parts using the given separator between each part.
+ * <br>
+ * <br>
+ * For example:<br>
+ * <ol>
+ * <li><pre>
+ * array = { { 'a' }, { 'b' } }
+ * separator = '.'
+ * => result = { 'a', '.', 'b' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = null
+ * separator = '.'
+ * => result = { }
+ * </pre></li>
+ * </ol>
+ *
+ * @param array the given array
+ * @param separator the given separator
+ * @return the concatenation of the given array parts using the given separator between each part
+ */
+ public static final char[] concatWith(char[][] array, char separator) {
+ int length = array == null ? 0 : array.length;
+ if (length == 0)
+ return CharOperation.NO_CHAR;
+
+ int size = length - 1;
+ int index = length;
+ while (--index >= 0) {
+ if (array[index].length == 0)
+ size--;
+ else
+ size += array[index].length;
+ }
+ if (size <= 0)
+ return CharOperation.NO_CHAR;
+ char[] result = new char[size];
+ index = length;
+ while (--index >= 0) {
+ length = array[index].length;
+ if (length > 0) {
+ System.arraycopy(
+ array[index],
+ 0,
+ result,
+ (size -= length),
+ length);
+ if (--size >= 0)
+ result[size] = separator;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Answers true if the array contains an occurrence of character, false otherwise.
+ *
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * character = 'c'
+ * array = { { ' a' }, { ' b' } }
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * character = 'a'
+ * array = { { ' a' }, { ' b' } }
+ * result => true
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param character the character to search
+ * @param array the array in which the search is done
+ * @return true if the array contains an occurrence of character, false otherwise.
+ * @throws NullPointerException if array is null.
+ */
+ public static final boolean contains(char character, char[][] array) {
+ for (int i = array.length; --i >= 0;) {
+ char[] subarray = array[i];
+ for (int j = subarray.length; --j >= 0;)
+ if (subarray[j] == character)
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Answers true if the array contains an occurrence of character, false otherwise.
+ *
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * character = 'c'
+ * array = { ' b' }
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * character = 'a'
+ * array = { ' a' , ' b' }
+ * result => true
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param character the character to search
+ * @param array the array in which the search is done
+ * @return true if the array contains an occurrence of character, false otherwise.
+ * @throws NullPointerException if array is null.
+ */
+ public static final boolean contains(char character, char[] array) {
+ for (int i = array.length; --i >= 0;)
+ if (array[i] == character)
+ return true;
+ return false;
+ }
+
+ /**
+ * Answers true if the array contains an occurrence of one of the characters, false otherwise.
+ *
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * characters = { 'c', 'd' }
+ * array = { 'a', ' b' }
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * characters = { 'c', 'd' }
+ * array = { 'a', ' b', 'c' }
+ * result => true
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param characters the characters to search
+ * @param array the array in which the search is done
+ * @return true if the array contains an occurrence of one of the characters, false otherwise.
+ * @throws NullPointerException if array is null.
+ * @since 3.1
+ */
+ public static final boolean contains(char[] characters, char[] array) {
+ for (int i = array.length; --i >= 0;)
+ for (int j = characters.length; --j >= 0;)
+ if (array[i] == characters[j])
+ return true;
+ return false;
+ }
+
+ /**
+ * Answers a deep copy of the toCopy array.
+ *
+ * @param toCopy the array to copy
+ * @return a deep copy of the toCopy array.
+ */
+
+ public static final char[][] deepCopy(char[][] toCopy) {
+ int toCopyLength = toCopy.length;
+ char[][] result = new char[toCopyLength][];
+ for (int i = 0; i < toCopyLength; i++) {
+ char[] toElement = toCopy[i];
+ int toElementLength = toElement.length;
+ char[] resultElement = new char[toElementLength];
+ System.arraycopy(toElement, 0, resultElement, 0, toElementLength);
+ result[i] = resultElement;
+ }
+ return result;
+ }
+
+ /**
+ * Return true if array ends with the sequence of characters contained in toBeFound,
+ * otherwise false.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = { 'a', 'b', 'c', 'd' }
+ * toBeFound = { 'b', 'c' }
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'a', 'b', 'c' }
+ * toBeFound = { 'b', 'c' }
+ * result => true
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param array the array to check
+ * @param toBeFound the array to find
+ * @return true if array ends with the sequence of characters contained in toBeFound,
+ * otherwise false.
+ * @throws NullPointerException if array is null or toBeFound is null
+ */
+ public static final boolean endsWith(char[] array, char[] toBeFound) {
+ int i = toBeFound.length;
+ int j = array.length - i;
+
+ if (j < 0)
+ return false;
+ while (--i >= 0)
+ if (toBeFound[i] != array[i + j])
+ return false;
+ return true;
+ }
+
+ /**
+ * Answers true if the two arrays are identical character by character, otherwise false.
+ * The equality is case sensitive.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * first = null
+ * second = null
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { { } }
+ * second = null
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { { 'a' } }
+ * second = { { 'a' } }
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { { 'A' } }
+ * second = { { 'a' } }
+ * result => false
+ * </pre>
+ * </li>
+ * </ol>
+ * @param first the first array
+ * @param second the second array
+ * @return true if the two arrays are identical character by character, otherwise false
+ */
+ public static final boolean equals(char[][] first, char[][] second) {
+ if (first == second)
+ return true;
+ if (first == null || second == null)
+ return false;
+ if (first.length != second.length)
+ return false;
+
+ for (int i = first.length; --i >= 0;)
+ if (!equals(first[i], second[i]))
+ return false;
+ return true;
+ }
+
+ /**
+ * If isCaseSensite is true, answers true if the two arrays are identical character
+ * by character, otherwise false.
+ * If it is false, answers true if the two arrays are identical character by
+ * character without checking the case, otherwise false.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * first = null
+ * second = null
+ * isCaseSensitive = true
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { { } }
+ * second = null
+ * isCaseSensitive = true
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { { 'A' } }
+ * second = { { 'a' } }
+ * isCaseSensitive = true
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { { 'A' } }
+ * second = { { 'a' } }
+ * isCaseSensitive = false
+ * result => true
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param first the first array
+ * @param second the second array
+ * @param isCaseSensitive check whether or not the equality should be case sensitive
+ * @return true if the two arrays are identical character by character according to the value
+ * of isCaseSensitive, otherwise false
+ */
+ public static final boolean equals(
+ char[][] first,
+ char[][] second,
+ boolean isCaseSensitive) {
+
+ if (isCaseSensitive) {
+ return equals(first, second);
+ }
+ if (first == second)
+ return true;
+ if (first == null || second == null)
+ return false;
+ if (first.length != second.length)
+ return false;
+
+ for (int i = first.length; --i >= 0;)
+ if (!equals(first[i], second[i], false))
+ return false;
+ return true;
+ }
+
+ /**
+ * Answers true if the two arrays are identical character by character, otherwise false.
+ * The equality is case sensitive.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * first = null
+ * second = null
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { }
+ * second = null
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * second = { 'a' }
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * second = { 'A' }
+ * result => false
+ * </pre>
+ * </li>
+ * </ol>
+ * @param first the first array
+ * @param second the second array
+ * @return true if the two arrays are identical character by character, otherwise false
+ */
+ public static final boolean equals(char[] first, char[] second) {
+ if (first == second)
+ return true;
+ if (first == null || second == null)
+ return false;
+ if (first.length != second.length)
+ return false;
+
+ for (int i = first.length; --i >= 0;)
+ if (first[i] != second[i])
+ return false;
+ return true;
+ }
+
+ /**
+ * Answers true if the first array is identical character by character to a portion of the second array
+ * delimited from position secondStart (inclusive) to secondEnd(exclusive), otherwise false.
+ * The equality is case sensitive.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * first = null
+ * second = null
+ * secondStart = 0
+ * secondEnd = 0
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { }
+ * second = null
+ * secondStart = 0
+ * secondEnd = 0
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * second = { 'a' }
+ * secondStart = 0
+ * secondEnd = 1
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * second = { 'A' }
+ * secondStart = 0
+ * secondEnd = 1
+ * result => false
+ * </pre>
+ * </li>
+ * </ol>
+ * @param first the first array
+ * @param second the second array
+ * @param secondStart inclusive start position in the second array to compare
+ * @param secondEnd exclusive end position in the second array to compare
+ * @return true if the first array is identical character by character to fragment of second array ranging from secondStart to secondEnd-1, otherwise false
+ * @since 3.0
+ */
+ public static final boolean equals(char[] first, char[] second, int secondStart, int secondEnd) {
+ return equals(first, second, secondStart, secondEnd, true);
+ }
+ /**
+ * <p>Answers true if the first array is identical character by character to a portion of the second array
+ * delimited from position secondStart (inclusive) to secondEnd(exclusive), otherwise false. The equality could be either
+ * case sensitive or case insensitive according to the value of the <code>isCaseSensitive</code> parameter.
+ * </p>
+ * <p>For example:</p>
+ * <ol>
+ * <li><pre>
+ * first = null
+ * second = null
+ * secondStart = 0
+ * secondEnd = 0
+ * isCaseSensitive = false
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { }
+ * second = null
+ * secondStart = 0
+ * secondEnd = 0
+ * isCaseSensitive = false
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * second = { 'a' }
+ * secondStart = 0
+ * secondEnd = 1
+ * isCaseSensitive = true
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * second = { 'A' }
+ * secondStart = 0
+ * secondEnd = 1
+ * isCaseSensitive = true
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'a' }
+ * second = { 'A' }
+ * secondStart = 0
+ * secondEnd = 1
+ * isCaseSensitive = false
+ * result => true
+ * </pre>
+ * </li>
+ * </ol>
+ * @param first the first array
+ * @param second the second array
+ * @param secondStart inclusive start position in the second array to compare
+ * @param secondEnd exclusive end position in the second array to compare
+ * @param isCaseSensitive check whether or not the equality should be case sensitive
+ * @return true if the first array is identical character by character to fragment of second array ranging from secondStart to secondEnd-1, otherwise false
+ * @since 3.2
+ */
+ public static final boolean equals(char[] first, char[] second, int secondStart, int secondEnd, boolean isCaseSensitive) {
+ if (first == second)
+ return true;
+ if (first == null || second == null)
+ return false;
+ if (first.length != secondEnd - secondStart)
+ return false;
+ if (isCaseSensitive) {
+ for (int i = first.length; --i >= 0;)
+ if (first[i] != second[i+secondStart])
+ return false;
+ } else {
+ for (int i = first.length; --i >= 0;)
+ if (ScannerHelper.toLowerCase(first[i]) != ScannerHelper.toLowerCase(second[i+secondStart]))
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * If isCaseSensite is true, answers true if the two arrays are identical character
+ * by character, otherwise false.
+ * If it is false, answers true if the two arrays are identical character by
+ * character without checking the case, otherwise false.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * first = null
+ * second = null
+ * isCaseSensitive = true
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { }
+ * second = null
+ * isCaseSensitive = true
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'A' }
+ * second = { 'a' }
+ * isCaseSensitive = true
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * first = { 'A' }
+ * second = { 'a' }
+ * isCaseSensitive = false
+ * result => true
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param first the first array
+ * @param second the second array
+ * @param isCaseSensitive check whether or not the equality should be case sensitive
+ * @return true if the two arrays are identical character by character according to the value
+ * of isCaseSensitive, otherwise false
+ */
+ public static final boolean equals(
+ char[] first,
+ char[] second,
+ boolean isCaseSensitive) {
+
+ if (isCaseSensitive) {
+ return equals(first, second);
+ }
+ if (first == second)
+ return true;
+ if (first == null || second == null)
+ return false;
+ if (first.length != second.length)
+ return false;
+
+ for (int i = first.length; --i >= 0;)
+ if (ScannerHelper.toLowerCase(first[i])
+ != ScannerHelper.toLowerCase(second[i]))
+ return false;
+ return true;
+ }
+
+ /**
+ * If isCaseSensite is true, the equality is case sensitive, otherwise it is case insensitive.
+ *
+ * Answers true if the name contains the fragment at the starting index startIndex, otherwise false.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * fragment = { 'b', 'c' , 'd' }
+ * name = { 'a', 'b', 'c' , 'd' }
+ * startIndex = 1
+ * isCaseSensitive = true
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * fragment = { 'b', 'c' , 'd' }
+ * name = { 'a', 'b', 'C' , 'd' }
+ * startIndex = 1
+ * isCaseSensitive = true
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * fragment = { 'b', 'c' , 'd' }
+ * name = { 'a', 'b', 'C' , 'd' }
+ * startIndex = 0
+ * isCaseSensitive = false
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * fragment = { 'b', 'c' , 'd' }
+ * name = { 'a', 'b'}
+ * startIndex = 0
+ * isCaseSensitive = true
+ * result => false
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param fragment the fragment to check
+ * @param name the array to check
+ * @param startIndex the starting index
+ * @param isCaseSensitive check whether or not the equality should be case sensitive
+ * @return true if the name contains the fragment at the starting index startIndex according to the
+ * value of isCaseSensitive, otherwise false.
+ * @throws NullPointerException if fragment or name is null.
+ */
+ public static final boolean fragmentEquals(
+ char[] fragment,
+ char[] name,
+ int startIndex,
+ boolean isCaseSensitive) {
+
+ int max = fragment.length;
+ if (name.length < max + startIndex)
+ return false;
+ if (isCaseSensitive) {
+ for (int i = max;
+ --i >= 0;
+ ) // assumes the prefix is not larger than the name
+ if (fragment[i] != name[i + startIndex])
+ return false;
+ return true;
+ }
+ for (int i = max;
+ --i >= 0;
+ ) // assumes the prefix is not larger than the name
+ if (ScannerHelper.toLowerCase(fragment[i])
+ != ScannerHelper.toLowerCase(name[i + startIndex]))
+ return false;
+ return true;
+ }
+
+ /**
+ * Answers a hashcode for the array
+ *
+ * @param array the array for which a hashcode is required
+ * @return the hashcode
+ * @throws NullPointerException if array is null
+ */
+ public static final int hashCode(char[] array) {
+ int length = array.length;
+ int hash = length == 0 ? 31 : array[0];
+ if (length < 8) {
+ for (int i = length; --i > 0;)
+ hash = (hash * 31) + array[i];
+ } else {
+ // 8 characters is enough to compute a decent hash code, don't waste time examining every character
+ for (int i = length - 1, last = i > 16 ? i - 16 : 0; i > last; i -= 2)
+ hash = (hash * 31) + array[i];
+ }
+ return hash & 0x7FFFFFFF;
+ }
+
+ /**
+ * Answers true if c is a whitespace according to the JLS (\u000a, \u000c, \u000d, \u0009), otherwise false.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * c = ' '
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * c = '\u3000'
+ * result => false
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param c the character to check
+ * @return true if c is a whitespace according to the JLS, otherwise false.
+ */
+ public static boolean isWhitespace(char c) {
+ return c < ScannerHelper.MAX_OBVIOUS && ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_JLS_SPACE) != 0);
+ }
+
+ /**
+ * Answers the first index in the array for which the corresponding character is
+ * equal to toBeFound. Answers -1 if no occurrence of this character is found.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { ' a', 'b', 'c', 'd' }
+ * result => 2
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'e'
+ * array = { ' a', 'b', 'c', 'd' }
+ * result => -1
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param toBeFound the character to search
+ * @param array the array to be searched
+ * @return the first index in the array for which the corresponding character is
+ * equal to toBeFound, -1 otherwise
+ * @throws NullPointerException if array is null
+ */
+ public static final int indexOf(char toBeFound, char[] array) {
+ return indexOf(toBeFound, array, 0);
+ }
+
+ /**
+ * Answers the first index in the array for which the toBeFound array is a matching
+ * subarray following the case rule. Answers -1 if no match is found.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * toBeFound = { 'c' }
+ * array = { ' a', 'b', 'c', 'd' }
+ * result => 2
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = { 'e' }
+ * array = { ' a', 'b', 'c', 'd' }
+ * result => -1
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param toBeFound the subarray to search
+ * @param array the array to be searched
+ * @param isCaseSensitive flag to know if the matching should be case sensitive
+ * @return the first index in the array for which the toBeFound array is a matching
+ * subarray following the case rule, -1 otherwise
+ * @throws NullPointerException if array is null or toBeFound is null
+ * @since 3.2
+ */
+ public static final int indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive) {
+ return indexOf(toBeFound, array, isCaseSensitive, 0);
+ }
+
+ /**
+ * Answers the first index in the array for which the toBeFound array is a matching
+ * subarray following the case rule starting at the index start. Answers -1 if no match is found.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * toBeFound = { 'c' }
+ * array = { ' a', 'b', 'c', 'd' }
+ * result => 2
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = { 'e' }
+ * array = { ' a', 'b', 'c', 'd' }
+ * result => -1
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param toBeFound the subarray to search
+ * @param array the array to be searched
+ * @param isCaseSensitive flag to know if the matching should be case sensitive
+ * @param start the starting index
+ * @return the first index in the array for which the toBeFound array is a matching
+ * subarray following the case rule starting at the index start, -1 otherwise
+ * @throws NullPointerException if array is null or toBeFound is null
+ * @since 3.2
+ */
+ public static final int indexOf(final char[] toBeFound, final char[] array, final boolean isCaseSensitive, final int start) {
+ return indexOf(toBeFound, array, isCaseSensitive, start, array.length);
+ }
+
+ /**
+ * Answers the first index in the array for which the toBeFound array is a matching
+ * subarray following the case rule starting at the index start. Answers -1 if no match is found.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * toBeFound = { 'c' }
+ * array = { ' a', 'b', 'c', 'd' }
+ * result => 2
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = { 'e' }
+ * array = { ' a', 'b', 'c', 'd' }
+ * result => -1
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param toBeFound the subarray to search
+ * @param array the array to be searched
+ * @param isCaseSensitive flag to know if the matching should be case sensitive
+ * @param start the starting index (inclusive)
+ * @param end the end index (exclusive)
+ * @return the first index in the array for which the toBeFound array is a matching
+ * subarray following the case rule starting at the index start, -1 otherwise
+ * @throws NullPointerException if array is null or toBeFound is null
+ * @since 3.2
+ */
+ public static final int indexOf(final char[] toBeFound, final char[] array, final boolean isCaseSensitive, final int start, final int end) {
+ final int arrayLength = end;
+ final int toBeFoundLength = toBeFound.length;
+ if (toBeFoundLength > arrayLength) return -1;
+ if (toBeFoundLength == 0) return 0;
+ if (toBeFoundLength == arrayLength) {
+ if (isCaseSensitive) {
+ for (int i = start; i < arrayLength; i++) {
+ if (array[i] != toBeFound[i]) return -1;
+ }
+ return 0;
+ } else {
+ for (int i = start; i < arrayLength; i++) {
+ if (ScannerHelper.toLowerCase(array[i]) != ScannerHelper.toLowerCase(toBeFound[i])) return -1;
+ }
+ return 0;
+ }
+ }
+ if (isCaseSensitive) {
+ arrayLoop: for (int i = start, max = arrayLength - toBeFoundLength + 1; i < max; i++) {
+ if (array[i] == toBeFound[0]) {
+ for (int j = 1; j < toBeFoundLength; j++) {
+ if (array[i + j] != toBeFound[j]) continue arrayLoop;
+ }
+ return i;
+ }
+ }
+ } else {
+ arrayLoop: for (int i = start, max = arrayLength - toBeFoundLength + 1; i < max; i++) {
+ if (ScannerHelper.toLowerCase(array[i]) == ScannerHelper.toLowerCase(toBeFound[0])) {
+ for (int j = 1; j < toBeFoundLength; j++) {
+ if (ScannerHelper.toLowerCase(array[i + j]) != ScannerHelper.toLowerCase(toBeFound[j])) continue arrayLoop;
+ }
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Answers the first index in the array for which the corresponding character is
+ * equal to toBeFound starting the search at index start.
+ * Answers -1 if no occurrence of this character is found.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { ' a', 'b', 'c', 'd' }
+ * start = 2
+ * result => 2
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { ' a', 'b', 'c', 'd' }
+ * start = 3
+ * result => -1
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'e'
+ * array = { ' a', 'b', 'c', 'd' }
+ * start = 1
+ * result => -1
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param toBeFound the character to search
+ * @param array the array to be searched
+ * @param start the starting index
+ * @return the first index in the array for which the corresponding character is
+ * equal to toBeFound, -1 otherwise
+ * @throws NullPointerException if array is null
+ * @throws ArrayIndexOutOfBoundsException if start is lower than 0
+ */
+ public static final int indexOf(char toBeFound, char[] array, int start) {
+ for (int i = start; i < array.length; i++)
+ if (toBeFound == array[i])
+ return i;
+ return -1;
+ }
+
+ /**
+ * Answers the first index in the array for which the corresponding character is
+ * equal to toBeFound starting the search at index start and before the ending index.
+ * Answers -1 if no occurrence of this character is found.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { ' a', 'b', 'c', 'd' }
+ * start = 2
+ * result => 2
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { ' a', 'b', 'c', 'd' }
+ * start = 3
+ * result => -1
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'e'
+ * array = { ' a', 'b', 'c', 'd' }
+ * start = 1
+ * result => -1
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param toBeFound the character to search
+ * @param array the array to be searched
+ * @param start the starting index (inclusive)
+ * @param end the ending index (exclusive)
+ * @return the first index in the array for which the corresponding character is
+ * equal to toBeFound, -1 otherwise
+ * @throws NullPointerException if array is null
+ * @throws ArrayIndexOutOfBoundsException if start is lower than 0 or ending greater than array length
+ * @since 3.2
+ */
+ public static final int indexOf(char toBeFound, char[] array, int start, int end) {
+ for (int i = start; i < end; i++)
+ if (toBeFound == array[i])
+ return i;
+ return -1;
+ }
+
+ /**
+ * Answers the last index in the array for which the corresponding character is
+ * equal to toBeFound starting from the end of the array.
+ * Answers -1 if no occurrence of this character is found.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { ' a', 'b', 'c', 'd' , 'c', 'e' }
+ * result => 4
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'e'
+ * array = { ' a', 'b', 'c', 'd' }
+ * result => -1
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param toBeFound the character to search
+ * @param array the array to be searched
+ * @return the last index in the array for which the corresponding character is
+ * equal to toBeFound starting from the end of the array, -1 otherwise
+ * @throws NullPointerException if array is null
+ */
+ public static final int lastIndexOf(char toBeFound, char[] array) {
+ for (int i = array.length; --i >= 0;)
+ if (toBeFound == array[i])
+ return i;
+ return -1;
+ }
+
+ /**
+ * Answers the last index in the array for which the corresponding character is
+ * equal to toBeFound stopping at the index startIndex.
+ * Answers -1 if no occurrence of this character is found.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { ' a', 'b', 'c', 'd' }
+ * startIndex = 2
+ * result => 2
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { ' a', 'b', 'c', 'd', 'e' }
+ * startIndex = 3
+ * result => -1
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'e'
+ * array = { ' a', 'b', 'c', 'd' }
+ * startIndex = 0
+ * result => -1
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param toBeFound the character to search
+ * @param array the array to be searched
+ * @param startIndex the stopping index
+ * @return the last index in the array for which the corresponding character is
+ * equal to toBeFound stopping at the index startIndex, -1 otherwise
+ * @throws NullPointerException if array is null
+ * @throws ArrayIndexOutOfBoundsException if startIndex is lower than 0
+ */
+ public static final int lastIndexOf(
+ char toBeFound,
+ char[] array,
+ int startIndex) {
+ for (int i = array.length; --i >= startIndex;)
+ if (toBeFound == array[i])
+ return i;
+ return -1;
+ }
+
+ /**
+ * Answers the last index in the array for which the corresponding character is
+ * equal to toBeFound starting from endIndex to startIndex.
+ * Answers -1 if no occurrence of this character is found.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { ' a', 'b', 'c', 'd' }
+ * startIndex = 2
+ * endIndex = 2
+ * result => 2
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { ' a', 'b', 'c', 'd', 'e' }
+ * startIndex = 3
+ * endIndex = 4
+ * result => -1
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'e'
+ * array = { ' a', 'b', 'c', 'd' }
+ * startIndex = 0
+ * endIndex = 3
+ * result => -1
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param toBeFound the character to search
+ * @param array the array to be searched
+ * @param startIndex the stopping index
+ * @param endIndex the starting index
+ * @return the last index in the array for which the corresponding character is
+ * equal to toBeFound starting from endIndex to startIndex, -1 otherwise
+ * @throws NullPointerException if array is null
+ * @throws ArrayIndexOutOfBoundsException if endIndex is greater or equals to array length or starting is lower than 0
+ */
+ public static final int lastIndexOf(
+ char toBeFound,
+ char[] array,
+ int startIndex,
+ int endIndex) {
+ for (int i = endIndex; --i >= startIndex;)
+ if (toBeFound == array[i])
+ return i;
+ return -1;
+ }
+
+ /**
+ * Answers the last portion of a name given a separator.
+ * <br>
+ * <br>
+ * For example,
+ * <pre>
+ * lastSegment("java.lang.Object".toCharArray(),'.') --> Object
+ * </pre>
+ *
+ * @param array the array
+ * @param separator the given separator
+ * @return the last portion of a name given a separator
+ * @throws NullPointerException if array is null
+ */
+ final static public char[] lastSegment(char[] array, char separator) {
+ int pos = lastIndexOf(separator, array);
+ if (pos < 0)
+ return array;
+ return subarray(array, pos + 1, array.length);
+ }
+
+ /**
+ * Answers true if the pattern matches the given name, false otherwise. This char[] pattern matching
+ * accepts wild-cards '*' and '?'.
+ *
+ * When not case sensitive, the pattern is assumed to already be lowercased, the
+ * name will be lowercased character per character as comparing.
+ * If name is null, the answer is false.
+ * If pattern is null, the answer is true if name is not null.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * pattern = { '?', 'b', '*' }
+ * name = { 'a', 'b', 'c' , 'd' }
+ * isCaseSensitive = true
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * pattern = { '?', 'b', '?' }
+ * name = { 'a', 'b', 'c' , 'd' }
+ * isCaseSensitive = true
+ * result => false
+ * </pre>
+ * </li>
+ * <li><pre>
+ * pattern = { 'b', '*' }
+ * name = { 'a', 'b', 'c' , 'd' }
+ * isCaseSensitive = true
+ * result => false
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param pattern the given pattern
+ * @param name the given name
+ * @param isCaseSensitive flag to know whether or not the matching should be case sensitive
+ * @return true if the pattern matches the given name, false otherwise
+ */
+ public static final boolean match(
+ char[] pattern,
+ char[] name,
+ boolean isCaseSensitive) {
+
+ if (name == null)
+ return false; // null name cannot match
+ if (pattern == null)
+ return true; // null pattern is equivalent to '*'
+
+ return match(
+ pattern,
+ 0,
+ pattern.length,
+ name,
+ 0,
+ name.length,
+ isCaseSensitive);
+ }
+
+ /**
+ * Answers true if a sub-pattern matches the subpart of the given name, false otherwise.
+ * char[] pattern matching, accepting wild-cards '*' and '?'. Can match only subset of name/pattern.
+ * end positions are non-inclusive.
+ * The subpattern is defined by the patternStart and pattternEnd positions.
+ * When not case sensitive, the pattern is assumed to already be lowercased, the
+ * name will be lowercased character per character as comparing.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * pattern = { '?', 'b', '*' }
+ * patternStart = 1
+ * patternEnd = 3
+ * name = { 'a', 'b', 'c' , 'd' }
+ * nameStart = 1
+ * nameEnd = 4
+ * isCaseSensitive = true
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * pattern = { '?', 'b', '*' }
+ * patternStart = 1
+ * patternEnd = 2
+ * name = { 'a', 'b', 'c' , 'd' }
+ * nameStart = 1
+ * nameEnd = 2
+ * isCaseSensitive = true
+ * result => false
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param pattern the given pattern
+ * @param patternStart the given pattern start
+ * @param patternEnd the given pattern end
+ * @param name the given name
+ * @param nameStart the given name start
+ * @param nameEnd the given name end
+ * @param isCaseSensitive flag to know if the matching should be case sensitive
+ * @return true if a sub-pattern matches the subpart of the given name, false otherwise
+ */
+ public static final boolean match(
+ char[] pattern,
+ int patternStart,
+ int patternEnd,
+ char[] name,
+ int nameStart,
+ int nameEnd,
+ boolean isCaseSensitive) {
+
+ if (name == null)
+ return false; // null name cannot match
+ if (pattern == null)
+ return true; // null pattern is equivalent to '*'
+ int iPattern = patternStart;
+ int iName = nameStart;
+
+ if (patternEnd < 0)
+ patternEnd = pattern.length;
+ if (nameEnd < 0)
+ nameEnd = name.length;
+
+ /* check first segment */
+ char patternChar = 0;
+ while ((iPattern < patternEnd)
+ && (patternChar = pattern[iPattern]) != '*') {
+ if (iName == nameEnd)
+ return false;
+ if (patternChar
+ != (isCaseSensitive
+ ? name[iName]
+ : ScannerHelper.toLowerCase(name[iName]))
+ && patternChar != '?') {
+ return false;
+ }
+ iName++;
+ iPattern++;
+ }
+ /* check sequence of star+segment */
+ int segmentStart;
+ if (patternChar == '*') {
+ segmentStart = ++iPattern; // skip star
+ } else {
+ segmentStart = 0; // force iName check
+ }
+ int prefixStart = iName;
+ checkSegment : while (iName < nameEnd) {
+ if (iPattern == patternEnd) {
+ iPattern = segmentStart; // mismatch - restart current segment
+ iName = ++prefixStart;
+ continue checkSegment;
+ }
+ /* segment is ending */
+ if ((patternChar = pattern[iPattern]) == '*') {
+ segmentStart = ++iPattern; // skip start
+ if (segmentStart == patternEnd) {
+ return true;
+ }
+ prefixStart = iName;
+ continue checkSegment;
+ }
+ /* check current name character */
+ if ((isCaseSensitive ? name[iName] : ScannerHelper.toLowerCase(name[iName]))
+ != patternChar
+ && patternChar != '?') {
+ iPattern = segmentStart; // mismatch - restart current segment
+ iName = ++prefixStart;
+ continue checkSegment;
+ }
+ iName++;
+ iPattern++;
+ }
+
+ return (segmentStart == patternEnd)
+ || (iName == nameEnd && iPattern == patternEnd)
+ || (iPattern == patternEnd - 1 && pattern[iPattern] == '*');
+ }
+
+ /**
+ * Answers true if the pattern matches the filepath using the pathSepatator, false otherwise.
+ *
+ * Path char[] pattern matching, accepting wild-cards '**', '*' and '?' (using Ant directory tasks
+ * conventions, also see "http://jakarta.apache.org/ant/manual/dirtasks.html#defaultexcludes").
+ * Path pattern matching is enhancing regular pattern matching in supporting extra rule where '**' represent
+ * any folder combination.
+ * Special rule:
+ * - foo\ is equivalent to foo\**
+ * When not case sensitive, the pattern is assumed to already be lowercased, the
+ * name will be lowercased character per character as comparing.
+ *
+ * @param pattern the given pattern
+ * @param filepath the given path
+ * @param isCaseSensitive to find out whether or not the matching should be case sensitive
+ * @param pathSeparator the given path separator
+ * @return true if the pattern matches the filepath using the pathSepatator, false otherwise
+ */
+ public static final boolean pathMatch(
+ char[] pattern,
+ char[] filepath,
+ boolean isCaseSensitive,
+ char pathSeparator) {
+
+ if (filepath == null)
+ return false; // null name cannot match
+ if (pattern == null)
+ return true; // null pattern is equivalent to '*'
+
+ // offsets inside pattern
+ int pSegmentStart = pattern[0] == pathSeparator ? 1 : 0;
+ int pLength = pattern.length;
+ int pSegmentEnd = CharOperation.indexOf(pathSeparator, pattern, pSegmentStart+1);
+ if (pSegmentEnd < 0) pSegmentEnd = pLength;
+
+ // special case: pattern foo\ is equivalent to foo\**
+ boolean freeTrailingDoubleStar = pattern[pLength - 1] == pathSeparator;
+
+ // offsets inside filepath
+ int fSegmentStart, fLength = filepath.length;
+ if (filepath[0] != pathSeparator){
+ fSegmentStart = 0;
+ } else {
+ fSegmentStart = 1;
+ }
+ if (fSegmentStart != pSegmentStart) {
+ return false; // both must start with a separator or none.
+ }
+ int fSegmentEnd = CharOperation.indexOf(pathSeparator, filepath, fSegmentStart+1);
+ if (fSegmentEnd < 0) fSegmentEnd = fLength;
+
+ // first segments
+ while (pSegmentStart < pLength
+ && !(pSegmentEnd == pLength && freeTrailingDoubleStar
+ || (pSegmentEnd == pSegmentStart + 2
+ && pattern[pSegmentStart] == '*'
+ && pattern[pSegmentStart + 1] == '*'))) {
+
+ if (fSegmentStart >= fLength)
+ return false;
+ if (!CharOperation
+ .match(
+ pattern,
+ pSegmentStart,
+ pSegmentEnd,
+ filepath,
+ fSegmentStart,
+ fSegmentEnd,
+ isCaseSensitive)) {
+ return false;
+ }
+
+ // jump to next segment
+ pSegmentEnd =
+ CharOperation.indexOf(
+ pathSeparator,
+ pattern,
+ pSegmentStart = pSegmentEnd + 1);
+ // skip separator
+ if (pSegmentEnd < 0)
+ pSegmentEnd = pLength;
+
+ fSegmentEnd =
+ CharOperation.indexOf(
+ pathSeparator,
+ filepath,
+ fSegmentStart = fSegmentEnd + 1);
+ // skip separator
+ if (fSegmentEnd < 0) fSegmentEnd = fLength;
+ }
+
+ /* check sequence of doubleStar+segment */
+ int pSegmentRestart;
+ if ((pSegmentStart >= pLength && freeTrailingDoubleStar)
+ || (pSegmentEnd == pSegmentStart + 2
+ && pattern[pSegmentStart] == '*'
+ && pattern[pSegmentStart + 1] == '*')) {
+ pSegmentEnd =
+ CharOperation.indexOf(
+ pathSeparator,
+ pattern,
+ pSegmentStart = pSegmentEnd + 1);
+ // skip separator
+ if (pSegmentEnd < 0) pSegmentEnd = pLength;
+ pSegmentRestart = pSegmentStart;
+ } else {
+ if (pSegmentStart >= pLength) return fSegmentStart >= fLength; // true if filepath is done too.
+ pSegmentRestart = 0; // force fSegmentStart check
+ }
+ int fSegmentRestart = fSegmentStart;
+ checkSegment : while (fSegmentStart < fLength) {
+
+ if (pSegmentStart >= pLength) {
+ if (freeTrailingDoubleStar) return true;
+ // mismatch - restart current path segment
+ pSegmentEnd =
+ CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart);
+ if (pSegmentEnd < 0) pSegmentEnd = pLength;
+
+ fSegmentRestart =
+ CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1);
+ // skip separator
+ if (fSegmentRestart < 0) {
+ fSegmentRestart = fLength;
+ } else {
+ fSegmentRestart++;
+ }
+ fSegmentEnd =
+ CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart);
+ if (fSegmentEnd < 0) fSegmentEnd = fLength;
+ continue checkSegment;
+ }
+
+ /* path segment is ending */
+ if (pSegmentEnd == pSegmentStart + 2
+ && pattern[pSegmentStart] == '*'
+ && pattern[pSegmentStart + 1] == '*') {
+ pSegmentEnd =
+ CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentEnd + 1);
+ // skip separator
+ if (pSegmentEnd < 0) pSegmentEnd = pLength;
+ pSegmentRestart = pSegmentStart;
+ fSegmentRestart = fSegmentStart;
+ if (pSegmentStart >= pLength) return true;
+ continue checkSegment;
+ }
+ /* chech current path segment */
+ if (!CharOperation.match(
+ pattern,
+ pSegmentStart,
+ pSegmentEnd,
+ filepath,
+ fSegmentStart,
+ fSegmentEnd,
+ isCaseSensitive)) {
+ // mismatch - restart current path segment
+ pSegmentEnd =
+ CharOperation.indexOf(pathSeparator, pattern, pSegmentStart = pSegmentRestart);
+ if (pSegmentEnd < 0) pSegmentEnd = pLength;
+
+ fSegmentRestart =
+ CharOperation.indexOf(pathSeparator, filepath, fSegmentRestart + 1);
+ // skip separator
+ if (fSegmentRestart < 0) {
+ fSegmentRestart = fLength;
+ } else {
+ fSegmentRestart++;
+ }
+ fSegmentEnd =
+ CharOperation.indexOf(pathSeparator, filepath, fSegmentStart = fSegmentRestart);
+ if (fSegmentEnd < 0) fSegmentEnd = fLength;
+ continue checkSegment;
+ }
+ // jump to next segment
+ pSegmentEnd =
+ CharOperation.indexOf(
+ pathSeparator,
+ pattern,
+ pSegmentStart = pSegmentEnd + 1);
+ // skip separator
+ if (pSegmentEnd < 0)
+ pSegmentEnd = pLength;
+
+ fSegmentEnd =
+ CharOperation.indexOf(
+ pathSeparator,
+ filepath,
+ fSegmentStart = fSegmentEnd + 1);
+ // skip separator
+ if (fSegmentEnd < 0)
+ fSegmentEnd = fLength;
+ }
+
+ return (pSegmentRestart >= pSegmentEnd)
+ || (fSegmentStart >= fLength && pSegmentStart >= pLength)
+ || (pSegmentStart == pLength - 2
+ && pattern[pSegmentStart] == '*'
+ && pattern[pSegmentStart + 1] == '*')
+ || (pSegmentStart == pLength && freeTrailingDoubleStar);
+ }
+
+ /**
+ * Answers the number of occurrences of the given character in the given array, 0 if any.
+ *
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * toBeFound = 'b'
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * result => 3
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * result => 0
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param toBeFound the given character
+ * @param array the given array
+ * @return the number of occurrences of the given character in the given array, 0 if any
+ * @throws NullPointerException if array is null
+ */
+ public static final int occurencesOf(char toBeFound, char[] array) {
+ int count = 0;
+ for (int i = 0; i < array.length; i++)
+ if (toBeFound == array[i])
+ count++;
+ return count;
+ }
+
+ /**
+ * Answers the number of occurrences of the given character in the given array starting
+ * at the given index, 0 if any.
+ *
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * toBeFound = 'b'
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * start = 2
+ * result => 2
+ * </pre>
+ * </li>
+ * <li><pre>
+ * toBeFound = 'c'
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * start = 0
+ * result => 0
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param toBeFound the given character
+ * @param array the given array
+ * @param start the given index
+ * @return the number of occurrences of the given character in the given array, 0 if any
+ * @throws NullPointerException if array is null
+ * @throws ArrayIndexOutOfBoundsException if start is lower than 0
+ */
+ public static final int occurencesOf(
+ char toBeFound,
+ char[] array,
+ int start) {
+ int count = 0;
+ for (int i = start; i < array.length; i++)
+ if (toBeFound == array[i])
+ count++;
+ return count;
+ }
+
+ /**
+ * Answers true if the given name starts with the given prefix, false otherwise.
+ * The comparison is case sensitive.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * prefix = { 'a' , 'b' }
+ * name = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * prefix = { 'a' , 'c' }
+ * name = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * result => false
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param prefix the given prefix
+ * @param name the given name
+ * @return true if the given name starts with the given prefix, false otherwise
+ * @throws NullPointerException if the given name is null or if the given prefix is null
+ */
+ public static final boolean prefixEquals(char[] prefix, char[] name) {
+
+ int max = prefix.length;
+ if (name.length < max)
+ return false;
+ for (int i = max;
+ --i >= 0;
+ ) // assumes the prefix is not larger than the name
+ if (prefix[i] != name[i])
+ return false;
+ return true;
+ }
+
+ /**
+ * Answers true if the given name starts with the given prefix, false otherwise.
+ * isCaseSensitive is used to find out whether or not the comparison should be case sensitive.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * prefix = { 'a' , 'B' }
+ * name = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * isCaseSensitive = false
+ * result => true
+ * </pre>
+ * </li>
+ * <li><pre>
+ * prefix = { 'a' , 'B' }
+ * name = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * isCaseSensitive = true
+ * result => false
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param prefix the given prefix
+ * @param name the given name
+ * @param isCaseSensitive to find out whether or not the comparison should be case sensitive
+ * @return true if the given name starts with the given prefix, false otherwise
+ * @throws NullPointerException if the given name is null or if the given prefix is null
+ */
+ public static final boolean prefixEquals(
+ char[] prefix,
+ char[] name,
+ boolean isCaseSensitive) {
+
+ int max = prefix.length;
+ if (name.length < max)
+ return false;
+ if (isCaseSensitive) {
+ for (int i = max;
+ --i >= 0;
+ ) // assumes the prefix is not larger than the name
+ if (prefix[i] != name[i])
+ return false;
+ return true;
+ }
+
+ for (int i = max;
+ --i >= 0;
+ ) // assumes the prefix is not larger than the name
+ if (ScannerHelper.toLowerCase(prefix[i])
+ != ScannerHelper.toLowerCase(name[i]))
+ return false;
+ return true;
+ }
+
+ /**
+ * Answers a new array removing a given character. Answers the given array if there is
+ * no occurence of the character to remove.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'c', 'b', 'a' }
+ * toBeRemoved = 'b'
+ * return { 'a' , 'c', 'a' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * toBeRemoved = 'c'
+ * return array
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param array the given array
+ * @param toBeRemoved the character to be removed
+ * @return a new array removing given character
+ * @since 3.2
+ */
+ public static final char[] remove(char[] array, char toBeRemoved) {
+
+ if (array == null) return null;
+ int length = array.length;
+ if (length == 0) return array;
+ char[] result = null;
+ int count = 0;
+ for (int i = 0; i < length; i++) {
+ char c = array[i];
+ if (c == toBeRemoved) {
+ if (result == null) {
+ result = new char[length];
+ System.arraycopy(array, 0, result, 0, i);
+ count = i;
+ }
+ } else if (result != null) {
+ result[count++] = c;
+ }
+ }
+ if (result == null) return array;
+ System.arraycopy(result, 0, result = new char[count], 0, count);
+ return result;
+ }
+
+ /**
+ * Replace all occurrence of the character to be replaced with the remplacement character in the
+ * given array.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * toBeReplaced = 'b'
+ * replacementChar = 'a'
+ * result => No returned value, but array is now equals to { 'a' , 'a', 'a', 'a', 'a', 'a' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * toBeReplaced = 'c'
+ * replacementChar = 'a'
+ * result => No returned value, but array is now equals to { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param array the given array
+ * @param toBeReplaced the character to be replaced
+ * @param replacementChar the replacement character
+ * @throws NullPointerException if the given array is null
+ */
+ public static final void replace(
+ char[] array,
+ char toBeReplaced,
+ char replacementChar) {
+ if (toBeReplaced != replacementChar) {
+ for (int i = 0, max = array.length; i < max; i++) {
+ if (array[i] == toBeReplaced)
+ array[i] = replacementChar;
+ }
+ }
+ }
+
+ /**
+ * Replace all occurrences of characters to be replaced with the remplacement character in the
+ * given array.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'c', 'a', 'b', 'c', 'a' }
+ * toBeReplaced = { 'b', 'c' }
+ * replacementChar = 'a'
+ * result => No returned value, but array is now equals to { 'a' , 'a', 'a', 'a', 'a', 'a', 'a', 'a' }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param array the given array
+ * @param toBeReplaced characters to be replaced
+ * @param replacementChar the replacement character
+ * @throws NullPointerException if arrays are null.
+ * @since 3.1
+ */
+ public static final void replace(char[] array, char[] toBeReplaced, char replacementChar) {
+ replace(array, toBeReplaced, replacementChar, 0, array.length);
+ }
+
+ /**
+ * Replace all occurrences of characters to be replaced with the remplacement character in the
+ * given array from the start position (inclusive) to the end position (exclusive).
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'c', 'a', 'b', 'c', 'a' }
+ * toBeReplaced = { 'b', 'c' }
+ * replacementChar = 'a'
+ * start = 4
+ * end = 8
+ * result => No returned value, but array is now equals to { 'a' , 'b', 'b', 'c', 'a', 'a', 'a', 'a' }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param array the given array
+ * @param toBeReplaced characters to be replaced
+ * @param replacementChar the replacement character
+ * @param start the given start position (inclusive)
+ * @param end the given end position (exclusive)
+ * @throws NullPointerException if arrays are null.
+ * @since 3.2
+ */
+ public static final void replace(char[] array, char[] toBeReplaced, char replacementChar, int start, int end) {
+ for (int i = end; --i >= start;)
+ for (int j = toBeReplaced.length; --j >= 0;)
+ if (array[i] == toBeReplaced[j])
+ array[i] = replacementChar;
+ }
+ /**
+ * Answers a new array of characters with substitutions. No side-effect is operated on the original
+ * array, in case no substitution happened, then the result is the same as the
+ * original one.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * toBeReplaced = { 'b' }
+ * replacementChar = { 'a', 'a' }
+ * result => { 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * toBeReplaced = { 'c' }
+ * replacementChar = { 'a' }
+ * result => { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param array the given array
+ * @param toBeReplaced characters to be replaced
+ * @param replacementChars the replacement characters
+ * @return a new array of characters with substitutions or the given array if none
+ * @throws NullPointerException if the given array is null
+ */
+ public static final char[] replace(
+ char[] array,
+ char[] toBeReplaced,
+ char[] replacementChars) {
+
+ int max = array.length;
+ int replacedLength = toBeReplaced.length;
+ int replacementLength = replacementChars.length;
+
+ int[] starts = new int[5];
+ int occurrenceCount = 0;
+
+ if (!equals(toBeReplaced, replacementChars)) {
+
+ next : for (int i = 0; i < max;) {
+ int index = indexOf(toBeReplaced, array, true, i);
+ if (index == -1) {
+ i++;
+ continue next;
+ }
+ if (occurrenceCount == starts.length) {
+ System.arraycopy(
+ starts,
+ 0,
+ starts = new int[occurrenceCount * 2],
+ 0,
+ occurrenceCount);
+ }
+ starts[occurrenceCount++] = index;
+ i = index + replacedLength;
+ }
+ }
+ if (occurrenceCount == 0)
+ return array;
+ char[] result =
+ new char[max
+ + occurrenceCount * (replacementLength - replacedLength)];
+ int inStart = 0, outStart = 0;
+ for (int i = 0; i < occurrenceCount; i++) {
+ int offset = starts[i] - inStart;
+ System.arraycopy(array, inStart, result, outStart, offset);
+ inStart += offset;
+ outStart += offset;
+ System.arraycopy(
+ replacementChars,
+ 0,
+ result,
+ outStart,
+ replacementLength);
+ inStart += replacedLength;
+ outStart += replacementLength;
+ }
+ System.arraycopy(array, inStart, result, outStart, max - inStart);
+ return result;
+ }
+
+ /**
+ * Replace all occurrence of the character to be replaced with the remplacement character
+ * in a copy of the given array. Returns the given array if no occurrences of the character
+ * to be replaced are found.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * toBeReplaced = 'b'
+ * replacementChar = 'a'
+ * result => A new array that is equals to { 'a' , 'a', 'a', 'a', 'a', 'a' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * toBeReplaced = 'c'
+ * replacementChar = 'a'
+ * result => The original array that remains unchanged.
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param array the given array
+ * @param toBeReplaced the character to be replaced
+ * @param replacementChar the replacement character
+ * @throws NullPointerException if the given array is null
+ * @since 3.1
+ */
+ public static final char[] replaceOnCopy(
+ char[] array,
+ char toBeReplaced,
+ char replacementChar) {
+
+ char[] result = null;
+ for (int i = 0, length = array.length; i < length; i++) {
+ char c = array[i];
+ if (c == toBeReplaced) {
+ if (result == null) {
+ result = new char[length];
+ System.arraycopy(array, 0, result, 0, i);
+ }
+ result[i] = replacementChar;
+ } else if (result != null) {
+ result[i] = c;
+ }
+ }
+ if (result == null) return array;
+ return result;
+ }
+
+ /**
+ * Return a new array which is the split of the given array using the given divider and triming each subarray to remove
+ * whitespaces equals to ' '.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * divider = 'b'
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * result => { { 'a' }, { }, { 'a' }, { 'a' } }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * divider = 'c'
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * divider = 'b'
+ * array = { 'a' , ' ', 'b', 'b', 'a', 'b', 'a' }
+ * result => { { 'a' }, { }, { 'a' }, { 'a' } }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * divider = 'c'
+ * array = { ' ', ' ', 'a' , 'b', 'b', 'a', 'b', 'a', ' ' }
+ * result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param divider the given divider
+ * @param array the given array
+ * @return a new array which is the split of the given array using the given divider and triming each subarray to remove
+ * whitespaces equals to ' '
+ */
+ public static final char[][] splitAndTrimOn(char divider, char[] array) {
+ int length = array == null ? 0 : array.length;
+ if (length == 0)
+ return NO_CHAR_CHAR;
+
+ int wordCount = 1;
+ for (int i = 0; i < length; i++)
+ if (array[i] == divider)
+ wordCount++;
+ char[][] split = new char[wordCount][];
+ int last = 0, currentWord = 0;
+ for (int i = 0; i < length; i++) {
+ if (array[i] == divider) {
+ int start = last, end = i - 1;
+ while (start < i && array[start] == ' ')
+ start++;
+ while (end > start && array[end] == ' ')
+ end--;
+ split[currentWord] = new char[end - start + 1];
+ System.arraycopy(
+ array,
+ start,
+ split[currentWord++],
+ 0,
+ end - start + 1);
+ last = i + 1;
+ }
+ }
+ int start = last, end = length - 1;
+ while (start < length && array[start] == ' ')
+ start++;
+ while (end > start && array[end] == ' ')
+ end--;
+ split[currentWord] = new char[end - start + 1];
+ System.arraycopy(
+ array,
+ start,
+ split[currentWord++],
+ 0,
+ end - start + 1);
+ return split;
+ }
+
+ /**
+ * Return a new array which is the split of the given array using the given divider.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * divider = 'b'
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * result => { { 'a' }, { }, { 'a' }, { 'a' } }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * divider = 'c'
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * divider = 'c'
+ * array = { ' ', ' ', 'a' , 'b', 'b', 'a', 'b', 'a', ' ' }
+ * result => { { ' ', 'a', 'b', 'b', 'a', 'b', 'a', ' ' } }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param divider the given divider
+ * @param array the given array
+ * @return a new array which is the split of the given array using the given divider
+ */
+ public static final char[][] splitOn(char divider, char[] array) {
+ int length = array == null ? 0 : array.length;
+ if (length == 0)
+ return NO_CHAR_CHAR;
+
+ int wordCount = 1;
+ for (int i = 0; i < length; i++)
+ if (array[i] == divider)
+ wordCount++;
+ char[][] split = new char[wordCount][];
+ int last = 0, currentWord = 0;
+ for (int i = 0; i < length; i++) {
+ if (array[i] == divider) {
+ split[currentWord] = new char[i - last];
+ System.arraycopy(
+ array,
+ last,
+ split[currentWord++],
+ 0,
+ i - last);
+ last = i + 1;
+ }
+ }
+ split[currentWord] = new char[length - last];
+ System.arraycopy(array, last, split[currentWord], 0, length - last);
+ return split;
+ }
+
+ /**
+ * Return a new array which is the split of the given array using the given divider. The given end
+ * is exclusive and the given start is inclusive.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * divider = 'b'
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * start = 2
+ * end = 5
+ * result => { { }, { 'a' }, { } }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param divider the given divider
+ * @param array the given array
+ * @param start the given starting index
+ * @param end the given ending index
+ * @return a new array which is the split of the given array using the given divider
+ * @throws ArrayIndexOutOfBoundsException if start is lower than 0 or end is greater than the array length
+ */
+ public static final char[][] splitOn(
+ char divider,
+ char[] array,
+ int start,
+ int end) {
+ int length = array == null ? 0 : array.length;
+ if (length == 0 || start > end)
+ return NO_CHAR_CHAR;
+
+ int wordCount = 1;
+ for (int i = start; i < end; i++)
+ if (array[i] == divider)
+ wordCount++;
+ char[][] split = new char[wordCount][];
+ int last = start, currentWord = 0;
+ for (int i = start; i < end; i++) {
+ if (array[i] == divider) {
+ split[currentWord] = new char[i - last];
+ System.arraycopy(
+ array,
+ last,
+ split[currentWord++],
+ 0,
+ i - last);
+ last = i + 1;
+ }
+ }
+ split[currentWord] = new char[end - last];
+ System.arraycopy(array, last, split[currentWord], 0, end - last);
+ return split;
+ }
+
+ /**
+ * Answers a new array which is a copy of the given array starting at the given start and
+ * ending at the given end. The given start is inclusive and the given end is exclusive.
+ * Answers null if start is greater than end, if start is lower than 0 or if end is greater
+ * than the length of the given array. If end equals -1, it is converted to the array length.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = { { 'a' } , { 'b' } }
+ * start = 0
+ * end = 1
+ * result => { { 'a' } }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { { 'a' } , { 'b' } }
+ * start = 0
+ * end = -1
+ * result => { { 'a' }, { 'b' } }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param array the given array
+ * @param start the given starting index
+ * @param end the given ending index
+ * @return a new array which is a copy of the given array starting at the given start and
+ * ending at the given end
+ * @throws NullPointerException if the given array is null
+ */
+ public static final char[][] subarray(char[][] array, int start, int end) {
+ if (end == -1)
+ end = array.length;
+ if (start > end)
+ return null;
+ if (start < 0)
+ return null;
+ if (end > array.length)
+ return null;
+
+ char[][] result = new char[end - start][];
+ System.arraycopy(array, start, result, 0, end - start);
+ return result;
+ }
+
+ /**
+ * Answers a new array which is a copy of the given array starting at the given start and
+ * ending at the given end. The given start is inclusive and the given end is exclusive.
+ * Answers null if start is greater than end, if start is lower than 0 or if end is greater
+ * than the length of the given array. If end equals -1, it is converted to the array length.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = { 'a' , 'b' }
+ * start = 0
+ * end = 1
+ * result => { 'a' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'a', 'b' }
+ * start = 0
+ * end = -1
+ * result => { 'a' , 'b' }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param array the given array
+ * @param start the given starting index
+ * @param end the given ending index
+ * @return a new array which is a copy of the given array starting at the given start and
+ * ending at the given end
+ * @throws NullPointerException if the given array is null
+ */
+ public static final char[] subarray(char[] array, int start, int end) {
+ if (end == -1)
+ end = array.length;
+ if (start > end)
+ return null;
+ if (start < 0)
+ return null;
+ if (end > array.length)
+ return null;
+
+ char[] result = new char[end - start];
+ System.arraycopy(array, start, result, 0, end - start);
+ return result;
+ }
+
+ /**
+ * Answers the result of a char[] conversion to lowercase. Answers null if the given chars array is null.
+ * <br>
+ * NOTE: If no conversion was necessary, then answers back the argument one.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * chars = { 'a' , 'b' }
+ * result => { 'a' , 'b' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'A', 'b' }
+ * result => { 'a' , 'b' }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param chars the chars to convert
+ * @return the result of a char[] conversion to lowercase
+ */
+ final static public char[] toLowerCase(char[] chars) {
+ if (chars == null)
+ return null;
+ int length = chars.length;
+ char[] lowerChars = null;
+ for (int i = 0; i < length; i++) {
+ char c = chars[i];
+ char lc = ScannerHelper.toLowerCase(c);
+ if ((c != lc) || (lowerChars != null)) {
+ if (lowerChars == null) {
+ System.arraycopy(
+ chars,
+ 0,
+ lowerChars = new char[length],
+ 0,
+ i);
+ }
+ lowerChars[i] = lc;
+ }
+ }
+ return lowerChars == null ? chars : lowerChars;
+ }
+
+ /**
+ * Answers a new array removing leading and trailing spaces (' '). Answers the given array if there is no
+ * space characters to remove.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * chars = { ' ', 'a' , 'b', ' ', ' ' }
+ * result => { 'a' , 'b' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'A', 'b' }
+ * result => { 'A' , 'b' }
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param chars the given array
+ * @return a new array removing leading and trailing spaces (' ')
+ */
+ final static public char[] trim(char[] chars) {
+
+ if (chars == null)
+ return null;
+
+ int start = 0, length = chars.length, end = length - 1;
+ while (start < length && chars[start] == ' ') {
+ start++;
+ }
+ while (end > start && chars[end] == ' ') {
+ end--;
+ }
+ if (start != 0 || end != length - 1) {
+ return subarray(chars, start, end + 1);
+ }
+ return chars;
+ }
+
+ /**
+ * Answers a string which is the concatenation of the given array using the '.' as a separator.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = { { 'a' } , { 'b' } }
+ * result => "a.b"
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { { ' ', 'a' } , { 'b' } }
+ * result => " a.b"
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param array the given array
+ * @return a string which is the concatenation of the given array using the '.' as a separator
+ */
+ final static public String toString(char[][] array) {
+ char[] result = concatWith(array, '.');
+ return new String(result);
+ }
+
+ /**
+ * Answers an array of strings from the given array of char array.
+ *
+ * @param array the given array
+ * @return an array of strings
+ * @since 3.0
+ */
+ final static public String[] toStrings(char[][] array) {
+ if (array == null) return NO_STRINGS;
+ int length = array.length;
+ if (length == 0) return NO_STRINGS;
+ String[] result = new String[length];
+ for (int i = 0; i < length; i++)
+ result[i] = new String(array[i]);
+ return result;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/IScanner.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/IScanner.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/IScanner.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.core.compiler;
+
+import copiedFromJDT.core.ToolFactory;
+
+ /**
+ * Definition of a Java scanner, as returned by the <code>ToolFactory</code>.
+ * The scanner is responsible for tokenizing a given source, providing information about
+ * the nature of the token read, its positions and source equivalent.
+ *
+ * When the scanner has finished tokenizing, it answers an EOF token (<code>
+ * ITerminalSymbols#TokenNameEOF</code>.
+ *
+ * When encountering lexical errors, an <code>InvalidInputException</code> is thrown.
+ *
+ * @see org.eclipse.jdt.core.ToolFactory
+ * @see ITerminalSymbols
+ * @since 2.0
+ */
+public interface IScanner {
+
+ /**
+ * Answers the current identifier source, after unicode escape sequences have
+ * been translated into unicode characters.
+ * For example, if original source was <code>\\u0061bc</code> then it will answer <code>abc</code>.
+ *
+ * @return the current identifier source, after unicode escape sequences have
+ * been translated into unicode characters
+ */
+ char[] getCurrentTokenSource();
+
+ /**
+ * Answers the starting position of the current token inside the original source.
+ * This position is zero-based and inclusive. It corresponds to the position of the first character
+ * which is part of this token. If this character was a unicode escape sequence, it points at the first
+ * character of this sequence.
+ *
+ * @return the starting position of the current token inside the original source
+ */
+ int getCurrentTokenStartPosition();
+
+ /**
+ * Answers the ending position of the current token inside the original source.
+ * This position is zero-based and inclusive. It corresponds to the position of the last character
+ * which is part of this token. If this character was a unicode escape sequence, it points at the last
+ * character of this sequence.
+ *
+ * @return the ending position of the current token inside the original source
+ */
+ int getCurrentTokenEndPosition();
+
+ /**
+ * Answers a 1-based line number using the lines which have been encountered so far. If the position
+ * is located beyond the current scanned line, then the last line number will be answered.
+ *
+ * @param charPosition the given character position
+ * @return a 1-based line number using the lines which have been encountered so far
+ */
+ int getLineNumber(int charPosition);
+
+ /**
+ * Read the next token in the source, and answers its ID as specified by <code>ITerminalSymbols</code>.
+ * Note that the actual token ID values are subject to change if new keywords were added to the language
+ * (for instance, 'assert' is a keyword in 1.4).
+ *
+ * @throws InvalidInputException in case a lexical error was detected while reading the current token
+ * @return the next token
+ */
+ int getNextToken() throws InvalidInputException;
+
+ /**
+ * Answers the original source being processed (not a copy of it).
+ *
+ * @return the original source being processed
+ */
+ char[] getSource();
+
+ /**
+ * Set the scanner source to process. By default, the scanner will consider starting at the beginning of the
+ * source until it reaches its end.
+ *
+ * @param source the given source
+ */
+ void setSource(char[] source);
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/InvalidInputException.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/InvalidInputException.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/compiler/InvalidInputException.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.core.compiler;
+
+/**
+ * Exception thrown by a scanner when encountering lexical errors.
+ */
+public class InvalidInputException extends Exception {
+
+ private static final long serialVersionUID = 2909732853499731592L; // backward compatible
+
+ /**
+ * Creates a new exception with no detail message.
+ */
+ public InvalidInputException() {
+ super();
+ }
+ /**
+ * Creates a new exception with the given detail message.
+ * @param message the detail message
+ */
+ public InvalidInputException(String message) {
+ super(message);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IBinding.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IBinding.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IBinding.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.core.dom;
+
+
+/**
+ * A binding represents a named entity in the Java language. The world of
+ * bindings provides an integrated picture of the structure of the program as
+ * seen from the compiler's point of view. This interface declare protocol
+ * common to the various different kinds of named entities in the Java language:
+ * packages, types, fields, methods, constructors, and local variables.
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ *
+ * @see IPackageBinding
+ * @see ITypeBinding
+ * @see IVariableBinding
+ * @see IMethodBinding
+ * @since 2.0
+ */
+public interface IBinding {
+
+ /**
+ * Kind constant (value 1) indicating a package binding.
+ * Bindings of this kind can be safely cast to <code>IPackageBinding</code>.
+ *
+ * @see #getKind()
+ * @see IPackageBinding
+ */
+ public static final int PACKAGE = 1;
+
+ /**
+ * Kind constant (value 2) indicating a type binding.
+ * Bindings of this kind can be safely cast to <code>ITypeBinding</code>.
+ *
+ * @see #getKind()
+ * @see ITypeBinding
+ */
+ public static final int TYPE = 2;
+
+ /**
+ * Kind constant (value 3) indicating a field or local variable binding.
+ * Bindings of this kind can be safely cast to <code>IVariableBinding</code>.
+ *
+ * @see #getKind()
+ * @see IVariableBinding
+ */
+ public static final int VARIABLE = 3;
+
+ /**
+ * Kind constant (value 4) indicating a method or constructor binding.
+ * Bindings of this kind can be safely cast to <code>IMethodBinding</code>.
+ *
+ * @see #getKind()
+ * @see IMethodBinding
+ */
+ public static final int METHOD = 4;
+
+ /**
+ * Returns the kind of bindings this is.
+ *
+ * @return one of the kind constants:
+ * <code>PACKAGE</code>,
+ * <code>TYPE</code>,
+ * <code>VARIABLE</code>,
+ * or <code>METHOD</code>.
+ */
+ public int getKind();
+
+ /**
+ * Returns the name of this binding.
+ * Details of the name are specified with each specific kind of binding.
+ *
+ * @return the name of this binding
+ */
+ public String getName();
+
+ /**
+ * Returns the modifiers for this binding.
+ * <p>
+ * Note that deprecated is not included among the modifiers.
+ * Use <code>isDeprecated</code> to find out whether a binding is deprecated.
+ * </p>
+ *
+ * @return the bit-wise or of <code>Modifier</code> constants
+ * @see Modifier
+ */
+ public int getModifiers();
+
+ /**
+ * Return whether this binding is for something that is deprecated.
+ * A deprecated class, interface, field, method, or constructor is one that
+ * is marked with the 'deprecated' tag in its Javadoc comment.
+ *
+ * @return <code>true</code> if this binding is deprecated, and
+ * <code>false</code> otherwise
+ */
+ public boolean isDeprecated();
+
+ /**
+ * Returns whether this binding is synthetic. A synthetic binding is one that
+ * was made up by the compiler, rather than something declared in the
+ * source code. Note that default constructors (the 0-argument constructor that
+ * the compiler generates for class declarations with no explicit constructors
+ * declarations) are not generally considered synthetic (although they
+ * may be if the class itself is synthetic).
+ * But see {@link IMethodBinding#isDefaultConstructor IMethodBinding.isDefaultConstructor}
+ * for cases where the compiled-generated default constructor can be recognized
+ * instead.
+ *
+ * @return <code>true</code> if this binding is synthetic, and
+ * <code>false</code> otherwise
+ * @see IMethodBinding#isDefaultConstructor()
+ */
+ public boolean isSynthetic();
+
+ /**
+ * Returns the key for this binding.
+ * <p>
+ * Within a connected cluster of bindings (for example, all bindings
+ * reachable from a given AST), each binding will have a distinct keys.
+ * The keys are generated in a manner that is predictable and as
+ * stable as possible. This last property makes these keys useful for
+ * comparing bindings between disconnected clusters of bindings (for example,
+ * the bindings between the "before" and "after" ASTs of the same
+ * compilation unit).
+ * </p>
+ * <p>
+ * The exact details of how the keys are generated is unspecified.
+ * However, it is a function of the following information:
+ * <ul>
+ * <li>packages - the name of the package (for an unnamed package,
+ * some internal id)</li>
+ * <li>classes or interfaces - the VM name of the type and the key
+ * of its package</li>
+ * <li>array types - the key of the component type and number of
+ * dimensions</li>
+ * <li>primitive types - the name of the primitive type</li>
+ * <li>fields - the name of the field and the key of its declaring
+ * type</li>
+ * <li>methods - the name of the method, the key of its declaring
+ * type, and the keys of the parameter types</li>
+ * <li>constructors - the key of its declaring class, and the
+ * keys of the parameter types</li>
+ * <li>local variables - the name of the local variable, the index of the
+ * declaring block relative to its parent, the key of its method</li>
+ * <li>local types - the name of the type, the index of the declaring
+ * block relative to its parent, the key of its method</li>
+ * <li>anonymous types - the occurence count of the anonymous
+ * type relative to its declaring type, the key of its declaring type</li>
+ * <li>enum types - treated like classes</li>
+ * <li>annotation types - treated like interfaces</li>
+ * <li>type variables - the name of the type variable and
+ * the key of the generic type or generic method that declares that
+ * type variable</li>
+ * <li>wildcard types - the key of the optional wildcard type bound</li>
+ * <li>capture type bindings - the key of the wildcard captured</li>
+ * <li>generic type instances - the key of the generic type and the keys
+ * of the type arguments used to instantiate it, and whether the
+ * instance is explicit (a parameterized type reference) or
+ * implicit (a raw type reference)</li>
+ * <li>generic method instances - the key of the generic method and the keys
+ * of the type arguments used to instantiate it, and whether the
+ * instance is explicit (a parameterized method reference) or
+ * implicit (a raw method reference)</li>
+ * <li>members of generic type instances - the key of the generic type
+ * instance and the key of the corresponding member in the generic
+ * type</li>
+ * </ul>
+ * </p>
+ *
+ * @return the key for this binding
+ */
+ public String getKey();
+
+ /**
+ * There is no special definition of equality for bindings; equality is
+ * simply object identity. Within the context of a single cluster of
+ * bindings, each binding is represented by a distinct object. However,
+ * between different clusters of bindings, the binding objects may or may
+ * not be different; in these cases, the client should compare bindings
+ * using {@link #isEqualTo(IBinding)}, which checks their keys.
+ *
+ * @param obj {@inheritDoc}
+ * @return {@inheritDoc}
+ */
+ public boolean equals(Object obj);
+
+ /**
+ * Returns whether this binding has the same key as that of the given
+ * binding. Within the context of a single cluster of bindings, each
+ * binding is represented by a distinct object. However, between
+ * different clusters of bindings, the binding objects may or may
+ * not be different objects; in these cases, the binding keys
+ * are used where available.
+ *
+ * @param binding the other binding, or <code>null</code>
+ * @return <code>true</code> if the given binding is the identical
+ * object as this binding, or if the keys of both bindings are the
+ * same string; <code>false</code> if the given binding is
+ * <code>null</code>, or if the bindings do not have the same key,
+ * or if one or both of the bindings have no key
+ * @see #getKey()
+ * @since 3.1
+ */
+ public boolean isEqualTo(IBinding binding);
+
+ /**
+ * Returns a string representation of this binding suitable for debugging
+ * purposes only.
+ *
+ * @return a debug string
+ */
+ public String toString();
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IMethodBinding.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IMethodBinding.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IMethodBinding.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.core.dom;
+
+/**
+ * A method binding represents a method or constructor of a class or interface.
+ * Method bindings usually correspond directly to method or
+ * constructor declarations found in the source code.
+ * However, in certain cases of references to a generic method,
+ * the method binding may correspond to a copy of a generic method
+ * declaration with substitutions for the method's type parameters
+ * (for these, <code>getTypeArguments</code> returns a non-empty
+ * list, and either <code>isParameterizedMethod</code> or
+ * <code>isRawMethod</code> returns <code>true</code>).
+ * And in certain cases of references to a method declared in a
+ * generic type, the method binding may correspond to a copy of a
+ * method declaration with substitutions for the type's type
+ * parameters (for these, <code>getTypeArguments</code> returns
+ * an empty list, and both <code>isParameterizedMethod</code> and
+ * <code>isRawMethod</code> return <code>false</code>).
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ *
+ * @see ITypeBinding#getDeclaredMethods()
+ * @since 2.0
+ */
+public interface IMethodBinding extends IBinding {
+
+ /**
+ * Returns whether this binding is for a constructor or a method.
+ *
+ * @return <code>true</code> if this is the binding for a constructor,
+ * and <code>false</code> if this is the binding for a method
+ */
+ public boolean isConstructor();
+
+ /**
+ * Returns whether this binding is known to be a compiler-generated
+ * default constructor.
+ * <p>
+ * This method returns <code>false</code> for:
+ * <ul>
+ * <li>methods</li>
+ * <li>constructors with more than one parameter</li>
+ * <li>0-argument constructors where the binding information was obtained
+ * from a Java source file containing an explicit 0-argument constructor
+ * declaration</li>
+ * <li>0-argument constructors where the binding information was obtained
+ * from a Java class file (it is not possible to determine from a
+ * class file whether a 0-argument constructor was present in the source
+ * code versus generated automatically by a Java compiler)</li>
+ * </ul>
+ *
+ * @return <code>true</code> if this is known to be the binding for a
+ * compiler-generated default constructor, and <code>false</code>
+ * otherwise
+ * @since 3.0
+ */
+ public boolean isDefaultConstructor();
+
+ /**
+ * Returns the name of the method declared in this binding. The method name
+ * is always a simple identifier. The name of a constructor is always the
+ * same as the declared name of its declaring class.
+ *
+ * @return the name of this method, or the declared name of this
+ * constructor's declaring class
+ */
+ public String getName();
+
+ /**
+ * Returns the type binding representing the class or interface
+ * that declares this method or constructor.
+ *
+ * @return the binding of the class or interface that declares this method
+ * or constructor
+ */
+ public ITypeBinding getDeclaringClass();
+
+ /**
+ * Returns a list of type bindings representing the formal parameter types,
+ * in declaration order, of this method or constructor. Returns an array of
+ * length 0 if this method or constructor does not takes any parameters.
+ * <p>
+ * Note that the binding for the last parameter type of a vararg method
+ * declaration like <code>void fun(Foo... args)</code> is always for
+ * an array type (i.e., <code>Foo[]</code>) reflecting the the way varargs
+ * get compiled. However, the type binding obtained directly from
+ * the <code>SingleVariableDeclaration</code> for the vararg parameter
+ * is always for the type as written; i.e., the type binding for
+ * <code>Foo</code>.
+ * </p>
+ * <p>
+ * Note: The result does not include synthetic parameters introduced by
+ * inner class emulation.
+ * </p>
+ *
+ * @return a (possibly empty) list of type bindings for the formal
+ * parameters of this method or constructor
+ */
+ public ITypeBinding[] getParameterTypes();
+
+ /**
+ * Returns the binding for the return type of this method. Returns the
+ * special primitive <code>void</code> return type for constructors.
+ *
+ * @return the binding for the return type of this method, or the
+ * <code>void</code> return type for constructors
+ */
+ public ITypeBinding getReturnType();
+
+ /**
+ * Returns a list of type bindings representing the types of the exceptions thrown
+ * by this method or constructor. Returns an array of length 0 if this method
+ * throws no exceptions. The resulting types are in no particular order.
+ *
+ * @return a list of type bindings for exceptions
+ * thrown by this method or constructor
+ */
+ public ITypeBinding[] getExceptionTypes();
+
+ /**
+ * Returns the type parameters of this method or constructor binding.
+ * <p>
+ * Note that type parameters only occur on the binding of the
+ * declaring generic method. Type bindings corresponding to a raw or
+ * parameterized reference to a generic method do not carry type
+ * parameters (they instead have non-empty type arguments
+ * and non-trivial erasure).
+ * </p>
+ *
+ * @return the list of binding for the type variables for the type
+ * parameters of this method, or otherwise the empty list
+ * @see ITypeBinding#isTypeVariable()
+ * @since 3.1
+ */
+ public ITypeBinding[] getTypeParameters();
+
+ /**
+ * Returns whether this method binding represents a declaration of
+ * a generic method.
+ * <p>
+ * Note that type parameters only occur on the binding of the
+ * declaring generic method; e.g., <code>public <T> T identity(T t);</code>.
+ * Method bindings corresponding to a raw or parameterized reference to a generic
+ * method do not carry type parameters (they instead have non-empty type arguments
+ * and non-trivial erasure).
+ * This method is fully equivalent to <code>getTypeParameters().length > 0)</code>.
+ * </p>
+ * <p>
+ * Note that {@link #isGenericMethod()},
+ * {@link #isParameterizedMethod()},
+ * and {@link #isRawMethod()} are mutually exclusive.
+ * </p>
+ *
+ * @return <code>true</code> if this method binding represents a
+ * declaration of a generic method, and <code>false</code> otherwise
+ * @see #getTypeParameters()
+ * @since 3.1
+ */
+ public boolean isGenericMethod();
+
+ /**
+ * Returns whether this method binding represents an instance of
+ * a generic method corresponding to a parameterized method reference.
+ * <p>
+ * Note that {@link #isGenericMethod()},
+ * {@link #isParameterizedMethod()},
+ * and {@link #isRawMethod()} are mutually exclusive.
+ * </p>
+ *
+ * @return <code>true</code> if this method binding represents a
+ * an instance of a generic method corresponding to a parameterized
+ * method reference, and <code>false</code> otherwise
+ * @see #getMethodDeclaration()
+ * @see #getTypeArguments()
+ * @since 3.1
+ */
+ public boolean isParameterizedMethod();
+
+ /**
+ * Returns the type arguments of this generic method instance, or the
+ * empty list for other method bindings.
+ * <p>
+ * Note that type arguments only occur on a method binding that represents
+ * an instance of a generic method corresponding to a raw or parameterized
+ * reference to a generic method. Do not confuse these with type parameters
+ * which only occur on the method binding corresponding directly to the
+ * declaration of a generic method.
+ * </p>
+ *
+ * @return the list of type bindings for the type arguments used to
+ * instantiate the corrresponding generic method, or otherwise the empty list
+ * @see #getMethodDeclaration()
+ * @see #isParameterizedMethod()
+ * @see #isRawMethod()
+ * @since 3.1
+ */
+ public ITypeBinding[] getTypeArguments();
+
+ /**
+ * Returns the binding for the method declaration corresponding to this
+ * method binding. For parameterized methods ({@link #isParameterizedMethod()})
+ * and raw methods ({@link #isRawMethod()}), this method returns the binding
+ * for the corresponding generic method. For other method bindings, this
+ * returns the same binding.
+ *
+ * <p>Note: The one notable exception is the method <code>Object.getClass()</code>,
+ * which is declared to return <code>Class<? extends Object></code>, but
+ * when invoked its return type becomes <code>Class<? extends
+ * </code><em>R</em><code>></code>, where <em>R</em> is the compile type of
+ * the receiver of the method invocation.</p>
+ *
+ * @return the method binding
+ * @since 3.1
+ */
+ public IMethodBinding getMethodDeclaration();
+
+ /**
+ * Returns whether this method binding represents an instance of
+ * a generic method corresponding to a raw method reference.
+ * <p>
+ * Note that {@link #isGenericMethod()},
+ * {@link #isParameterizedMethod()},
+ * and {@link #isRawMethod()} are mutually exclusive.
+ * </p>
+ *
+ * @return <code>true</code> if this method binding represents a
+ * an instance of a generic method corresponding to a raw
+ * method reference, and <code>false</code> otherwise
+ * @see #getMethodDeclaration()
+ * @see #getTypeArguments()
+ * @since 3.1
+ */
+ public boolean isRawMethod();
+
+ /**
+ * Returns whether this method's signature is a subsignature of the given method as
+ * specified in section 8.4.2 of <em>The Java Language Specification, Third Edition</em> (JLS3).
+ *
+ * @return <code>true</code> if this method's signature is a subsignature of the given method
+ * @since 3.1
+ */
+ public boolean isSubsignature(IMethodBinding otherMethod);
+
+ /**
+ * Returns whether this is a variable arity method.
+ * <p>
+ * Note: Variable arity ("varargs") methods were added in JLS3.
+ * </p>
+ *
+ * @return <code>true</code> if this is a variable arity method,
+ * and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public boolean isVarargs();
+
+ /**
+ * Returns whether this method overrides the given method,
+ * as specified in section 6.4.2 of <em>The Java Language
+ * Specification, Second Edition</em> (JLS2).
+ *
+ * @param method the method that is possibly overriden
+ * @return <code>true</code> if this method overrides the given method,
+ * and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public boolean overrides(IMethodBinding method);
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IPackageBinding.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IPackageBinding.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IPackageBinding.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.core.dom;
+
+/**
+ * A package binding represents a named or unnamed package.
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ *
+ * @since 2.0
+ */
+public interface IPackageBinding extends IBinding {
+
+ /**
+ * Returns the name of the package represented by this binding. For named
+ * packages, this is the fully qualified package name (using "." for
+ * separators). For unnamed packages, this is an empty string.
+ *
+ * @return the name of the package represented by this binding, or
+ * an empty string for an unnamed package
+ */
+ public String getName();
+
+ /**
+ * Returns whether this package is an unnamed package.
+ * See <em>The Java Language Specification</em> section 7.4.2 for details.
+ *
+ * @return <code>true</code> if this is an unnamed package, and
+ * <code>false</code> otherwise
+ */
+ public boolean isUnnamed();
+
+ /**
+ * Returns the list of name component making up the name of the package
+ * represented by this binding. For example, for the package named
+ * "com.example.tool", this method returns {"com", "example", "tool"}.
+ * Returns the empty list for unnamed packages.
+ *
+ * @return the name of the package represented by this binding, or the
+ * empty list for unnamed packages
+ */
+ public String[] getNameComponents();
+
+// /**
+// * Finds and returns the binding for the class or interface with the given
+// * name declared in this package.
+// * <p>
+// * For top-level classes and interfaces, the name here is just the simple
+// * name of the class or interface. For nested classes and interfaces, the
+// * name is the VM class name (in other words, a name like
+// * <code>"Outer$Inner"</code> as used to name the class file; see
+// * <code>ITypeBinding.getName</code>).
+// * </p>
+// *
+// * @param name the name of a class or interface
+// * @return the type binding for the class or interface with the
+// * given name declared in this package, or <code>null</code>
+// * if there is no such type
+// */
+// public ITypeBinding findTypeBinding(String name);
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/ITypeBinding.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/ITypeBinding.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/ITypeBinding.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,941 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.core.dom;
+
+/**
+ * A type binding represents fully-resolved type. There are a number of
+ * different kinds of type bindings:
+ * <ul>
+ * <li>a class - represents the class declaration;
+ * possibly with type parameters</li>
+ * <li>an interface - represents the class declaration;
+ * possibly with type parameters</li>
+ * <li>an enum - represents the enum declaration (enum types do not have
+ * have type parameters)</li>
+ * <li>an annotation - represents the annotation type declaration
+ * (annotation types do not have have type parameters)</li>
+ * <li>an array type - array types are referenced but not explicitly
+ * declared</li>
+ * <li>a primitive type (including the special return type <code>void</code>)
+ * - primitive types are referenced but not explicitly declared</li>
+ * <li>the null type - this is the special type of <code>null</code></li>
+ * <li>a type variable - represents the declaration of a type variable;
+ * possibly with type bounds</li>
+ * <li>a wildcard type - represents a wild card used as a type argument in
+ * a parameterized type reference</li>
+ * <li>a raw type - represents a legacy non-parameterized reference to
+ * a generic type</li>
+ * <li>a parameterized type - represents an copy of a type declaration
+ * with substitutions for its type parameters</li>
+ * <li>a capture - represents a capture binding</li>
+ * </ul>
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ *
+ * @see ITypeBinding#getDeclaredTypes()
+ * @since 2.0
+ */
+public interface ITypeBinding extends IBinding {
+
+
+ /**
+ * Answer an array type binding using the receiver and the given dimension.
+ *
+ * <p>If the receiver is an array binding, then the resulting dimension is the given dimension
+ * plus the dimension of the receiver. Otherwise the resulting dimension is the given
+ * dimension.</p>
+ *
+ * @param dimension the given dimension
+ * @return an array type binding
+ * @throws IllegalArgumentException:<ul>
+ * <li>if the receiver represents the void type</li>
+ * <li>if the resulting dimensions is lower than one or greater than 255</li>
+ * </ul>
+ * @since 3.3
+ */
+ public ITypeBinding createArrayType(int dimension);
+
+ /**
+ * Returns the binary name of this type binding.
+ * The binary name of a class is defined in the Java Language
+ * Specification 3rd edition, section 13.1.
+ * <p>
+ * Note that in some cases, the binary name may be unavailable.
+ * This may happen, for example, for a local type declared in
+ * unreachable code.
+ * </p>
+ *
+ * @return the binary name of this type, or <code>null</code>
+ * if the binary name is unknown
+ * @since 3.0
+ */
+ public String getBinaryName();
+
+ /**
+ * Returns the bound of this wildcard type if it has one.
+ * Returns <code>null</code> if this is not a wildcard type.
+ *
+ * @return the bound of this wildcard type, or <code>null</code> if none
+ * @see #isWildcardType()
+ * @see #isUpperbound()
+ * @since 3.1
+ */
+ public ITypeBinding getBound();
+
+ /**
+ * Returns the binding representing the component type of this array type,
+ * or <code>null</code> if this is not an array type binding. The component
+ * type of an array might be an array type.
+ * <p>This is subject to change before 3.2 release.</p>
+ *
+ * @return the component type binding, or <code>null</code> if this is
+ * not an array type
+ * @since 3.2
+ */
+ public ITypeBinding getComponentType();
+
+ /**
+ * Returns a list of bindings representing all the fields declared
+ * as members of this class, interface, or enum type.
+ *
+ * <p>These include public, protected, default (package-private) access,
+ * and private fields declared by the class, but excludes inherited fields.
+ * Synthetic fields may or may not be included. Fields from binary types that
+ * reference unresolvable types may not be included.</p>
+ *
+ * <p>Returns an empty list if the class, interface, or enum declares no fields,
+ * and for other kinds of type bindings that do not directly have members.</p>
+ *
+ * <p>The resulting bindings are in no particular order.</p>
+ *
+ * @return the list of bindings for the field members of this type,
+ * or the empty list if this type does not have field members
+ */
+ public IVariableBinding[] getDeclaredFields();
+
+ /**
+ * Returns a list of method bindings representing all the methods and
+ * constructors declared for this class, interface, enum, or annotation
+ * type.
+ * <p>These include public, protected, default (package-private) access,
+ * and private methods Synthetic methods and constructors may or may not be
+ * included. Returns an empty list if the class, interface, or enum,
+ * type declares no methods or constructors, if the annotation type declares
+ * no members, or if this type binding represents some other kind of type
+ * binding. Methods from binary types that reference unresolvable types may
+ * not be included.</p>
+ * <p>The resulting bindings are in no particular order.</p>
+ *
+ * @return the list of method bindings for the methods and constructors
+ * declared by this class, interface, enum type, or annotation type,
+ * or the empty list if this type does not declare any methods or constructors
+ */
+ public IMethodBinding[] getDeclaredMethods();
+
+ /**
+ * Returns the declared modifiers for this class or interface binding
+ * as specified in the original source declaration of the class or
+ * interface. The result may not correspond to the modifiers in the compiled
+ * binary, since the compiler may change them (in particular, for inner
+ * class emulation). The <code>getModifiers</code> method should be used if
+ * the compiled modifiers are needed. Returns -1 if this type does not
+ * represent a class or interface.
+ *
+ * @return the bit-wise or of <code>Modifier</code> constants
+ * @see #getModifiers()
+ *
+ */
+ public int getDeclaredModifiers();
+
+ /**
+ * Returns a list of type bindings representing all the types declared as
+ * members of this class, interface, or enum type.
+ * These include public, protected, default (package-private) access,
+ * and private classes, interfaces, enum types, and annotation types
+ * declared by the type, but excludes inherited types. Returns an empty
+ * list if the type declares no type members, or if this type
+ * binding represents an array type, a primitive type, a type variable,
+ * a wildcard type, a capture, or the null type.
+ * The resulting bindings are in no particular order.
+ *
+ * @return the list of type bindings for the member types of this type,
+ * or the empty list if this type does not have member types
+ */
+ public ITypeBinding[] getDeclaredTypes();
+
+ /**
+ * Returns the type binding representing the class, interface, or enum
+ * that declares this binding.
+ * <p>
+ * The declaring class of a member class, interface, enum, annotation
+ * type is the class, interface, or enum type of which it is a member.
+ * The declaring class of a local class or interface (including anonymous
+ * classes) is the innermost class or interface containing the expression
+ * or statement in which this type is declared.
+ * </p>
+ * <p>The declaring class of a type variable is the class in which the type
+ * variable is declared if it is declared on a type. It returns
+ * <code>null</code> otherwise.
+ * </p>
+ * <p>The declaring class of a capture binding is the innermost class or
+ * interface containing the expression or statement in which this capture is
+ * declared.
+ * </p>
+ * <p>Array types, primitive types, the null type, top-level types,
+ * wildcard types, recovered binding have no declaring class.
+ * </p>
+ *
+ * @return the binding of the type that declares this type, or
+ * <code>null</code> if none
+ */
+ public ITypeBinding getDeclaringClass();
+
+ /**
+ * Returns the method binding representing the method that declares this binding
+ * of a local type or type variable.
+ * <p>
+ * The declaring method of a local class or interface (including anonymous
+ * classes) is the innermost method containing the expression or statement in
+ * which this type is declared. Returns <code>null</code> if the type
+ * is declared in an initializer.
+ * </p>
+ * <p>
+ * The declaring method of a type variable is the method in which the type
+ * variable is declared if it is declared on a method. It
+ * returns <code>null</code> otherwise.
+ * </p>
+ * <p>Array types, primitive types, the null type, top-level types,
+ * wildcard types, capture bindings, and recovered binding have no
+ * declaring method.
+ * </p>
+ *
+ * @return the binding of the method that declares this type, or
+ * <code>null</code> if none
+ * @since 3.1
+ */
+ public IMethodBinding getDeclaringMethod();
+
+ /**
+ * Returns the dimensionality of this array type, or <code>0</code> if this
+ * is not an array type binding.
+ *
+ * @return the number of dimension of this array type binding, or
+ * <code>0</code> if this is not an array type
+ */
+ public int getDimensions();
+
+ /**
+ * Returns the binding representing the element type of this array type,
+ * or <code>null</code> if this is not an array type binding. The element
+ * type of an array is never itself an array type.
+ *
+ * @return the element type binding, or <code>null</code> if this is
+ * not an array type
+ */
+ public ITypeBinding getElementType();
+
+ /**
+ * Returns the erasure of this type binding.
+ * <ul>
+ * <li>For parameterized types ({@link #isParameterizedType()})
+ * - returns the binding for the corresponding generic type.</li>
+ * <li>For raw types ({@link #isRawType()})
+ * - returns the binding for the corresponding generic type.</li>
+ * <li>For wildcard types ({@link #isWildcardType()})
+ * - returns the binding for the upper bound if it has one and
+ * java.lang.Object in other cases.</li>
+ * <li>For type variables ({@link #isTypeVariable()})
+ * - returns the binding for the erasure of the leftmost bound
+ * if it has bounds and java.lang.Object if it does not.</li>
+ * <li>For captures ({@link #isCapture()})
+ * - returns the binding for the erasure of the leftmost bound
+ * if it has bounds and java.lang.Object if it does not.</li>
+ * <li>For array types ({@link #isArray()}) - returns an array type of
+ * the same dimension ({@link #getDimensions()}) as this type
+ * binding for which the element type is the erasure of the element type
+ * ({@link #getElementType()}) of this type binding.</li>
+ * <li>For all other type bindings - returns the identical binding.</li>
+ * </ul>
+ *
+ * @return the erasure type binding
+ * @since 3.1
+ */
+ public ITypeBinding getErasure();
+
+ /**
+ * Returns a list of type bindings representing the direct superinterfaces
+ * of the class, interface, or enum type represented by this type binding.
+ * <p>
+ * If this type binding represents a class or enum type, the return value
+ * is an array containing type bindings representing all interfaces
+ * directly implemented by this class. The number and order of the interface
+ * objects in the array corresponds to the number and order of the interface
+ * names in the <code>implements</code> clause of the original declaration
+ * of this type.
+ * </p>
+ * <p>
+ * If this type binding represents an interface, the array contains
+ * type bindings representing all interfaces directly extended by this
+ * interface. The number and order of the interface objects in the array
+ * corresponds to the number and order of the interface names in the
+ * <code>extends</code> clause of the original declaration of this interface.
+ * </p>
+ * <p>
+ * If the class or enum implements no interfaces, or the interface extends
+ * no interfaces, or if this type binding represents an array type, a
+ * primitive type, the null type, a type variable, an annotation type,
+ * a wildcard type, or a capture binding, this method returns an array of
+ * length 0.
+ * </p>
+ *
+ * @return the list of type bindings for the interfaces extended by this
+ * class or enum, or interfaces extended by this interface, or otherwise
+ * the empty list
+ */
+ public ITypeBinding[] getInterfaces();
+
+ /**
+ * Returns the compiled modifiers for this class, interface, enum,
+ * or annotation type binding.
+ * The result may not correspond to the modifiers as declared in the
+ * original source, since the compiler may change them (in particular,
+ * for inner class emulation). The <code>getDeclaredModifiers</code> method
+ * should be used if the original modifiers are needed.
+ * Returns 0 if this type does not represent a class, an interface, an enum, an annotation
+ * type or a recovered type.
+ *
+ * @return the compiled modifiers for this type binding or 0
+ * if this type does not represent a class, an interface, an enum, an annotation
+ * type or a recovered type.
+ * @see #getDeclaredModifiers()
+ */
+ public int getModifiers();
+
+ /**
+ * Returns the unqualified name of the type represented by this binding
+ * if it has one.
+ * <ul>
+ * <li>For top-level types, member types, and local types,
+ * the name is the simple name of the type.
+ * Example: <code>"String"</code> or <code>"Collection"</code>.
+ * Note that the type parameters of a generic type are not included.</li>
+ * <li>For primitive types, the name is the keyword for the primitive type.
+ * Example: <code>"int"</code>.</li>
+ * <li>For the null type, the name is the string "null".</li>
+ * <li>For anonymous classes, which do not have a name,
+ * this method returns an empty string.</li>
+ * <li>For array types, the name is the unqualified name of the component
+ * type (as computed by this method) followed by "[]".
+ * Example: <code>"String[]"</code>. Note that the component type is never an
+ * an anonymous class.</li>
+ * <li>For type variables, the name is just the simple name of the
+ * type variable (type bounds are not included).
+ * Example: <code>"X"</code>.</li>
+ * <li>For type bindings that correspond to particular instances of a generic
+ * type arising from a parameterized type reference,
+ * the name is the unqualified name of the erasure type (as computed by this method)
+ * followed by the names (again, as computed by this method) of the type arguments
+ * surrounded by "<>" and separated by ",".
+ * Example: <code>"Collection<String>"</code>.
+ * </li>
+ * <li>For type bindings that correspond to particular instances of a generic
+ * type arising from a raw type reference, the name is the unqualified name of
+ * the erasure type (as computed by this method).
+ * Example: <code>"Collection"</code>.</li>
+ * <li>For wildcard types, the name is "?" optionally followed by
+ * a single space followed by the keyword "extends" or "super"
+ * followed a single space followed by the name of the bound (as computed by
+ * this method) when present.
+ * Example: <code>"? extends InputStream"</code>.
+ * </li>
+ * <li>Capture types do not have a name. For these types,
+ * and array types thereof, this method returns an empty string.</li>
+ * </ul>
+ *
+ * @return the unqualified name of the type represented by this binding,
+ * or the empty string if it has none
+ * @see #getQualifiedName()
+ */
+ public String getName();
+
+ /**
+ * Returns the binding for the package in which this type is declared.
+ *
+ * <p>The package of a recovered type reference binding is the package of the
+ * enclosing type.</p>
+ *
+ * @return the binding for the package in which this class, interface,
+ * enum, or annotation type is declared, or <code>null</code> if this type
+ * binding represents a primitive type, an array type, the null type,
+ * a type variable, a wildcard type, a capture binding.
+ */
+ public IPackageBinding getPackage();
+
+ /**
+ * Returns the fully qualified name of the type represented by this
+ * binding if it has one.
+ * <ul>
+ * <li>For top-level types, the fully qualified name is the simple name of
+ * the type preceded by the package name (or unqualified if in a default package)
+ * and a ".".
+ * Example: <code>"java.lang.String"</code> or <code>"java.util.Collection"</code>.
+ * Note that the type parameters of a generic type are not included.</li>
+ * <li>For members of top-level types, the fully qualified name is the
+ * simple name of the type preceded by the fully qualified name of the
+ * enclosing type (as computed by this method) and a ".".
+ * Example: <code>"java.io.ObjectInputStream.GetField"</code>.
+ * If the binding is for a member type that corresponds to a particular instance
+ * of a generic type arising from a parameterized type reference, the simple
+ * name of the type is followed by the fully qualified names of the type arguments
+ * (as computed by this method) surrounded by "<>" and separated by ",".
+ * Example: <code>"pkg.Outer.Inner<java.lang.String>"</code>.
+ * </li>
+ * <li>For primitive types, the fully qualified name is the keyword for
+ * the primitive type.
+ * Example: <code>"int"</code>.</li>
+ * <li>For the null type, the fully qualified name is the string
+ * "null".</li>
+ * <li>Local types (including anonymous classes) and members of local
+ * types do not have a fully qualified name. For these types, and array
+ * types thereof, this method returns an empty string.</li>
+ * <li>For array types whose component type has a fully qualified name,
+ * the fully qualified name is the fully qualified name of the component
+ * type (as computed by this method) followed by "[]".
+ * Example: <code>"java.lang.String[]"</code>.</li>
+ * <li>For type variables, the fully qualified name is just the name of the
+ * type variable (type bounds are not included).
+ * Example: <code>"X"</code>.</li>
+ * <li>For type bindings that correspond to particular instances of a generic
+ * type arising from a parameterized type reference,
+ * the fully qualified name is the fully qualified name of the erasure
+ * type followed by the fully qualified names of the type arguments surrounded by "<>" and separated by ",".
+ * Example: <code>"java.util.Collection<java.lang.String>"</code>.
+ * </li>
+ * <li>For type bindings that correspond to particular instances of a generic
+ * type arising from a raw type reference,
+ * the fully qualified name is the fully qualified name of the erasure type.
+ * Example: <code>"java.util.Collection"</code>. Note that the
+ * the type parameters are omitted.</li>
+ * <li>For wildcard types, the fully qualified name is "?" optionally followed by
+ * a single space followed by the keyword "extends" or "super"
+ * followed a single space followed by the fully qualified name of the bound
+ * (as computed by this method) when present.
+ * Example: <code>"? extends java.io.InputStream"</code>.
+ * </li>
+ * <li>Capture types do not have a fully qualified name. For these types,
+ * and array types thereof, this method returns an empty string.</li>
+ * </ul>
+ *
+ * @return the fully qualified name of the type represented by this
+ * binding, or the empty string if it has none
+ * @see #getName()
+ * @since 2.1
+ */
+ public String getQualifiedName();
+
+ /**
+ * Returns the type binding for the superclass of the type represented
+ * by this class binding.
+ * <p>
+ * If this type binding represents any class other than the class
+ * <code>java.lang.Object</code>, then the type binding for the direct
+ * superclass of this class is returned. If this type binding represents
+ * the class <code>java.lang.Object</code>, then <code>null</code> is
+ * returned.
+ * <p>
+ * Loops that ascend the class hierarchy need a suitable termination test.
+ * Rather than test the superclass for <code>null</code>, it is more
+ * transparent to check whether the class is <code>Object</code>, by
+ * comparing whether the class binding is identical to
+ * <code>ast.resolveWellKnownType("java.lang.Object")</code>.
+ * </p>
+ * <p>
+ * If this type binding represents an interface, an array type, a
+ * primitive type, the null type, a type variable, an enum type,
+ * an annotation type, a wildcard type, or a capture binding then
+ * <code>null</code> is returned.
+ * </p>
+ *
+ * @return the superclass of the class represented by this type binding,
+ * or <code>null</code> if none
+ */
+ public ITypeBinding getSuperclass();
+
+ /**
+ * Returns the type arguments of this generic type instance, or the
+ * empty list for other type bindings.
+ * <p>
+ * Note that type arguments only occur on a type binding that represents
+ * an instance of a generic type corresponding to a parameterized type
+ * reference (e.g., <code>Collection<String></code>).
+ * Do not confuse these with type parameters which only occur on the
+ * type binding corresponding directly to the declaration of the
+ * generic class or interface (e.g., <code>Collection<T></code>).
+ * </p>
+ *
+ * @return the list of type bindings for the type arguments used to
+ * instantiate the corresponding generic type, or otherwise the empty list
+ * @see #getTypeDeclaration()
+ * @see #isGenericType()
+ * @see #isParameterizedType()
+ * @see #isRawType()
+ * @since 3.1
+ */
+ public ITypeBinding[] getTypeArguments();
+
+ /**
+ * Returns the declared type bounds of this type variable or capture. If the
+ * variable or the capture had no explicit bound, then it returns an empty list.
+ * <p>
+ * Note that per construction, it can only contain one class or array type,
+ * at most, and then it is located in first position.
+ * </p>
+ * <p>
+ * Also note that array type bound may only occur in the case of a capture
+ * binding, e.g. <code>capture-of ? extends Object[]</code>
+ * </p>
+ *
+ * @return the list of type bindings for this type variable or capture,
+ * or otherwise the empty list
+ * @see #isCapture()
+ * @see #isTypeVariable()
+ * @since 3.1
+ */
+ public ITypeBinding[] getTypeBounds();
+
+ /**
+ * Returns the binding for the type declaration corresponding to this type
+ * binding.
+ * <p>For parameterized types ({@link #isParameterizedType()})
+ * and most raw types ({@link #isRawType()}), this method returns the binding
+ * for the corresponding generic type.</p>
+ * <p>For raw member types ({@link #isRawType()}, {@link #isMember()})
+ * of a raw declaring class, the type declaration is a generic or a non-generic
+ * type.</p>
+ * <p>A different non-generic binding will be returned when one of the declaring
+ * types/methods was parameterized.</p>
+ * <p>For other type bindings, this returns the same binding.</p>
+ *
+ * @return the type binding
+ * @since 3.1
+ */
+ public ITypeBinding getTypeDeclaration();
+
+ /**
+ * Returns the type parameters of this class or interface type binding.
+ * <p>
+ * Note that type parameters only occur on the binding of the
+ * declaring generic class or interface; e.g., <code>Collection<T></code>.
+ * Type bindings corresponding to a raw or parameterized reference to a generic
+ * type do not carry type parameters (they instead have non-empty type arguments
+ * and non-trivial erasure).
+ * </p>
+ *
+ * @return the list of binding for the type variables for the type
+ * parameters of this type, or otherwise the empty list
+ * @see #isTypeVariable()
+ * @since 3.1
+ */
+ // TODO (jeem) - clarify whether binding for a generic type instance carries a copy of the generic type's type parameters as well as type arguments
+ public ITypeBinding[] getTypeParameters();
+
+ /**
+ * Returns the corresponding wildcard binding of this capture binding.
+ * Returns <code>null</code> if this type bindings does not represent
+ * a capture binding.
+ *
+ * @return the corresponding wildcard binding for a capture
+ * binding, <code>null</code> otherwise
+ * @since 3.1
+ */
+ public ITypeBinding getWildcard();
+
+ /**
+ * Returns whether this type binding represents an annotation type.
+ * <p>
+ * Note that an annotation type is always an interface.
+ * </p>
+ *
+ * @return <code>true</code> if this object represents an annotation type,
+ * and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public boolean isAnnotation();
+
+ /**
+ * Returns whether this type binding represents an anonymous class.
+ * <p>
+ * An anonymous class is a subspecies of local class, and therefore mutually
+ * exclusive with member types. Note that anonymous classes have no name
+ * (<code>getName</code> returns the empty string).
+ * </p>
+ *
+ * @return <code>true</code> if this type binding is for an anonymous class,
+ * and <code>false</code> otherwise
+ */
+ public boolean isAnonymous();
+
+ /**
+ * Returns whether this type binding represents an array type.
+ *
+ * @return <code>true</code> if this type binding is for an array type,
+ * and <code>false</code> otherwise
+ * @see #getElementType()
+ * @see #getDimensions()
+ */
+ public boolean isArray();
+
+ /**
+ * Returns whether an expression of this type can be assigned to a variable
+ * of the given type, as specified in section 5.2 of <em>The Java Language
+ * Specification, Third Edition</em> (JLS3).
+ *
+ * <p>If the receiver or the argument is a recovered type, the answer is always false,
+ * unless the two types are identical or the argument is <code>java.lang.Object</code>.</p>
+ *
+ * @param variableType the type of a variable to check compatibility against
+ * @return <code>true</code> if an expression of this type can be assigned to a
+ * variable of the given type, and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public boolean isAssignmentCompatible(ITypeBinding variableType);
+
+ /**
+ * Returns whether this type binding represents a capture binding.
+ * <p>
+ * Capture bindings result from capture conversion as specified
+ * in section 5.1.10 of <em>The Java Language Specification,
+ * Third Edition</em> (JLS3).
+ * </p>
+ * <p>
+ * A capture binding may have upper bounds and a lower bound.
+ * Upper bounds may be accessed using {@link #getTypeBounds()},
+ * the lower bound must be accessed indirectly through the associated
+ * wildcard {@link #getWildcard()} when it is a lower bound wildcard.
+ * </p>
+ * <p>
+ * Note that capture bindings are distinct from type variables
+ * (even though they are often depicted as synthetic type
+ * variables); as such, {@link #isTypeVariable()} answers
+ * <code>false</code> for capture bindings, and
+ * {@link #isCapture()} answers <code>false</code> for type variables.
+ * </p>
+ *
+ * @return <code>true</code> if this type binding is a capture,
+ * and <code>false</code> otherwise
+ * @see #getTypeBounds()
+ * @see #getWildcard()
+ * @since 3.1
+ */
+ public boolean isCapture();
+
+ /**
+ * Returns whether this type is cast compatible with the given type,
+ * as specified in section 5.5 of <em>The Java Language
+ * Specification, Third Edition</em> (JLS3).
+ * <p>
+ * NOTE: The cast compatibility check performs backwards.
+ * When testing whether type B can be cast to type A, one would use:
+ * <code>A.isCastCompatible(B)</code>
+ * </p>
+ *
+ * <p>If the receiver or the argument is a recovered type, the answer is always false,
+ * unless the two types are identical or the argument is <code>java.lang.Object</code>.</p>
+ *
+ * @param type the type to check compatibility against
+ * @return <code>true</code> if this type is cast compatible with the
+ * given type, and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public boolean isCastCompatible(ITypeBinding type);
+
+ /**
+ * Returns whether this type binding represents a class type or a recovered binding.
+ *
+ * @return <code>true</code> if this object represents a class or a recovered binding,
+ * and <code>false</code> otherwise
+ */
+ public boolean isClass();
+
+ /**
+ * Returns whether this type binding represents an enum type.
+ *
+ * @return <code>true</code> if this object represents an enum type,
+ * and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public boolean isEnum();
+
+ /**
+ * Returns whether this type binding originated in source code.
+ * Returns <code>false</code> for all primitive types, the null type,
+ * array types, and for all classes, interfaces, enums, annotation
+ * types, type variables, parameterized type references,
+ * raw type references, wildcard types, and capture bindings
+ * whose information came from a pre-compiled binary class file.
+ *
+ * @return <code>true</code> if the type is in source code,
+ * and <code>false</code> otherwise
+ */
+ public boolean isFromSource();
+
+ /**
+ * Returns whether this type binding represents a declaration of
+ * a generic class or interface.
+ * <p>
+ * Note that type parameters only occur on the binding of the
+ * declaring generic class or interface; e.g., <code>Collection<T></code>.
+ * Type bindings corresponding to a raw or parameterized reference to a generic
+ * type do not carry type parameters (they instead have non-empty type arguments
+ * and non-trivial erasure).
+ * This method is fully equivalent to <code>getTypeParameters().length > 0)</code>.
+ * </p>
+ * <p>
+ * Note that {@link #isGenericType()},
+ * {@link #isParameterizedType()},
+ * and {@link #isRawType()} are mutually exclusive.
+ * </p>
+ *
+ * @return <code>true</code> if this type binding represents a
+ * declaration of a generic class or interface, and <code>false</code> otherwise
+ * @see #getTypeParameters()
+ * @since 3.1
+ */
+ public boolean isGenericType();
+
+ /**
+ * Returns whether this type binding represents an interface type.
+ * <p>
+ * Note that an interface can also be an annotation type.
+ * </p>
+ *
+ * @return <code>true</code> if this object represents an interface,
+ * and <code>false</code> otherwise
+ */
+ public boolean isInterface();
+
+ /**
+ * Returns whether this type binding represents a local class.
+ * <p>
+ * A local class is any nested class or enum type not declared as a member
+ * of another class or interface. A local class is a subspecies of nested
+ * type, and mutually exclusive with member types. Note that anonymous
+ * classes are a subspecies of local classes.
+ * </p>
+ * <p>
+ * Also note that interfaces and annotation types cannot be local.
+ * </p>
+ *
+ * @return <code>true</code> if this type binding is for a local class or
+ * enum type, and <code>false</code> otherwise
+ */
+ public boolean isLocal();
+
+ /**
+ * Returns whether this type binding represents a member class or
+ * interface.
+ * <p>
+ * A member type is any type declared as a member of
+ * another type. A member type is a subspecies of nested
+ * type, and mutually exclusive with local types.
+ * </p>
+ *
+ * @return <code>true</code> if this type binding is for a member class,
+ * interface, enum, or annotation type, and <code>false</code> otherwise
+ */
+ public boolean isMember();
+
+ /**
+ * Returns whether this type binding represents a nested class, interface,
+ * enum, or annotation type.
+ * <p>
+ * A nested type is any type whose declaration occurs within
+ * the body of another. The set of nested types is disjoint from the set of
+ * top-level types. Nested types further subdivide into member types, local
+ * types, and anonymous types.
+ * </p>
+ *
+ * @return <code>true</code> if this type binding is for a nested class,
+ * interface, enum, or annotation type, and <code>false</code> otherwise
+ */
+ public boolean isNested();
+
+ /**
+ * Returns whether this type binding represents the null type.
+ * <p>
+ * The null type is the type of a <code>NullLiteral</code> node.
+ * </p>
+ *
+ * @return <code>true</code> if this type binding is for the null type,
+ * and <code>false</code> otherwise
+ */
+ public boolean isNullType();
+
+ /**
+ * Returns whether this type binding represents an instance of
+ * a generic type corresponding to a parameterized type reference.
+ * <p>
+ * For example, an AST type like
+ * <code>Collection<String></code> typically resolves to a
+ * type binding whose type argument is the type binding for the
+ * class <code>java.lang.String</code> and whose erasure is the type
+ * binding for the generic type <code>java.util.Collection</code>.
+ * </p>
+ * <p>
+ * Note that {@link #isGenericType()},
+ * {@link #isParameterizedType()},
+ * and {@link #isRawType()} are mutually exclusive.
+ * </p>
+ *
+ * @return <code>true</code> if this type binding represents a
+ * an instance of a generic type corresponding to a parameterized
+ * type reference, and <code>false</code> otherwise
+ * @see #getTypeArguments()
+ * @see #getTypeDeclaration()
+ * @since 3.1
+ */
+ public boolean isParameterizedType();
+
+ /**
+ * Returns whether this type binding represents a primitive type.
+ * <p>
+ * There are nine predefined type bindings to represent the eight primitive
+ * types and <code>void</code>. These have the same names as the primitive
+ * types that they represent, namely boolean, byte, char, short, int,
+ * long, float, and double, and void.
+ * </p>
+ *
+ * @return <code>true</code> if this type binding is for a primitive type,
+ * and <code>false</code> otherwise
+ */
+ public boolean isPrimitive();
+
+ /**
+ * Returns whether this type binding represents an instance of
+ * a generic type corresponding to a raw type reference.
+ * <p>
+ * For example, an AST type like
+ * <code>Collection</code> typically resolves to a
+ * type binding whose type argument is the type binding for
+ * the class <code>java.lang.Object</code> (the
+ * default bound for the single type parameter of
+ * <code>java.util.Collection</code>) and whose erasure is the
+ * type binding for the generic type
+ * <code>java.util.Collection</code>.
+ * </p>
+ * <p>
+ * Note that {@link #isGenericType()},
+ * {@link #isParameterizedType()},
+ * and {@link #isRawType()} are mutually exclusive.
+ * </p>
+ *
+ * @return <code>true</code> if this type binding represents a
+ * an instance of a generic type corresponding to a raw
+ * type reference, and <code>false</code> otherwise
+ * @see #getTypeDeclaration()
+ * @see #getTypeArguments()
+ * @since 3.1
+ */
+ public boolean isRawType();
+
+ /**
+ * Returns whether this type is subtype compatible with the given type,
+ * as specified in section 4.10 of <em>The Java Language
+ * Specification, Third Edition</em> (JLS3).
+ *
+ * <p>If the receiver or the argument is a recovered type, the answer is always false,
+ * unless the two types are identical or the argument is <code>java.lang.Object</code>.</p>
+ *
+ * @param type the type to check compatibility against
+ * @return <code>true</code> if this type is subtype compatible with the
+ * given type, and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public boolean isSubTypeCompatible(ITypeBinding type);
+
+ /**
+ * Returns whether this type binding represents a top-level class,
+ * interface, enum, or annotation type.
+ * <p>
+ * A top-level type is any type whose declaration does not occur within the
+ * body of another type declaration. The set of top level types is disjoint
+ * from the set of nested types.
+ * </p>
+ *
+ * @return <code>true</code> if this type binding is for a top-level class,
+ * interface, enum, or annotation type, and <code>false</code> otherwise
+ */
+ public boolean isTopLevel();
+
+ /**
+ * Returns whether this type binding represents a type variable.
+ * Type variables bindings carry the type variable's bounds.
+ * <p>
+ * Note that type variables are distinct from capture bindings
+ * (even though capture bindings are often depicted as synthetic
+ * type variables); as such, {@link #isTypeVariable()} answers
+ * <code>false</code> for capture bindings, and
+ * {@link #isCapture()} answers <code>false</code> for type variables.
+ * </p>
+ *
+ * @return <code>true</code> if this type binding is for a type variable,
+ * and <code>false</code> otherwise
+ * @see #getName()
+ * @see #getTypeBounds()
+ * @since 3.1
+ */
+ public boolean isTypeVariable();
+
+ /**
+ * Returns whether this wildcard type is an upper bound
+ * ("extends") as opposed to a lower bound ("super").
+ * Note that this property is only relevant for wildcards
+ * that have a bound.
+ *
+ * @return <code>true</code> if this wildcard type has a bound that is
+ * an upper bound, and <code>false</code> in all other cases
+ * @see #isWildcardType()
+ * @see #getBound()
+ * @since 3.1
+ */
+ public boolean isUpperbound();
+
+ /**
+ * Returns whether this type binding represents a wildcard type. A wildcard
+ * type occus only as an argument to a parameterized type reference.
+ * <p>
+ * For example, a AST type like
+ * <code>Collection<? extends Object></code> typically resolves to a
+ * parameterized type binding whose type argument is a wildcard type
+ * with upper type bound <code>java.util.Object</code>.
+ * </p>
+ *
+ * @return <code>true</code> if this object represents a wildcard type,
+ * and <code>false</code> otherwise
+ * @since 3.1
+ * @see #getBound()
+ * @see #isUpperbound()
+ */
+ public boolean isWildcardType();
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IVariableBinding.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IVariableBinding.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/core/dom/IVariableBinding.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.core.dom;
+
+/**
+ * A variable binding represents either a field of a class or interface, or
+ * a local variable declaration (including formal parameters, local variables,
+ * and exception variables).
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ *
+ * @see ITypeBinding#getDeclaredFields()
+ * @since 2.0
+ */
+public interface IVariableBinding extends IBinding {
+
+ /**
+ * Returns whether this binding is for a field.
+ * Note that this method returns <code>true</code> for constants,
+ * including enum constants. This method returns <code>false</code>
+ * for local variables.
+ *
+ * @return <code>true</code> if this is the binding for a field,
+ * and <code>false</code> otherwise
+ */
+ public boolean isField();
+
+ /**
+ * Returns whether this binding is for an enum constant.
+ * Note that this method returns <code>false</code> for local variables
+ * and for fields other than enum constants.
+ *
+ * @return <code>true</code> if this is the binding for an enum constant,
+ * and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public boolean isEnumConstant();
+
+ /**
+ * Returns the name of the field or local variable declared in this binding.
+ * The name is always a simple identifier.
+ *
+ * @return the name of this field or local variable
+ */
+ public String getName();
+
+ /**
+ * Returns the type binding representing the class or interface
+ * that declares this field.
+ * <p>
+ * The declaring class of a field is the class or interface of which it is
+ * a member. Local variables have no declaring class. The field length of an
+ * array type has no declaring class.
+ * </p>
+ *
+ * @return the binding of the class or interface that declares this field,
+ * or <code>null</code> if none
+ */
+ public ITypeBinding getDeclaringClass();
+
+ /**
+ * Returns the binding for the type of this field or local variable.
+ *
+ * @return the binding for the type of this field or local variable
+ */
+ public ITypeBinding getType();
+
+ /**
+ * Returns a small integer variable id for this variable binding.
+ * <p>
+ * <b>Local variables inside methods:</b> Local variables (and parameters)
+ * declared within a single method are assigned ascending ids in normal
+ * code reading order; var1.getVariableId()<var2.getVariableId() means that var1 is
+ * declared before var2.
+ * </p>
+ * <p>
+ * <b>Local variables outside methods:</b> Local variables declared in a
+ * type's static initializers (or initializer expressions of static fields)
+ * are assigned ascending ids in normal code reading order. Local variables
+ * declared in a type's instance initializers (or initializer expressions
+ * of non-static fields) are assigned ascending ids in normal code reading
+ * order. These ids are useful when checking definite assignment for
+ * static initializers (JLS 16.7) and instance initializers (JLS 16.8),
+ * respectively.
+ * </p>
+ * <p>
+ * <b>Fields:</b> Fields declared as members of a type are assigned
+ * ascending ids in normal code reading order;
+ * field1.getVariableId()<field2.getVariableId() means that field1 is declared before
+ * field2.
+ * </p>
+ *
+ * @return a small non-negative variable id
+ */
+ public int getVariableId();
+
+ /**
+ * Returns this binding's constant value if it has one.
+ * Some variables may have a value computed at compile-time. If the type of
+ * the value is a primitive type, the result is the boxed equivalent (i.e.,
+ * int returned as an <code>Integer</code>). If the type of the value is
+ * <code>String</code>, the result is the string itself. If the variable has
+ * no compile-time computed value, the result is <code>null</code>.
+ * (Note: compile-time constant expressions cannot denote <code>null</code>;
+ * JLS2 15.28.). The result is always <code>null</code> for enum constants.
+ *
+ * @return the constant value, or <code>null</code> if none
+ * @since 3.0
+ */
+ public Object getConstantValue();
+
+ /**
+ * Returns the method binding representing the method containing the scope
+ * in which this local variable is declared.
+ * <p>
+ * The declaring method of a method formal parameter is the method itself.
+ * For a local variable declared somewhere within the body of a method,
+ * the declaring method is the enclosing method. When local or anonymous
+ * classes are involved, the declaring method is the innermost such method.
+ * There is no declaring method for a field, or for a local variable
+ * declared in a static or instance initializer; this method returns
+ * <code>null</code> in those cases.
+ * </p>
+ *
+ * @return the binding of the method or constructor that declares this
+ * local variable, or <code>null</code> if none
+ * @since 3.1
+ */
+ public IMethodBinding getDeclaringMethod();
+
+ /**
+ * Returns the binding for the variable declaration corresponding to this
+ * variable binding. For a binding for a field declaration in an instance
+ * of a generic type, this method returns the binding for the corresponding
+ * field declaration in the generic type. For other variable bindings,
+ * including all ones for local variables and parameters, this method
+ * returns the same binding.
+ *
+ * @return the variable binding for the originating declaration
+ * @since 3.1
+ */
+ public IVariableBinding getVariableDeclaration();
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/ASTNode.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/ASTNode.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/ASTNode.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.internal.compiler.ast;
+
+public class ASTNode {
+
+ // storage for internal flags (32 bits) BIT USAGE
+ public final static int Bit1 = 0x1; // return type (operator) | name reference kind (name ref) | add assertion (type decl) | useful empty statement (empty statement)
+ public final static int Bit2 = 0x2; // return type (operator) | name reference kind (name ref) | has local type (type, method, field decl)
+ public final static int Bit3 = 0x4; // return type (operator) | name reference kind (name ref) | implicit this (this ref)
+ public final static int Bit4 = 0x8; // return type (operator) | first assignment to local (name ref,local decl) | undocumented empty block (block, type and method decl)
+ public final static int Bit5 = 0x10; // value for return (expression) | has all method bodies (unit) | supertype ref (type ref) | resolved (field decl)
+ public final static int Bit6 = 0x20; // depth (name ref, msg) | ignore need cast check (cast expression) | error in signature (method declaration/ initializer)
+ public final static int Bit7 = 0x40; // depth (name ref, msg) | operator (operator) | need runtime checkcast (cast expression) | label used (labelStatement) | needFreeReturn (AbstractMethodDeclaration)
+ public final static int Bit8 = 0x80; // depth (name ref, msg) | operator (operator) | unsafe cast (cast expression) | is default constructor (constructor declaration)
+ public final static int Bit9 = 0x100; // depth (name ref, msg) | operator (operator) | is local type (type decl)
+ public final static int Bit10= 0x200; // depth (name ref, msg) | operator (operator) | is anonymous type (type decl)
+ public final static int Bit11 = 0x400; // depth (name ref, msg) | operator (operator) | is member type (type decl)
+ public final static int Bit12 = 0x800; // depth (name ref, msg) | operator (operator) | has abstract methods (type decl)
+ public final static int Bit13 = 0x1000; // depth (name ref, msg) | is secondary type (type decl)
+ public final static int Bit14 = 0x2000; // strictly assigned (reference lhs) | discard enclosing instance (explicit constr call) | hasBeenGenerated (type decl)
+ public final static int Bit15 = 0x4000; // is unnecessary cast (expression) | is varargs (type ref) | isSubRoutineEscaping (try statement) | superAccess (javadoc allocation expression/javadoc message send/javadoc return statement)
+ public final static int Bit16 = 0x8000; // in javadoc comment (name ref, type ref, msg)
+ public final static int Bit17 = 0x10000; // compound assigned (reference lhs)
+ public final static int Bit18 = 0x20000; // non null (expression) | onDemand (import reference)
+ public final static int Bit19 = 0x40000; // didResolve (parameterized qualified type ref/parameterized single type ref) | empty (javadoc return statement)
+ public final static int Bit20 = 0x80000;
+ public final static int Bit21 = 0x100000;
+ public final static int Bit22 = 0x200000; // parenthesis count (expression) | used (import reference)
+ public final static int Bit23 = 0x400000; // parenthesis count (expression)
+ public final static int Bit24 = 0x800000; // parenthesis count (expression)
+ public final static int Bit25 = 0x1000000; // parenthesis count (expression)
+ public final static int Bit26 = 0x2000000; // parenthesis count (expression)
+ public final static int Bit27 = 0x4000000; // parenthesis count (expression)
+ public final static int Bit28 = 0x8000000; // parenthesis count (expression)
+ public final static int Bit29 = 0x10000000; // parenthesis count (expression)
+ public final static int Bit30 = 0x20000000; // elseif (if statement) | try block exit (try statement) | fall-through (case statement) | ignore no effect assign (expression ref) | needScope (for statement) | isAnySubRoutineEscaping (return statement) | blockExit (synchronized statement)
+ public final static int Bit31 = 0x40000000; // local declaration reachable (local decl) | ignore raw type check (type ref) | discard entire assignment (assignment) | isSynchronized (return statement) | thenExit (if statement)
+ public final static int Bit32 = 0x80000000; // reachable (statement)
+
+ public final static long Bit32L = 0x80000000L;
+ public final static long Bit33L = 0x100000000L;
+ public final static long Bit34L = 0x200000000L;
+ public final static long Bit35L = 0x400000000L;
+ public final static long Bit36L = 0x800000000L;
+ public final static long Bit37L = 0x1000000000L;
+ public final static long Bit38L = 0x2000000000L;
+ public final static long Bit39L = 0x4000000000L;
+ public final static long Bit40L = 0x8000000000L;
+ public final static long Bit41L = 0x10000000000L;
+ public final static long Bit42L = 0x20000000000L;
+ public final static long Bit43L = 0x40000000000L;
+ public final static long Bit44L = 0x80000000000L;
+ public final static long Bit45L = 0x100000000000L;
+ public final static long Bit46L = 0x200000000000L;
+ public final static long Bit47L = 0x400000000000L;
+ public final static long Bit48L = 0x800000000000L;
+ public final static long Bit49L = 0x1000000000000L;
+ public final static long Bit50L = 0x2000000000000L;
+ public final static long Bit51L = 0x4000000000000L;
+ public final static long Bit52L = 0x8000000000000L;
+ public final static long Bit53L = 0x10000000000000L;
+ public final static long Bit54L = 0x20000000000000L;
+ public final static long Bit55L = 0x40000000000000L;
+ public final static long Bit56L = 0x80000000000000L;
+ public final static long Bit57L = 0x100000000000000L;
+ public final static long Bit58L = 0x200000000000000L;
+ public final static long Bit59L = 0x400000000000000L;
+ public final static long Bit60L = 0x800000000000000L;
+ public final static long Bit61L = 0x1000000000000000L;
+ public final static long Bit62L = 0x2000000000000000L;
+ public final static long Bit63L = 0x4000000000000000L;
+ public final static long Bit64L = 0x8000000000000000L;
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/Literal.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/Literal.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/Literal.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.internal.compiler.ast;
+
+public abstract class Literal {
+ int sourceStart;
+ int sourceEnd;
+
+ public Literal(int s, int e) {
+ sourceStart = s;
+ sourceEnd = e;
+ }
+}
+
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/StringLiteral.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/StringLiteral.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/ast/StringLiteral.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.internal.compiler.ast;
+
+public class StringLiteral extends Literal {
+
+ char[] source;
+ int lineNumber;
+
+ public StringLiteral(char[] token, int start, int end, int lineNumber) {
+
+ this(start,end);
+ this.source = token;
+ this.lineNumber = lineNumber - 1; // line number is 1 based
+ }
+
+ public StringLiteral(int s, int e) {
+ super(s,e);
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ // handle some special char.....
+ output.append('\"');
+ for (int i = 0; i < source.length; i++) {
+ switch (source[i]) {
+ case '\b' :
+ output.append("\\b"); //$NON-NLS-1$
+ break;
+ case '\t' :
+ output.append("\\t"); //$NON-NLS-1$
+ break;
+ case '\n' :
+ output.append("\\n"); //$NON-NLS-1$
+ break;
+ case '\f' :
+ output.append("\\f"); //$NON-NLS-1$
+ break;
+ case '\r' :
+ output.append("\\r"); //$NON-NLS-1$
+ break;
+ case '\"' :
+ output.append("\\\""); //$NON-NLS-1$
+ break;
+ case '\'' :
+ output.append("\\'"); //$NON-NLS-1$
+ break;
+ case '\\' : //take care not to display the escape as a potential real char
+ output.append("\\\\"); //$NON-NLS-1$
+ break;
+ default :
+ output.append(source[i]);
+ }
+ }
+ output.append('\"');
+ return output;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/classfmt/ClassFileConstants.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/classfmt/ClassFileConstants.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/classfmt/ClassFileConstants.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.internal.compiler.classfmt;
+
+import copiedFromJDT.internal.compiler.ast.ASTNode;
+
+public interface ClassFileConstants {
+
+ int AccDefault = 0;
+ /*
+ * Modifiers
+ */
+ int AccPublic = 0x0001;
+ int AccPrivate = 0x0002;
+ int AccProtected = 0x0004;
+ int AccStatic = 0x0008;
+ int AccFinal = 0x0010;
+ int AccSynchronized = 0x0020;
+ int AccVolatile = 0x0040;
+ int AccBridge = 0x0040;
+ int AccTransient = 0x0080;
+ int AccVarargs = 0x0080;
+ int AccNative = 0x0100;
+ int AccInterface = 0x0200;
+ int AccAbstract = 0x0400;
+ int AccStrictfp = 0x0800;
+ int AccSynthetic = 0x1000;
+ int AccAnnotation = 0x2000;
+ int AccEnum = 0x4000;
+
+ /**
+ * Other VM flags.
+ */
+ int AccSuper = 0x0020;
+
+ /**
+ * Extra flags for types and members attributes.
+ */
+ int AccAnnotationDefault = ASTNode.Bit18; // indicate presence of an attribute "DefaultValue" (annotation method)
+ int AccDeprecated = ASTNode.Bit21; // indicate presence of an attribute "Deprecated"
+
+ int Utf8Tag = 1;
+ int IntegerTag = 3;
+ int FloatTag = 4;
+ int LongTag = 5;
+ int DoubleTag = 6;
+ int ClassTag = 7;
+ int StringTag = 8;
+ int FieldRefTag = 9;
+ int MethodRefTag = 10;
+ int InterfaceMethodRefTag = 11;
+ int NameAndTypeTag = 12;
+
+ int ConstantMethodRefFixedSize = 5;
+ int ConstantClassFixedSize = 3;
+ int ConstantDoubleFixedSize = 9;
+ int ConstantFieldRefFixedSize = 5;
+ int ConstantFloatFixedSize = 5;
+ int ConstantIntegerFixedSize = 5;
+ int ConstantInterfaceMethodRefFixedSize = 5;
+ int ConstantLongFixedSize = 9;
+ int ConstantStringFixedSize = 3;
+ int ConstantUtf8FixedSize = 3;
+ int ConstantNameAndTypeFixedSize = 5;
+
+ int MAJOR_VERSION_1_1 = 45;
+ int MAJOR_VERSION_1_2 = 46;
+ int MAJOR_VERSION_1_3 = 47;
+ int MAJOR_VERSION_1_4 = 48;
+ int MAJOR_VERSION_1_5 = 49;
+ int MAJOR_VERSION_1_6 = 50;
+ int MAJOR_VERSION_1_7 = 51;
+
+ int MINOR_VERSION_0 = 0;
+ int MINOR_VERSION_1 = 1;
+ int MINOR_VERSION_2 = 2;
+ int MINOR_VERSION_3 = 3;
+
+ // JDK 1.1 -> 1.7, comparable value allowing to check both major/minor version at once 1.4.1 > 1.4.0
+ // 16 unsigned bits for major, then 16 bits for minor
+ long JDK1_1 = ((long)ClassFileConstants.MAJOR_VERSION_1_1 << 16) + ClassFileConstants.MINOR_VERSION_3; // 1.1. is 45.3
+ long JDK1_2 = ((long)ClassFileConstants.MAJOR_VERSION_1_2 << 16) + ClassFileConstants.MINOR_VERSION_0;
+ long JDK1_3 = ((long)ClassFileConstants.MAJOR_VERSION_1_3 << 16) + ClassFileConstants.MINOR_VERSION_0;
+ long JDK1_4 = ((long)ClassFileConstants.MAJOR_VERSION_1_4 << 16) + ClassFileConstants.MINOR_VERSION_0;
+ long JDK1_5 = ((long)ClassFileConstants.MAJOR_VERSION_1_5 << 16) + ClassFileConstants.MINOR_VERSION_0;
+ long JDK1_6 = ((long)ClassFileConstants.MAJOR_VERSION_1_6 << 16) + ClassFileConstants.MINOR_VERSION_0;
+ long JDK1_7 = ((long)ClassFileConstants.MAJOR_VERSION_1_7 << 16) + ClassFileConstants.MINOR_VERSION_0;
+
+ // jdk level used to denote future releases: optional behavior is not enabled for now, but may become so. In order to enable these,
+ // search for references to this constant, and change it to one of the official JDT constants above.
+ long JDK_DEFERRED = Long.MAX_VALUE;
+
+ int INT_ARRAY = 10;
+ int BYTE_ARRAY = 8;
+ int BOOLEAN_ARRAY = 4;
+ int SHORT_ARRAY = 9;
+ int CHAR_ARRAY = 5;
+ int LONG_ARRAY = 11;
+ int FLOAT_ARRAY = 6;
+ int DOUBLE_ARRAY = 7;
+
+ // Debug attributes
+ int ATTR_SOURCE = 1; // SourceFileAttribute
+ int ATTR_LINES = 2; // LineNumberAttribute
+ int ATTR_VARS = 4; // LocalVariableTableAttribute
+ int ATTR_STACK_MAP = 8; // Stack map table attribute
+}
+
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/NLSLine.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/NLSLine.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/NLSLine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+package copiedFromJDT.internal.compiler.parser;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import copiedFromJDT.internal.compiler.ast.StringLiteral;
+
+
+public class NLSLine {
+
+ private List elements;
+
+ public NLSLine() {
+ this.elements = new ArrayList();
+ }
+
+ /**
+ * Adds a NLS element to this line.
+ */
+ public void add(StringLiteral element) {
+ this.elements.add(element);
+ }
+
+ /**
+ * returns an Iterator over NLSElements
+ */
+ public Iterator iterator() {
+ return this.elements.iterator();
+ }
+
+ public StringLiteral get(int index) {
+ return (StringLiteral) this.elements.get(index);
+ }
+
+ public void set(int index, StringLiteral literal) {
+ this.elements.set(index, literal);
+ }
+
+ public boolean exists(int index) {
+ return index >= 0 && index < this.elements.size();
+ }
+
+ public int size(){
+ return this.elements.size();
+ }
+
+ public String toString() {
+ StringBuffer result= new StringBuffer();
+ for (Iterator iter= iterator(); iter.hasNext(); ) {
+ result.append("\t"); //$NON-NLS-1$
+ result.append(iter.next().toString());
+ result.append("\n"); //$NON-NLS-1$
+ }
+ return result.toString();
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/Scanner.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/Scanner.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/Scanner.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.internal.compiler.parser;
+
+public class Scanner implements TerminalTokens {
+
+ public static final String END_OF_SOURCE = "End_Of_Source"; //$NON-NLS-1$
+
+ public static final String INVALID_HEXA = "Invalid_Hexa_Literal"; //$NON-NLS-1$
+ public static final String INVALID_OCTAL = "Invalid_Octal_Literal"; //$NON-NLS-1$
+ public static final String INVALID_CHARACTER_CONSTANT = "Invalid_Character_Constant"; //$NON-NLS-1$
+ public static final String INVALID_ESCAPE = "Invalid_Escape"; //$NON-NLS-1$
+ public static final String INVALID_INPUT = "Invalid_Input"; //$NON-NLS-1$
+ public static final String INVALID_UNICODE_ESCAPE = "Invalid_Unicode_Escape"; //$NON-NLS-1$
+ public static final String INVALID_FLOAT = "Invalid_Float_Literal"; //$NON-NLS-1$
+ public static final String INVALID_LOW_SURROGATE = "Invalid_Low_Surrogate"; //$NON-NLS-1$
+ public static final String INVALID_HIGH_SURROGATE = "Invalid_High_Surrogate"; //$NON-NLS-1$
+
+ public static final String NULL_SOURCE_STRING = "Null_Source_String"; //$NON-NLS-1$
+ public static final String UNTERMINATED_STRING = "Unterminated_String"; //$NON-NLS-1$
+ public static final String UNTERMINATED_COMMENT = "Unterminated_Comment"; //$NON-NLS-1$
+ public static final String INVALID_CHAR_IN_STRING = "Invalid_Char_In_String"; //$NON-NLS-1$
+ public static final String INVALID_DIGIT = "Invalid_Digit"; //$NON-NLS-1$
+
+ public static final int RoundBracket = 0;
+ public static final int SquareBracket = 1;
+ public static final int CurlyBracket = 2;
+ public static final int BracketKinds = 3;
+
+ // extended unicode support
+ public static final int LOW_SURROGATE_MIN_VALUE = 0xDC00;
+ public static final int HIGH_SURROGATE_MIN_VALUE = 0xD800;
+ public static final int HIGH_SURROGATE_MAX_VALUE = 0xDBFF;
+ public static final int LOW_SURROGATE_MAX_VALUE = 0xDFFF;
+}
+
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/ScannerHelper.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/ScannerHelper.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/ScannerHelper.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,366 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+package copiedFromJDT.internal.compiler.parser;
+
+import java.io.DataInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import copiedFromJDT.core.compiler.InvalidInputException;
+import copiedFromJDT.internal.compiler.ast.ASTNode;
+
+public class ScannerHelper {
+
+ public final static long[] Bits = {
+ ASTNode.Bit1, ASTNode.Bit2, ASTNode.Bit3, ASTNode.Bit4, ASTNode.Bit5, ASTNode.Bit6,
+ ASTNode.Bit7, ASTNode.Bit8, ASTNode.Bit9, ASTNode.Bit10, ASTNode.Bit11, ASTNode.Bit12,
+ ASTNode.Bit13, ASTNode.Bit14, ASTNode.Bit15, ASTNode.Bit16, ASTNode.Bit17, ASTNode.Bit18,
+ ASTNode.Bit19, ASTNode.Bit20, ASTNode.Bit21, ASTNode.Bit22, ASTNode.Bit23, ASTNode.Bit24,
+ ASTNode.Bit25, ASTNode.Bit26, ASTNode.Bit27, ASTNode.Bit28, ASTNode.Bit29, ASTNode.Bit30,
+ ASTNode.Bit31, ASTNode.Bit32, ASTNode.Bit33L, ASTNode.Bit34L, ASTNode.Bit35L, ASTNode.Bit36L,
+ ASTNode.Bit37L, ASTNode.Bit38L, ASTNode.Bit39L, ASTNode.Bit40L, ASTNode.Bit41L, ASTNode.Bit42L,
+ ASTNode.Bit43L, ASTNode.Bit44L, ASTNode.Bit45L, ASTNode.Bit46L, ASTNode.Bit47L, ASTNode.Bit48L,
+ ASTNode.Bit49L, ASTNode.Bit50L, ASTNode.Bit51L, ASTNode.Bit52L, ASTNode.Bit53L, ASTNode.Bit54L,
+ ASTNode.Bit55L, ASTNode.Bit56L, ASTNode.Bit57L, ASTNode.Bit58L, ASTNode.Bit59L, ASTNode.Bit60L,
+ ASTNode.Bit61L, ASTNode.Bit62L, ASTNode.Bit63L, ASTNode.Bit64L,
+ };
+
+ private static final int START_INDEX = 0;
+ private static final int PART_INDEX = 1;
+
+ private static long[][][] Tables;
+
+ public final static int MAX_OBVIOUS = 128;
+ public final static int[] OBVIOUS_IDENT_CHAR_NATURES = new int[MAX_OBVIOUS];
+
+ public final static int C_JLS_SPACE = ASTNode.Bit9;
+ public final static int C_SPECIAL = ASTNode.Bit8;
+ public final static int C_IDENT_START = ASTNode.Bit7;
+ public final static int C_UPPER_LETTER = ASTNode.Bit6;
+ public final static int C_LOWER_LETTER = ASTNode.Bit5;
+ public final static int C_IDENT_PART = ASTNode.Bit4;
+ public final static int C_DIGIT = ASTNode.Bit3;
+ public final static int C_SEPARATOR = ASTNode.Bit2;
+ public final static int C_SPACE = ASTNode.Bit1;
+
+ static {
+ OBVIOUS_IDENT_CHAR_NATURES[0] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[1] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[2] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[3] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[4] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[5] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[6] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[7] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[8] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[14] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[15] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[16] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[17] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[18] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[19] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[20] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[21] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[22] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[23] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[24] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[25] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[26] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[27] = C_IDENT_PART;
+ OBVIOUS_IDENT_CHAR_NATURES[127] = C_IDENT_PART;
+
+ for (int i = '0'; i <= '9'; i++)
+ OBVIOUS_IDENT_CHAR_NATURES[i] = C_DIGIT | C_IDENT_PART;
+
+ for (int i = 'a'; i <= 'z'; i++)
+ OBVIOUS_IDENT_CHAR_NATURES[i] = C_LOWER_LETTER | C_IDENT_PART | C_IDENT_START;
+ for (int i = 'A'; i <= 'Z'; i++)
+ OBVIOUS_IDENT_CHAR_NATURES[i] = C_UPPER_LETTER | C_IDENT_PART | C_IDENT_START;
+
+ OBVIOUS_IDENT_CHAR_NATURES['_'] = C_SPECIAL | C_IDENT_PART | C_IDENT_START;
+ OBVIOUS_IDENT_CHAR_NATURES['$'] = C_SPECIAL | C_IDENT_PART | C_IDENT_START;
+
+ OBVIOUS_IDENT_CHAR_NATURES[9] = C_SPACE | C_JLS_SPACE; // \ u0009: HORIZONTAL TABULATION
+ OBVIOUS_IDENT_CHAR_NATURES[10] = C_SPACE | C_JLS_SPACE; // \ u000a: LINE FEED
+ OBVIOUS_IDENT_CHAR_NATURES[11] = C_SPACE;
+ OBVIOUS_IDENT_CHAR_NATURES[12] = C_SPACE | C_JLS_SPACE; // \ u000c: FORM FEED
+ OBVIOUS_IDENT_CHAR_NATURES[13] = C_SPACE | C_JLS_SPACE; // \ u000d: CARRIAGE RETURN
+ OBVIOUS_IDENT_CHAR_NATURES[28] = C_SPACE;
+ OBVIOUS_IDENT_CHAR_NATURES[29] = C_SPACE;
+ OBVIOUS_IDENT_CHAR_NATURES[30] = C_SPACE;
+ OBVIOUS_IDENT_CHAR_NATURES[31] = C_SPACE;
+ OBVIOUS_IDENT_CHAR_NATURES[32] = C_SPACE | C_JLS_SPACE; // \ u0020: SPACE
+
+ OBVIOUS_IDENT_CHAR_NATURES['.'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES[':'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES[';'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES[','] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['['] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES[']'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['('] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES[')'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['{'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['}'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['+'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['-'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['*'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['/'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['='] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['&'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['|'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['?'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['<'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['>'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['!'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['%'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['^'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['~'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['"'] = C_SEPARATOR;
+ OBVIOUS_IDENT_CHAR_NATURES['\''] = C_SEPARATOR;
+ }
+
+ static {
+ Tables = new long[2][][];
+ Tables[START_INDEX] = new long[2][];
+ Tables[PART_INDEX] = new long[3][];
+ try {
+ DataInputStream inputStream = new DataInputStream(ScannerHelper.class.getResourceAsStream("start1.rsc")); //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ inputStream.close();
+ Tables[START_INDEX][0] = readValues;
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try {
+ DataInputStream inputStream = new DataInputStream(ScannerHelper.class.getResourceAsStream("start2.rsc")); //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ inputStream.close();
+ Tables[START_INDEX][1] = readValues;
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try {
+ DataInputStream inputStream = new DataInputStream(ScannerHelper.class.getResourceAsStream("part1.rsc")); //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ inputStream.close();
+ Tables[PART_INDEX][0] = readValues;
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try {
+ DataInputStream inputStream = new DataInputStream(ScannerHelper.class.getResourceAsStream("part2.rsc")); //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ inputStream.close();
+ Tables[PART_INDEX][1] = readValues;
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try {
+ DataInputStream inputStream = new DataInputStream(ScannerHelper.class.getResourceAsStream("part14.rsc")); //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ inputStream.close();
+ Tables[PART_INDEX][2] = readValues;
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private final static boolean isBitSet(long[] values, int i) {
+ try {
+ return (values[i / 64] & Bits[i % 64]) != 0;
+ } catch (NullPointerException e) {
+ return false;
+ }
+ }
+ public static boolean isJavaIdentifierPart(char c) {
+ if (c < MAX_OBVIOUS) {
+ return (ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_IDENT_PART) != 0;
+ }
+ return Character.isJavaIdentifierPart(c);
+ }
+ public static boolean isJavaIdentifierPart(char high, char low) {
+ int codePoint = toCodePoint(high, low);
+ switch((codePoint & 0x1F0000) >> 16) {
+ case 0 :
+ return Character.isJavaIdentifierPart((char) codePoint);
+ case 1 :
+ return isBitSet(Tables[PART_INDEX][0], codePoint & 0xFFFF);
+ case 2 :
+ return isBitSet(Tables[PART_INDEX][1], codePoint & 0xFFFF);
+ case 14 :
+ return isBitSet(Tables[PART_INDEX][2], codePoint & 0xFFFF);
+ }
+ return false;
+ }
+ public static boolean isJavaIdentifierStart(char c) {
+ if (c < MAX_OBVIOUS) {
+ return (ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_IDENT_START) != 0;
+ }
+ return Character.isJavaIdentifierStart(c);
+ }
+ public static boolean isJavaIdentifierStart(char high, char low) {
+ int codePoint = toCodePoint(high, low);
+ switch((codePoint & 0x1F0000) >> 16) {
+ case 0 :
+ return Character.isJavaIdentifierStart((char) codePoint);
+ case 1 :
+ return isBitSet(Tables[START_INDEX][0], codePoint & 0xFFFF);
+ case 2 :
+ return isBitSet(Tables[START_INDEX][1], codePoint & 0xFFFF);
+ }
+ return false;
+ }
+
+ private static int toCodePoint(char high, char low) {
+ return (high - Scanner.HIGH_SURROGATE_MIN_VALUE) * 0x400 + (low - Scanner.LOW_SURROGATE_MIN_VALUE) + 0x10000;
+ }
+ public static boolean isDigit(char c) throws InvalidInputException {
+ if(c < ScannerHelper.MAX_OBVIOUS) {
+ return (ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_DIGIT) != 0;
+ }
+ if (Character.isDigit(c)) {
+ throw new InvalidInputException(Scanner.INVALID_DIGIT);
+ }
+ return false;
+ }
+ public static int digit(char c, int radix) {
+ if (c < ScannerHelper.MAX_OBVIOUS) {
+ switch(radix) {
+ case 8 :
+ if (c >= 48 && c <= 55) {
+ return c - 48;
+ }
+ return -1;
+ case 10 :
+ if (c >= 48 && c <= 57) {
+ return c - 48;
+ }
+ return -1;
+ case 16 :
+ if (c >= 48 && c <= 57) {
+ return c - 48;
+ }
+ if (c >= 65 && c <= 70) {
+ return c - 65 + 10;
+ }
+ if (c >= 97 && c <= 102) {
+ return c - 97 + 10;
+ }
+ return -1;
+ }
+ }
+ return Character.digit(c, radix);
+ }
+ public static int getNumericValue(char c) {
+ if (c < ScannerHelper.MAX_OBVIOUS) {
+ switch(ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c]) {
+ case C_DIGIT :
+ return c - '0';
+ case C_LOWER_LETTER :
+ return 10 + c - 'a';
+ case C_UPPER_LETTER :
+ return 10 + c - 'A';
+ }
+ }
+ return Character.getNumericValue(c);
+ }
+ public static char toUpperCase(char c) {
+ if (c < MAX_OBVIOUS) {
+ if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_UPPER_LETTER) != 0) {
+ return c;
+ } else if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_LOWER_LETTER) != 0) {
+ return (char) (c - 32);
+ }
+ }
+ return Character.toLowerCase(c);
+ }
+ public static char toLowerCase(char c) {
+ if (c < MAX_OBVIOUS) {
+ if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_LOWER_LETTER) != 0) {
+ return c;
+ } else if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_UPPER_LETTER) != 0) {
+ return (char) (32 + c);
+ }
+ }
+ return Character.toLowerCase(c);
+ }
+ public static boolean isLowerCase(char c) {
+ if (c < MAX_OBVIOUS) {
+ return (ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_LOWER_LETTER) != 0;
+ }
+ return Character.isLowerCase(c);
+ }
+ public static boolean isUpperCase(char c) {
+ if (c < MAX_OBVIOUS) {
+ return (ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_UPPER_LETTER) != 0;
+ }
+ return Character.isUpperCase(c);
+ }
+ /**
+ * Include also non JLS whitespaces.
+ *
+ * return true if Character.isWhitespace(c) would return true
+ */
+ public static boolean isWhitespace(char c) {
+ if (c < MAX_OBVIOUS) {
+ return (ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_SPACE) != 0;
+ }
+ return Character.isWhitespace(c);
+ }
+ public static boolean isLetter(char c) {
+ if (c < MAX_OBVIOUS) {
+ return (ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_LOWER_LETTER)) != 0;
+ }
+ return Character.isLetter(c);
+ }
+ public static boolean isLetterOrDigit(char c) {
+ if (c < MAX_OBVIOUS) {
+ return (ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_LOWER_LETTER | ScannerHelper.C_DIGIT)) != 0;
+ }
+ return Character.isLetterOrDigit(c);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/TerminalTokens.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/TerminalTokens.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/compiler/parser/TerminalTokens.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+package copiedFromJDT.internal.compiler.parser;
+
+/**
+ * IMPORTANT NOTE: These constants are dedicated to the internal Scanner implementation.
+ * It is mirrored in org.eclipse.jdt.core.compiler public package where it is API.
+ * The mirror implementation is using the backward compatible ITerminalSymbols constant
+ * definitions (stable with 2.0), whereas the internal implementation uses TerminalTokens
+ * which constant values reflect the latest parser generation state.
+ */
+/**
+ * Maps each terminal symbol in the java-grammar into a unique integer.
+ * This integer is used to represent the terminal when computing a parsing action.
+ *
+ * Disclaimer : These constant values are generated automatically using a Java
+ * grammar, therefore their actual values are subject to change if new keywords
+ * were added to the language (for instance, 'assert' is a keyword in 1.4).
+ */
+public interface TerminalTokens {
+
+ // special tokens not part of grammar - not autogenerated
+ int TokenNameWHITESPACE = 1000,
+ TokenNameCOMMENT_LINE = 1001,
+ TokenNameCOMMENT_BLOCK = 1002,
+ TokenNameCOMMENT_JAVADOC = 1003;
+
+ int TokenNameIdentifier = 26,
+ TokenNameabstract = 56,
+ TokenNameassert = 74,
+ TokenNameboolean = 32,
+ TokenNamebreak = 75,
+ TokenNamebyte = 33,
+ TokenNamecase = 101,
+ TokenNamecatch = 102,
+ TokenNamechar = 34,
+ TokenNameclass = 72,
+ TokenNamecontinue = 76,
+ TokenNameconst = 108,
+ TokenNamedefault = 97,
+ TokenNamedo = 77,
+ TokenNamedouble = 35,
+ TokenNameelse = 103,
+ TokenNameenum = 98,
+ TokenNameextends = 99,
+ TokenNamefalse = 44,
+ TokenNamefinal = 57,
+ TokenNamefinally = 104,
+ TokenNamefloat = 36,
+ TokenNamefor = 78,
+ TokenNamegoto = 109,
+ TokenNameif = 79,
+ TokenNameimplements = 106,
+ TokenNameimport = 100,
+ TokenNameinstanceof = 15,
+ TokenNameint = 37,
+ TokenNameinterface = 95,
+ TokenNamelong = 38,
+ TokenNamenative = 58,
+ TokenNamenew = 43,
+ TokenNamenull = 45,
+ TokenNamepackage = 96,
+ TokenNameprivate = 59,
+ TokenNameprotected = 60,
+ TokenNamepublic = 61,
+ TokenNamereturn = 80,
+ TokenNameshort = 39,
+ TokenNamestatic = 54,
+ TokenNamestrictfp = 62,
+ TokenNamesuper = 41,
+ TokenNameswitch = 81,
+ TokenNamesynchronized = 55,
+ TokenNamethis = 42,
+ TokenNamethrow = 82,
+ TokenNamethrows = 105,
+ TokenNametransient = 63,
+ TokenNametrue = 46,
+ TokenNametry = 83,
+ TokenNamevoid = 40,
+ TokenNamevolatile = 64,
+ TokenNamewhile = 73,
+ TokenNameIntegerLiteral = 47,
+ TokenNameLongLiteral = 48,
+ TokenNameFloatingPointLiteral = 49,
+ TokenNameDoubleLiteral = 50,
+ TokenNameCharacterLiteral = 51,
+ TokenNameStringLiteral = 52,
+ TokenNamePLUS_PLUS = 9,
+ TokenNameMINUS_MINUS = 10,
+ TokenNameEQUAL_EQUAL = 18,
+ TokenNameLESS_EQUAL = 16,
+ TokenNameGREATER_EQUAL = 17,
+ TokenNameNOT_EQUAL = 19,
+ TokenNameLEFT_SHIFT = 13,
+ TokenNameRIGHT_SHIFT = 8,
+ TokenNameUNSIGNED_RIGHT_SHIFT = 11,
+ TokenNamePLUS_EQUAL = 84,
+ TokenNameMINUS_EQUAL = 85,
+ TokenNameMULTIPLY_EQUAL = 86,
+ TokenNameDIVIDE_EQUAL = 87,
+ TokenNameAND_EQUAL = 88,
+ TokenNameOR_EQUAL = 89,
+ TokenNameXOR_EQUAL = 90,
+ TokenNameREMAINDER_EQUAL = 91,
+ TokenNameLEFT_SHIFT_EQUAL = 92,
+ TokenNameRIGHT_SHIFT_EQUAL = 93,
+ TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 94,
+ TokenNameOR_OR = 25,
+ TokenNameAND_AND = 24,
+ TokenNamePLUS = 1,
+ TokenNameMINUS = 2,
+ TokenNameNOT = 66,
+ TokenNameREMAINDER = 5,
+ TokenNameXOR = 21,
+ TokenNameAND = 20,
+ TokenNameMULTIPLY = 4,
+ TokenNameOR = 22,
+ TokenNameTWIDDLE = 67,
+ TokenNameDIVIDE = 6,
+ TokenNameGREATER = 12,
+ TokenNameLESS = 7,
+ TokenNameLPAREN = 28,
+ TokenNameRPAREN = 29,
+ TokenNameLBRACE = 69,
+ TokenNameRBRACE = 31,
+ TokenNameLBRACKET = 14,
+ TokenNameRBRACKET = 70,
+ TokenNameSEMICOLON = 27,
+ TokenNameQUESTION = 23,
+ TokenNameCOLON = 65,
+ TokenNameCOMMA = 30,
+ TokenNameDOT = 3,
+ TokenNameEQUAL = 71,
+ TokenNameAT = 53,
+ TokenNameELLIPSIS = 107,
+ TokenNameEOF = 68,
+ TokenNameERROR = 110;
+}
+
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core/util/MementoTokenizer.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core/util/MementoTokenizer.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core/util/MementoTokenizer.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.internal.core.util;
+
+public class MementoTokenizer {
+
+ public static final char C_ESCAPE = '\\';
+ public static final char C_JAVAPROJECT = '=';
+ public static final char C_PACKAGEFRAGMENTROOT = '/';
+ public static final char C_PACKAGEFRAGMENT = '<';
+ public static final char C_FIELD = '^';
+ public static final char C_METHOD = '~';
+ public static final char C_INITIALIZER = '|';
+ public static final char C_COMPILATIONUNIT = '{';
+ public static final char C_CLASSFILE = '(';
+ public static final char C_TYPE = '[';
+ public static final char C_PACKAGEDECLARATION = '%';
+ public static final char C_IMPORTDECLARATION = '#';
+ public static final char C_COUNT = '!';
+ public static final char C_LOCALVARIABLE = '@';
+ public static final char C_TYPE_PARAMETER = ']';
+
+ private static final String COUNT = Character.toString(C_COUNT);
+ private static final String JAVAPROJECT = Character.toString( C_JAVAPROJECT);
+ private static final String PACKAGEFRAGMENTROOT = Character.toString( C_PACKAGEFRAGMENTROOT);
+ private static final String PACKAGEFRAGMENT = Character.toString( C_PACKAGEFRAGMENT);
+ private static final String FIELD = Character.toString( C_FIELD);
+ private static final String METHOD = Character.toString( C_METHOD);
+ private static final String INITIALIZER = Character.toString( C_INITIALIZER);
+ private static final String COMPILATIONUNIT = Character.toString( C_COMPILATIONUNIT);
+ private static final String CLASSFILE = Character.toString( C_CLASSFILE);
+ private static final String TYPE = Character.toString( C_TYPE);
+ private static final String PACKAGEDECLARATION = Character.toString( C_PACKAGEDECLARATION);
+ private static final String IMPORTDECLARATION = Character.toString( C_IMPORTDECLARATION);
+ private static final String LOCALVARIABLE = Character.toString( C_LOCALVARIABLE);
+ private static final String TYPE_PARAMETER = Character.toString( C_TYPE_PARAMETER);
+
+ private final char[] memento;
+ private final int length;
+ private int index = 0;
+
+ public MementoTokenizer(String memento) {
+ this.memento = memento.toCharArray();
+ this.length = this.memento.length;
+ }
+
+ public boolean hasMoreTokens() {
+ return this.index < this.length;
+ }
+
+ public String nextToken() {
+ int start = this.index;
+ StringBuffer buffer = null;
+ switch (this.memento[this.index++]) {
+ case C_ESCAPE:
+ buffer = new StringBuffer();
+ buffer.append(this.memento[this.index]);
+ start = ++this.index;
+ break;
+ case C_COUNT:
+ return COUNT;
+ case C_JAVAPROJECT:
+ return JAVAPROJECT;
+ case C_PACKAGEFRAGMENTROOT:
+ return PACKAGEFRAGMENTROOT;
+ case C_PACKAGEFRAGMENT:
+ return PACKAGEFRAGMENT;
+ case C_FIELD:
+ return FIELD;
+ case C_METHOD:
+ return METHOD;
+ case C_INITIALIZER:
+ return INITIALIZER;
+ case C_COMPILATIONUNIT:
+ return COMPILATIONUNIT;
+ case C_CLASSFILE:
+ return CLASSFILE;
+ case C_TYPE:
+ return TYPE;
+ case C_PACKAGEDECLARATION:
+ return PACKAGEDECLARATION;
+ case C_IMPORTDECLARATION:
+ return IMPORTDECLARATION;
+ case C_LOCALVARIABLE:
+ return LOCALVARIABLE;
+ case C_TYPE_PARAMETER:
+ return TYPE_PARAMETER;
+ }
+ loop: while (this.index < this.length) {
+ switch (this.memento[this.index]) {
+ case C_ESCAPE:
+ if (buffer == null) buffer = new StringBuffer();
+ buffer.append(this.memento, start, this.index - start);
+ start = ++this.index;
+ break;
+ case C_COUNT:
+ case C_JAVAPROJECT:
+ case C_PACKAGEFRAGMENTROOT:
+ case C_PACKAGEFRAGMENT:
+ case C_FIELD:
+ case C_METHOD:
+ case C_INITIALIZER:
+ case C_COMPILATIONUNIT:
+ case C_CLASSFILE:
+ case C_TYPE:
+ case C_PACKAGEDECLARATION:
+ case C_IMPORTDECLARATION:
+ case C_LOCALVARIABLE:
+ case C_TYPE_PARAMETER:
+ break loop;
+ }
+ this.index++;
+ }
+ if (buffer != null) {
+ buffer.append(this.memento, start, this.index - start);
+ return buffer.toString();
+ } else {
+ return new String(this.memento, start, this.index - start);
+ }
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core/util/PublicScanner.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core/util/PublicScanner.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/core/util/PublicScanner.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3804 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+package copiedFromJDT.internal.core.util;
+
+import java.util.Iterator;
+
+import copiedFromJDT.core.compiler.CharOperation;
+import copiedFromJDT.core.compiler.IScanner;
+import copiedFromJDT.core.compiler.InvalidInputException;
+import copiedFromJDT.internal.compiler.ast.StringLiteral;
+import copiedFromJDT.internal.compiler.classfmt.ClassFileConstants;
+import copiedFromJDT.internal.compiler.parser.NLSLine;
+import copiedFromJDT.internal.compiler.parser.Scanner;
+import copiedFromJDT.internal.compiler.parser.ScannerHelper;
+
+public class PublicScanner implements IScanner {
+
+ final private static int TokenNameWHITESPACE = 1000;
+ final private static int TokenNameCOMMENT_LINE = 1001;
+ final private static int TokenNameCOMMENT_BLOCK = 1002;
+ final private static int TokenNameCOMMENT_JAVADOC = 1003;
+
+ final private static int TokenNameIdentifier = 5;
+ final private static int TokenNameabstract = 98;
+
+ /**
+ * "assert" token (added in J2SE 1.4).
+ */
+ final private static int TokenNameassert = 118;
+ final private static int TokenNameboolean = 18;
+ final private static int TokenNamebreak = 119;
+ final private static int TokenNamebyte = 19;
+ final private static int TokenNamecase = 211;
+ final private static int TokenNamecatch = 225;
+ final private static int TokenNamechar = 20;
+ final private static int TokenNameclass = 165;
+ final private static int TokenNamecontinue = 120;
+ final private static int TokenNamedefault = 212;
+ final private static int TokenNamedo = 121;
+ final private static int TokenNamedouble = 21;
+ final private static int TokenNameelse = 213;
+ final private static int TokenNameextends = 243;
+ final private static int TokenNamefalse = 37;
+ final private static int TokenNamefinal = 99;
+ final private static int TokenNamefinally = 226;
+ final private static int TokenNamefloat = 22;
+ final private static int TokenNamefor = 122;
+ final private static int TokenNameif = 123;
+ final private static int TokenNameimplements = 268;
+ final private static int TokenNameinclude = 191;
+ final private static int TokenNameinstanceof = 65;
+ final private static int TokenNameint = 23;
+ final private static int TokenNameinterface = 180;
+ final private static int TokenNamelong = 24;
+ final private static int TokenNamenative = 100;
+ final private static int TokenNamenew = 32;
+ final private static int TokenNamenull = 38;
+ final private static int TokenNamepackage = 214;
+ final private static int TokenNameprivate = 101;
+ final private static int TokenNameprotected = 102;
+ final private static int TokenNamepublic = 103;
+ final private static int TokenNamereturn = 124;
+ final private static int TokenNameshort = 25;
+ final private static int TokenNamestatic = 94;
+ final private static int TokenNamestrictfp = 104;
+ final private static int TokenNamesuper = 33;
+ final private static int TokenNameswitch = 125;
+ final private static int TokenNamesynchronized = 85;
+ final private static int TokenNamethis = 34;
+ final private static int TokenNamethrow = 126;
+ final private static int TokenNamethrows = 227;
+ final private static int TokenNametransient = 105;
+ final private static int TokenNametrue = 39;
+ final private static int TokenNametry = 127;
+ final private static int TokenNamevoid = 26;
+ final private static int TokenNamevolatile = 106;
+ final private static int TokenNamewhile = 117;
+ final private static int TokenNameIntegerLiteral = 40;
+ final private static int TokenNameLongLiteral = 41;
+ final private static int TokenNameFloatingPointLiteral = 42;
+ final private static int TokenNameDoubleLiteral = 43;
+ final private static int TokenNameCharacterLiteral = 44;
+ final private static int TokenNameStringLiteral = 45;
+ final private static int TokenNamePLUS_PLUS = 1;
+ final private static int TokenNameMINUS_MINUS = 2;
+ final private static int TokenNameEQUAL_EQUAL = 35;
+ final private static int TokenNameLESS_EQUAL = 66;
+ final private static int TokenNameGREATER_EQUAL = 67;
+ final private static int TokenNameNOT_EQUAL = 36;
+ final private static int TokenNameLEFT_SHIFT = 14;
+ final private static int TokenNameRIGHT_SHIFT = 11;
+ final private static int TokenNameUNSIGNED_RIGHT_SHIFT = 12;
+ final private static int TokenNamePLUS_EQUAL = 168;
+ final private static int TokenNameMINUS_EQUAL = 169;
+ final private static int TokenNameMULTIPLY_EQUAL = 170;
+ final private static int TokenNameDIVIDE_EQUAL = 171;
+ final private static int TokenNameAND_EQUAL = 172;
+ final private static int TokenNameOR_EQUAL = 173;
+ final private static int TokenNameXOR_EQUAL = 174;
+ final private static int TokenNameREMAINDER_EQUAL = 175;
+ final private static int TokenNameLEFT_SHIFT_EQUAL = 176;
+ final private static int TokenNameRIGHT_SHIFT_EQUAL = 177;
+ final private static int TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 178;
+ final private static int TokenNameOR_OR = 80;
+ final private static int TokenNameAND_AND = 79;
+ final private static int TokenNamePLUS = 3;
+ final private static int TokenNameMINUS = 4;
+ final private static int TokenNameNOT = 71;
+ final private static int TokenNameREMAINDER = 9;
+ final private static int TokenNameXOR = 63;
+ final private static int TokenNameAND = 62;
+ final private static int TokenNameMULTIPLY = 8;
+ final private static int TokenNameOR = 70;
+ final private static int TokenNameTWIDDLE = 72;
+ final private static int TokenNameDIVIDE = 10;
+ final private static int TokenNameGREATER = 68;
+ final private static int TokenNameLESS = 69;
+ final private static int TokenNameLPAREN = 7;
+ final private static int TokenNameRPAREN = 86;
+ final private static int TokenNameLBRACE = 110;
+ final private static int TokenNameRBRACE = 95;
+ final private static int TokenNameLBRACKET = 15;
+ final private static int TokenNameRBRACKET = 166;
+ final private static int TokenNameSEMICOLON = 64;
+ final private static int TokenNameQUESTION = 81;
+ final private static int TokenNameCOLON = 154;
+ final private static int TokenNameCOMMA = 90;
+ final private static int TokenNameDOT = 6;
+ final private static int TokenNameEQUAL = 167;
+ final private static int TokenNameEOF = 158;
+ final private static int TokenNameERROR = 309;
+
+ /**
+ * "enum" keyword (added in J2SE 1.5).
+ *
+ * @since 3.0
+ */
+ final private static int TokenNameenum = 400;
+
+ /**
+ * "@" token (added in J2SE 1.5).
+ *
+ * @since 3.0
+ */
+ final private static int TokenNameAT = 401;
+
+ /**
+ * "..." token (added in J2SE 1.5).
+ *
+ * @since 3.0
+ */
+ final private static int TokenNameELLIPSIS = 402;
+
+ /**
+ * @since 3.1
+ */
+ final private static int TokenNameconst = 403;
+
+ /**
+ * @since 3.1
+ */
+ final private static int TokenNamegoto = 404;
+
+ // public int newIdentCount = 0;
+
+ /*
+ * APIs ares - getNextToken() which return the current type of the token
+ * (this value is not memorized by the scanner) - getCurrentTokenSource()
+ * which provides with the token "REAL" source (aka all unicode have been
+ * transformed into a correct char) - sourceStart gives the position into
+ * the stream - currentPosition-1 gives the sourceEnd position into the
+ * stream
+ */
+ protected long sourceLevel;
+ protected long complianceLevel;
+
+ // 1.4 feature
+ public boolean useAssertAsAnIndentifier = false;
+ // flag indicating if processed source contains occurrences of keyword
+ // assert
+ public boolean containsAssertKeyword = false;
+
+ // 1.5 feature
+ public boolean useEnumAsAnIndentifier = false;
+
+ public boolean recordLineSeparator = false;
+ public char currentCharacter;
+ public int startPosition;
+ public int currentPosition;
+ public int initialPosition, eofPosition;
+ // after this position eof are generated instead of real token from the
+ // source
+
+ public boolean tokenizeComments = false;
+ public boolean tokenizeWhiteSpace = false;
+
+ // source should be viewed as a window (aka a part)
+ // of a entire very large stream
+ public char source[];
+
+ // unicode support
+ public char[] withoutUnicodeBuffer;
+ public int withoutUnicodePtr; // when == 0 ==> no unicode in the current
+ // token
+ public boolean unicodeAsBackSlash = false;
+
+ public boolean scanningFloatLiteral = false;
+
+ // support for /** comments
+ public static int COMMENT_ARRAYS_SIZE = 30;
+ public int[] commentStops = new int[COMMENT_ARRAYS_SIZE];
+ public int[] commentStarts = new int[COMMENT_ARRAYS_SIZE];
+ public int[] commentTagStarts = new int[COMMENT_ARRAYS_SIZE];
+ public int commentPtr = -1; // no comment test with commentPtr value -1
+ protected int lastCommentLinePosition = -1;
+
+ // task tag support
+ public char[][] foundTaskTags = null;
+ public char[][] foundTaskMessages;
+ public char[][] foundTaskPriorities = null;
+ public int[][] foundTaskPositions;
+ public int foundTaskCount = 0;
+ public char[][] taskTags = null;
+ public char[][] taskPriorities = null;
+ public boolean isTaskCaseSensitive = true;
+
+ // diet parsing support - jump over some method body when requested
+ public boolean diet = false;
+
+ // support for the poor-line-debuggers ....
+ // remember the position of the cr/lf
+ public int[] lineEnds = new int[250];
+ public int linePtr = -1;
+ public boolean wasAcr = false;
+
+ public static final String END_OF_SOURCE = "End_Of_Source"; //$NON-NLS-1$
+
+ public static final String INVALID_HEXA = "Invalid_Hexa_Literal"; //$NON-NLS-1$
+ public static final String INVALID_OCTAL = "Invalid_Octal_Literal"; //$NON-NLS-1$
+ public static final String INVALID_CHARACTER_CONSTANT = "Invalid_Character_Constant"; //$NON-NLS-1$
+ public static final String INVALID_ESCAPE = "Invalid_Escape"; //$NON-NLS-1$
+ public static final String INVALID_INPUT = "Invalid_Input"; //$NON-NLS-1$
+ public static final String INVALID_UNICODE_ESCAPE = "Invalid_Unicode_Escape"; //$NON-NLS-1$
+ public static final String INVALID_FLOAT = "Invalid_Float_Literal"; //$NON-NLS-1$
+ public static final String INVALID_LOW_SURROGATE = "Invalid_Low_Surrogate"; //$NON-NLS-1$
+ public static final String INVALID_HIGH_SURROGATE = "Invalid_High_Surrogate"; //$NON-NLS-1$
+
+ public static final String NULL_SOURCE_STRING = "Null_Source_String"; //$NON-NLS-1$
+ public static final String UNTERMINATED_STRING = "Unterminated_String"; //$NON-NLS-1$
+ public static final String UNTERMINATED_COMMENT = "Unterminated_Comment"; //$NON-NLS-1$
+ public static final String INVALID_CHAR_IN_STRING = "Invalid_Char_In_String"; //$NON-NLS-1$
+ public static final String INVALID_DIGIT = "Invalid_Digit"; //$NON-NLS-1$
+ private static final int[] EMPTY_LINE_ENDS = new int[0];
+
+ // ----------------optimized identifier managment------------------
+ static final char[] charArray_a = new char[] { 'a' },
+ charArray_b = new char[] { 'b' }, charArray_c = new char[] { 'c' },
+ charArray_d = new char[] { 'd' }, charArray_e = new char[] { 'e' },
+ charArray_f = new char[] { 'f' }, charArray_g = new char[] { 'g' },
+ charArray_h = new char[] { 'h' }, charArray_i = new char[] { 'i' },
+ charArray_j = new char[] { 'j' }, charArray_k = new char[] { 'k' },
+ charArray_l = new char[] { 'l' }, charArray_m = new char[] { 'm' },
+ charArray_n = new char[] { 'n' }, charArray_o = new char[] { 'o' },
+ charArray_p = new char[] { 'p' }, charArray_q = new char[] { 'q' },
+ charArray_r = new char[] { 'r' }, charArray_s = new char[] { 's' },
+ charArray_t = new char[] { 't' }, charArray_u = new char[] { 'u' },
+ charArray_v = new char[] { 'v' }, charArray_w = new char[] { 'w' },
+ charArray_x = new char[] { 'x' }, charArray_y = new char[] { 'y' },
+ charArray_z = new char[] { 'z' };
+
+ static final char[] initCharArray = new char[] { '\u0000', '\u0000',
+ '\u0000', '\u0000', '\u0000', '\u0000' };
+ static final int TableSize = 30, InternalTableSize = 6; // 30*6 =210 entries
+
+ public final static int MAX_OBVIOUS = 128;
+ static final int[] ObviousIdentCharNatures = new int[MAX_OBVIOUS];
+ public final static int C_LETTER = 4;
+ public final static int C_DIGIT = 3;
+ public final static int C_SEPARATOR = 2;
+ public final static int C_SPACE = 1;
+ static {
+ for (int i = '0'; i <= '9'; i++)
+ ObviousIdentCharNatures[i] = C_DIGIT;
+
+ for (int i = 'a'; i <= 'z'; i++)
+ ObviousIdentCharNatures[i] = C_LETTER;
+ for (int i = 'A'; i <= 'Z'; i++)
+ ObviousIdentCharNatures[i] = C_LETTER;
+ ObviousIdentCharNatures['_'] = C_LETTER;
+ ObviousIdentCharNatures['$'] = C_LETTER;
+
+ ObviousIdentCharNatures[10] = C_SPACE; // \ u000a: LINE FEED
+ ObviousIdentCharNatures[12] = C_SPACE; // \ u000c: FORM FEED
+ ObviousIdentCharNatures[13] = C_SPACE; // \ u000d: CARRIAGE RETURN
+ ObviousIdentCharNatures[32] = C_SPACE; // \ u0020: SPACE
+ ObviousIdentCharNatures[9] = C_SPACE; // \ u0009: HORIZONTAL
+ // TABULATION
+
+ ObviousIdentCharNatures['.'] = C_SEPARATOR;
+ ObviousIdentCharNatures[':'] = C_SEPARATOR;
+ ObviousIdentCharNatures[';'] = C_SEPARATOR;
+ ObviousIdentCharNatures[','] = C_SEPARATOR;
+ ObviousIdentCharNatures['['] = C_SEPARATOR;
+ ObviousIdentCharNatures[']'] = C_SEPARATOR;
+ ObviousIdentCharNatures['('] = C_SEPARATOR;
+ ObviousIdentCharNatures[')'] = C_SEPARATOR;
+ ObviousIdentCharNatures['{'] = C_SEPARATOR;
+ ObviousIdentCharNatures['}'] = C_SEPARATOR;
+ ObviousIdentCharNatures['+'] = C_SEPARATOR;
+ ObviousIdentCharNatures['-'] = C_SEPARATOR;
+ ObviousIdentCharNatures['*'] = C_SEPARATOR;
+ ObviousIdentCharNatures['/'] = C_SEPARATOR;
+ ObviousIdentCharNatures['='] = C_SEPARATOR;
+ ObviousIdentCharNatures['&'] = C_SEPARATOR;
+ ObviousIdentCharNatures['|'] = C_SEPARATOR;
+ ObviousIdentCharNatures['?'] = C_SEPARATOR;
+ ObviousIdentCharNatures['<'] = C_SEPARATOR;
+ ObviousIdentCharNatures['>'] = C_SEPARATOR;
+ ObviousIdentCharNatures['!'] = C_SEPARATOR;
+ ObviousIdentCharNatures['%'] = C_SEPARATOR;
+ ObviousIdentCharNatures['^'] = C_SEPARATOR;
+ ObviousIdentCharNatures['~'] = C_SEPARATOR;
+ ObviousIdentCharNatures['"'] = C_SEPARATOR;
+ ObviousIdentCharNatures['\''] = C_SEPARATOR;
+ }
+
+ public static final int OptimizedLength = 7;
+ public/* static */final char[][][][] charArray_length = new char[OptimizedLength][TableSize][InternalTableSize][];
+ // support for detecting non-externalized string literals
+ public NLSLine currentLine = null;
+ public static final String TAG_PREFIX = "//$NON-NLS-"; //$NON-NLS-1$
+ public static final int TAG_PREFIX_LENGTH = TAG_PREFIX.length();
+ public static final String TAG_POSTFIX = "$"; //$NON-NLS-1$
+ public static final int TAG_POSTFIX_LENGTH = TAG_POSTFIX.length();
+ public StringLiteral[] nonNLSStrings = null;
+ public boolean checkNonExternalizedStringLiterals = false;
+ public boolean wasNonExternalizedStringLiteral = false;
+
+ // generic support
+ public boolean returnOnlyGreater = false;
+
+ /* static */{
+ for (int i = 0; i < 6; i++) {
+ for (int j = 0; j < TableSize; j++) {
+ for (int k = 0; k < InternalTableSize; k++) {
+ this.charArray_length[i][j][k] = initCharArray;
+ }
+ }
+ }
+ }
+ /* static */int newEntry2 = 0, newEntry3 = 0, newEntry4 = 0, newEntry5 = 0,
+ newEntry6 = 0;
+
+ public static final int RoundBracket = 0;
+ public static final int SquareBracket = 1;
+ public static final int CurlyBracket = 2;
+ public static final int BracketKinds = 3;
+
+ // extended unicode support
+ public static final int LOW_SURROGATE_MIN_VALUE = 0xDC00;
+ public static final int HIGH_SURROGATE_MIN_VALUE = 0xD800;
+ public static final int HIGH_SURROGATE_MAX_VALUE = 0xDBFF;
+ public static final int LOW_SURROGATE_MAX_VALUE = 0xDFFF;
+
+ public PublicScanner() {
+ this(false /* comment */, false /* whitespace */, false /* nls */,
+ ClassFileConstants.JDK1_3 /* sourceLevel */, null/* taskTag */,
+ null/* taskPriorities */, true /* taskCaseSensitive */);
+ }
+
+ public PublicScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace,
+ boolean checkNonExternalizedStringLiterals, long sourceLevel,
+ long complianceLevel, char[][] taskTags, char[][] taskPriorities,
+ boolean isTaskCaseSensitive) {
+
+ this.eofPosition = Integer.MAX_VALUE;
+ this.tokenizeComments = tokenizeComments;
+ this.tokenizeWhiteSpace = tokenizeWhiteSpace;
+ this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals;
+ this.sourceLevel = sourceLevel;
+ this.complianceLevel = complianceLevel;
+ this.taskTags = taskTags;
+ this.taskPriorities = taskPriorities;
+ this.isTaskCaseSensitive = isTaskCaseSensitive;
+ }
+
+ public PublicScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace,
+ boolean checkNonExternalizedStringLiterals, long sourceLevel,
+ char[][] taskTags, char[][] taskPriorities,
+ boolean isTaskCaseSensitive) {
+
+ this.eofPosition = Integer.MAX_VALUE;
+ this.tokenizeComments = tokenizeComments;
+ this.tokenizeWhiteSpace = tokenizeWhiteSpace;
+ this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals;
+ this.sourceLevel = sourceLevel;
+ this.complianceLevel = sourceLevel;
+ this.taskTags = taskTags;
+ this.taskPriorities = taskPriorities;
+ this.isTaskCaseSensitive = isTaskCaseSensitive;
+ }
+
+ public final boolean atEnd() {
+ // This code is not relevant if source is
+ // Only a part of the real stream input
+
+ return this.source.length == this.currentPosition;
+ }
+
+ protected void checkNonExternalizedString() {
+ if (this.currentLine == null)
+ return;
+ parseTags(this.currentLine);
+ }
+
+ // chech presence of task: tags
+ // TODO (frederic) see if we need to take unicode characters into account...
+ public void checkTaskTag(int commentStart, int commentEnd)
+ throws InvalidInputException {
+ char[] src = this.source;
+
+ // only look for newer task: tags
+ if (this.foundTaskCount > 0
+ && this.foundTaskPositions[this.foundTaskCount - 1][0] >= commentStart) {
+ return;
+ }
+ int foundTaskIndex = this.foundTaskCount;
+ char previous = src[commentStart + 1]; // should be '*' or '/'
+ nextChar: for (int i = commentStart + 2; i < commentEnd
+ && i < this.eofPosition; i++) {
+ char[] tag = null;
+ char[] priority = null;
+ // check for tag occurrence only if not ambiguous with javadoc tag
+ if (previous != '@') {
+ nextTag: for (int itag = 0; itag < this.taskTags.length; itag++) {
+ tag = this.taskTags[itag];
+ int tagLength = tag.length;
+ if (tagLength == 0)
+ continue nextTag;
+
+ // ensure tag is not leaded with letter if tag starts with a
+ // letter
+ if (Character.isJavaIdentifierStart(tag[0])) {
+ if (Character.isJavaIdentifierPart(previous)) {
+ continue nextTag;
+ }
+ }
+
+ for (int t = 0; t < tagLength; t++) {
+ char sc, tc;
+ int x = i + t;
+ if (x >= this.eofPosition || x >= commentEnd)
+ continue nextTag;
+ if ((sc = src[i + t]) != (tc = tag[t])) { // case
+ // sensitive
+ // check
+ if (this.isTaskCaseSensitive
+ || (Character.toLowerCase(sc) != Character
+ .toLowerCase(tc))) { // case
+ // insensitive
+ // check
+ continue nextTag;
+ }
+ }
+ }
+ // ensure tag is not followed with letter if tag finishes
+ // with a letter
+ if (i + tagLength < commentEnd
+ && Character.isJavaIdentifierPart(src[i + tagLength
+ - 1])) {
+ if (Character.isJavaIdentifierPart(src[i + tagLength]))
+ continue nextTag;
+ }
+ if (this.foundTaskTags == null) {
+ this.foundTaskTags = new char[5][];
+ this.foundTaskMessages = new char[5][];
+ this.foundTaskPriorities = new char[5][];
+ this.foundTaskPositions = new int[5][];
+ } else if (this.foundTaskCount == this.foundTaskTags.length) {
+ System
+ .arraycopy(
+ this.foundTaskTags,
+ 0,
+ this.foundTaskTags = new char[this.foundTaskCount * 2][],
+ 0, this.foundTaskCount);
+ System
+ .arraycopy(
+ this.foundTaskMessages,
+ 0,
+ this.foundTaskMessages = new char[this.foundTaskCount * 2][],
+ 0, this.foundTaskCount);
+ System
+ .arraycopy(
+ this.foundTaskPriorities,
+ 0,
+ this.foundTaskPriorities = new char[this.foundTaskCount * 2][],
+ 0, this.foundTaskCount);
+ System
+ .arraycopy(
+ this.foundTaskPositions,
+ 0,
+ this.foundTaskPositions = new int[this.foundTaskCount * 2][],
+ 0, this.foundTaskCount);
+ }
+
+ priority = this.taskPriorities != null
+ && itag < this.taskPriorities.length ? this.taskPriorities[itag]
+ : null;
+
+ this.foundTaskTags[this.foundTaskCount] = tag;
+ this.foundTaskPriorities[this.foundTaskCount] = priority;
+ this.foundTaskPositions[this.foundTaskCount] = new int[] {
+ i, i + tagLength - 1 };
+ this.foundTaskMessages[this.foundTaskCount] = CharOperation.NO_CHAR;
+ this.foundTaskCount++;
+ i += tagLength - 1; // will be incremented when looping
+ break nextTag;
+ }
+ }
+ previous = src[i];
+ }
+ for (int i = foundTaskIndex; i < this.foundTaskCount; i++) {
+ // retrieve message start and end positions
+ int msgStart = this.foundTaskPositions[i][0]
+ + this.foundTaskTags[i].length;
+ int max_value = i + 1 < this.foundTaskCount ? this.foundTaskPositions[i + 1][0] - 1
+ : commentEnd - 1;
+ // at most beginning of next task
+ if (max_value < msgStart) {
+ max_value = msgStart; // would only occur if tag is before
+ // EOF.
+ }
+ int end = -1;
+ char c;
+ for (int j = msgStart; j < max_value; j++) {
+ if ((c = src[j]) == '\n' || c == '\r') {
+ end = j - 1;
+ break;
+ }
+ }
+ if (end == -1) {
+ for (int j = max_value; j > msgStart; j--) {
+ if ((c = src[j]) == '*') {
+ end = j - 1;
+ break;
+ }
+ }
+ if (end == -1)
+ end = max_value;
+ }
+ if (msgStart == end)
+ continue; // empty
+ // trim the message
+ while (CharOperation.isWhitespace(src[end]) && msgStart <= end)
+ end--;
+ while (CharOperation.isWhitespace(src[msgStart]) && msgStart <= end)
+ msgStart++;
+ // update the end position of the task
+ this.foundTaskPositions[i][1] = end;
+ // get the message source
+ final int messageLength = end - msgStart + 1;
+ char[] message = new char[messageLength];
+ System.arraycopy(src, msgStart, message, 0, messageLength);
+ this.foundTaskMessages[i] = message;
+ }
+ }
+
+ public char[] getCurrentIdentifierSource() {
+ // return the token REAL source (aka unicodes are precomputed)
+
+ char[] result;
+ if (this.withoutUnicodePtr != 0) {
+ // 0 is used as a fast test flag so the real first char is in
+ // position 1
+ System.arraycopy(this.withoutUnicodeBuffer, 1,
+ result = new char[this.withoutUnicodePtr], 0,
+ this.withoutUnicodePtr);
+ } else {
+ int length = this.currentPosition - this.startPosition;
+ if (length == this.source.length)
+ return this.source;
+ switch (length) { // see OptimizedLength
+ case 1:
+ return optimizedCurrentTokenSource1();
+ case 2:
+ return optimizedCurrentTokenSource2();
+ case 3:
+ return optimizedCurrentTokenSource3();
+ case 4:
+ return optimizedCurrentTokenSource4();
+ case 5:
+ return optimizedCurrentTokenSource5();
+ case 6:
+ return optimizedCurrentTokenSource6();
+ }
+ // no optimization
+ System.arraycopy(this.source, this.startPosition,
+ result = new char[length], 0, length);
+ }
+ // newIdentCount++;
+ return result;
+ }
+
+ public int getCurrentTokenEndPosition() {
+ return this.currentPosition - 1;
+ }
+
+ public final char[] getCurrentTokenSource() {
+ // Return the token REAL source (aka unicodes are precomputed)
+
+ char[] result;
+ if (this.withoutUnicodePtr != 0)
+ // 0 is used as a fast test flag so the real first char is in
+ // position 1
+ System.arraycopy(this.withoutUnicodeBuffer, 1,
+ result = new char[this.withoutUnicodePtr], 0,
+ this.withoutUnicodePtr);
+ else {
+ int length;
+ System.arraycopy(this.source, this.startPosition,
+ result = new char[length = this.currentPosition
+ - this.startPosition], 0, length);
+ }
+ return result;
+ }
+
+ public final String getCurrentTokenString() {
+ // Return current token as a string
+
+ if (this.withoutUnicodePtr != 0) {
+ // 0 is used as a fast test flag so the real first char is in
+ // position 1
+ return new String(this.withoutUnicodeBuffer, 1,
+ this.withoutUnicodePtr);
+ }
+ return new String(this.source, this.startPosition, this.currentPosition
+ - this.startPosition);
+ }
+
+ public final char[] getCurrentTokenSourceString() {
+ // return the token REAL source (aka unicodes are precomputed).
+ // REMOVE the two " that are at the beginning and the end.
+
+ char[] result;
+ if (this.withoutUnicodePtr != 0)
+ // 0 is used as a fast test flag so the real first char is in
+ // position 1
+ System.arraycopy(this.withoutUnicodeBuffer, 2,
+ // 2 is 1 (real start) + 1 (to jump over the ")
+ result = new char[this.withoutUnicodePtr - 2], 0,
+ this.withoutUnicodePtr - 2);
+ else {
+ int length;
+ System.arraycopy(this.source, this.startPosition + 1,
+ result = new char[length = this.currentPosition
+ - this.startPosition - 2], 0, length);
+ }
+ return result;
+ }
+
+ public int getCurrentTokenStartPosition() {
+ return this.startPosition;
+ }
+
+ /*
+ * Search the source position corresponding to the end of a given line
+ * number
+ *
+ * Line numbers are 1-based, and relative to the scanner initialPosition.
+ * Character positions are 0-based.
+ *
+ * In case the given line number is inconsistent, answers -1.
+ */
+ public final int getLineEnd(int lineNumber) {
+
+ if (this.lineEnds == null || this.linePtr == -1)
+ return -1;
+ if (lineNumber > this.lineEnds.length + 1)
+ return -1;
+ if (lineNumber <= 0)
+ return -1;
+ if (lineNumber == this.lineEnds.length + 1)
+ return this.eofPosition;
+ return this.lineEnds[lineNumber - 1]; // next line start one character
+ // behind the lineEnd of the
+ // previous line
+ }
+
+ public final int getNextChar() {
+ try {
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ this.unicodeAsBackSlash = false;
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ return this.currentCharacter;
+ } catch (IndexOutOfBoundsException e) {
+ return -1;
+ } catch (InvalidInputException e) {
+ return -1;
+ }
+ }
+
+ public final boolean getNextChar(char testedChar) {
+ // BOOLEAN
+ // handle the case of unicode.
+ // when a unicode appears then we must use a buffer that holds char
+ // internal values
+ // At the end of this method currentCharacter holds the new visited char
+ // and currentPosition points right next after it
+ // Both previous lines are true if the currentCharacter is == to the
+ // testedChar
+ // On false, no side effect has occured.
+
+ // ALL getNextChar.... ARE OPTIMIZED COPIES
+
+ if (this.currentPosition >= this.source.length) { // handle the
+ // obvious case
+ // upfront
+ this.unicodeAsBackSlash = false;
+ return false;
+ }
+
+ int temp = this.currentPosition;
+ try {
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ if (this.currentCharacter != testedChar) {
+ this.currentPosition = temp;
+ this.withoutUnicodePtr--;
+ return false;
+ }
+ return true;
+ } // -------------end unicode traitement--------------
+ else {
+ if (this.currentCharacter != testedChar) {
+ this.currentPosition = temp;
+ return false;
+ }
+ this.unicodeAsBackSlash = false;
+ if (this.withoutUnicodePtr != 0)
+ unicodeStore();
+ return true;
+ }
+ } catch (IndexOutOfBoundsException e) {
+ this.unicodeAsBackSlash = false;
+ this.currentPosition = temp;
+ return false;
+ } catch (InvalidInputException e) {
+ this.unicodeAsBackSlash = false;
+ this.currentPosition = temp;
+ return false;
+ }
+ }
+
+ public final int getNextChar(char testedChar1, char testedChar2) {
+ // INT 0 : testChar1 \\\\///\\\\ 1 : testedChar2 \\\\///\\\\ -1 : others
+ // test can be done with (x==0) for the first and (x>0) for the second
+ // handle the case of unicode.
+ // when a unicode appears then we must use a buffer that holds char
+ // internal values
+ // At the end of this method currentCharacter holds the new visited char
+ // and currentPosition points right next after it
+ // Both previous lines are true if the currentCharacter is == to the
+ // testedChar1/2
+ // On false, no side effect has occured.
+
+ // ALL getNextChar.... ARE OPTIMIZED COPIES
+ if (this.currentPosition >= this.source.length) // handle the obvious
+ // case upfront
+ return -1;
+
+ int temp = this.currentPosition;
+ try {
+ int result;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ if (this.currentCharacter == testedChar1) {
+ result = 0;
+ } else if (this.currentCharacter == testedChar2) {
+ result = 1;
+ } else {
+ this.currentPosition = temp;
+ this.withoutUnicodePtr--;
+ result = -1;
+ }
+ return result;
+ } else {
+ if (this.currentCharacter == testedChar1) {
+ result = 0;
+ } else if (this.currentCharacter == testedChar2) {
+ result = 1;
+ } else {
+ this.currentPosition = temp;
+ return -1;
+ }
+
+ if (this.withoutUnicodePtr != 0)
+ unicodeStore();
+ return result;
+ }
+ } catch (IndexOutOfBoundsException e) {
+ this.currentPosition = temp;
+ return -1;
+ } catch (InvalidInputException e) {
+ this.currentPosition = temp;
+ return -1;
+ }
+ }
+
+ public final boolean getNextCharAsDigit() throws InvalidInputException {
+ // BOOLEAN
+ // handle the case of unicode.
+ // when a unicode appears then we must use a buffer that holds char
+ // internal values
+ // At the end of this method currentCharacter holds the new visited char
+ // and currentPosition points right next after it
+ // Both previous lines are true if the currentCharacter is a digit
+ // On false, no side effect has occured.
+
+ // ALL getNextChar.... ARE OPTIMIZED COPIES
+ if (this.currentPosition >= this.source.length) // handle the obvious
+ // case upfront
+ return false;
+
+ int temp = this.currentPosition;
+ try {
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ if (!isDigit(this.currentCharacter)) {
+ this.currentPosition = temp;
+ this.withoutUnicodePtr--;
+ return false;
+ }
+ return true;
+ } else {
+ if (!isDigit(this.currentCharacter)) {
+ this.currentPosition = temp;
+ return false;
+ }
+ if (this.withoutUnicodePtr != 0)
+ unicodeStore();
+ return true;
+ }
+ } catch (IndexOutOfBoundsException e) {
+ this.currentPosition = temp;
+ return false;
+ } catch (InvalidInputException e) {
+ this.currentPosition = temp;
+ return false;
+ }
+ }
+
+ public final boolean getNextCharAsDigit(int radix) {
+ // BOOLEAN
+ // handle the case of unicode.
+ // when a unicode appears then we must use a buffer that holds char
+ // internal values
+ // At the end of this method currentCharacter holds the new visited char
+ // and currentPosition points right next after it
+ // Both previous lines are true if the currentCharacter is a digit base
+ // on radix
+ // On false, no side effect has occured.
+
+ // ALL getNextChar.... ARE OPTIMIZED COPIES
+ if (this.currentPosition >= this.source.length) // handle the obvious
+ // case upfront
+ return false;
+
+ int temp = this.currentPosition;
+ try {
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ if (Character.digit(this.currentCharacter, radix) == -1) {
+ this.currentPosition = temp;
+ this.withoutUnicodePtr--;
+ return false;
+ }
+ return true;
+ } else {
+ if (Character.digit(this.currentCharacter, radix) == -1) {
+ this.currentPosition = temp;
+ return false;
+ }
+ if (this.withoutUnicodePtr != 0)
+ unicodeStore();
+ return true;
+ }
+ } catch (IndexOutOfBoundsException e) {
+ this.currentPosition = temp;
+ return false;
+ } catch (InvalidInputException e) {
+ this.currentPosition = temp;
+ return false;
+ }
+ }
+
+ public boolean getNextCharAsJavaIdentifierPart() {
+ // BOOLEAN
+ // handle the case of unicode.
+ // when a unicode appears then we must use a buffer that holds char
+ // internal values
+ // At the end of this method currentCharacter holds the new visited char
+ // and currentPosition points right next after it
+ // Both previous lines are true if the currentCharacter is a
+ // JavaIdentifierPart
+ // On false, no side effect has occured.
+
+ // ALL getNextChar.... ARE OPTIMIZED COPIES
+ int pos;
+ if ((pos = this.currentPosition) >= this.source.length) // handle the
+ // obvious case
+ // upfront
+ return false;
+
+ int temp2 = this.withoutUnicodePtr;
+ try {
+ boolean unicode = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ unicode = true;
+ }
+ char c = this.currentCharacter;
+ boolean isJavaIdentifierPart = false;
+ if (c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE) {
+ if (this.complianceLevel < ClassFileConstants.JDK1_5) {
+ this.currentPosition = pos;
+ this.withoutUnicodePtr = temp2;
+ return false;
+ }
+ // Unicode 4 detection
+ char low = (char) getNextChar();
+ if (low < LOW_SURROGATE_MIN_VALUE
+ || low > LOW_SURROGATE_MAX_VALUE) {
+ // illegal low surrogate
+ this.currentPosition = pos;
+ this.withoutUnicodePtr = temp2;
+ return false;
+ }
+ isJavaIdentifierPart = ScannerHelper.isJavaIdentifierPart(c,
+ low);
+ } else if (c >= LOW_SURROGATE_MIN_VALUE
+ && c <= LOW_SURROGATE_MAX_VALUE) {
+ this.currentPosition = pos;
+ this.withoutUnicodePtr = temp2;
+ return false;
+ } else {
+ isJavaIdentifierPart = Character.isJavaIdentifierPart(c);
+ }
+ if (unicode) {
+ if (!isJavaIdentifierPart) {
+ this.currentPosition = pos;
+ this.withoutUnicodePtr = temp2;
+ return false;
+ }
+ return true;
+ } else {
+ if (!isJavaIdentifierPart) {
+ this.currentPosition = pos;
+ return false;
+ }
+
+ if (this.withoutUnicodePtr != 0)
+ unicodeStore();
+ return true;
+ }
+ } catch (IndexOutOfBoundsException e) {
+ this.currentPosition = pos;
+ this.withoutUnicodePtr = temp2;
+ return false;
+ } catch (InvalidInputException e) {
+ this.currentPosition = pos;
+ this.withoutUnicodePtr = temp2;
+ return false;
+ }
+ }
+
+ public int getNextToken() throws InvalidInputException {
+ this.wasAcr = false;
+ if (this.diet) {
+ jumpOverMethodBody();
+ this.diet = false;
+ return this.currentPosition > this.source.length ? TokenNameEOF
+ : TokenNameRBRACE;
+ }
+ int whiteStart = 0;
+ try {
+ while (true) { // loop for jumping over comments
+ this.withoutUnicodePtr = 0;
+ // start with a new token (even comment written with unicode )
+
+ // ---------Consume white space and handles
+ // startPosition---------
+ whiteStart = this.currentPosition;
+ boolean isWhiteSpace, hasWhiteSpaces = false;
+ int offset;
+ int unicodePtr;
+ boolean checkIfUnicode = false;
+ do {
+ unicodePtr = this.withoutUnicodePtr;
+ offset = this.currentPosition;
+ this.startPosition = this.currentPosition;
+ try {
+ checkIfUnicode = ((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u');
+ } catch (IndexOutOfBoundsException e) {
+ if (this.tokenizeWhiteSpace
+ && (whiteStart != this.currentPosition - 1)) {
+ // reposition scanner in case we are interested by
+ // spaces as tokens
+ this.currentPosition--;
+ this.startPosition = whiteStart;
+ return TokenNameWHITESPACE;
+ }
+ if (this.currentPosition > this.eofPosition)
+ return TokenNameEOF;
+ }
+ if (checkIfUnicode) {
+ isWhiteSpace = jumpOverUnicodeWhiteSpace();
+ offset = this.currentPosition - offset;
+ } else {
+ offset = this.currentPosition - offset;
+ if ((this.currentCharacter == '\r')
+ || (this.currentCharacter == '\n')) {
+ checkNonExternalizedString();
+ if (this.recordLineSeparator) {
+ pushLineSeparator();
+ } else {
+ this.currentLine = null;
+ }
+ }
+ // inline version of:
+ // isWhiteSpace =
+ // (this.currentCharacter == ' ') ||
+ // CharOperation.isWhitespace(this.currentCharacter);
+ switch (this.currentCharacter) {
+ case 10: /* \ u000a: LINE FEED */
+ case 12: /* \ u000c: FORM FEED */
+ case 13: /* \ u000d: CARRIAGE RETURN */
+ case 32: /* \ u0020: SPACE */
+ case 9: /* \ u0009: HORIZONTAL TABULATION */
+ isWhiteSpace = true;
+ break;
+ default:
+ isWhiteSpace = false;
+ }
+ }
+ if (isWhiteSpace) {
+ hasWhiteSpaces = true;
+ }
+ } while (isWhiteSpace);
+ if (hasWhiteSpaces) {
+ if (this.tokenizeWhiteSpace) {
+ // reposition scanner in case we are interested by
+ // spaces as tokens
+ this.currentPosition -= offset;
+ this.startPosition = whiteStart;
+ if (checkIfUnicode) {
+ this.withoutUnicodePtr = unicodePtr;
+ }
+ return TokenNameWHITESPACE;
+ } else if (checkIfUnicode) {
+ this.withoutUnicodePtr = 0;
+ unicodeStore();
+ } else {
+ this.withoutUnicodePtr = 0;
+ }
+ }
+ // little trick to get out in the middle of a source compuation
+ if (this.currentPosition > this.eofPosition)
+ return TokenNameEOF;
+
+ // ---------Identify the next token-------------
+
+ switch (this.currentCharacter) {
+ case '@':
+ /*
+ * if (this.sourceLevel >= ClassFileConstants.JDK1_5) {
+ * return TokenNameAT; } else { return TokenNameERROR; }
+ */
+ return TokenNameAT;
+ case '(':
+ return TokenNameLPAREN;
+ case ')':
+ return TokenNameRPAREN;
+ case '{':
+ return TokenNameLBRACE;
+ case '}':
+ return TokenNameRBRACE;
+ case '[':
+ return TokenNameLBRACKET;
+ case ']':
+ return TokenNameRBRACKET;
+ case ';':
+ return TokenNameSEMICOLON;
+ case ',':
+ return TokenNameCOMMA;
+ case '.':
+ if (getNextCharAsDigit()) {
+ return scanNumber(true);
+ }
+ /*
+ * if (this.sourceLevel >= ClassFileConstants.JDK1_5) { int
+ * temp = this.currentPosition; if (getNextChar('.')) { if
+ * (getNextChar('.')) { return TokenNameELLIPSIS; } else {
+ * this.currentPosition = temp; return TokenNameDOT; } }
+ * else { this.currentPosition = temp; return TokenNameDOT; } }
+ * else { return TokenNameDOT; }
+ */
+ int temp = this.currentPosition;
+ if (getNextChar('.')) {
+ if (getNextChar('.')) {
+ return TokenNameELLIPSIS;
+ } else {
+ this.currentPosition = temp;
+ return TokenNameDOT;
+ }
+ } else {
+ this.currentPosition = temp;
+ return TokenNameDOT;
+ }
+ case '+': {
+ int test;
+ if ((test = getNextChar('+', '=')) == 0)
+ return TokenNamePLUS_PLUS;
+ if (test > 0)
+ return TokenNamePLUS_EQUAL;
+ return TokenNamePLUS;
+ }
+ case '-': {
+ int test;
+ if ((test = getNextChar('-', '=')) == 0)
+ return TokenNameMINUS_MINUS;
+ if (test > 0)
+ return TokenNameMINUS_EQUAL;
+ return TokenNameMINUS;
+ }
+ case '~':
+ return TokenNameTWIDDLE;
+ case '!':
+ if (getNextChar('='))
+ return TokenNameNOT_EQUAL;
+ return TokenNameNOT;
+ case '*':
+ if (getNextChar('='))
+ return TokenNameMULTIPLY_EQUAL;
+ return TokenNameMULTIPLY;
+ case '%':
+ if (getNextChar('='))
+ return TokenNameREMAINDER_EQUAL;
+ return TokenNameREMAINDER;
+ case '<': {
+ int test;
+ if ((test = getNextChar('=', '<')) == 0)
+ return TokenNameLESS_EQUAL;
+ if (test > 0) {
+ if (getNextChar('='))
+ return TokenNameLEFT_SHIFT_EQUAL;
+ return TokenNameLEFT_SHIFT;
+ }
+ return TokenNameLESS;
+ }
+ case '>': {
+ int test;
+ if (this.returnOnlyGreater) {
+ return TokenNameGREATER;
+ }
+ if ((test = getNextChar('=', '>')) == 0)
+ return TokenNameGREATER_EQUAL;
+ if (test > 0) {
+ if ((test = getNextChar('=', '>')) == 0)
+ return TokenNameRIGHT_SHIFT_EQUAL;
+ if (test > 0) {
+ if (getNextChar('='))
+ return TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL;
+ return TokenNameUNSIGNED_RIGHT_SHIFT;
+ }
+ return TokenNameRIGHT_SHIFT;
+ }
+ return TokenNameGREATER;
+ }
+ case '=':
+ if (getNextChar('='))
+ return TokenNameEQUAL_EQUAL;
+ return TokenNameEQUAL;
+ case '&': {
+ int test;
+ if ((test = getNextChar('&', '=')) == 0)
+ return TokenNameAND_AND;
+ if (test > 0)
+ return TokenNameAND_EQUAL;
+ return TokenNameAND;
+ }
+ case '|': {
+ int test;
+ if ((test = getNextChar('|', '=')) == 0)
+ return TokenNameOR_OR;
+ if (test > 0)
+ return TokenNameOR_EQUAL;
+ return TokenNameOR;
+ }
+ case '^':
+ if (getNextChar('='))
+ return TokenNameXOR_EQUAL;
+ return TokenNameXOR;
+ case '?':
+ return TokenNameQUESTION;
+ case ':':
+ return TokenNameCOLON;
+ case '\'': {
+ int test;
+ if ((test = getNextChar('\n', '\r')) == 0) {
+ throw new InvalidInputException(
+ INVALID_CHARACTER_CONSTANT);
+ }
+ if (test > 0) {
+ // relocate if finding another quote fairly close: thus
+ // unicode '/u000D' will be fully consumed
+ for (int lookAhead = 0; lookAhead < 3; lookAhead++) {
+ if (this.currentPosition + lookAhead == this.source.length)
+ break;
+ if (this.source[this.currentPosition + lookAhead] == '\n')
+ break;
+ if (this.source[this.currentPosition + lookAhead] == '\'') {
+ this.currentPosition += lookAhead + 1;
+ break;
+ }
+ }
+ throw new InvalidInputException(
+ INVALID_CHARACTER_CONSTANT);
+ }
+ }
+ if (getNextChar('\'')) {
+ // relocate if finding another quote fairly close: thus
+ // unicode '/u000D' will be fully consumed
+ for (int lookAhead = 0; lookAhead < 3; lookAhead++) {
+ if (this.currentPosition + lookAhead == this.source.length)
+ break;
+ if (this.source[this.currentPosition + lookAhead] == '\n')
+ break;
+ if (this.source[this.currentPosition + lookAhead] == '\'') {
+ this.currentPosition += lookAhead + 1;
+ break;
+ }
+ }
+ throw new InvalidInputException(
+ INVALID_CHARACTER_CONSTANT);
+ }
+ if (getNextChar('\\')) {
+ if (this.unicodeAsBackSlash) {
+ // consume next character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ } else {
+ this.currentCharacter = this.source[this.currentPosition++];
+ }
+ scanEscapeCharacter();
+ } else { // consume next character
+ this.unicodeAsBackSlash = false;
+ checkIfUnicode = false;
+ try {
+ checkIfUnicode = ((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u');
+ } catch (IndexOutOfBoundsException e) {
+ this.currentPosition--;
+ throw new InvalidInputException(
+ INVALID_CHARACTER_CONSTANT);
+ }
+ if (checkIfUnicode) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ }
+ if (getNextChar('\''))
+ return TokenNameCharacterLiteral;
+ // relocate if finding another quote fairly close: thus
+ // unicode '/u000D' will be fully consumed
+ for (int lookAhead = 0; lookAhead < 20; lookAhead++) {
+ if (this.currentPosition + lookAhead == this.source.length)
+ break;
+ if (this.source[this.currentPosition + lookAhead] == '\n')
+ break;
+ if (this.source[this.currentPosition + lookAhead] == '\'') {
+ this.currentPosition += lookAhead + 1;
+ break;
+ }
+ }
+ throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+ case '"':
+ try {
+ // consume next character
+ this.unicodeAsBackSlash = false;
+ boolean isUnicode = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ isUnicode = true;
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+
+ while (this.currentCharacter != '"') {
+ /** ** \r and \n are not valid in string literals *** */
+ if ((this.currentCharacter == '\n')
+ || (this.currentCharacter == '\r')) {
+ // relocate if finding another quote fairly
+ // close: thus unicode '/u000D' will be fully
+ // consumed
+ if (isUnicode) {
+ int start = this.currentPosition;
+ for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
+ if (this.currentPosition >= this.eofPosition) {
+ this.currentPosition = start;
+ break;
+ }
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ isUnicode = true;
+ getNextUnicodeChar();
+ } else {
+ isUnicode = false;
+ }
+ if (!isUnicode
+ && this.currentCharacter == '\n') {
+ this.currentPosition--; // set
+ // current
+ // position
+ // on new
+ // line
+ // character
+ break;
+ }
+ if (this.currentCharacter == '\"') {
+ throw new InvalidInputException(
+ INVALID_CHAR_IN_STRING);
+ }
+ }
+ } else {
+ this.currentPosition--; // set current
+ // position on new
+ // line character
+ }
+ throw new InvalidInputException(
+ INVALID_CHAR_IN_STRING);
+ }
+ if (this.currentCharacter == '\\') {
+ if (this.unicodeAsBackSlash) {
+ this.withoutUnicodePtr--;
+ // consume next character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ this.withoutUnicodePtr--;
+ }
+ } else {
+ if (this.withoutUnicodePtr == 0) {
+ unicodeInitializeBuffer(this.currentPosition
+ - this.startPosition);
+ }
+ this.withoutUnicodePtr--;
+ this.currentCharacter = this.source[this.currentPosition++];
+ }
+ // we need to compute the escape character in a
+ // separate buffer
+ scanEscapeCharacter();
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ // consume next character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+
+ }
+ } catch (IndexOutOfBoundsException e) {
+ this.currentPosition--;
+ throw new InvalidInputException(UNTERMINATED_STRING);
+ } catch (InvalidInputException e) {
+ if (e.getMessage().equals(INVALID_ESCAPE)) {
+ // relocate if finding another quote fairly close:
+ // thus unicode '/u000D' will be fully consumed
+ for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
+ if (this.currentPosition + lookAhead == this.source.length)
+ break;
+ if (this.source[this.currentPosition
+ + lookAhead] == '\n')
+ break;
+ if (this.source[this.currentPosition
+ + lookAhead] == '\"') {
+ this.currentPosition += lookAhead + 1;
+ break;
+ }
+ }
+
+ }
+ throw e; // rethrow
+ }
+ if (this.checkNonExternalizedStringLiterals) { // check for
+ // presence
+ // of NLS
+ // tags
+ // //$NON-NLS-?$
+ // where ?
+ // is an
+ // int.
+ if (this.currentLine == null) {
+ this.currentLine = new NLSLine();
+ }
+ this.currentLine
+ .add(new StringLiteral(
+ getCurrentTokenSourceString(),
+ this.startPosition,
+ this.currentPosition - 1, 0));
+ }
+ return TokenNameStringLiteral;
+ case '/': {
+ int test;
+ if ((test = getNextChar('/', '*')) == 0) { // line comment
+ this.lastCommentLinePosition = this.currentPosition;
+ try { // get the next char
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ }
+
+ // handle the \\u case manually into comment
+if (this.currentCharacter == '\\') {
+ if (this.source[this.currentPosition] == '\\')
+ this.currentPosition++;
+ } // jump over the \\
+ boolean isUnicode = false;
+ while (this.currentCharacter != '\r'
+ && this.currentCharacter != '\n') {
+ this.lastCommentLinePosition = this.currentPosition;
+ // get the next char
+ isUnicode = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ isUnicode = true;
+ }
+ // handle the \\u case manually into comment
+if (this.currentCharacter == '\\') {
+ if (this.source[this.currentPosition] == '\\')
+ this.currentPosition++;
+ } // jump over the \\
+ }
+ /*
+ * We need to completely consume the line break
+ */
+ if (this.currentCharacter == '\r'
+ && this.source.length > this.currentPosition) {
+ if (this.source[this.currentPosition] == '\n') {
+ this.currentPosition++;
+ this.currentCharacter = '\n';
+ } else if ((this.source[this.currentPosition] == '\\')
+ && (this.source[this.currentPosition + 1] == 'u')) {
+ getNextUnicodeChar();
+ isUnicode = true;
+ }
+ }
+ recordComment(TokenNameCOMMENT_LINE);
+ if (this.taskTags != null)
+ checkTaskTag(this.startPosition,
+ this.currentPosition);
+ if ((this.currentCharacter == '\r')
+ || (this.currentCharacter == '\n')) {
+ checkNonExternalizedString();
+ if (this.recordLineSeparator) {
+ if (isUnicode) {
+ pushUnicodeLineSeparator();
+ } else {
+ pushLineSeparator();
+ }
+ } else {
+ this.currentLine = null;
+ }
+ }
+ if (this.tokenizeComments) {
+ return TokenNameCOMMENT_LINE;
+ }
+ } catch (IndexOutOfBoundsException e) {
+ this.currentPosition--;
+ recordComment(TokenNameCOMMENT_LINE);
+ if (this.taskTags != null)
+ checkTaskTag(this.startPosition,
+ this.currentPosition);
+ if (this.tokenizeComments) {
+ return TokenNameCOMMENT_LINE;
+ } else {
+ this.currentPosition++;
+ }
+ }
+ break;
+ }
+ if (test > 0) { // traditional and javadoc comment
+ try { // get the next char
+ boolean isJavadoc = false, star = false;
+ boolean isUnicode = false;
+ int previous;
+ // consume next character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ isUnicode = true;
+ } else {
+ isUnicode = false;
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+
+ if (this.currentCharacter == '*') {
+ isJavadoc = true;
+ star = true;
+ }
+ if ((this.currentCharacter == '\r')
+ || (this.currentCharacter == '\n')) {
+ checkNonExternalizedString();
+ if (this.recordLineSeparator) {
+ if (isUnicode) {
+ pushUnicodeLineSeparator();
+ } else {
+ pushLineSeparator();
+ }
+ } else {
+ this.currentLine = null;
+ }
+ }
+ isUnicode = false;
+ previous = this.currentPosition;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ // -------------unicode traitement ------------
+ getNextUnicodeChar();
+ isUnicode = true;
+ } else {
+ isUnicode = false;
+ }
+ // handle the \\u case manually into comment
+if (this.currentCharacter == '\\') {
+ if (this.source[this.currentPosition] == '\\')
+ this.currentPosition++; // jump over the \\
+ }
+ // empty comment is not a javadoc /**/
+ if (this.currentCharacter == '/') {
+ isJavadoc = false;
+ }
+ // loop until end of comment */
+ int firstTag = 0;
+ while ((this.currentCharacter != '/') || (!star)) {
+ if ((this.currentCharacter == '\r')
+ || (this.currentCharacter == '\n')) {
+ checkNonExternalizedString();
+ if (this.recordLineSeparator) {
+ if (isUnicode) {
+ pushUnicodeLineSeparator();
+ } else {
+ pushLineSeparator();
+ }
+ } else {
+ this.currentLine = null;
+ }
+ }
+ switch (this.currentCharacter) {
+ case '*':
+ star = true;
+ break;
+ case '@':
+ if (firstTag == 0) {
+ firstTag = previous;
+ }
+ // fall through default case to set star to
+ // false
+ default:
+ star = false;
+ }
+ // get next char
+ previous = this.currentPosition;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ // -------------unicode traitement
+ // ------------
+ getNextUnicodeChar();
+ isUnicode = true;
+ } else {
+ isUnicode = false;
+ }
+ // handle the \\u case manually into comment
+if (this.currentCharacter == '\\') {
+ if (this.source[this.currentPosition] == '\\')
+ this.currentPosition++;
+ } // jump over the \\
+ }
+ int token = isJavadoc ? TokenNameCOMMENT_JAVADOC
+ : TokenNameCOMMENT_BLOCK;
+ recordComment(token);
+ this.commentTagStarts[this.commentPtr] = firstTag;
+ if (this.taskTags != null)
+ checkTaskTag(this.startPosition,
+ this.currentPosition);
+ if (this.tokenizeComments) {
+ /*
+ * if (isJavadoc) return
+ * TokenNameCOMMENT_JAVADOC; return
+ * TokenNameCOMMENT_BLOCK;
+ */
+ return token;
+ }
+ } catch (IndexOutOfBoundsException e) {
+ this.currentPosition--;
+ throw new InvalidInputException(
+ UNTERMINATED_COMMENT);
+ }
+ break;
+ }
+ if (getNextChar('='))
+ return TokenNameDIVIDE_EQUAL;
+ return TokenNameDIVIDE;
+ }
+ case '\u001a':
+ if (atEnd())
+ return TokenNameEOF;
+ // the atEnd may not be <currentPosition == source.length>
+ // if source is only some part of a real (external) stream
+ throw new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$
+
+ default:
+ char c = this.currentCharacter;
+ if (c < MAX_OBVIOUS) {
+ switch (ObviousIdentCharNatures[c]) {
+ case C_LETTER:
+ return scanIdentifierOrKeyword();
+ case C_DIGIT:
+ return scanNumber(false);
+ }
+ }
+ boolean isJavaIdStart;
+ if (c >= HIGH_SURROGATE_MIN_VALUE
+ && c <= HIGH_SURROGATE_MAX_VALUE) {
+ if (this.complianceLevel < ClassFileConstants.JDK1_5) {
+ throw new InvalidInputException(
+ INVALID_UNICODE_ESCAPE);
+ }
+ // Unicode 4 detection
+ char low = (char) getNextChar();
+ if (low < LOW_SURROGATE_MIN_VALUE
+ || low > LOW_SURROGATE_MAX_VALUE) {
+ // illegal low surrogate
+ throw new InvalidInputException(
+ INVALID_LOW_SURROGATE);
+ }
+ isJavaIdStart = ScannerHelper.isJavaIdentifierStart(c,
+ low);
+ } else if (c >= LOW_SURROGATE_MIN_VALUE
+ && c <= LOW_SURROGATE_MAX_VALUE) {
+ if (this.complianceLevel < ClassFileConstants.JDK1_5) {
+ throw new InvalidInputException(
+ INVALID_UNICODE_ESCAPE);
+ }
+ throw new InvalidInputException(INVALID_HIGH_SURROGATE);
+ } else {
+ isJavaIdStart = Character.isJavaIdentifierStart(c);
+ }
+ if (isJavaIdStart)
+ return scanIdentifierOrKeyword();
+ if (isDigit(this.currentCharacter)) {
+ return scanNumber(false);
+ }
+ return TokenNameERROR;
+ }
+ }
+ } // -----------------end switch while try--------------------
+ catch (IndexOutOfBoundsException e) {
+ if (this.tokenizeWhiteSpace
+ && (whiteStart != this.currentPosition - 1)) {
+ // reposition scanner in case we are interested by spaces as
+ // tokens
+ this.currentPosition--;
+ this.startPosition = whiteStart;
+ return TokenNameWHITESPACE;
+ }
+ }
+ return TokenNameEOF;
+ }
+
+ public void getNextUnicodeChar() throws InvalidInputException {
+ // VOID
+ // handle the case of unicode.
+ // when a unicode appears then we must use a buffer that holds char
+ // internal values
+ // At the end of this method currentCharacter holds the new visited char
+ // and currentPosition points right next after it
+
+ // ALL getNextChar.... ARE OPTIMIZED COPIES
+
+ try {
+ int c1 = 0, c2 = 0, c3 = 0, c4 = 0, unicodeSize = 6;
+ this.currentPosition++;
+ while (this.source[this.currentPosition] == 'u') {
+ this.currentPosition++;
+ unicodeSize++;
+ }
+
+ if ((c1 = Character
+ .getNumericValue(this.source[this.currentPosition++])) > 15
+ || c1 < 0
+ || (c2 = Character
+ .getNumericValue(this.source[this.currentPosition++])) > 15
+ || c2 < 0
+ || (c3 = Character
+ .getNumericValue(this.source[this.currentPosition++])) > 15
+ || c3 < 0
+ || (c4 = Character
+ .getNumericValue(this.source[this.currentPosition++])) > 15
+ || c4 < 0) {
+ throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ }
+ this.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
+ // need the unicode buffer
+ if (this.withoutUnicodePtr == 0) {
+ // buffer all the entries that have been left aside....
+ unicodeInitializeBuffer(this.currentPosition - unicodeSize
+ - this.startPosition);
+ }
+ // fill the buffer with the char
+ unicodeStore();
+ this.unicodeAsBackSlash = this.currentCharacter == '\\';
+ } catch (ArrayIndexOutOfBoundsException e) {
+ this.currentPosition--;
+ throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ }
+ }
+
+ public char[] getSource() {
+ return this.source;
+ }
+
+ // TODO (philippe) should simply switch on character
+ protected boolean isDigit(char c) throws InvalidInputException {
+ if (Character.isDigit(c)) {
+ switch (c) {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ return true;
+ }
+ throw new InvalidInputException(Scanner.INVALID_DIGIT);
+ } else {
+ return false;
+ }
+ }
+
+ public final void jumpOverMethodBody() {
+
+ this.wasAcr = false;
+ int found = 1;
+ try {
+ while (true) { // loop for jumping over comments
+ // ---------Consume white space and handles
+ // startPosition---------
+ boolean isWhiteSpace;
+ do {
+ this.startPosition = this.currentPosition;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ isWhiteSpace = jumpOverUnicodeWhiteSpace();
+ } else {
+ if (this.recordLineSeparator
+ && ((this.currentCharacter == '\r') || (this.currentCharacter == '\n')))
+ pushLineSeparator();
+ isWhiteSpace = CharOperation
+ .isWhitespace(this.currentCharacter);
+ }
+ } while (isWhiteSpace);
+
+ // -------consume token until } is found---------
+ NextToken: switch (this.currentCharacter) {
+ case '{':
+ found++;
+ break NextToken;
+ case '}':
+ found--;
+ if (found == 0)
+ return;
+ break NextToken;
+ case '\'': {
+ boolean test;
+ test = getNextChar('\\');
+ if (test) {
+ try {
+ if (this.unicodeAsBackSlash) {
+ // consume next character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ } else {
+ this.currentCharacter = this.source[this.currentPosition++];
+ }
+ scanEscapeCharacter();
+ } catch (InvalidInputException ex) {
+ // ignore
+ }
+ } else {
+ try { // consume next character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ } catch (InvalidInputException ex) {
+ // ignore
+ }
+ }
+ getNextChar('\'');
+ break NextToken;
+ }
+ case '"':
+ try {
+ try { // consume next character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ } catch (InvalidInputException ex) {
+ // ignore
+ }
+ while (this.currentCharacter != '"') {
+ if (this.currentCharacter == '\r') {
+ if (this.source[this.currentPosition] == '\n')
+ this.currentPosition++;
+ break NextToken; // the string cannot go
+ // further that the line
+ }
+ if (this.currentCharacter == '\n') {
+ break; // the string cannot go further that the
+ // line
+ }
+ if (this.currentCharacter == '\\') {
+ try {
+ if (this.unicodeAsBackSlash) {
+ // consume next character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ } else {
+ this.currentCharacter = this.source[this.currentPosition++];
+ }
+ scanEscapeCharacter();
+ } catch (InvalidInputException ex) {
+ // ignore
+ }
+ }
+ try { // consume next character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ } catch (InvalidInputException ex) {
+ // ignore
+ }
+ }
+ } catch (IndexOutOfBoundsException e) {
+ return;
+ }
+ break NextToken;
+ case '/': {
+ int test;
+ if ((test = getNextChar('/', '*')) == 0) { // line comment
+ try {
+ this.lastCommentLinePosition = this.currentPosition;
+ // get the next char
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ }
+ // handle the \\u case manually into comment
+if (this.currentCharacter == '\\') {
+ if (this.source[this.currentPosition] == '\\')
+ this.currentPosition++;
+ } // jump over the \\
+ boolean isUnicode = false;
+ while (this.currentCharacter != '\r'
+ && this.currentCharacter != '\n') {
+ this.lastCommentLinePosition = this.currentPosition;
+ // get the next char
+ isUnicode = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ isUnicode = true;
+ getNextUnicodeChar();
+ }
+ // handle the \\u case manually into comment
+if (this.currentCharacter == '\\') {
+ if (this.source[this.currentPosition] == '\\')
+ this.currentPosition++;
+ } // jump over the \\
+ }
+ /*
+ * We need to completely consume the line break
+ */
+ if (this.currentCharacter == '\r'
+ && this.source.length > this.currentPosition) {
+ if (this.source[this.currentPosition] == '\n') {
+ this.currentPosition++;
+ this.currentCharacter = '\n';
+ } else if ((this.source[this.currentPosition] == '\\')
+ && (this.source[this.currentPosition + 1] == 'u')) {
+ isUnicode = true;
+ getNextUnicodeChar();
+ }
+ }
+ recordComment(TokenNameCOMMENT_LINE);
+ if (this.recordLineSeparator
+ && ((this.currentCharacter == '\r') || (this.currentCharacter == '\n'))) {
+ if (isUnicode) {
+ pushUnicodeLineSeparator();
+ } else {
+ pushLineSeparator();
+ }
+ }
+ } catch (IndexOutOfBoundsException e) {
+ // an eof will then be generated
+ this.currentPosition--;
+ recordComment(TokenNameCOMMENT_LINE);
+ if (!this.tokenizeComments) {
+ this.currentPosition++;
+ }
+ }
+ break NextToken;
+ }
+ if (test > 0) { // traditional and javadoc comment
+ boolean isJavadoc = false;
+ try { // get the next char
+ boolean star = false;
+ int previous;
+ boolean isUnicode = false;
+ // consume next character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ isUnicode = true;
+ } else {
+ isUnicode = false;
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+
+ if (this.currentCharacter == '*') {
+ isJavadoc = true;
+ star = true;
+ }
+ if ((this.currentCharacter == '\r')
+ || (this.currentCharacter == '\n')) {
+ if (this.recordLineSeparator) {
+ if (isUnicode) {
+ pushUnicodeLineSeparator();
+ } else {
+ pushLineSeparator();
+ }
+ } else {
+ this.currentLine = null;
+ }
+ }
+ isUnicode = false;
+ previous = this.currentPosition;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ isUnicode = true;
+ } else {
+ isUnicode = false;
+ }
+ // handle the \\u case manually into comment
+if (this.currentCharacter == '\\') {
+ if (this.source[this.currentPosition] == '\\')
+ this.currentPosition++; // jump over the \\
+ }
+ // empty comment is not a javadoc /**/
+ if (this.currentCharacter == '/') {
+ isJavadoc = false;
+ }
+ // loop until end of comment */
+ int firstTag = 0;
+ while ((this.currentCharacter != '/') || (!star)) {
+ if ((this.currentCharacter == '\r')
+ || (this.currentCharacter == '\n')) {
+ if (this.recordLineSeparator) {
+ if (isUnicode) {
+ pushUnicodeLineSeparator();
+ } else {
+ pushLineSeparator();
+ }
+ } else {
+ this.currentLine = null;
+ }
+ }
+ switch (this.currentCharacter) {
+ case '*':
+ star = true;
+ break;
+ case '@':
+ if (firstTag == 0) {
+ firstTag = previous;
+ }
+ // fall through default case to set star to
+ // false
+ default:
+ star = false;
+ }
+ // get next char
+ previous = this.currentPosition;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ isUnicode = true;
+ } else {
+ isUnicode = false;
+ }
+ // handle the \\u case manually into comment
+if (this.currentCharacter == '\\') {
+ if (this.source[this.currentPosition] == '\\')
+ this.currentPosition++;
+ } // jump over the \\
+ }
+ recordComment(isJavadoc ? TokenNameCOMMENT_JAVADOC
+ : TokenNameCOMMENT_BLOCK);
+ this.commentTagStarts[this.commentPtr] = firstTag;
+ } catch (IndexOutOfBoundsException e) {
+ return;
+ }
+ break NextToken;
+ }
+ break NextToken;
+ }
+
+ default:
+ try {
+ char c = this.currentCharacter;
+ if (c < MAX_OBVIOUS) {
+ switch (ObviousIdentCharNatures[c]) {
+ case C_LETTER:
+ scanIdentifierOrKeyword();
+ break NextToken;
+ case C_DIGIT:
+ scanNumber(false);
+ break NextToken;
+ }
+ }
+ boolean isJavaIdStart;
+ if (c >= HIGH_SURROGATE_MIN_VALUE
+ && c <= HIGH_SURROGATE_MAX_VALUE) {
+ if (this.complianceLevel < ClassFileConstants.JDK1_5) {
+ throw new InvalidInputException(
+ INVALID_UNICODE_ESCAPE);
+ }
+ // Unicode 4 detection
+ char low = (char) getNextChar();
+ if (low < LOW_SURROGATE_MIN_VALUE
+ || low > LOW_SURROGATE_MAX_VALUE) {
+ // illegal low surrogate
+ throw new InvalidInputException(
+ INVALID_LOW_SURROGATE);
+ }
+ isJavaIdStart = ScannerHelper
+ .isJavaIdentifierStart(c, low);
+ } else if (c >= LOW_SURROGATE_MIN_VALUE
+ && c <= LOW_SURROGATE_MAX_VALUE) {
+ if (this.complianceLevel < ClassFileConstants.JDK1_5) {
+ throw new InvalidInputException(
+ INVALID_UNICODE_ESCAPE);
+ }
+ throw new InvalidInputException(
+ INVALID_HIGH_SURROGATE);
+ } else {
+ isJavaIdStart = Character.isJavaIdentifierStart(c);
+ }
+ if (isJavaIdStart) {
+ scanIdentifierOrKeyword();
+ break NextToken;
+ }
+ if (isDigit(this.currentCharacter)) {
+ scanNumber(false);
+ break NextToken;
+ }
+ } catch (InvalidInputException ex) {
+ // ignore
+ }
+ }
+ }
+ // -----------------end switch while try--------------------
+ } catch (IndexOutOfBoundsException e) {
+ // ignore
+ } catch (InvalidInputException e) {
+ // ignore
+ }
+ return;
+ }
+
+ public final boolean jumpOverUnicodeWhiteSpace()
+ throws InvalidInputException {
+ // BOOLEAN
+ // handle the case of unicode. Jump over the next whiteSpace
+ // making startPosition pointing on the next available char
+ // On false, the currentCharacter is filled up with a potential
+ // correct char
+
+ try {
+ this.wasAcr = false;
+ getNextUnicodeChar();
+ return CharOperation.isWhitespace(this.currentCharacter);
+ } catch (IndexOutOfBoundsException e) {
+ this.currentPosition--;
+ throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ }
+ }
+
+ final char[] optimizedCurrentTokenSource1() {
+ // return always the same char[] build only once
+
+ // optimization at no speed cost of 99.5 % of the singleCharIdentifier
+ char charOne = this.source[this.startPosition];
+ switch (charOne) {
+ case 'a':
+ return charArray_a;
+ case 'b':
+ return charArray_b;
+ case 'c':
+ return charArray_c;
+ case 'd':
+ return charArray_d;
+ case 'e':
+ return charArray_e;
+ case 'f':
+ return charArray_f;
+ case 'g':
+ return charArray_g;
+ case 'h':
+ return charArray_h;
+ case 'i':
+ return charArray_i;
+ case 'j':
+ return charArray_j;
+ case 'k':
+ return charArray_k;
+ case 'l':
+ return charArray_l;
+ case 'm':
+ return charArray_m;
+ case 'n':
+ return charArray_n;
+ case 'o':
+ return charArray_o;
+ case 'p':
+ return charArray_p;
+ case 'q':
+ return charArray_q;
+ case 'r':
+ return charArray_r;
+ case 's':
+ return charArray_s;
+ case 't':
+ return charArray_t;
+ case 'u':
+ return charArray_u;
+ case 'v':
+ return charArray_v;
+ case 'w':
+ return charArray_w;
+ case 'x':
+ return charArray_x;
+ case 'y':
+ return charArray_y;
+ case 'z':
+ return charArray_z;
+ default:
+ return new char[] { charOne };
+ }
+ }
+
+ final char[] optimizedCurrentTokenSource2() {
+ // try to return the same char[] build only once
+
+ char[] src = this.source;
+ int start = this.startPosition;
+ char c0, c1;
+ int hash = (((c0 = src[start]) << 6) + (c1 = src[start + 1]))
+ % TableSize;
+ char[][] table = this.charArray_length[0][hash];
+ int i = newEntry2;
+ while (++i < InternalTableSize) {
+ char[] charArray = table[i];
+ if ((c0 == charArray[0]) && (c1 == charArray[1]))
+ return charArray;
+ }
+ // ---------other side---------
+ i = -1;
+ int max = newEntry2;
+ while (++i <= max) {
+ char[] charArray = table[i];
+ if ((c0 == charArray[0]) && (c1 == charArray[1]))
+ return charArray;
+ }
+ // --------add the entry-------
+ if (++max >= InternalTableSize)
+ max = 0;
+ char[] r;
+ System.arraycopy(src, start, r = new char[2], 0, 2);
+ // newIdentCount++;
+ return table[newEntry2 = max] = r; // (r = new char[] {c0, c1});
+ }
+
+ final char[] optimizedCurrentTokenSource3() {
+ // try to return the same char[] build only once
+
+ char[] src = this.source;
+ int start = this.startPosition;
+ char c0, c1 = src[start + 1], c2;
+ int hash = (((c0 = src[start]) << 6) + (c2 = src[start + 2]))
+ % TableSize;
+ // int hash = ((c0 << 12) + (c1<< 6) + c2) % TableSize;
+ char[][] table = this.charArray_length[1][hash];
+ int i = newEntry3;
+ while (++i < InternalTableSize) {
+ char[] charArray = table[i];
+ if ((c0 == charArray[0]) && (c1 == charArray[1])
+ && (c2 == charArray[2]))
+ return charArray;
+ }
+ // ---------other side---------
+ i = -1;
+ int max = newEntry3;
+ while (++i <= max) {
+ char[] charArray = table[i];
+ if ((c0 == charArray[0]) && (c1 == charArray[1])
+ && (c2 == charArray[2]))
+ return charArray;
+ }
+ // --------add the entry-------
+ if (++max >= InternalTableSize)
+ max = 0;
+ char[] r;
+ System.arraycopy(src, start, r = new char[3], 0, 3);
+ // newIdentCount++;
+ return table[newEntry3 = max] = r; // (r = new char[] {c0, c1, c2});
+ }
+
+ final char[] optimizedCurrentTokenSource4() {
+ // try to return the same char[] build only once
+
+ char[] src = this.source;
+ int start = this.startPosition;
+ char c0, c1 = src[start + 1], c2, c3 = src[start + 3];
+ int hash = (((c0 = src[start]) << 6) + (c2 = src[start + 2]))
+ % TableSize;
+ // int hash = (int) (((((long) c0) << 18) + (c1 << 12) + (c2 << 6) + c3)
+ // % TableSize);
+ char[][] table = this.charArray_length[2][hash];
+ int i = newEntry4;
+ while (++i < InternalTableSize) {
+ char[] charArray = table[i];
+ if ((c0 == charArray[0]) && (c1 == charArray[1])
+ && (c2 == charArray[2]) && (c3 == charArray[3]))
+ return charArray;
+ }
+ // ---------other side---------
+ i = -1;
+ int max = newEntry4;
+ while (++i <= max) {
+ char[] charArray = table[i];
+ if ((c0 == charArray[0]) && (c1 == charArray[1])
+ && (c2 == charArray[2]) && (c3 == charArray[3]))
+ return charArray;
+ }
+ // --------add the entry-------
+ if (++max >= InternalTableSize)
+ max = 0;
+ char[] r;
+ System.arraycopy(src, start, r = new char[4], 0, 4);
+ // newIdentCount++;
+ return table[newEntry4 = max] = r; // (r = new char[] {c0, c1, c2,
+ // c3});
+ }
+
+ final char[] optimizedCurrentTokenSource5() {
+ // try to return the same char[] build only once
+
+ char[] src = this.source;
+ int start = this.startPosition;
+ char c0, c1 = src[start + 1], c2, c3 = src[start + 3], c4;
+ int hash = (((c0 = src[start]) << 12) + ((c2 = src[start + 2]) << 6) + (c4 = src[start + 4]))
+ % TableSize;
+ // int hash = (int) (((((long) c0) << 24) + (((long) c1) << 18) + (c2 <<
+ // 12) + (c3 << 6) + c4) % TableSize);
+ char[][] table = this.charArray_length[3][hash];
+ int i = newEntry5;
+ while (++i < InternalTableSize) {
+ char[] charArray = table[i];
+ if ((c0 == charArray[0]) && (c1 == charArray[1])
+ && (c2 == charArray[2]) && (c3 == charArray[3])
+ && (c4 == charArray[4]))
+ return charArray;
+ }
+ // ---------other side---------
+ i = -1;
+ int max = newEntry5;
+ while (++i <= max) {
+ char[] charArray = table[i];
+ if ((c0 == charArray[0]) && (c1 == charArray[1])
+ && (c2 == charArray[2]) && (c3 == charArray[3])
+ && (c4 == charArray[4]))
+ return charArray;
+ }
+ // --------add the entry-------
+ if (++max >= InternalTableSize)
+ max = 0;
+ char[] r;
+ System.arraycopy(src, start, r = new char[5], 0, 5);
+ // newIdentCount++;
+ return table[newEntry5 = max] = r; // (r = new char[] {c0, c1, c2, c3,
+ // c4});
+ }
+
+ final char[] optimizedCurrentTokenSource6() {
+ // try to return the same char[] build only once
+
+ char[] src = this.source;
+ int start = this.startPosition;
+ char c0, c1 = src[start + 1], c2, c3 = src[start + 3], c4, c5 = src[start + 5];
+ int hash = (((c0 = src[start]) << 12) + ((c2 = src[start + 2]) << 6) + (c4 = src[start + 4]))
+ % TableSize;
+ // int hash = (int)(((((long) c0) << 32) + (((long) c1) << 24) +
+ // (((long) c2) << 18) + (c3 << 12) + (c4 << 6) + c5) % TableSize);
+ char[][] table = this.charArray_length[4][hash];
+ int i = newEntry6;
+ while (++i < InternalTableSize) {
+ char[] charArray = table[i];
+ if ((c0 == charArray[0]) && (c1 == charArray[1])
+ && (c2 == charArray[2]) && (c3 == charArray[3])
+ && (c4 == charArray[4]) && (c5 == charArray[5]))
+ return charArray;
+ }
+ // ---------other side---------
+ i = -1;
+ int max = newEntry6;
+ while (++i <= max) {
+ char[] charArray = table[i];
+ if ((c0 == charArray[0]) && (c1 == charArray[1])
+ && (c2 == charArray[2]) && (c3 == charArray[3])
+ && (c4 == charArray[4]) && (c5 == charArray[5]))
+ return charArray;
+ }
+ // --------add the entry-------
+ if (++max >= InternalTableSize)
+ max = 0;
+ char[] r;
+ System.arraycopy(src, start, r = new char[6], 0, 6);
+ // newIdentCount++;
+ return table[newEntry6 = max] = r; // (r = new char[] {c0, c1, c2, c3,
+ // c4, c5});
+ }
+
+ protected void parseTags(NLSLine line) {
+ String s = new String(getCurrentTokenSource());
+ int pos = s.indexOf(TAG_PREFIX);
+ int lineLength = line.size();
+ while (pos != -1) {
+ int start = pos + TAG_PREFIX_LENGTH;
+ int end = s.indexOf(TAG_POSTFIX, start);
+ if (end != -1) {
+ String index = s.substring(start, end);
+ int i = 0;
+ try {
+ i = Integer.parseInt(index) - 1; // Tags are one based
+ // not zero based.
+ } catch (NumberFormatException e) {
+ i = -1; // we don't want to consider this as a valid NLS tag
+ }
+ if (line.exists(i)) {
+ line.set(i, null);
+ }
+ }
+ pos = s.indexOf(TAG_PREFIX, start);
+ }
+
+ this.nonNLSStrings = new StringLiteral[lineLength];
+ int nonNLSCounter = 0;
+ for (Iterator iterator = line.iterator(); iterator.hasNext();) {
+ StringLiteral literal = (StringLiteral) iterator.next();
+ if (literal != null) {
+ this.nonNLSStrings[nonNLSCounter++] = literal;
+ }
+ }
+ if (nonNLSCounter == 0) {
+ this.nonNLSStrings = null;
+ this.currentLine = null;
+ return;
+ }
+ this.wasNonExternalizedStringLiteral = true;
+ if (nonNLSCounter != lineLength) {
+ System.arraycopy(this.nonNLSStrings, 0,
+ (this.nonNLSStrings = new StringLiteral[nonNLSCounter]), 0,
+ nonNLSCounter);
+ }
+ this.currentLine = null;
+ }
+
+ public final void pushLineSeparator() {
+ // see comment on isLineDelimiter(char) for the use of '\n' and '\r'
+ final int INCREMENT = 250;
+
+ if (this.checkNonExternalizedStringLiterals) {
+ // reinitialize the current line for non externalize strings purpose
+ this.currentLine = null;
+ }
+ // currentCharacter is at position currentPosition-1
+
+ // cr 000D
+ if (this.currentCharacter == '\r') {
+ int separatorPos = this.currentPosition - 1;
+ // TODO (olivier) david - why the following line was "if
+ // ((this.linePtr > 0) && (this.lineEnds[this.linePtr] >=
+ // separatorPos)) return;" ?
+ if ((this.linePtr >= 0)
+ && (this.lineEnds[this.linePtr] >= separatorPos))
+ return;
+ // System.out.println("CR-" + separatorPos);
+ int length = this.lineEnds.length;
+ if (++this.linePtr >= length)
+ System.arraycopy(this.lineEnds, 0,
+ this.lineEnds = new int[length + INCREMENT], 0, length);
+ this.lineEnds[this.linePtr] = separatorPos;
+ // look-ahead for merged cr+lf
+ try {
+ if (this.source[this.currentPosition] == '\n') {
+ // System.out.println("look-ahead LF-" +
+ // this.currentPosition);
+ this.lineEnds[this.linePtr] = this.currentPosition;
+ this.currentPosition++;
+ this.wasAcr = false;
+ } else {
+ this.wasAcr = true;
+ }
+ } catch (IndexOutOfBoundsException e) {
+ this.wasAcr = true;
+ }
+ } else {
+ // lf 000A
+ if (this.currentCharacter == '\n') { // must merge eventual cr
+ // followed by lf
+ if (this.wasAcr
+ && (this.lineEnds[this.linePtr] == (this.currentPosition - 2))) {
+ // System.out.println("merge LF-" + (this.currentPosition -
+ // 1));
+ this.lineEnds[this.linePtr] = this.currentPosition - 1;
+ } else {
+ int separatorPos = this.currentPosition - 1;
+ // TODO (olivier) david - why the following line was "if
+ // ((this.linePtr > 0) && (this.lineEnds[this.linePtr] >=
+ // separatorPos)) return;" ?
+ if ((this.linePtr >= 0)
+ && (this.lineEnds[this.linePtr] >= separatorPos))
+ return;
+ // System.out.println("LF-" + separatorPos);
+ int length = this.lineEnds.length;
+ if (++this.linePtr >= length)
+ System.arraycopy(this.lineEnds, 0,
+ this.lineEnds = new int[length + INCREMENT], 0,
+ length);
+ this.lineEnds[this.linePtr] = separatorPos;
+ }
+ this.wasAcr = false;
+ }
+ }
+ }
+
+ public final void pushUnicodeLineSeparator() {
+ if (this.checkNonExternalizedStringLiterals) {
+ // reinitialize the current line for non externalize strings purpose
+ this.currentLine = null;
+ }
+
+ // cr 000D
+ if (this.currentCharacter == '\r') {
+ if (this.source[this.currentPosition] == '\n') {
+ this.wasAcr = false;
+ } else {
+ this.wasAcr = true;
+ }
+ } else {
+ // lf 000A
+ if (this.currentCharacter == '\n') { // must merge eventual cr
+ // followed by lf
+ this.wasAcr = false;
+ }
+ }
+ }
+
+ public void recordComment(int token) {
+ // compute position
+ int stopPosition = this.currentPosition;
+ switch (token) {
+ case TokenNameCOMMENT_LINE:
+ stopPosition = -this.lastCommentLinePosition;
+ break;
+ case TokenNameCOMMENT_BLOCK:
+ stopPosition = -this.currentPosition;
+ break;
+ }
+
+ // a new comment is recorded
+ int length = this.commentStops.length;
+ if (++this.commentPtr >= length) {
+ int newLength = length + COMMENT_ARRAYS_SIZE * 10;
+ System.arraycopy(this.commentStops, 0,
+ this.commentStops = new int[newLength], 0, length);
+ System.arraycopy(this.commentStarts, 0,
+ this.commentStarts = new int[newLength], 0, length);
+ System.arraycopy(this.commentTagStarts, 0,
+ this.commentTagStarts = new int[newLength], 0, length);
+ }
+ this.commentStops[this.commentPtr] = stopPosition;
+ this.commentStarts[this.commentPtr] = this.startPosition;
+ }
+
+ public final void scanEscapeCharacter() throws InvalidInputException {
+ // the string with "\\u" is a legal string of two chars \ and u
+// thus we use a direct access to the source (for regular cases).
+ switch (this.currentCharacter) {
+ case 'b':
+ this.currentCharacter = '\b';
+ break;
+ case 't':
+ this.currentCharacter = '\t';
+ break;
+ case 'n':
+ this.currentCharacter = '\n';
+ break;
+ case 'f':
+ this.currentCharacter = '\f';
+ break;
+ case 'r':
+ this.currentCharacter = '\r';
+ break;
+ case '\"':
+ this.currentCharacter = '\"';
+ break;
+ case '\'':
+ this.currentCharacter = '\'';
+ break;
+ case '\\':
+ this.currentCharacter = '\\';
+ break;
+ default:
+ // -----------octal escape--------------
+ // OctalDigit
+ // OctalDigit OctalDigit
+ // ZeroToThree OctalDigit OctalDigit
+
+ int number = Character.getNumericValue(this.currentCharacter);
+ if (number >= 0 && number <= 7) {
+ boolean zeroToThreeNot = number > 3;
+ if (isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
+ int digit = Character
+ .getNumericValue(this.currentCharacter);
+ if (digit >= 0 && digit <= 7) {
+ number = (number * 8) + digit;
+ if (isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
+ if (zeroToThreeNot) {// has read \NotZeroToThree
+ // OctalDigit Digit -->
+ // ignore last character
+ this.currentPosition--;
+ } else {
+ digit = Character
+ .getNumericValue(this.currentCharacter);
+ if (digit >= 0 && digit <= 7) { // has read
+ // \ZeroToThree
+ // OctalDigit
+ // OctalDigit
+ number = (number * 8) + digit;
+ } else {// has read \ZeroToThree OctalDigit
+ // NonOctalDigit --> ignore last
+ // character
+ this.currentPosition--;
+ }
+ }
+ } else { // has read \OctalDigit NonDigit--> ignore
+ // last character
+ this.currentPosition--;
+ }
+ } else { // has read \OctalDigit NonOctalDigit--> ignore
+ // last character
+ this.currentPosition--;
+ }
+ } else { // has read \OctalDigit --> ignore last character
+ this.currentPosition--;
+ }
+ if (number > 255)
+ throw new InvalidInputException(INVALID_ESCAPE);
+ this.currentCharacter = (char) number;
+ } else
+ throw new InvalidInputException(INVALID_ESCAPE);
+ }
+ }
+
+ public int scanIdentifierOrKeyword() {
+ // test keywords
+
+ // first dispatch on the first char.
+ // then the length. If there are several
+ // keywors with the same length AND the same first char, then do another
+ // dispatch on the second char
+ this.useAssertAsAnIndentifier = false;
+ this.useEnumAsAnIndentifier = false;
+
+ char[] src = this.source;
+ identLoop: {
+ int pos, srcLength = this.source.length;
+ while (true) {
+ if ((pos = this.currentPosition) >= srcLength) // handle the
+ // obvious case
+ // upfront
+ break identLoop;
+ char c = src[pos];
+ if (c < MAX_OBVIOUS) {
+ switch (ObviousIdentCharNatures[c]) {
+ case C_LETTER:
+ case C_DIGIT:
+ if (this.withoutUnicodePtr != 0) {
+ this.currentCharacter = c;
+ unicodeStore();
+ }
+ this.currentPosition++;
+ break;
+
+ case C_SEPARATOR:
+ case C_SPACE:
+ this.currentCharacter = c;
+ break identLoop;
+
+ default:
+ // System.out.println("slow<=128: "+ c);
+ while (getNextCharAsJavaIdentifierPart()) {/* empty */
+ }
+ break identLoop;
+ }
+ } else {
+ // System.out.println("slow>>128: "+ c);
+ while (getNextCharAsJavaIdentifierPart()) {/* empty */
+ }
+ break identLoop;
+ }
+ }
+ }
+
+ int index, length;
+ char[] data;
+ if (this.withoutUnicodePtr == 0)
+
+ // quick test on length == 1 but not on length > 12 while most
+ // identifier
+ // have a length which is <= 12...but there are lots of identifier with
+ // only one char....
+
+ {
+ if ((length = this.currentPosition - this.startPosition) == 1)
+ return TokenNameIdentifier;
+ data = this.source;
+ index = this.startPosition;
+ } else {
+ if ((length = this.withoutUnicodePtr) == 1)
+ return TokenNameIdentifier;
+ data = this.withoutUnicodeBuffer;
+ index = 1;
+ }
+
+ switch (data[index]) {
+
+ case 'a':
+ switch (length) {
+ case 8: // abstract
+ if ((data[++index] == 'b') && (data[++index] == 's')
+ && (data[++index] == 't') && (data[++index] == 'r')
+ && (data[++index] == 'a') && (data[++index] == 'c')
+ && (data[++index] == 't')) {
+ return TokenNameabstract;
+ } else {
+ return TokenNameIdentifier;
+ }
+ case 6: // assert
+ if ((data[++index] == 's') && (data[++index] == 's')
+ && (data[++index] == 'e') && (data[++index] == 'r')
+ && (data[++index] == 't')) {
+ if (this.sourceLevel >= ClassFileConstants.JDK1_4) {
+ this.containsAssertKeyword = true;
+ return TokenNameassert;
+ } else {
+ this.useAssertAsAnIndentifier = true;
+ return TokenNameIdentifier;
+ }
+ } else {
+ return TokenNameIdentifier;
+ }
+ default:
+ return TokenNameIdentifier;
+ }
+ case 'b': // boolean break byte
+ switch (length) {
+ case 4:
+ if ((data[++index] == 'y') && (data[++index] == 't')
+ && (data[++index] == 'e'))
+ return TokenNamebyte;
+ else
+ return TokenNameIdentifier;
+ case 5:
+ if ((data[++index] == 'r') && (data[++index] == 'e')
+ && (data[++index] == 'a') && (data[++index] == 'k'))
+ return TokenNamebreak;
+ else
+ return TokenNameIdentifier;
+ case 7:
+ if ((data[++index] == 'o') && (data[++index] == 'o')
+ && (data[++index] == 'l') && (data[++index] == 'e')
+ && (data[++index] == 'a') && (data[++index] == 'n'))
+ return TokenNameboolean;
+ else
+ return TokenNameIdentifier;
+ default:
+ return TokenNameIdentifier;
+ }
+
+ case 'c': // case char catch const class continue
+ switch (length) {
+ case 4:
+ if (data[++index] == 'a')
+ if ((data[++index] == 's') && (data[++index] == 'e'))
+ return TokenNamecase;
+ else
+ return TokenNameIdentifier;
+ else if ((data[index] == 'h') && (data[++index] == 'a')
+ && (data[++index] == 'r'))
+ return TokenNamechar;
+ else
+ return TokenNameIdentifier;
+ case 5:
+ if (data[++index] == 'a')
+ if ((data[++index] == 't') && (data[++index] == 'c')
+ && (data[++index] == 'h'))
+ return TokenNamecatch;
+ else
+ return TokenNameIdentifier;
+ else if (data[index] == 'l')
+ if ((data[++index] == 'a') && (data[++index] == 's')
+ && (data[++index] == 's'))
+ return TokenNameclass;
+ else
+ return TokenNameIdentifier;
+ else if ((data[index] == 'o') && (data[++index] == 'n')
+ && (data[++index] == 's') && (data[++index] == 't'))
+ return TokenNameconst; // const is not used in java ???????
+ else
+ return TokenNameIdentifier;
+ case 8:
+ if ((data[++index] == 'o') && (data[++index] == 'n')
+ && (data[++index] == 't') && (data[++index] == 'i')
+ && (data[++index] == 'n') && (data[++index] == 'u')
+ && (data[++index] == 'e'))
+ return TokenNamecontinue;
+ else
+ return TokenNameIdentifier;
+ default:
+ return TokenNameIdentifier;
+ }
+
+ case 'd': // default do double
+ switch (length) {
+ case 2:
+ if ((data[++index] == 'o'))
+ return TokenNamedo;
+ else
+ return TokenNameIdentifier;
+ case 6:
+ if ((data[++index] == 'o') && (data[++index] == 'u')
+ && (data[++index] == 'b') && (data[++index] == 'l')
+ && (data[++index] == 'e'))
+ return TokenNamedouble;
+ else
+ return TokenNameIdentifier;
+ case 7:
+ if ((data[++index] == 'e') && (data[++index] == 'f')
+ && (data[++index] == 'a') && (data[++index] == 'u')
+ && (data[++index] == 'l') && (data[++index] == 't'))
+ return TokenNamedefault;
+ else
+ return TokenNameIdentifier;
+
+ default:
+ return TokenNameIdentifier;
+
+ }
+ case 'e': // else extends
+ switch (length) {
+ case 4:
+ if ((data[++index] == 'l') && (data[++index] == 's')
+ && (data[++index] == 'e'))
+ return TokenNameelse;
+ else if ((data[index] == 'n') && (data[++index] == 'u')
+ && (data[++index] == 'm')) {
+ if (this.sourceLevel >= ClassFileConstants.JDK1_5) {
+ return TokenNameenum;
+ } else {
+ this.useEnumAsAnIndentifier = true;
+ return TokenNameIdentifier;
+ }
+ } else {
+ return TokenNameIdentifier;
+ }
+ case 7:
+ if ((data[++index] == 'x') && (data[++index] == 't')
+ && (data[++index] == 'e') && (data[++index] == 'n')
+ && (data[++index] == 'd') && (data[++index] == 's'))
+ return TokenNameextends;
+ else
+ return TokenNameIdentifier;
+ default:
+ return TokenNameIdentifier;
+ }
+
+ case 'f': // final finally float for false
+ switch (length) {
+ case 3:
+ if ((data[++index] == 'o') && (data[++index] == 'r'))
+ return TokenNamefor;
+ else
+ return TokenNameIdentifier;
+ case 5:
+ if (data[++index] == 'i')
+ if ((data[++index] == 'n') && (data[++index] == 'a')
+ && (data[++index] == 'l')) {
+ return TokenNamefinal;
+ } else
+ return TokenNameIdentifier;
+ else if (data[index] == 'l')
+ if ((data[++index] == 'o') && (data[++index] == 'a')
+ && (data[++index] == 't'))
+ return TokenNamefloat;
+ else
+ return TokenNameIdentifier;
+ else if ((data[index] == 'a') && (data[++index] == 'l')
+ && (data[++index] == 's') && (data[++index] == 'e'))
+ return TokenNamefalse;
+ else
+ return TokenNameIdentifier;
+ case 7:
+ if ((data[++index] == 'i') && (data[++index] == 'n')
+ && (data[++index] == 'a') && (data[++index] == 'l')
+ && (data[++index] == 'l') && (data[++index] == 'y'))
+ return TokenNamefinally;
+ else
+ return TokenNameIdentifier;
+
+ default:
+ return TokenNameIdentifier;
+ }
+ case 'g': // goto
+ if (length == 4) {
+ if ((data[++index] == 'o') && (data[++index] == 't')
+ && (data[++index] == 'o')) {
+ return TokenNamegoto;
+ }
+ } // no goto in java are allowed, so why java removes this keyword
+ // ???
+ return TokenNameIdentifier;
+
+ case 'i': // if implements import instanceof int interface
+ switch (length) {
+ case 2:
+ if (data[++index] == 'f')
+ return TokenNameif;
+ else
+ return TokenNameIdentifier;
+ case 3:
+ if ((data[++index] == 'n') && (data[++index] == 't'))
+ return TokenNameint;
+ else
+ return TokenNameIdentifier;
+ case 7:
+ if ((data[++index] == 'n') && (data[++index] == 'c')
+ && (data[++index] == 'l') && (data[++index] == 'u')
+ && (data[++index] == 'd') && (data[++index] == 'e'))
+ return TokenNameinclude;
+ else
+ return TokenNameIdentifier;
+ case 9:
+ if ((data[++index] == 'n') && (data[++index] == 't')
+ && (data[++index] == 'e') && (data[++index] == 'r')
+ && (data[++index] == 'f') && (data[++index] == 'a')
+ && (data[++index] == 'c') && (data[++index] == 'e'))
+ return TokenNameinterface;
+ else
+ return TokenNameIdentifier;
+ case 10:
+ if (data[++index] == 'm')
+ if ((data[++index] == 'p') && (data[++index] == 'l')
+ && (data[++index] == 'e') && (data[++index] == 'm')
+ && (data[++index] == 'e') && (data[++index] == 'n')
+ && (data[++index] == 't') && (data[++index] == 's'))
+ return TokenNameimplements;
+ else
+ return TokenNameIdentifier;
+ else if ((data[index] == 'n') && (data[++index] == 's')
+ && (data[++index] == 't') && (data[++index] == 'a')
+ && (data[++index] == 'n') && (data[++index] == 'c')
+ && (data[++index] == 'e') && (data[++index] == 'o')
+ && (data[++index] == 'f'))
+ return TokenNameinstanceof;
+ else
+ return TokenNameIdentifier;
+
+ default:
+ return TokenNameIdentifier;
+ }
+
+ case 'l': // long
+ if (length == 4) {
+ if ((data[++index] == 'o') && (data[++index] == 'n')
+ && (data[++index] == 'g')) {
+ return TokenNamelong;
+ }
+ }
+ return TokenNameIdentifier;
+
+ case 'n': // native new null
+ switch (length) {
+ case 3:
+ if ((data[++index] == 'e') && (data[++index] == 'w'))
+ return TokenNamenew;
+ else
+ return TokenNameIdentifier;
+ case 4:
+ if ((data[++index] == 'u') && (data[++index] == 'l')
+ && (data[++index] == 'l'))
+ return TokenNamenull;
+ else
+ return TokenNameIdentifier;
+ case 6:
+ if ((data[++index] == 'a') && (data[++index] == 't')
+ && (data[++index] == 'i') && (data[++index] == 'v')
+ && (data[++index] == 'e')) {
+ return TokenNamenative;
+ } else
+ return TokenNameIdentifier;
+ default:
+ return TokenNameIdentifier;
+ }
+
+ case 'p': // package private protected public
+ switch (length) {
+ case 6:
+ if ((data[++index] == 'u') && (data[++index] == 'b')
+ && (data[++index] == 'l') && (data[++index] == 'i')
+ && (data[++index] == 'c')) {
+ return TokenNamepublic;
+ } else
+ return TokenNameIdentifier;
+ case 7:
+ if (data[++index] == 'a')
+ if ((data[++index] == 'c') && (data[++index] == 'k')
+ && (data[++index] == 'a') && (data[++index] == 'g')
+ && (data[++index] == 'e'))
+ return TokenNamepackage;
+ else
+ return TokenNameIdentifier;
+ else if ((data[index] == 'r') && (data[++index] == 'i')
+ && (data[++index] == 'v') && (data[++index] == 'a')
+ && (data[++index] == 't') && (data[++index] == 'e')) {
+ return TokenNameprivate;
+ } else
+ return TokenNameIdentifier;
+ case 9:
+ if ((data[++index] == 'r') && (data[++index] == 'o')
+ && (data[++index] == 't') && (data[++index] == 'e')
+ && (data[++index] == 'c') && (data[++index] == 't')
+ && (data[++index] == 'e') && (data[++index] == 'd')) {
+ return TokenNameprotected;
+ } else
+ return TokenNameIdentifier;
+
+ default:
+ return TokenNameIdentifier;
+ }
+
+ case 'r': // return
+ if (length == 6) {
+ if ((data[++index] == 'e') && (data[++index] == 't')
+ && (data[++index] == 'u') && (data[++index] == 'r')
+ && (data[++index] == 'n')) {
+ return TokenNamereturn;
+ }
+ }
+ return TokenNameIdentifier;
+
+ case 's': // short static super switch synchronized strictfp
+ switch (length) {
+ case 5:
+ if (data[++index] == 'h')
+ if ((data[++index] == 'o') && (data[++index] == 'r')
+ && (data[++index] == 't'))
+ return TokenNameshort;
+ else
+ return TokenNameIdentifier;
+ else if ((data[index] == 'u') && (data[++index] == 'p')
+ && (data[++index] == 'e') && (data[++index] == 'r'))
+ return TokenNamesuper;
+ else
+ return TokenNameIdentifier;
+
+ case 6:
+ if (data[++index] == 't')
+ if ((data[++index] == 'a') && (data[++index] == 't')
+ && (data[++index] == 'i') && (data[++index] == 'c')) {
+ return TokenNamestatic;
+ } else
+ return TokenNameIdentifier;
+ else if ((data[index] == 'w') && (data[++index] == 'i')
+ && (data[++index] == 't') && (data[++index] == 'c')
+ && (data[++index] == 'h'))
+ return TokenNameswitch;
+ else
+ return TokenNameIdentifier;
+ case 8:
+ if ((data[++index] == 't') && (data[++index] == 'r')
+ && (data[++index] == 'i') && (data[++index] == 'c')
+ && (data[++index] == 't') && (data[++index] == 'f')
+ && (data[++index] == 'p'))
+ return TokenNamestrictfp;
+ else
+ return TokenNameIdentifier;
+ case 12:
+ if ((data[++index] == 'y') && (data[++index] == 'n')
+ && (data[++index] == 'c') && (data[++index] == 'h')
+ && (data[++index] == 'r') && (data[++index] == 'o')
+ && (data[++index] == 'n') && (data[++index] == 'i')
+ && (data[++index] == 'z') && (data[++index] == 'e')
+ && (data[++index] == 'd')) {
+ return TokenNamesynchronized;
+ } else
+ return TokenNameIdentifier;
+ default:
+ return TokenNameIdentifier;
+ }
+
+ case 't': // try throw throws transient this true
+ switch (length) {
+ case 3:
+ if ((data[++index] == 'r') && (data[++index] == 'y'))
+ return TokenNametry;
+ else
+ return TokenNameIdentifier;
+ case 4:
+ if (data[++index] == 'h')
+ if ((data[++index] == 'i') && (data[++index] == 's'))
+ return TokenNamethis;
+ else
+ return TokenNameIdentifier;
+ else if ((data[index] == 'r') && (data[++index] == 'u')
+ && (data[++index] == 'e'))
+ return TokenNametrue;
+ else
+ return TokenNameIdentifier;
+ case 5:
+ if ((data[++index] == 'h') && (data[++index] == 'r')
+ && (data[++index] == 'o') && (data[++index] == 'w'))
+ return TokenNamethrow;
+ else
+ return TokenNameIdentifier;
+ case 6:
+ if ((data[++index] == 'h') && (data[++index] == 'r')
+ && (data[++index] == 'o') && (data[++index] == 'w')
+ && (data[++index] == 's'))
+ return TokenNamethrows;
+ else
+ return TokenNameIdentifier;
+ case 9:
+ if ((data[++index] == 'r') && (data[++index] == 'a')
+ && (data[++index] == 'n') && (data[++index] == 's')
+ && (data[++index] == 'i') && (data[++index] == 'e')
+ && (data[++index] == 'n') && (data[++index] == 't')) {
+ return TokenNametransient;
+ } else
+ return TokenNameIdentifier;
+
+ default:
+ return TokenNameIdentifier;
+ }
+
+ case 'v': // void volatile
+ switch (length) {
+ case 4:
+ if ((data[++index] == 'o') && (data[++index] == 'i')
+ && (data[++index] == 'd'))
+ return TokenNamevoid;
+ else
+ return TokenNameIdentifier;
+ case 8:
+ if ((data[++index] == 'o') && (data[++index] == 'l')
+ && (data[++index] == 'a') && (data[++index] == 't')
+ && (data[++index] == 'i') && (data[++index] == 'l')
+ && (data[++index] == 'e')) {
+ return TokenNamevolatile;
+ } else
+ return TokenNameIdentifier;
+
+ default:
+ return TokenNameIdentifier;
+ }
+
+ case 'w': // while widefp
+ switch (length) {
+ case 5:
+ if ((data[++index] == 'h') && (data[++index] == 'i')
+ && (data[++index] == 'l') && (data[++index] == 'e'))
+ return TokenNamewhile;
+ else
+ return TokenNameIdentifier;
+ // case 6:if ( (data[++index] =='i') && (data[++index]=='d') &&
+ // (data[++index]=='e') && (data[++index]=='f')&&
+ // (data[++index]=='p'))
+ // return TokenNamewidefp ;
+ // else
+ // return TokenNameIdentifier;
+ default:
+ return TokenNameIdentifier;
+ }
+
+ default:
+ return TokenNameIdentifier;
+ }
+ }
+
+ public int scanNumber(boolean dotPrefix) throws InvalidInputException {
+
+ // when entering this method the currentCharacter is the first
+ // digit of the number. It may be preceeded by a '.' when
+ // dotPrefix is true
+
+ boolean floating = dotPrefix;
+ if ((!dotPrefix) && (this.currentCharacter == '0')) {
+ if (getNextChar('x', 'X') >= 0) { // ----------hexa-----------------
+ int start = this.currentPosition;
+ while (getNextCharAsDigit(16)) {/* empty */
+ }
+ int end = this.currentPosition;
+ if (getNextChar('l', 'L') >= 0) {
+ if (end == start) {
+ throw new InvalidInputException(INVALID_HEXA);
+ }
+ return TokenNameLongLiteral;
+ } else if (getNextChar('.')) {
+ if (this.sourceLevel < ClassFileConstants.JDK1_5) {
+ if (end == start) {
+ throw new InvalidInputException(INVALID_HEXA);
+ }
+ this.currentPosition = end;
+ return TokenNameIntegerLiteral;
+ }
+ // hexadecimal floating point literal
+ // read decimal part
+ boolean hasNoDigitsBeforeDot = end == start;
+ start = this.currentPosition;
+ while (getNextCharAsDigit(16)) {/* empty */
+ }
+ end = this.currentPosition;
+ if (hasNoDigitsBeforeDot && end == start) {
+ throw new InvalidInputException(INVALID_HEXA);
+ }
+
+ if (getNextChar('p', 'P') >= 0) { // consume next
+ // character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+
+ if ((this.currentCharacter == '-')
+ || (this.currentCharacter == '+')) { // consume
+ // next
+ // character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ }
+ if (!isDigit(this.currentCharacter)) {
+ throw new InvalidInputException(INVALID_HEXA);
+ }
+ while (getNextCharAsDigit()) {/* empty */
+ }
+ if (getNextChar('f', 'F') >= 0) {
+ return TokenNameFloatingPointLiteral;
+ }
+ if (getNextChar('d', 'D') >= 0) {
+ return TokenNameDoubleLiteral;
+ }
+ if (getNextChar('l', 'L') >= 0) {
+ throw new InvalidInputException(INVALID_HEXA);
+ }
+ return TokenNameDoubleLiteral;
+ } else {
+ throw new InvalidInputException(INVALID_HEXA);
+ }
+ } else if (getNextChar('p', 'P') >= 0) { // consume next
+ // character
+ if (this.sourceLevel < ClassFileConstants.JDK1_5) {
+ // if we are in source level < 1.5 we report an integer
+ // literal
+ this.currentPosition = end;
+ return TokenNameIntegerLiteral;
+ }
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+
+ if ((this.currentCharacter == '-')
+ || (this.currentCharacter == '+')) { // consume
+ // next
+ // character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ }
+ if (!isDigit(this.currentCharacter))
+ throw new InvalidInputException(INVALID_FLOAT);
+ while (getNextCharAsDigit()) {/* empty */
+ }
+ if (getNextChar('f', 'F') >= 0)
+ return TokenNameFloatingPointLiteral;
+ if (getNextChar('d', 'D') >= 0)
+ return TokenNameDoubleLiteral;
+ if (getNextChar('l', 'L') >= 0) {
+ throw new InvalidInputException(INVALID_HEXA);
+ }
+ return TokenNameDoubleLiteral;
+ } else {
+ if (end == start)
+ throw new InvalidInputException(INVALID_HEXA);
+ return TokenNameIntegerLiteral;
+ }
+ }
+
+ // there is x or X in the number
+ // potential octal ! ... some one may write 000099.0 ! thus 00100 <
+ // 00078.0 is true !!!!! crazy language
+ if (getNextCharAsDigit()) { // -------------potential
+ // octal-----------------
+ while (getNextCharAsDigit()) {/* empty */
+ }
+
+ if (getNextChar('l', 'L') >= 0) {
+ return TokenNameLongLiteral;
+ }
+
+ if (getNextChar('f', 'F') >= 0) {
+ return TokenNameFloatingPointLiteral;
+ }
+
+ if (getNextChar('d', 'D') >= 0) {
+ return TokenNameDoubleLiteral;
+ } else { // make the distinction between octal and float ....
+ boolean isInteger = true;
+ if (getNextChar('.')) {
+ isInteger = false;
+ while (getNextCharAsDigit()) {/* empty */
+ }
+ }
+ if (getNextChar('e', 'E') >= 0) { // consume next
+ // character
+ isInteger = false;
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+
+ if ((this.currentCharacter == '-')
+ || (this.currentCharacter == '+')) { // consume
+ // next
+ // character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ }
+ if (!isDigit(this.currentCharacter))
+ throw new InvalidInputException(INVALID_FLOAT);
+ while (getNextCharAsDigit()) {/* empty */
+ }
+ }
+ if (getNextChar('f', 'F') >= 0)
+ return TokenNameFloatingPointLiteral;
+ if (getNextChar('d', 'D') >= 0 || !isInteger)
+ return TokenNameDoubleLiteral;
+ return TokenNameIntegerLiteral;
+ }
+ } else {
+ /* carry on */
+ }
+ }
+
+ while (getNextCharAsDigit()) {/* empty */
+ }
+
+ if ((!dotPrefix) && (getNextChar('l', 'L') >= 0))
+ return TokenNameLongLiteral;
+
+ if ((!dotPrefix) && (getNextChar('.'))) { // decimal part that can be
+ // empty
+ while (getNextCharAsDigit()) {/* empty */
+ }
+ floating = true;
+ }
+
+ // if floating is true both exponant and suffix may be optional
+
+ if (getNextChar('e', 'E') >= 0) {
+ floating = true;
+ // consume next character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+
+ if ((this.currentCharacter == '-')
+ || (this.currentCharacter == '+')) { // consume next
+ // character
+ this.unicodeAsBackSlash = false;
+ if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
+ && (this.source[this.currentPosition] == 'u')) {
+ getNextUnicodeChar();
+ } else {
+ if (this.withoutUnicodePtr != 0) {
+ unicodeStore();
+ }
+ }
+ }
+ if (!isDigit(this.currentCharacter))
+ throw new InvalidInputException(INVALID_FLOAT);
+ while (getNextCharAsDigit()) {/* empty */
+ }
+ }
+
+ if (getNextChar('d', 'D') >= 0)
+ return TokenNameDoubleLiteral;
+ if (getNextChar('f', 'F') >= 0)
+ return TokenNameFloatingPointLiteral;
+
+ // the long flag has been tested before
+
+ return floating ? TokenNameDoubleLiteral : TokenNameIntegerLiteral;
+ }
+
+ /**
+ * Search the line number corresponding to a specific position
+ *
+ * @param position
+ * int
+ * @return int
+ */
+ public final int getLineNumber(int position) {
+
+ if (this.lineEnds == null)
+ return 1;
+ int length = this.linePtr + 1;
+ if (length == 0)
+ return 1;
+ int g = 0, d = length - 1;
+ int m = 0;
+ while (g <= d) {
+ m = (g + d) / 2;
+ if (position < this.lineEnds[m]) {
+ d = m - 1;
+ } else if (position > this.lineEnds[m]) {
+ g = m + 1;
+ } else {
+ return m + 1;
+ }
+ }
+ if (position < this.lineEnds[m]) {
+ return m + 1;
+ }
+ return m + 2;
+ }
+
+ public final void setSource(char[] sourceString) {
+ // the source-buffer is set to sourceString
+
+ int sourceLength;
+ if (sourceString == null) {
+ this.source = CharOperation.NO_CHAR;
+ sourceLength = 0;
+ } else {
+ this.source = sourceString;
+ sourceLength = sourceString.length;
+ }
+ this.startPosition = -1;
+ this.eofPosition = sourceLength;
+ this.initialPosition = this.currentPosition = 0;
+ this.containsAssertKeyword = false;
+ this.linePtr = -1;
+ }
+
+ public String toString() {
+ if (this.startPosition == this.source.length)
+ return "EOF\n\n" + new String(this.source); //$NON-NLS-1$
+ if (this.currentPosition > this.source.length)
+ return "behind the EOF\n\n" + new String(this.source); //$NON-NLS-1$
+
+ char front[] = new char[this.startPosition];
+ System.arraycopy(this.source, 0, front, 0, this.startPosition);
+
+ int middleLength = (this.currentPosition - 1) - this.startPosition + 1;
+ char middle[];
+ if (middleLength > -1) {
+ middle = new char[middleLength];
+ System.arraycopy(this.source, this.startPosition, middle, 0,
+ middleLength);
+ } else {
+ middle = CharOperation.NO_CHAR;
+ }
+
+ char end[] = new char[this.source.length - (this.currentPosition - 1)];
+ System.arraycopy(this.source, (this.currentPosition - 1) + 1, end, 0,
+ this.source.length - (this.currentPosition - 1) - 1);
+
+ return new String(front)
+ + "\n===============================\nStarts here -->" //$NON-NLS-1$
+ + new String(middle)
+ + "<-- Ends here\n===============================\n" //$NON-NLS-1$
+ + new String(end);
+ }
+
+ public String toStringAction(int act) {
+ switch (act) {
+ case TokenNameIdentifier:
+ return "Identifier(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ case TokenNameabstract:
+ return "abstract"; //$NON-NLS-1$
+ case TokenNameboolean:
+ return "boolean"; //$NON-NLS-1$
+ case TokenNamebreak:
+ return "break"; //$NON-NLS-1$
+ case TokenNamebyte:
+ return "byte"; //$NON-NLS-1$
+ case TokenNamecase:
+ return "case"; //$NON-NLS-1$
+ case TokenNamecatch:
+ return "catch"; //$NON-NLS-1$
+ case TokenNamechar:
+ return "char"; //$NON-NLS-1$
+ case TokenNameclass:
+ return "class"; //$NON-NLS-1$
+ case TokenNamecontinue:
+ return "continue"; //$NON-NLS-1$
+ case TokenNamedefault:
+ return "default"; //$NON-NLS-1$
+ case TokenNamedo:
+ return "do"; //$NON-NLS-1$
+ case TokenNamedouble:
+ return "double"; //$NON-NLS-1$
+ case TokenNameelse:
+ return "else"; //$NON-NLS-1$
+ case TokenNameextends:
+ return "extends"; //$NON-NLS-1$
+ case TokenNamefalse:
+ return "false"; //$NON-NLS-1$
+ case TokenNamefinal:
+ return "final"; //$NON-NLS-1$
+ case TokenNamefinally:
+ return "finally"; //$NON-NLS-1$
+ case TokenNamefloat:
+ return "float"; //$NON-NLS-1$
+ case TokenNamefor:
+ return "for"; //$NON-NLS-1$
+ case TokenNameif:
+ return "if"; //$NON-NLS-1$
+ case TokenNameimplements:
+ return "implements"; //$NON-NLS-1$
+ case TokenNameinclude:
+ return "include"; //$NON-NLS-1$
+ case TokenNameinstanceof:
+ return "instanceof"; //$NON-NLS-1$
+ case TokenNameint:
+ return "int"; //$NON-NLS-1$
+ case TokenNameinterface:
+ return "interface"; //$NON-NLS-1$
+ case TokenNamelong:
+ return "long"; //$NON-NLS-1$
+ case TokenNamenative:
+ return "native"; //$NON-NLS-1$
+ case TokenNamenew:
+ return "new"; //$NON-NLS-1$
+ case TokenNamenull:
+ return "null"; //$NON-NLS-1$
+ case TokenNamepackage:
+ return "package"; //$NON-NLS-1$
+ case TokenNameprivate:
+ return "private"; //$NON-NLS-1$
+ case TokenNameprotected:
+ return "protected"; //$NON-NLS-1$
+ case TokenNamepublic:
+ return "public"; //$NON-NLS-1$
+ case TokenNamereturn:
+ return "return"; //$NON-NLS-1$
+ case TokenNameshort:
+ return "short"; //$NON-NLS-1$
+ case TokenNamestatic:
+ return "static"; //$NON-NLS-1$
+ case TokenNamesuper:
+ return "super"; //$NON-NLS-1$
+ case TokenNameswitch:
+ return "switch"; //$NON-NLS-1$
+ case TokenNamesynchronized:
+ return "synchronized"; //$NON-NLS-1$
+ case TokenNamethis:
+ return "this"; //$NON-NLS-1$
+ case TokenNamethrow:
+ return "throw"; //$NON-NLS-1$
+ case TokenNamethrows:
+ return "throws"; //$NON-NLS-1$
+ case TokenNametransient:
+ return "transient"; //$NON-NLS-1$
+ case TokenNametrue:
+ return "true"; //$NON-NLS-1$
+ case TokenNametry:
+ return "try"; //$NON-NLS-1$
+ case TokenNamevoid:
+ return "void"; //$NON-NLS-1$
+ case TokenNamevolatile:
+ return "volatile"; //$NON-NLS-1$
+ case TokenNamewhile:
+ return "while"; //$NON-NLS-1$
+
+ case TokenNameIntegerLiteral:
+ return "Integer(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ case TokenNameLongLiteral:
+ return "Long(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ case TokenNameFloatingPointLiteral:
+ return "Float(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ case TokenNameDoubleLiteral:
+ return "Double(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ case TokenNameCharacterLiteral:
+ return "Char(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ case TokenNameStringLiteral:
+ return "String(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ case TokenNamePLUS_PLUS:
+ return "++"; //$NON-NLS-1$
+ case TokenNameMINUS_MINUS:
+ return "--"; //$NON-NLS-1$
+ case TokenNameEQUAL_EQUAL:
+ return "=="; //$NON-NLS-1$
+ case TokenNameLESS_EQUAL:
+ return "<="; //$NON-NLS-1$
+ case TokenNameGREATER_EQUAL:
+ return ">="; //$NON-NLS-1$
+ case TokenNameNOT_EQUAL:
+ return "!="; //$NON-NLS-1$
+ case TokenNameLEFT_SHIFT:
+ return "<<"; //$NON-NLS-1$
+ case TokenNameRIGHT_SHIFT:
+ return ">>"; //$NON-NLS-1$
+ case TokenNameUNSIGNED_RIGHT_SHIFT:
+ return ">>>"; //$NON-NLS-1$
+ case TokenNamePLUS_EQUAL:
+ return "+="; //$NON-NLS-1$
+ case TokenNameMINUS_EQUAL:
+ return "-="; //$NON-NLS-1$
+ case TokenNameMULTIPLY_EQUAL:
+ return "*="; //$NON-NLS-1$
+ case TokenNameDIVIDE_EQUAL:
+ return "/="; //$NON-NLS-1$
+ case TokenNameAND_EQUAL:
+ return "&="; //$NON-NLS-1$
+ case TokenNameOR_EQUAL:
+ return "|="; //$NON-NLS-1$
+ case TokenNameXOR_EQUAL:
+ return "^="; //$NON-NLS-1$
+ case TokenNameREMAINDER_EQUAL:
+ return "%="; //$NON-NLS-1$
+ case TokenNameLEFT_SHIFT_EQUAL:
+ return "<<="; //$NON-NLS-1$
+ case TokenNameRIGHT_SHIFT_EQUAL:
+ return ">>="; //$NON-NLS-1$
+ case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL:
+ return ">>>="; //$NON-NLS-1$
+ case TokenNameOR_OR:
+ return "||"; //$NON-NLS-1$
+ case TokenNameAND_AND:
+ return "&&"; //$NON-NLS-1$
+ case TokenNamePLUS:
+ return "+"; //$NON-NLS-1$
+ case TokenNameMINUS:
+ return "-"; //$NON-NLS-1$
+ case TokenNameNOT:
+ return "!"; //$NON-NLS-1$
+ case TokenNameREMAINDER:
+ return "%"; //$NON-NLS-1$
+ case TokenNameXOR:
+ return "^"; //$NON-NLS-1$
+ case TokenNameAND:
+ return "&"; //$NON-NLS-1$
+ case TokenNameMULTIPLY:
+ return "*"; //$NON-NLS-1$
+ case TokenNameOR:
+ return "|"; //$NON-NLS-1$
+ case TokenNameTWIDDLE:
+ return "~"; //$NON-NLS-1$
+ case TokenNameDIVIDE:
+ return "/"; //$NON-NLS-1$
+ case TokenNameGREATER:
+ return ">"; //$NON-NLS-1$
+ case TokenNameLESS:
+ return "<"; //$NON-NLS-1$
+ case TokenNameLPAREN:
+ return "("; //$NON-NLS-1$
+ case TokenNameRPAREN:
+ return ")"; //$NON-NLS-1$
+ case TokenNameLBRACE:
+ return "{"; //$NON-NLS-1$
+ case TokenNameRBRACE:
+ return "}"; //$NON-NLS-1$
+ case TokenNameLBRACKET:
+ return "["; //$NON-NLS-1$
+ case TokenNameRBRACKET:
+ return "]"; //$NON-NLS-1$
+ case TokenNameSEMICOLON:
+ return ";"; //$NON-NLS-1$
+ case TokenNameQUESTION:
+ return "?"; //$NON-NLS-1$
+ case TokenNameCOLON:
+ return ":"; //$NON-NLS-1$
+ case TokenNameCOMMA:
+ return ","; //$NON-NLS-1$
+ case TokenNameDOT:
+ return "."; //$NON-NLS-1$
+ case TokenNameEQUAL:
+ return "="; //$NON-NLS-1$
+ case TokenNameEOF:
+ return "EOF"; //$NON-NLS-1$
+ case TokenNameWHITESPACE:
+ return "white_space(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ default:
+ return "not-a-token"; //$NON-NLS-1$
+ }
+ }
+
+ public void unicodeInitializeBuffer(int length) {
+ this.withoutUnicodePtr = length;
+ if (this.withoutUnicodeBuffer == null)
+ this.withoutUnicodeBuffer = new char[length + (1 + 10)];
+ int bLength = this.withoutUnicodeBuffer.length;
+ if (1 + length >= bLength) {
+ System.arraycopy(this.withoutUnicodeBuffer, 0,
+ this.withoutUnicodeBuffer = new char[length + (1 + 10)], 0,
+ bLength);
+ }
+ System.arraycopy(this.source, this.startPosition,
+ this.withoutUnicodeBuffer, 1, length);
+ }
+
+ public void unicodeStore() {
+ int pos = ++this.withoutUnicodePtr;
+ if (this.withoutUnicodeBuffer == null)
+ this.withoutUnicodeBuffer = new char[10];
+ int length = this.withoutUnicodeBuffer.length;
+ if (pos == length) {
+ System
+ .arraycopy(this.withoutUnicodeBuffer, 0,
+ this.withoutUnicodeBuffer = new char[length * 2],
+ 0, length);
+ }
+ this.withoutUnicodeBuffer[pos] = this.currentCharacter;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/KeyValuePair.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/KeyValuePair.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/KeyValuePair.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+package copiedFromJDT.internal.corext.refactoring.nls;
+
+public class KeyValuePair {
+
+ public String fKey;
+ public String fValue;
+
+ public KeyValuePair(String key, String value) {
+ fKey= key;
+ fValue= value;
+ }
+
+ public String getKey() {
+ return fKey;
+ }
+
+ public void setKey(String key) {
+ fKey= key;
+ }
+
+ public String getValue() {
+ return fValue;
+ }
+
+ public void setValue(String value) {
+ fValue= value;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSElement.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSElement.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSElement.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+package copiedFromJDT.internal.corext.refactoring.nls;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.text.Region;
+
+public class NLSElement {
+
+ public static final String TAG_PREFIX= "//$NON-NLS-"; //$NON-NLS-1$
+ public static final int TAG_PREFIX_LENGTH= TAG_PREFIX.length();
+ public static final String TAG_POSTFIX= "$"; //$NON-NLS-1$
+ public static final int TAG_POSTFIX_LENGTH= TAG_POSTFIX.length();
+
+ /** The original string denoted by the position */
+ private String fValue;
+ /** The position of the original string */
+ private Region fPosition;
+
+ /** Position of the // $NON_NLS_*$ tag */
+ private Region fTagPosition;
+
+ /** Index of the Element in an NLSLine */
+ private int fIndex;
+
+ /**
+ * Creates a new NLS element for the given string and position.
+ */
+ public NLSElement(String value, int start, int length, int index) {
+ fValue= value;
+ fIndex= index;
+ Assert.isNotNull(fValue);
+ fPosition= new Region(start, length);
+ }
+
+ /**
+ * Returns the position of the string to be NLSed.
+ * @return Returns the position of the string to be NLSed
+ */
+ public Region getPosition() {
+ return fPosition;
+ }
+
+ /**
+ * Returns the actual string value.
+ * @return the actual string value
+ */
+ public String getValue() {
+ return fValue;
+ }
+
+ /**
+ * Sets the actual string value.
+ */
+ public void setValue(String value) {
+ fValue= value;
+ }
+
+ /**
+ * Sets the tag position if one is associated with the NLS element.
+ */
+ public void setTagPosition(int start, int length) {
+ fTagPosition= new Region(start, length);
+ }
+
+ /**
+ * Returns the tag position for this element. The method can return <code>null</code>.
+ * In this case no tag has been found for this NLS element.
+ */
+ public Region getTagPosition() {
+ return fTagPosition;
+ }
+
+ /**
+ * Returns <code>true</code> if the NLS element has an asscociated $NON-NLS-*$ tag.
+ * Otherwise <code>false</code> is returned.
+ */
+ public boolean hasTag() {
+ return fTagPosition != null && fTagPosition.getLength() > 0;
+ }
+
+ public static String createTagText(int index) {
+ return TAG_PREFIX + index + TAG_POSTFIX;
+ }
+
+ public String getTagText() {
+ return TAG_PREFIX + (fIndex + 1) + TAG_POSTFIX;
+ }
+
+ /* (Non-Javadoc)
+ * Method declared in Object.
+ * only for debugging
+ */
+ public String toString() {
+ return fPosition + ": " + fValue + " Tag position: " + //$NON-NLS-2$ //$NON-NLS-1$
+ (hasTag() ? fTagPosition.toString() : "no tag found"); //$NON-NLS-1$
+ }
+
+}
+
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSLine.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSLine.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSLine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+package copiedFromJDT.internal.corext.refactoring.nls;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+
+public class NLSLine {
+
+ private int fLineNumber;
+ private List fElements;
+
+ public NLSLine(int lineNumber) {
+ fLineNumber= lineNumber;
+ Assert.isTrue(fLineNumber >= 0);
+ fElements= new ArrayList();
+ }
+
+ public int getLineNumber() {
+ return fLineNumber;
+ }
+
+ /**
+ * Adds a NLS element to this line.
+ */
+ public void add(NLSElement element) {
+ Assert.isNotNull(element);
+ fElements.add(element);
+ }
+
+ public NLSElement[] getElements() {
+ return (NLSElement[]) fElements.toArray(new NLSElement[fElements.size()]);
+ }
+
+ public NLSElement get(int index) {
+ return (NLSElement)fElements.get(index);
+ }
+
+ public boolean exists(int index) {
+ return index >= 0 && index < fElements.size();
+ }
+
+ public int size(){
+ return fElements.size();
+ }
+
+ /* non javaDoc
+ * only for debugging
+ * @see Object#toString()
+ */
+ public String toString() {
+ StringBuffer result= new StringBuffer();
+ result.append("Line: " + fLineNumber + "\n"); //$NON-NLS-2$ //$NON-NLS-1$
+ for (Iterator iter= fElements.iterator(); iter.hasNext(); ) {
+ result.append("\t"); //$NON-NLS-1$
+ result.append(iter.next().toString());
+ result.append("\n"); //$NON-NLS-1$
+ }
+ return result.toString();
+ }
+}
+
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSScanner.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSScanner.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSScanner.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+package copiedFromJDT.internal.corext.refactoring.nls;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+
+import copiedFromJDT.core.ToolFactory;
+import copiedFromJDT.core.compiler.IScanner;
+import copiedFromJDT.core.compiler.InvalidInputException;
+
+
+public class NLSScanner {
+
+ //no instances
+ private NLSScanner() {
+ }
+
+ private final static int TokenNameEOF = 158;
+ private final static int TokenNameStringLiteral = 45;
+ private final static int TokenNameCOMMENT_LINE = 1001;
+
+ /**
+ * Returns a list of NLSLines found in the string
+ */
+ public static NLSLine[] scan(String s) throws InvalidInputException {
+ return scan(s.toCharArray());
+ }
+
+ private static NLSLine[] scan(char[] content) throws InvalidInputException {
+ List lines= new ArrayList();
+ IScanner scanner= ToolFactory.createScanner(true, true, false, true);
+ scanner.setSource(content);
+ int token= scanner.getNextToken();
+ int currentLineNr= -1;
+ int previousLineNr= -1;
+ NLSLine currentLine= null;
+ int nlsElementIndex= 0;
+
+ while (token != TokenNameEOF) {
+ switch (token) {
+ case TokenNameStringLiteral:
+ currentLineNr= scanner.getLineNumber(scanner.getCurrentTokenStartPosition());
+ if (currentLineNr != previousLineNr) {
+ currentLine= new NLSLine(currentLineNr - 1);
+ lines.add(currentLine);
+ previousLineNr= currentLineNr;
+ nlsElementIndex= 0;
+ }
+ String value= new String(scanner.getCurrentTokenSource());
+ currentLine.add(
+ new NLSElement(
+ value,
+ scanner.getCurrentTokenStartPosition(),
+ scanner.getCurrentTokenEndPosition() + 1 - scanner.getCurrentTokenStartPosition(),
+ nlsElementIndex++));
+ break;
+ case TokenNameCOMMENT_LINE:
+ if (currentLineNr != scanner.getLineNumber(scanner.getCurrentTokenStartPosition()))
+ break;
+
+ parseTags(currentLine, scanner);
+ break;
+ }
+ token= scanner.getNextToken();
+ }
+ NLSLine[] result;
+ try {
+ result= (NLSLine[]) lines.toArray(new NLSLine[lines.size()]);
+ IDocument document= new Document(String.valueOf(scanner.getSource()));
+ for (int i= 0; i < result.length; i++) {
+ setTagPositions(document, result[i]);
+ }
+ } catch (BadLocationException exception) {
+ throw new InvalidInputException();
+ }
+ return result;
+ }
+
+ private static void parseTags(NLSLine line, IScanner scanner) {
+ String s= new String(scanner.getCurrentTokenSource());
+ int pos= s.indexOf(NLSElement.TAG_PREFIX);
+ while (pos != -1) {
+ int start= pos + NLSElement.TAG_PREFIX_LENGTH;
+ int end= s.indexOf(NLSElement.TAG_POSTFIX, start);
+ if (end < 0)
+ return; //no error recovery
+
+ String index= s.substring(start, end);
+ int i= 0;
+ try {
+ i= Integer.parseInt(index) - 1; // Tags are one based not zero based.
+ } catch (NumberFormatException e) {
+ return; //ignore the exception - no error recovery
+ }
+ if (line.exists(i)) {
+ NLSElement element= line.get(i);
+ element.setTagPosition(scanner.getCurrentTokenStartPosition() + pos, end - pos + 1);
+ } else {
+ return; //no error recovery
+ }
+ pos= s.indexOf(NLSElement.TAG_PREFIX, start);
+ }
+ }
+
+ private static void setTagPositions(IDocument document, NLSLine line) throws BadLocationException {
+ IRegion info= document.getLineInformation(line.getLineNumber());
+ int defaultValue= info.getOffset() + info.getLength();
+ NLSElement[] elements= line.getElements();
+ for (int i= 0; i < elements.length; i++) {
+ NLSElement element= elements[i];
+ if (!element.hasTag()) {
+ element.setTagPosition(computeInsertOffset(elements, i, defaultValue), 0);
+ }
+ }
+ }
+
+ private static int computeInsertOffset(NLSElement[] elements, int index, int defaultValue) {
+ NLSElement previousTagged= findPreviousTagged(index, elements);
+ if (previousTagged != null)
+ return previousTagged.getTagPosition().getOffset() + previousTagged.getTagPosition().getLength();
+ NLSElement nextTagged= findNextTagged(index, elements);
+ if (nextTagged != null)
+ return nextTagged.getTagPosition().getOffset();
+ return defaultValue;
+ }
+
+ private static NLSElement findPreviousTagged(int startIndex, NLSElement[] elements){
+ int i= startIndex - 1;
+ while (i >= 0){
+ if (elements[i].hasTag())
+ return elements[i];
+ i--;
+ }
+ return null;
+ }
+
+ private static NLSElement findNextTagged(int startIndex, NLSElement[] elements){
+ int i= startIndex + 1;
+ while (i < elements.length){
+ if (elements[i].hasTag())
+ return elements[i];
+ i++;
+ }
+ return null;
+ }
+}
+
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSSubstitution.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSSubstitution.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/corext/refactoring/nls/NLSSubstitution.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,332 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+package copiedFromJDT.internal.corext.refactoring.nls;
+
+import java.util.Properties;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Assert;
+
+
+public class NLSSubstitution {
+ public static final int EXTERNALIZED= 0;
+ public static final int IGNORED= 1;
+ public static final int INTERNALIZED= 2;
+
+ public static final int DEFAULT= EXTERNALIZED;
+ public static final int STATE_COUNT= 3;
+
+ private int fState;
+ private String fKey;
+ /**
+ * @since 3.1
+ */
+ private String fCachedPrefixPlusKey;
+ private String fValue;
+
+ private int fInitialState;
+ private String fInitialKey;
+ private String fInitialValue;
+
+ private NLSElement fNLSElement;
+ private String fNewAccessorClassName;
+
+ private String fPrefix= ""; //$NON-NLS-1$
+
+ private IResource fResource;
+
+ public NLSSubstitution(int state, String value, NLSElement element, IResource resource) {
+ fNLSElement= element;
+ fValue= value;
+ fState= state;
+ fInitialState= state;
+ fInitialValue= value;
+ fCachedPrefixPlusKey= null;
+ fResource = resource;
+ Assert.isTrue(state == EXTERNALIZED || state == IGNORED || state == INTERNALIZED);
+ }
+
+ //util
+ public static int countItems(NLSSubstitution[] elems, int task) {
+ Assert.isTrue(task == NLSSubstitution.EXTERNALIZED || task == NLSSubstitution.IGNORED || task == NLSSubstitution.INTERNALIZED);
+ int result= 0;
+ for (int i= 0; i < elems.length; i++) {
+ if (elems[i].fState == task) {
+ result++;
+ }
+ }
+ return result;
+ }
+
+ public NLSElement getNLSElement() {
+ return fNLSElement;
+ }
+
+ public String getKeyWithoutPrefix() {
+ return fKey;
+ }
+
+ /**
+ * Returns key dependent on state.
+ * @return prefix + key when
+ */
+ public String getKey() {
+ if ((fState == EXTERNALIZED) && hasStateChanged()) {
+ if (fCachedPrefixPlusKey == null) {
+ int length= 0;
+ if (fPrefix != null)
+ length= length + fPrefix.length();
+ if (fKey != null)
+ length= length + fKey.length();
+ StringBuffer sb= new StringBuffer(length);
+ sb.append(fPrefix);
+ sb.append(fKey);
+ fCachedPrefixPlusKey= sb.toString();
+ }
+ return fCachedPrefixPlusKey;
+ }
+ return fKey;
+ }
+
+ public void setKey(String key) {
+ if (fState != EXTERNALIZED) {
+ throw new IllegalStateException("Must be in Externalized State !"); //$NON-NLS-1$
+ }
+ fCachedPrefixPlusKey= null;
+ fKey= key;
+ }
+
+ public void setValue(String value) {
+ fValue= value;
+ }
+
+ public void setInitialValue(String value) {
+ fInitialValue= value;
+ }
+
+ /**
+ * Value can be null.
+ */
+ public IResource getIResource() {
+ return fResource;
+ }
+
+ /**
+ * Value can be null.
+ */
+ public String getValue() {
+ return fValue;
+ }
+
+ public String getValueNonEmpty() {
+ if (fValue == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return fValue;
+ }
+
+ public int getState() {
+ return fState;
+ }
+
+ public void setState(int state) {
+ fCachedPrefixPlusKey= null;
+ fState= state;
+ }
+
+ public void setUpdatedAccessor(String accessorClassName) {
+ fNewAccessorClassName= accessorClassName;
+ }
+
+ public String getUpdatedAccessor() {
+ return fNewAccessorClassName;
+ }
+
+ public boolean hasStateChanged() {
+ return fState != fInitialState;
+ }
+
+ public boolean isKeyRename() {
+ return (fInitialKey != null && !fInitialKey.equals(fKey));
+ }
+
+ public boolean isValueRename() {
+ return (fInitialValue != null && !fInitialValue.equals(fValue));
+ }
+
+ public boolean isAccessorRename() {
+ return (fNewAccessorClassName != null);
+ }
+
+
+ public boolean hasPropertyFileChange() {
+ if (fInitialState != EXTERNALIZED && fState != EXTERNALIZED) {
+ return false;
+ }
+ if (fInitialState != fState) {
+ return true;
+ }
+ if (fState == EXTERNALIZED) {
+ if (fInitialValue == null) {
+ return true; // recreate entry in property file
+ } else if (!fInitialValue.equals(fValue)) {
+ return true; // change of value
+ }
+ if (!fInitialKey.equals(fKey)) {
+ return true; // change of key
+ }
+ }
+ return false;
+ }
+
+ public boolean hasAccessorClassChange() {
+ if (fInitialState != EXTERNALIZED && fState != EXTERNALIZED) {
+ return false;
+ }
+ if (fInitialState != fState) {
+ return true;
+ }
+ if (fState == EXTERNALIZED) {
+ if (fInitialValue == null) {
+ return true; // recreate entry in property file
+ } else if (!fInitialValue.equals(fValue)) {
+ return false; // change of value
+ }
+ if (!fInitialKey.equals(fKey)) {
+ return true; // change of key
+ }
+ }
+ return false;
+ }
+
+ public boolean hasSourceChange() {
+ if (hasStateChanged()) {
+ return true;
+ }
+ if (fState == EXTERNALIZED) {
+ if (!fInitialKey.equals(fKey)) {
+ return true; // change of key
+ }
+ if (isAccessorRename()) {
+ return true;
+ }
+ } else {
+ if (!fInitialValue.equals(fValue)) {
+ return true; // change of value
+ }
+ }
+ return false;
+ }
+
+ public int getInitialState() {
+ return fInitialState;
+ }
+
+ public String getInitialKey() {
+ return fInitialKey;
+ }
+
+ public String getInitialValue() {
+ return fInitialValue;
+ }
+
+ /**
+ * Sets the prefix.
+ */
+ public void setPrefix(String prefix) {
+ fPrefix= prefix;
+ fCachedPrefixPlusKey= null;
+ }
+
+ public boolean isConflicting(NLSSubstitution[] substitutions) {
+ if (fState == EXTERNALIZED) {
+ String currKey= getKey();
+ String currValue= getValueNonEmpty();
+ for (int i= 0; i < substitutions.length; i++) {
+ NLSSubstitution substitution= substitutions[i];
+ if (substitution != this && substitution.getState() == EXTERNALIZED) {
+ // same key but different value
+ if (currKey.equals(substitution.getKey()) && !currValue.equals(substitution.getValueNonEmpty())) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private String internalGetKeyWithoutPrefix() {
+ if (fState == EXTERNALIZED && fPrefix != null && fKey != null && fKey.indexOf(fPrefix) == 0)
+ return fKey.substring(fPrefix.length());
+ return fKey;
+ }
+
+ public void generateKey(NLSSubstitution[] substitutions) {
+ if (fState != EXTERNALIZED || ((fState == EXTERNALIZED) && hasStateChanged())) {
+ int min= Integer.MAX_VALUE;
+ int max= Integer.MIN_VALUE;
+
+ for (int i= 0; i < substitutions.length; i++) {
+ NLSSubstitution substitution= substitutions[i];
+ if (substitution == this || substitution.fState != EXTERNALIZED)
+ continue;
+ try {
+ int value= Integer.parseInt(substitution.internalGetKeyWithoutPrefix());
+ min= Math.min(min, value);
+ max= Math.max(max, value);
+ } catch (NumberFormatException ex) {
+
+ }
+ }
+
+ fCachedPrefixPlusKey= null;
+ if (min == Integer.MAX_VALUE)
+ fKey= createKey(0);
+ else if (min > 0)
+ fKey= createKey(min-1);
+ else
+ fKey= createKey(max + 1);
+ }
+ }
+
+ public static void updateSubtitutions(NLSSubstitution[] substitutions, Properties props, String accessorClassName) {
+ for (int i= 0; i < substitutions.length; i++) {
+ NLSSubstitution substitution= substitutions[i];
+ if ((substitution.getState() == NLSSubstitution.EXTERNALIZED) && !substitution.hasStateChanged()) {
+ substitution.setInitialValue(props.getProperty(substitution.getKey()));
+ substitution.setUpdatedAccessor(accessorClassName);
+ }
+ }
+ }
+
+ public void revert() {
+ fState= fInitialState;
+ fKey= fInitialKey;
+ fCachedPrefixPlusKey= null;
+ fValue= fInitialValue;
+ }
+
+ private String createKey(int counter) {
+ return String.valueOf(counter);
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/CopiedFromJDTPluginImages.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/CopiedFromJDTPluginImages.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/CopiedFromJDTPluginImages.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.internal.ui;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+
+public class CopiedFromJDTPluginImages {
+
+ private static final String PREFIX = "./icons/full/obj16";
+
+ // The plug-in registry
+ private static ImageRegistry fgImageRegistry= null;
+ private static HashMap fgAvoidSWTErrorMap= null;
+
+ public static final String IMG_OBJS_NLS_TRANSLATE= "translate.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_NLS_NEVER_TRANSLATE= "never_translate.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_NLS_SKIP= "skip.gif"; //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_OBJS_NLS_TRANSLATE= createManaged(PREFIX, IMG_OBJS_NLS_TRANSLATE);
+ public static final ImageDescriptor DESC_OBJS_NLS_NEVER_TRANSLATE= createManaged(PREFIX, IMG_OBJS_NLS_NEVER_TRANSLATE);
+ public static final ImageDescriptor DESC_OBJS_NLS_SKIP= createManaged(PREFIX, IMG_OBJS_NLS_SKIP);
+
+
+ /*
+ * Helper method to access the image registry from the JavaPlugin class.
+ */
+ /* package */ static ImageRegistry getImageRegistry() {
+ if (fgImageRegistry == null) {
+ fgImageRegistry= new ImageRegistry();
+ for (Iterator iter= fgAvoidSWTErrorMap.keySet().iterator(); iter.hasNext();) {
+ String key= (String) iter.next();
+ fgImageRegistry.put(key, (ImageDescriptor) fgAvoidSWTErrorMap.get(key));
+ }
+ fgAvoidSWTErrorMap= null;
+ }
+ return fgImageRegistry;
+ }
+
+ /**
+ * Returns the image managed under the given key in this registry.
+ *
+ * @param key the image's key
+ * @return the image managed under the given key
+ */
+ public static Image get(String key) {
+ return getImageRegistry().get(key);
+ }
+
+ private static ImageDescriptor createManaged(String prefix, String name) {
+ ImageDescriptor result= UIActivator.getImageDescriptor(prefix + name);
+ if (fgAvoidSWTErrorMap == null) {
+ fgAvoidSWTErrorMap= new HashMap();
+ }
+ fgAvoidSWTErrorMap.put(name, result);
+ if (fgImageRegistry != null) {
+ //UIActivator.logErrorMessage("Image registry already defined"); //$NON-NLS-1$
+ }
+ return result;
+
+ }
+
+
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/MultiStateCellEditor.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/MultiStateCellEditor.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/MultiStateCellEditor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.internal.ui.refactoring.nls;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+import org.eclipse.jface.viewers.CellEditor;
+
+
+public class MultiStateCellEditor extends CellEditor {
+
+ private int fValue;
+ private final int fStateCount;
+
+ /**
+ * @param stateCount must be > 1
+ * @param initialValue initialValue
+ */
+ public MultiStateCellEditor(Composite parent, int stateCount, int initialValue) {
+ super(parent);
+ Assert.isTrue(stateCount > 1, "incorrect state count"); //$NON-NLS-1$
+ fStateCount= stateCount;
+
+ Assert.isTrue(initialValue >= 0 && initialValue < stateCount, "incorrect initial value"); //$NON-NLS-1$
+ fValue= initialValue;
+
+ setValueValid(true);
+ }
+
+ /*
+ * @see org.eclipse.jface.viewers.CellEditor#activate()
+ */
+ public void activate() {
+ fValue= getNextValue(fStateCount, fValue);
+ fireApplyEditorValue();
+ }
+
+ public static int getNextValue(int stateCount, int currentValue){
+ Assert.isTrue(stateCount > 1, "incorrect state count"); //$NON-NLS-1$
+ Assert.isTrue(currentValue >= 0 && currentValue < stateCount, "incorrect initial value"); //$NON-NLS-1$
+ return (currentValue + 1) % stateCount;
+ }
+
+ /*
+ * @see org.eclipse.jface.viewers.CellEditor#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createControl(Composite parent) {
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.jface.viewers.CellEditor#doGetValue()
+ * @return the Integer value
+ */
+ protected Object doGetValue() {
+ return new Integer(fValue);
+ }
+
+ /*
+ * @see org.eclipse.jface.viewers.CellEditor#doSetFocus()
+ */
+ protected void doSetFocus() {
+ // Ignore
+ }
+
+ /*
+ * @see org.eclipse.jface.viewers.CellEditor#doSetValue(java.lang.Object)
+ * @param value an Integer value
+ * must be >=0 and < stateCount (value passed in the constructor)
+ */
+ protected void doSetValue(Object value) {
+ Assert.isTrue(value instanceof Integer, "value must be Integer"); //$NON-NLS-1$
+ fValue = ((Integer) value).intValue();
+ Assert.isTrue(fValue >= 0 && fValue < fStateCount, "invalid value"); //$NON-NLS-1$
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/NLSUIMessages.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/NLSUIMessages.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/NLSUIMessages.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.internal.ui.refactoring.nls;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Helper class to get NLSed messages.
+ */
+final class NLSUIMessages extends NLS {
+
+ private static final String BUNDLE_NAME= NLSUIMessages.class.getName();
+
+ private NLSUIMessages() {
+ }
+
+ public static String RenameKeysDialog_title;
+ public static String RenameKeysDialog_description_noprefix;
+ public static String RenameKeysDialog_description_withprefix;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, NLSUIMessages.class);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/NLSUIMessages.properties
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/NLSUIMessages.properties (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/NLSUIMessages.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+###############################################################################
+# Copyright (c) 2000, 2004 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+###############################################################################
+# Copyright (c) 2007-2008 INdT.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Carolina Nogueira (carolina at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
+###############################################################################
+
+
+RenameKeysDialog_title=Rename Keys
+RenameKeysDialog_description_noprefix=Enter new prefix: (selected entries do not share a prefix)
+RenameKeysDialog_description_withprefix=Enter replacement prefix for
\ No newline at end of file
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/RenameKeysDialog.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/RenameKeysDialog.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/copied/copiedFromJDT/internal/ui/refactoring/nls/RenameKeysDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package copiedFromJDT.internal.ui.refactoring.nls;
+
+import java.util.List;
+
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.StringDialogField;
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+import copiedFromJDT.internal.corext.refactoring.nls.NLSSubstitution;
+
+/**
+ *
+ */
+public class RenameKeysDialog extends StatusDialog {
+
+ private StringDialogField fNameField;
+ private List fSelectedSubstitutions;
+ private int fCommonPrefixLength;
+
+ /**
+ * @param parent
+ */
+ public RenameKeysDialog(Shell parent, List selectedSubstitutions) {
+ super(parent);
+ setTitle(NLSUIMessages.RenameKeysDialog_title);
+
+ fSelectedSubstitutions= selectedSubstitutions;
+ String prefix= getInitialPrefix(selectedSubstitutions);
+ fCommonPrefixLength= prefix.length();
+
+ fNameField= new StringDialogField();
+ fNameField.setText(prefix);
+
+ if (prefix.length() == 0) {
+ fNameField.setLabelText(NLSUIMessages.RenameKeysDialog_description_noprefix);
+ } else {
+ fNameField.setLabelText(NLSUIMessages.RenameKeysDialog_description_withprefix + prefix + ':');
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+ Composite composite= (Composite) super.createDialogArea(parent);
+
+ fNameField.doFillIntoGrid(composite, 2);
+ LayoutUtil.setHorizontalGrabbing(fNameField.getTextControl(null));
+ return composite;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ protected void okPressed() {
+ String prefix= fNameField.getText();
+ for (int i= 0; i < fSelectedSubstitutions.size(); i++) {
+ NLSSubstitution sub= (NLSSubstitution) fSelectedSubstitutions.get(i);
+ String newKey= prefix + sub.getKey().substring(fCommonPrefixLength);
+ sub.setKey(newKey);
+ }
+ super.okPressed();
+ }
+
+ private String getInitialPrefix(List selectedSubstitutions) {
+ String prefix= null;
+ for (int i= 0; i < selectedSubstitutions.size(); i++) {
+ NLSSubstitution sub= (NLSSubstitution) selectedSubstitutions.get(i);
+ String curr= sub.getKey();
+ if (prefix == null) {
+ prefix= curr;
+ } else if (!curr.startsWith(prefix)) {
+ prefix= getCommonPrefix(prefix, curr);
+ if (prefix.length() == 0) {
+ return prefix;
+ }
+ }
+ }
+ return prefix;
+ }
+
+ private String getCommonPrefix(String a, String b) {
+ String shorter= a.length() <= b.length() ? a : b;
+ int len= shorter.length();
+ for (int i= 0; i < len; i++) {
+ if (a.charAt(i) != b.charAt(i)) {
+ return a.substring(0, i);
+ }
+ }
+ return shorter;
+ }
+
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/maemomenu_misc.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/maemomenu_misc.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/restart_co.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/restart_co.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/scratchbox_terminal.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/scratchbox_terminal.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/start_co.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/start_co.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/stop_co.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/stop_co.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/xservermenu_misc.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/etool16/xservermenu_misc.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/define_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/define_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/fldr_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/fldr_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/hfolder_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/hfolder_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/keylock_misc.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/keylock_misc.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/maemoprj_cnv.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/maemoprj_cnv.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/maemoprj_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/maemoprj_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/mountpoint_tsk.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/mountpoint_tsk.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/never_translate.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/never_translate.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/output_folder_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/output_folder_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/skip.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/skip.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/translate.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/translate.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/variable_obj.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/obj16/variable_obj.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/view16/oprofile_view.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/view16/oprofile_view.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/view16/oprofile_view.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/view16/oprofile_view.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/view16/valgrind_view.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/view16/valgrind_view.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/wizban/newmaemoprj_wiz.png
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/wizban/newmaemoprj_wiz.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/wizban/newtarget_wiz.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/wizban/newtarget_wiz.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/wizban/sbrsh_wiz.gif
===================================================================
(Binary files differ)
Property changes on: trunk/cpp/org.maemo.esbox.cpp.project.ui/icons/full/wizban/sbrsh_wiz.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/plugin.xml
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/plugin.xml (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,371 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.navigator.navigatorContent">
+ <commonWizard
+ associatedExtensionId="org.eclipse.cdt.ui.navigator.content"
+ menuGroupId="org.eclipse.cdt.ui.newProject"
+ type="new"
+ wizardId="org.maemo.esbox.ui.wizards.ConvertToESboxWizard">
+ <enablement>
+ <and>
+ <adapt
+ type="org.eclipse.core.resources.IProject">
+ </adapt>
+ <not>
+ <adapt
+ type="org.eclipse.core.resources.IProject">
+ <test
+ property="org.eclipse.core.resources.projectNature"
+ value="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </test>
+ </adapt>
+ </not>
+ </and>
+ </enablement>
+ </commonWizard>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.eclipse.cdt.ui.newCWizards"
+ class="org.maemo.esbox.cpp.project.ui.wizards.ConvertToESboxCppBuildConfigWizard"
+ finalPerspective="org.eclipse.cdt.ui.CPerspective"
+ hasPages="true"
+ icon="icons/full/obj16/maemoprj_cnv.png"
+ id="org.maemo.esbox.ui.wizards.ConvertToESboxWizard"
+ name="Convert to a Maemo C Project)">
+ <description>
+ Convert an existing C or C++ Makefile or autotools project to build with ESbox.
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IProject">
+ </selection>
+ </wizard>
+ <wizard
+ category="org.eclipse.cdt.ui.newCCWizards"
+ class="org.maemo.esbox.cpp.project.ui.wizards.ConvertToESboxCppBuildConfigWizard"
+ finalPerspective="org.eclipse.cdt.ui.CPerspective"
+ hasPages="true"
+ icon="icons/full/obj16/maemoprj_cnv.png"
+ id="org.maemo.esbox.ui.wizards.ConvertToESboxWizard"
+ name="Convert to a Maemo C++ Project">
+ <description>
+ Convert an existing C or C++ Makefile or autotools project to build with ESbox.
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IProject">
+ </selection>
+ </wizard>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ canFinishEarly="false"
+ category="org.eclipse.cdt.ui.newCWizards"
+ class="org.maemo.esbox.cpp.project.ui.wizards.CppProjectWizard"
+ finalPerspective="org.eclipse.cdt.ui.CPerspective"
+ hasPages="true"
+ icon="icons/full/obj16/maemoprj_obj.png"
+ id="org.maemo.esbox.ui.wizards.ESboxCppProjectWizard"
+ name="C/C++ Maemo Project"
+ project="true">
+ </wizard>
+ </extension>
+ <extension
+ point="org.eclipse.cdt.ui.ConfigManager">
+ <manager
+ class="org.maemo.esbox.cpp.project.ui.ESboxBuildConfigManager">
+ </manager>
+ </extension>
+
+
+<extension
+ point="org.eclipse.cdt.ui.cPropertyTab">
+
+ <tab
+ class="org.eclipse.cdt.ui.newui.IncludeTab"
+ name="Includes"
+ icon="icons/full/obj16/hfolder_obj.gif"
+ weight="001"
+ helpId="cdt_u_prop_pns_inc"
+ parent="org.maemo.esbox.cpp.project.ui.properties.PathAndSymbolPage"
+ tooltip="View and edit the include paths used to index sources"/>
+ <tab
+ class="org.eclipse.cdt.ui.newui.SymbolTab"
+ name="Symbols"
+ icon="icons/full/obj16/define_obj.gif"
+ weight="002"
+ helpId="cdt_u_prop_pns_sym"
+ parent="org.maemo.esbox.cpp.project.ui.properties.PathAndSymbolPage"
+ tooltip="View and edit the macros used to index sources"/>
+ <tab
+ class="org.eclipse.cdt.ui.newui.CLocationSourceTab"
+ name="Source Paths"
+ icon="icons/full/obj16/fldr_obj.gif"
+ weight="003"
+ helpId="cdt_u_prop_pns_src"
+ parent="org.maemo.esbox.cpp.project.ui.properties.PathAndSymbolPage"
+ tooltip="View and edit the source paths scanned by the indexer"/>
+ <tab
+ class="org.eclipse.cdt.ui.newui.CLocationOutputTab"
+ name="Output Paths"
+ icon="icons/full/obj16/output_folder_obj.gif"
+ weight="004"
+ helpId="cdt_u_prop_pns_out"
+ parent="org.maemo.esbox.cpp.project.ui.properties.PathAndSymbolPage"
+ tooltip="View and edit the output paths"/>
+</extension>
+
+ <extension
+ point="org.eclipse.ui.propertyPages">
+
+ <page
+ class="org.maemo.esbox.cpp.project.ui.properties.PathAndSymbolPage"
+ id="org.esbox.maemo.pathAndSymbolsPropertyPage"
+ name="C/C++ Include Paths and Symbols"
+ >
+ <filter
+ name="nature"
+ value="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </filter>
+ <enabledWhen>
+ <adapt type="org.eclipse.core.resources.IProject">
+ </adapt>
+ </enabledWhen>
+ </page>
+
+ <page
+ class="org.maemo.esbox.project.ui.ESboxBuildConfigurationsPage"
+ id="org.maemo.esbox.cpp.project.ui.BuildConfigurations"
+ name="ESbox Build Configurations">
+ <filter
+ name="nature"
+ value="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </filter>
+ <enabledWhen>
+ <adapt type="org.eclipse.core.resources.IProject">
+ </adapt>
+ </enabledWhen>
+ </page>
+
+ <page
+ class="org.maemo.esbox.cpp.project.ui.properties.ESBoxOldCppTargetPropertyPage"
+ id="org.maemo.esbox.cpp.project.ui.oldESboxProjectPropertyPage"
+ name="ESbox Build Configurations"
+ nameFilter="*">
+ <filter
+ name="nature"
+ value="org.indt.esbox.core.ESboxNature">
+ </filter>
+ <enabledWhen>
+ <adapt type="org.eclipse.core.resources.IProject">
+ </adapt>
+ </enabledWhen>
+ </page>
+
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.navigator.navigatorContent">
+ <commonWizard
+ associatedExtensionId="org.eclipse.cdt.ui.navigator.content"
+ menuGroupId="org.eclipse.cdt.ui.newProject"
+ type="new"
+ wizardId="org.maemo.esbox.cpp.project.ui.wizards.ConvertToESboxCppBuildConfigWizard">
+ <enablement>
+ <and>
+ <adapt type="org.eclipse.core.resources.IProject" />
+ <not>
+ <adapt type="org.eclipse.core.resources.IProject" >
+ <test
+ property="org.eclipse.core.resources.projectNature"
+ value="org.maemo.esbox.cpp.project.core.ESboxCppNature"/>
+ </adapt>
+ </not>
+ </and>
+ <and>
+ <adapt type="org.eclipse.core.resources.IProject" />
+ <not>
+ <adapt type="org.eclipse.core.resources.IProject" >
+ <test
+ property="org.eclipse.core.resources.projectNature"
+ value="org.maemo.esbox.python.project.core.ESboxPythonNature"/>
+ </adapt>
+ </not>
+ </and>
+ </enablement>
+ </commonWizard>
+
+ <commonWizard
+ associatedExtensionId="org.eclipse.cdt.ui.navigator.content"
+ menuGroupId="org.eclipse.cdt.ui.newProject"
+ type="new"
+ wizardId="org.maemo.esbox.cpp.project.ui.wizards.ESboxNewCppBuildConfigProjectWizard">
+ <enablement>
+ </enablement>
+ </commonWizard>
+ </extension>
+ <extension
+ point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ class="org.maemo.esbox.cpp.project.ui.ConvertCppProjectMarkerResolutionGenerator"
+ markerType="org.eclipse.core.resources.problemmarker">
+ </markerResolutionGenerator>
+ </extension>
+
+ <extension
+ point="org.eclipse.cdt.core.CBuildConsole">
+ <CBuildConsole
+ class="org.maemo.esbox.cpp.project.ui.CScratchboxConsole"
+ id="org.maemo.esbox.cpp.project.ui.scratchboxConsole"/>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.maemo.esbox.cpp.project.ui.popupMenu"
+ objectClass="org.eclipse.core.resources.IProject">
+ <menu
+ id="org.maemo.esbox.cpp.project.ui.buildpopup"
+ label="Build Application"
+ path="buildGroup">
+ </menu>
+ <action
+ class="org.maemo.esbox.cpp.project.ui.actions.BuildAllAction"
+ enablesFor="?"
+ id="org.maemo.esbox.cpp.project.ui.buildAllAction"
+ label="Build All"
+ menubarPath="org.maemo.esbox.cpp.project.ui.buildpopup/content"
+ tooltip="Build binaries">
+ </action>
+ <action
+ class="org.maemo.esbox.cpp.project.ui.actions.ConfigureAction"
+ enablesFor="?"
+ id="org.maemo.esbox.cpp.project.ui.configureAction"
+ label="Configure"
+ menubarPath="org.maemo.esbox.cpp.project.ui.buildpopup/content"
+ tooltip="Runs configure script">
+ </action>
+ <action
+ class="org.maemo.esbox.cpp.project.ui.actions.GenerateConfigureAction"
+ enablesFor="?"
+ id="org.maemo.esbox.cpp.project.ui.generateConfigureAction"
+ label="Generate Configure"
+ menubarPath="org.maemo.esbox.cpp.project.ui.buildpopup/content"
+ tooltip="Generates configure script">
+ </action>
+ <action
+ class="org.eclipse.cdt.make.ui.actions.BuildTargetAction"
+ enablesFor="1"
+ id="org.maemo.esbox.cpp.project.ui.NavigatorBuildTargetAction"
+ label="Build Make Target"
+ menubarPath="buildGroup">
+ </action>
+ <action
+ class="org.eclipse.cdt.make.ui.actions.CreateTargetAction"
+ enablesFor="1"
+ id="org.maemo.esbox.cpp.project.ui.NavigatorCreateTargetAction"
+ label="Create Make Target"
+ menubarPath="buildGroup">
+ </action>
+ <filter
+ name="projectNature"
+ value="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </filter>
+ </objectContribution>
+ <objectContribution
+ adaptable="true"
+ id="org.maemo.esbox.cpp.project.ui.popupMenu.Externalize"
+ nameFilter="*"
+ objectClass="org.eclipse.core.resources.IProject">
+ <menu
+ id="org.maemo.esbox.cpp.project.ui.sourcepopup"
+ label="Source"
+ path="buildGroup">
+ </menu>
+ <action
+ class="org.maemo.esbox.cpp.project.ui.actions.ExternalizeAction"
+ enablesFor="+"
+ id="org.maemo.esbox.cpp.project.ui.ExternalizeAction"
+ label="Externalize Strings.."
+ menubarPath="org.maemo.esbox.cpp.project.ui.sourcepopup/content">
+ </action>
+ <filter
+ name="projectNature"
+ value="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </filter>
+ </objectContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.cdt.core.templateProcessTypes">
+
+ <processType
+ name="AddProjectSourceFolders"
+ processRunner="org.maemo.esbox.cpp.project.ui.processes.AddProjectSourceFolders">
+ <simple name="projectName"/>
+ <complexArray name="paths">
+ <baseType>
+ <simple name="path"/>
+ </baseType>
+ </complexArray>
+ </processType>
+
+ <processType
+ name="AddIndexerIncludePaths"
+ processRunner="org.maemo.esbox.cpp.project.ui.processes.AddIndexerIncludePaths">
+ <simple name="projectName"/>
+ <complexArray name="paths">
+ <baseType>
+ <simple name="path"/>
+ <simple name="isUserPath"/>
+ </baseType>
+ </complexArray>
+ </processType>
+
+ <processType
+ name="AddIndexerMacroDefinitions"
+ processRunner="org.maemo.esbox.cpp.project.ui.processes.AddIndexerMacroDefinitions">
+ <simple name="projectName"/>
+ <complexArray name="macros">
+ <baseType>
+ <simple name="name"/>
+ <simple name="value"/>
+ </baseType>
+ </complexArray>
+ </processType>
+
+ <processType
+ name="ValidateAndInstallPackages"
+ processRunner="org.maemo.esbox.cpp.project.ui.processes.ValidateAndInstallPackages">
+ <simple name="projectName"/>
+ <simpleArray name="packages" />
+ </processType>
+
+ <processType
+ name="AddPkgConfigIndexerInfo"
+ processRunner="org.maemo.esbox.cpp.project.ui.processes.AddPkgConfigIndexerInfo">
+ <simple name="projectName"/>
+ <simpleArray name="packages" />
+ </processType>
+
+ <processType
+ name="RunScript"
+ processRunner="org.maemo.esbox.cpp.project.ui.processes.RunScript">
+ <simple name="projectName"/>
+ <simpleArray name="commandArguments" />
+ </processType>
+
+ </extension>
+ <extension
+ point="org.maemo.esbox.project.core.esboxLanguageTemplateProvider">
+ <languageTemplateContributor
+ class="org.maemo.esbox.cpp.project.ui.templateengine.CppTemplateProvider">
+ </languageTemplateContributor>
+ </extension>
+</plugin>
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/CScratchboxConsole.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/CScratchboxConsole.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/CScratchboxConsole.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui;
+
+import org.eclipse.cdt.core.ConsoleOutputStream;
+import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.IBuildConsoleManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.project.core.ProjectManager;
+
+/**
+ * Console for displaying Scratchbox-related output, one per target and project
+ * @author eswartz
+ *
+ */
+public class CScratchboxConsole implements IConsole {
+ private IProject project;
+
+ public static final String ID = "org.maemo.esbox.core.scratchboxConsole";
+
+ public CScratchboxConsole() {
+ }
+
+ private IConsole getConsole() {
+ String id = ID;
+ String consoleName = "Scratchbox Console";
+ if (project != null) {
+ try {
+ ISDKTarget sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
+ consoleName += " - " + sdkTarget.getName();
+ id += "." + sdkTarget.getName();
+ } catch (ESboxException e) {
+ }
+ }
+ IBuildConsoleManager consoleManager = CUIPlugin.getDefault().getConsoleManager(consoleName, id);
+ return consoleManager.getConsole(project);
+ }
+
+ public void start(IProject project) {
+ this.project = project;
+ getConsole().start(project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.resources.IConsole#getOutputStream()
+ */
+ public ConsoleOutputStream getOutputStream() throws CoreException {
+ return getConsole().getOutputStream();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.resources.IConsole#getInfoStream()
+ */
+ public ConsoleOutputStream getInfoStream() throws CoreException {
+ return getConsole().getInfoStream();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.resources.IConsole#getErrorStream()
+ */
+ public ConsoleOutputStream getErrorStream() throws CoreException {
+ return getConsole().getErrorStream();
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ConvertCppProjectMarkerResolutionGenerator.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ConvertCppProjectMarkerResolutionGenerator.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ConvertCppProjectMarkerResolutionGenerator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.ui;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.*;
+import org.maemo.esbox.cpp.project.ui.wizards.ConvertToESboxCppBuildConfigWizard;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+import org.maemo.esbox.project.core.IOldESboxProjectBuilder;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ConvertCppProjectMarkerResolutionGenerator implements
+ IMarkerResolutionGenerator2 {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IMarkerResolutionGenerator2#hasResolutions(org.eclipse.core.resources.IMarker)
+ */
+ public boolean hasResolutions(IMarker marker) {
+ try {
+ if (Boolean.TRUE.equals(marker.getAttribute(IOldESboxProjectBuilder.ATTR_NEEDS_CONVERSION)))
+ return true;
+ } catch (CoreException e) {
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IMarkerResolutionGenerator#getResolutions(org.eclipse.core.resources.IMarker)
+ */
+ public IMarkerResolution[] getResolutions(IMarker marker) {
+ return new IMarkerResolution[] {
+ new IMarkerResolution2() {
+
+ public String getDescription() {
+ return "Convert Maemo C/C++ project to current format. This will make it incompatible with older versions.";
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+ public String getLabel() {
+ return "Convert Project";
+ }
+
+ public void run(IMarker marker) {
+ try {
+ ConvertToESboxCppBuildConfigWizard wizard = new ConvertToESboxCppBuildConfigWizard();
+ WizardDialog dialog = new WizardDialog(null, wizard);
+ if (dialog.open() == IDialogConstants.OK_ID) {
+ marker.delete();
+ }
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().logError("Failed to fix marker", e);
+ }
+ }
+
+ }
+ };
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ESboxBuildConfigManager.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ESboxBuildConfigManager.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ESboxBuildConfigManager.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.ui;
+
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.newui.*;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.maemo.esbox.cpp.project.core.ESboxCppProjectNature;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+
+/**
+ * This implements the ...ConfigManager extension which tells CDT
+ * what UI to present for a given project's "Build Configurations"
+ * dialog.
+ * <p>
+ * In ESbox C/C++ projects, we want to show a checklist of ISDKTargets
+ * and let the user create configurations from those.
+ * @author eswartz
+ *
+ */
+public class ESboxBuildConfigManager implements IConfigManager {
+
+ /**
+ *
+ */
+ private static final String BUILD_CONFIG_PAGE_ID = UIActivator.PLUGIN_ID + ".BuildConfigurations";
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.ui.newui.IConfigManager#canManage(org.eclipse.core.resources.IProject[])
+ */
+ public boolean canManage(IProject[] obs) {
+ if (obs != null && obs.length == 1) {
+ IProject project = obs[0];
+ return ESboxCppProjectNature.isNatureInProject(project);
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.ui.newui.IConfigManager#manage(org.eclipse.core.resources.IProject[], boolean)
+ */
+ public boolean manage(IProject[] obs, boolean doOk) {
+ if (!canManage(obs)) {
+ return false;
+ }
+
+ IProject project = obs[0];
+
+ PreferenceDialog preferenceDialog = PreferencesUtil.createPropertyDialogOn(
+ CUIPlugin.getActiveWorkbenchShell(),
+ project,
+ BUILD_CONFIG_PAGE_ID,
+ new String[] { BUILD_CONFIG_PAGE_ID },
+ null
+ );
+ int ret = preferenceDialog.open();
+ if (ret == IDialogConstants.OK_ID) {
+ if (doOk) {
+ CDTPropertyManager.getProjectDescription(obs[0]);
+ CDTPropertyManager.performOk(preferenceDialog.getShell());
+ }
+ AbstractPage.updateViews(obs[0]);
+ return true;
+ }
+ return false;
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ESboxCppTemplateWrapper.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ESboxCppTemplateWrapper.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/ESboxCppTemplateWrapper.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.ui;
+
+import com.nokia.cpp.internal.api.utils.core.Check;
+
+import org.eclipse.cdt.ui.templateengine.Template;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.cpp.project.ui.templateengine.ESboxTemplateInfo;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+import org.maemo.esbox.project.core.ITemplate;
+
+import java.util.Map;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ESboxCppTemplateWrapper implements ITemplate {
+
+ private final Template template;
+
+ public ESboxCppTemplateWrapper(Template template) {
+ Check.checkArg(template);
+ this.template = template;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ITemplate#getName()
+ */
+ public String getName() {
+ return template.getLabel();
+ }
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ITemplate#getDescription()
+ */
+ public String getDescription() {
+ return template.getDescription();
+ }
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ITemplate#executeTemplateProcesses(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public MultiStatus executeTemplateProcesses(IProgressMonitor monitor) {
+ IStatus[] statuses = template.executeTemplateProcesses(null, false);
+
+ if (statuses.length > 0) {
+ final MultiStatus multiStatus = new MultiStatus(
+ UIActivator.PLUGIN_ID, 0,
+ "Template project creation failed", null);
+ for (IStatus status : statuses) {
+ if (status.getSeverity() == IStatus.ERROR) {
+ multiStatus.merge(status);
+ }
+ }
+ return multiStatus;
+ }
+ return new MultiStatus(UIActivator.PLUGIN_ID, 0, "No error", null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ITemplate#getCategory()
+ */
+ public String getCategory() {
+ if (template.getTemplateInfo() instanceof ESboxTemplateInfo)
+ return ((ESboxTemplateInfo) template.getTemplateInfo()).getCategory();
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ITemplate#getExecutionEnvironmentId()
+ */
+ public String getExecutionEnvironmentId() {
+ if (template.getTemplateInfo() instanceof ESboxTemplateInfo)
+ return ((ESboxTemplateInfo) template.getTemplateInfo()).getExecutionEnvironment();
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ITemplate#getFilterPattern()
+ */
+ public String getFilterPattern() {
+ return template.getTemplateInfo().getFilterPattern();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ITemplate#getProjectNature()
+ */
+ public String getProjectNature() {
+ if (template.getTemplateInfo() instanceof ESboxTemplateInfo)
+ return ((ESboxTemplateInfo) template.getTemplateInfo()).getProjectNature();
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ITemplate#getTemplateId()
+ */
+ public String getTemplateId() {
+ return template.getTemplateId();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ITemplate#getValueStore()
+ */
+ public Map<String, String> getValueStore() {
+ return template.getValueStore();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter.equals(Template.class))
+ return template;
+ return null;
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/BuildAllAction.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/BuildAllAction.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/BuildAllAction.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.actions;
+
+import org.eclipse.cdt.make.core.IMakeTarget;
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.make.ui.TargetBuild;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.widgets.Display;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+import org.maemo.esbox.ui.actions.ESboxAction;
+
+/**
+ * @author raul
+ *
+ */
+public class BuildAllAction extends ESboxAction {
+
+ public static final String TARGET_ALL = "all";
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ IProject project = (IProject)extractSelection();
+ IMakeTarget all = null;
+ IMakeTarget[] targets = null;
+ try {
+ targets = MakeCorePlugin.getDefault().getTargetManager().getTargets(project);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ for (int i = 0; i < targets.length; i++) {
+ String targetName = targets[i].getName();
+ if (targetName.equals(TARGET_ALL))
+ all = targets[i];
+ }
+ if (all == null) {
+ String message = "Make target \"all\" not defined";
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+ errorLogger.logAndShowError("ESbox error", new ESboxException(message));
+ return;
+ }
+
+ TargetBuild.buildTargets(Display.getCurrent().getActiveShell(), new IMakeTarget[] { all });
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ConfigureAction.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ConfigureAction.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ConfigureAction.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.actions;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.action.IAction;
+import org.maemo.esbox.core.ESboxException;
+
+import org.maemo.esbox.cpp.project.core.CppScriptLauncher;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+import org.maemo.esbox.ui.actions.ESboxAction;
+
+/**
+ * @author raul
+ *
+ */
+public class ConfigureAction extends ESboxAction {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ IProject project = (IProject)extractSelection();
+ try {
+ CppScriptLauncher.getInstance().runConfigure(project);
+ } catch (ESboxException e) {
+ UIActivator.getErrorLogger().logAndShowError(
+ "Failed to run configure", e);
+ }
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ExternalizeAction.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ExternalizeAction.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ExternalizeAction.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.ui.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.cpp.project.ui.dialogs.ExternalizeDialog;
+import org.maemo.esbox.ui.actions.ESboxAction;
+
+public class ExternalizeAction extends ESboxAction {
+
+ public void run(IAction action) {
+ try {
+ ExternalizeDialog wizard = new ExternalizeDialog(new Shell(), extractSelection());
+ wizard.open();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/GenerateConfigureAction.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/GenerateConfigureAction.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/GenerateConfigureAction.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.actions;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.action.IAction;
+import org.maemo.esbox.core.ESboxException;
+
+import org.maemo.esbox.cpp.project.core.CppScriptLauncher;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+import org.maemo.esbox.ui.actions.ESboxAction;
+
+/**
+ *
+ */
+public class GenerateConfigureAction extends ESboxAction {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ IProject project = (IProject)extractSelection();
+ try {
+ CppScriptLauncher.getInstance().runAutogen(project);
+ } catch (ESboxException e) {
+ UIActivator.getErrorLogger().logAndShowError(
+ "Failed to run autoconf", e);
+ }
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ProjectConverter.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ProjectConverter.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/actions/ProjectConverter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.actions;
+
+import org.eclipse.core.commands.AbstractParameterValueConverter;
+import org.eclipse.core.commands.ParameterValueConversionException;
+import org.eclipse.core.resources.*;
+
+/**
+ * A command parameter value converter to convert between IProject and strings
+ * encoding the project name.
+ */
+public final class ProjectConverter extends
+ AbstractParameterValueConverter {
+
+ public final Object convertToObject(final String parameterValue)
+ throws ParameterValueConversionException {
+ final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace()
+ .getRoot();
+ final IProject project = workspaceRoot.getProject(parameterValue);
+
+ if (project == null) {
+ throw new ParameterValueConversionException(
+ "parameterValue must be a project name"); //$NON-NLS-1$
+ }
+
+ return project;
+ }
+
+ public final String convertToString(final Object parameterValue)
+ throws ParameterValueConversionException {
+ if (!(parameterValue instanceof IProject)) {
+ throw new ParameterValueConversionException(
+ "parameterValue must be an IProject"); //$NON-NLS-1$
+ }
+ final IProject project = (IProject) parameterValue;
+ return project.getName();
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/dialogs/ExternalizeDialog.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/dialogs/ExternalizeDialog.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/dialogs/ExternalizeDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,272 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.ui.dialogs;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.maemo.esbox.cpp.project.ui.wizards.ExternalizeWizard;
+
+import copiedFromJDT.core.compiler.InvalidInputException;
+import copiedFromJDT.internal.corext.refactoring.nls.NLSElement;
+import copiedFromJDT.internal.corext.refactoring.nls.NLSLine;
+import copiedFromJDT.internal.corext.refactoring.nls.NLSScanner;
+
+
+public class ExternalizeDialog extends Dialog {
+
+ private IResource project;
+ private Table fTable;
+ private ArrayList<ElementSource> files;
+ private Button externalize;
+
+ public ExternalizeDialog(Shell parent, IResource project) {
+ super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL );
+ this.project = project;
+ this.setText("Externalize Strings..");
+ }
+
+ public void open(){
+ // Create the dialog window
+ Shell shell = new Shell(getParent(), getStyle());
+ shell.setText(getText());
+ createContents(shell);
+ shell.setSize(400, 500);
+ shell.open();
+ Display display = getParent().getDisplay();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ }
+
+
+ /**
+ * @param parent
+ * creates buttons, comboboxes and texts and their handlers
+ */
+ protected void createContents(final Shell parent){
+ parent.setLayout(new GridLayout(1, true));
+
+ Label label = new Label(parent, SWT.LEFT);
+
+ fTable = createTable(parent);
+ label.setText(fTable.getItems().length + " non-externalized string(s) found.");
+
+ fTable.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ validatePage();
+ }
+ });
+
+ GridData data = new GridData();
+ data.horizontalSpan = 1;
+ data = new GridData(GridData.FILL_BOTH);
+
+ GridData okcanceldata = new GridData();
+ okcanceldata.horizontalSpan = 2;
+ okcanceldata.horizontalAlignment = SWT.END;
+ Composite buttonscomposite = new Composite(parent, SWT.NONE);
+ buttonscomposite.setLayoutData(okcanceldata);
+ buttonscomposite.setLayout(new GridLayout(2, true));
+ // Create the Externalize button and add a handler
+ // so that pressing it will set input
+ // to the entered value
+ externalize = new Button(buttonscomposite, SWT.PUSH);
+ externalize.setText("Externalize..");
+ externalize.setEnabled(false);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ externalize.setLayoutData(data);
+ externalize.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ HandleExternalizeSelected(parent);
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ //does nothing
+ }
+ });
+
+ Button close = new Button(buttonscomposite, SWT.PUSH);
+ close.setText("Close");
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ close.setLayoutData(data);
+ close.addSelectionListener(new SelectionListener() {
+ // Case cancel
+ public void widgetSelected(SelectionEvent e) {
+ parent.close();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ //does nothing
+ }
+ });
+
+ }
+
+ private void validatePage() {
+ if (itensChecked() > 0 && (externalize != null) )
+ externalize.setEnabled(true);
+ else
+ externalize.setEnabled(false);
+ }
+
+ private int itensChecked() {
+ int itensChecked = 0;
+ for (TableItem item: fTable.getItems())
+ if (item.getChecked())
+ itensChecked++;
+ return itensChecked;
+ }
+
+ private Table createTable(Composite parent) {
+
+ GridData data = new GridData();
+ data.horizontalSpan = 1;
+ data = new GridData(GridData.FILL_BOTH);
+
+ Table table = new Table(parent, SWT.MULTI| SWT.BORDER | SWT.V_SCROLL | SWT.CHECK);
+ table.setLayoutData(data);
+ table.setLayoutData(new GridData(GridData.FILL_BOTH));
+ table.setLinesVisible(true);
+ table.setHeaderVisible(false);
+
+ Collection<ElementSource> files;
+ try {
+ files = getFiles();
+ for (ElementSource file : files) {
+ TableItem item = new TableItem(table, SWT.NONE);
+ item.setText(file.nonExternalizeString + " in "+ file.resource.getFullPath().toOSString());
+ item.setData(file);
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ return table;
+ }
+
+
+ protected void HandleExternalizeSelected(Shell parent) {
+ try {
+ ArrayList<IResource> resources = new ArrayList<IResource>(0);
+ for (TableItem item: fTable.getItems())
+ if (item.getChecked())
+ resources.add(((ElementSource)item.getData()).resource);
+
+ ExternalizeWizard wizard = new ExternalizeWizard(
+ (IResource[]) resources.toArray(new IResource[resources.size()])
+ );
+ WizardDialog dlg = new WizardDialog(new Shell(), wizard);
+ dlg.open();
+ } catch (Exception e) {
+ CCorePlugin.log(e);
+ MessageDialog.openError(parent, "Externalize Wizard Error", "Is not possible open Externalize Wizard.");
+ }
+ parent.close();
+ }
+
+ private Collection<ElementSource> getFiles() throws CoreException {
+ files = new ArrayList<ElementSource>(0);
+ for (IResource child: project.getProject().members())
+ checkRecursive(child);
+ return files;
+ }
+
+ private void checkRecursive(IResource child) throws CoreException {
+ if (child.getType() == IResource.FOLDER) {
+ for (IResource otherChild: ((IContainer) child).members())
+ checkRecursive(otherChild);
+ } else if (child.toString().endsWith(".c") || child.toString().endsWith(".cpp"))
+ try {
+ int nonExternalized = countNonExternalizedStrings(child);
+ if (nonExternalized > 0)
+ files.add(new ElementSource(child, nonExternalized ));
+ } catch (IOException e) {
+ CCorePlugin.log(e);
+ }
+ }
+
+
+ private int countNonExternalizedStrings(IResource child) throws CoreException, IOException {
+ try {
+ BufferedReader file = new BufferedReader(new FileReader(child.getLocation().toOSString()));
+ NLSLine[] lines= NLSScanner.scan(getContents(file));
+
+ int result= 0;
+ for (NLSLine line : lines)
+ result += countNonExternalizedStrings(line);
+
+ return result;
+ } catch (InvalidInputException e) {
+ CCorePlugin.log(e);
+ }
+ return 0;
+ }
+
+ private String getContents(BufferedReader file) throws IOException {
+ String contents = "";
+ String linha;
+ while( (linha = file.readLine()) != null)
+ if (!contains(linha))
+ contents = contents + linha + "\n";
+ return contents;
+ }
+
+ private int countNonExternalizedStrings(NLSLine line){
+ int result= 0;
+ for (NLSElement elements : line.getElements() )
+ if (!elements.hasTag())
+ result++;
+ return result;
+ }
+
+ private boolean contains(String element) {
+ if (element.contains("\"\"") ) // if a element not contains ""
+ return true;
+ if (element.contains("#include") )
+ return true;
+ return false;
+ }
+
+ private class ElementSource {
+ IResource resource;
+ int nonExternalizeString;
+
+ public ElementSource (IResource resource, int nonExternalizeString) {
+ this.resource = resource;
+ this.nonExternalizeString = nonExternalizeString;
+ }
+ }
+}
+
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddIndexerIncludePaths.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddIndexerIncludePaths.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddIndexerIncludePaths.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.processes;
+
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+import org.eclipse.cdt.core.templateengine.process.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.cpp.project.core.ESboxCppProjectCreatorConverterBase;
+import org.maemo.esbox.cpp.project.core.ESboxCppTemplateProcessInfo;
+
+import java.text.MessageFormat;
+
+/**
+ * This process adds a given list of include paths to the project's
+ * CDT Paths and Symbols. This may only be used for C++ projects.
+ * @author eswartz
+ *
+ */
+public class AddIndexerIncludePaths extends ProcessRunner {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.templateengine.process.ProcessRunner#process(org.eclipse.cdt.core.templateengine.TemplateCore, org.eclipse.cdt.core.templateengine.process.ProcessArgument[], java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void process(TemplateCore template, ProcessArgument[] args,
+ String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
+
+ ESboxCppProjectCreatorConverterBase creator = ESboxCppTemplateProcessInfo.currentCppProjectCreatorConverter;
+ if (creator == null) {
+ // ignore for old wizard
+ return;
+ }
+
+ String projectName = args[0].getSimpleValue();
+ if (!projectName.equals(creator.getProject().getName())) {
+ throw new ProcessFailureException(getProcessMessage(processId, 1,
+ MessageFormat.format("Unexpected project specified: ''{0}''", projectName)));
+ }
+
+ ProcessArgument[][] pathMembers = args[1].getComplexArrayValue();
+ for (ProcessArgument[] pathMember : pathMembers) {
+ String path = pathMember[0].getSimpleValue();
+ boolean isUserPath = pathMember[0].getSimpleValue().equalsIgnoreCase("true");
+ creator.getProjectIndexerSettings().addIncludePath(new Path(path),
+ !isUserPath);
+ }
+
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddIndexerMacroDefinitions.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddIndexerMacroDefinitions.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddIndexerMacroDefinitions.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.processes;
+
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+import org.eclipse.cdt.core.templateengine.process.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.cpp.project.core.ESboxCppProjectCreatorConverterBase;
+import org.maemo.esbox.cpp.project.core.ESboxCppTemplateProcessInfo;
+
+import java.text.MessageFormat;
+
+/**
+ * This process adds a given list of macro definitions to the project's
+ * CDT Paths and Symbols. This may only be used for C++ projects.
+ * @author eswartz
+ *
+ */
+public class AddIndexerMacroDefinitions extends ProcessRunner {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.templateengine.process.ProcessRunner#process(org.eclipse.cdt.core.templateengine.TemplateCore, org.eclipse.cdt.core.templateengine.process.ProcessArgument[], java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void process(TemplateCore template, ProcessArgument[] args,
+ String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
+
+
+ ESboxCppProjectCreatorConverterBase creator = ESboxCppTemplateProcessInfo.currentCppProjectCreatorConverter;
+ if (creator == null) {
+ // ignore for old wizard
+ return;
+ }
+
+ String projectName = args[0].getSimpleValue();
+ if (!projectName.equals(creator.getProject().getName())) {
+ throw new ProcessFailureException(getProcessMessage(processId, 1,
+ MessageFormat.format("Unexpected project specified: ''{0}''", projectName)));
+ }
+
+ ProcessArgument[][] macroMembers = args[1].getComplexArrayValue();
+ for (ProcessArgument[] macroMember : macroMembers) {
+ String name = macroMember[0].getSimpleValue();
+ String value = macroMember[1].getSimpleValue();
+ creator.getProjectIndexerSettings().addMacroDefinition(name, value);
+ }
+
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddPkgConfigIndexerInfo.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddPkgConfigIndexerInfo.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddPkgConfigIndexerInfo.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.processes;
+
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+import org.eclipse.cdt.core.templateengine.process.*;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.cpp.IDefine;
+import org.maemo.esbox.cpp.project.core.ESboxCppProjectCreatorConverterBase;
+import org.maemo.esbox.cpp.project.core.ESboxCppTemplateProcessInfo;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+import org.maemo.esbox.linux.packages.core.*;
+import org.maemo.esbox.project.core.IESboxBuildConfiguration;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This process runs "pkg-config --cflags" on the packages listed
+ * in the element values, and extracts the -I and -D options to construct
+ * indexer includes and macros. This may only be used for C++ projects.
+ * @author eswartz
+ *
+ */
+public class AddPkgConfigIndexerInfo extends ProcessRunner {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.templateengine.process.ProcessRunner#process(org.eclipse.cdt.core.templateengine.TemplateCore, org.eclipse.cdt.core.templateengine.process.ProcessArgument[], java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void process(TemplateCore template, ProcessArgument[] args,
+ String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
+ final ESboxCppProjectCreatorConverterBase creator = ESboxCppTemplateProcessInfo.currentCppProjectCreatorConverter;
+ if (creator == null) {
+ // ignore for old wizard
+ return;
+ }
+
+ String projectName = args[0].getSimpleValue();
+ if (!projectName.equals(creator.getProject().getName())) {
+ throw new ProcessFailureException(getProcessMessage(processId, 1,
+ MessageFormat.format("Unexpected project specified: ''{0}''", projectName)));
+ }
+
+ List<IStatus> statuses = new ArrayList<IStatus>();
+ String[] packages = args[1].getSimpleArrayValue();
+
+ IESboxBuildConfiguration[] buildConfigurations = creator.getProjectHandle().getBuildConfigurations();
+
+ monitor.beginTask("Adding indexer information for packages",
+ buildConfigurations.length);
+
+ for (IESboxBuildConfiguration config : buildConfigurations) {
+ if (config.getSDKTarget() == null)
+ continue;
+
+ IPackageManager packageManager = PackageManagerProvider.getInstance().getPackageManagerFor(
+ config.getSDKTarget(), new SubProgressMonitor(monitor, 1));
+ if (packageManager == null)
+ continue;
+
+ for (String package_ : packages) {
+ IBuildPackage buildPackage = packageManager.getBuildPackage(package_);
+ if (buildPackage == null) {
+ statuses.add(UIActivator.createErrorStatus(
+ MessageFormat.format("Cannot find information on pkg-config package ''{0}'' for target ''{1}''; indexer settings will be missing",
+ package_,
+ config.getSDKTarget().getName()), null
+ ));
+ } else {
+ for (IDefine define : buildPackage.getMacros()) {
+ creator.getProjectIndexerSettings().addMacroDefinition(
+ config.getId(), define.getPrototype(), define.getExpansion());
+ }
+ for (IPath path : buildPackage.getSystemIncludes()) {
+ creator.getProjectIndexerSettings().addIncludePath(
+ config.getId(), path, true);
+ }
+ }
+ }
+ }
+
+ monitor.done();
+
+ if (statuses.size() != 0) {
+ // status info is lost :p
+ StringBuilder buffer = new StringBuilder();
+ for (IStatus status : statuses) {
+ buffer.append('\n');
+ buffer.append(status.getMessage());
+ }
+ throw new ProcessFailureException("Failed to scan all packages for indexer information:" + buffer);
+ }
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddProjectSourceFolders.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddProjectSourceFolders.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/AddProjectSourceFolders.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.processes;
+
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+import org.eclipse.cdt.core.templateengine.process.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.cpp.project.core.ESboxCppProjectCreatorConverterBase;
+import org.maemo.esbox.cpp.project.core.ESboxCppTemplateProcessInfo;
+
+import java.text.MessageFormat;
+
+/**
+ * This process adds a given list of source folders to the project's
+ * CDT Source Folders list. This may only be used for C++ projects.
+ * @author eswartz
+ *
+ */
+public class AddProjectSourceFolders extends ProcessRunner {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.templateengine.process.ProcessRunner#process(org.eclipse.cdt.core.templateengine.TemplateCore, org.eclipse.cdt.core.templateengine.process.ProcessArgument[], java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void process(TemplateCore template, ProcessArgument[] args,
+ String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
+
+ ESboxCppProjectCreatorConverterBase creator = ESboxCppTemplateProcessInfo.currentCppProjectCreatorConverter;
+ if (creator == null) {
+ // ignore for old wizard
+ return;
+ }
+
+ String projectName = args[0].getSimpleValue();
+ if (!projectName.equals(creator.getProject().getName())) {
+ throw new ProcessFailureException(getProcessMessage(processId, 1,
+ MessageFormat.format("Unexpected project specified: ''{0}''", projectName)));
+ }
+
+ ProcessArgument[][] pathMembers = args[1].getComplexArrayValue();
+ for (ProcessArgument[] pathMember : pathMembers) {
+ String pathString = pathMember[0].getSimpleValue();
+ creator.getProjectIndexerSettings().addSourceFolder(new Path(projectName).append(pathString));
+ }
+
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/RunScript.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/RunScript.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/RunScript.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.processes;
+
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+import org.eclipse.cdt.core.templateengine.process.*;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.project.core.ProjectManager;
+
+import java.util.List;
+
+/**
+ * This process runs a script with arguments. This may be used in any project.
+ * @author eswartz
+ *
+ */
+public class RunScript extends ProcessRunner {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.templateengine.process.ProcessRunner#process(org.eclipse.cdt.core.templateengine.TemplateCore, org.eclipse.cdt.core.templateengine.process.ProcessArgument[], java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void process(TemplateCore template, ProcessArgument[] args,
+ String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
+
+ String projectName = args[0].getSimpleValue();
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project == null || !project.exists() || project.getLocation() == null) {
+ throw new ProcessFailureException("Uncreated project: " + projectName);
+ }
+
+ ISDKTarget sdkTarget = null;
+ try {
+ sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
+ } catch (ESboxException e) {
+ throw new ProcessFailureException(e);
+ }
+
+ String[] arguments = args[1].getSimpleArrayValue();
+ List<String> cmdLine = CommandLineArguments.createFromArray(arguments);
+
+ IProcessLauncher launcher;
+ try {
+ launcher = ProcessLauncherCreator.createProcessLauncher(
+ sdkTarget.getProcessLauncherFactory(),
+ sdkTarget.convertHostToTargetPath(project.getLocation()),
+ CommandLineArguments.wrapScriptCommandLineForShell(cmdLine));
+ } catch (ESboxException e1) {
+ throw new ProcessFailureException(e1);
+ }
+
+ java.lang.Process process = null;
+ try {
+ process = launcher.createProcess();
+ } catch (ESboxException e) {
+ throw new ProcessFailureException(e);
+ }
+
+ launcher.redirectToConsole(true, sdkTarget,
+ "Running " + CommandLineArguments.toString(cmdLine));
+
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ throw new ProcessFailureException(e);
+ }
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/ValidateAndInstallPackages.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/ValidateAndInstallPackages.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/processes/ValidateAndInstallPackages.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.ui.processes;
+
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+import org.eclipse.cdt.core.templateengine.process.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.linux.packages.core.IPackageManager;
+import org.maemo.esbox.linux.packages.core.PackageManagerProvider;
+import org.maemo.esbox.linux.packages.ui.ProjectPackageInstaller;
+import org.maemo.esbox.project.core.*;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This will check whether a given list of apt packages is available and
+ * prompt the user to install them if needed. This may be used in any wizard.
+ * @author eswartz
+ *
+ */
+public class ValidateAndInstallPackages extends ProcessRunner {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.templateengine.process.ProcessRunner#process(org.eclipse.cdt.core.templateengine.TemplateCore, org.eclipse.cdt.core.templateengine.process.ProcessArgument[], java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void process(TemplateCore template, ProcessArgument[] args,
+ String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
+ try {
+ String projectName = args[0].getSimpleValue();
+ if (!projectName.equals(ESboxTemplateProcessInfo.currentProject.getName())) {
+ throw new ProcessFailureException(getProcessMessage(processId, 1,
+ MessageFormat.format("Unexpected project specified: ''{0}''", projectName)));
+ }
+
+ Shell shell = null;
+
+ // get the package names and package managers
+
+ String[] packageNames = args[1].getSimpleArrayValue();
+
+ ESboxConfigHandler configHandler = ESboxTemplateProcessInfo.currentConfigHandler;
+ List<IPackageManager> managerList = new ArrayList<IPackageManager>();
+
+ int numConfigs = configHandler.getBuildConfigurationParameters().size();
+ monitor.beginTask("Validating packages", numConfigs + packageNames.length * numConfigs);
+
+ for (ESboxBuildConfigurationParameters params : configHandler.getBuildConfigurationParameters()) {
+ IPackageManager manager = PackageManagerProvider.getInstance().getPackageManagerFor(params.getSdkTarget(),
+ new SubProgressMonitor(monitor, 1));
+ if (manager != null) {
+ managerList.add(manager);
+ }
+ }
+
+ try {
+ IPackageManager[] managers = (IPackageManager[]) managerList
+ .toArray(new IPackageManager[managerList.size()]);
+ ProjectPackageInstaller.ensureInstalledPackages(shell, managers, packageNames, new SubProgressMonitor(monitor, packageNames.length * managers.length));
+ } catch (CoreException e) {
+ throw new ProcessFailureException(e);
+ }
+
+ } finally {
+ monitor.done();
+ }
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/properties/ESBoxOldCppTargetPropertyPage.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/properties/ESBoxOldCppTargetPropertyPage.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/properties/ESBoxOldCppTargetPropertyPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) -- initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.ui.properties;
+
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.cpp.project.ui.wizards.ConvertToESboxCppBuildConfigWizard;
+import org.maemo.esbox.project.ui.properties.BaseESBoxBuildTargetPropertyPage;
+
+/**
+ * This property page is shown for non-yet-converted C++ projects from ESbox 1.4 and older.
+ * <p>
+ * It alerts the user to convert the projects. Until such a time, builds won't work.
+ * @author eswartz
+ */
+public class ESBoxOldCppTargetPropertyPage extends BaseESBoxBuildTargetPropertyPage {
+
+ protected boolean convertOnClose;
+
+ public ESBoxOldCppTargetPropertyPage() {
+ noDefaultAndApplyButton();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.properties.BaseESBoxBuildTargetPropertyPage#getPageTitle()
+ */
+ @Override
+ protected String getPageTitle() {
+ return "";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.properties.BaseESBoxBuildTargetPropertyPage#createBuildTargetUI(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected void createBuildTargetUI(final Composite parent) {
+ Composite control = new Composite(parent, SWT.NONE);
+ GridLayout controlLayout = new GridLayout(1, false);
+
+ control.setLayout(controlLayout);
+ control.setLayoutData(new GridData(GridData.FILL_BOTH
+ | GridData.GRAB_VERTICAL));
+
+ final Button convertButton = new Button(control, SWT.CHECK);
+
+ convertButton.setText("Launch 'Convert to Maemo C/C++ Project' wizard on completion");
+ convertButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ convertButton.addSelectionListener(new SelectionAdapter() {
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ convertOnClose = convertButton.getSelection();
+ }
+ });
+
+ getShell().addDisposeListener(new DisposeListener() {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
+ */
+ public void widgetDisposed(DisposeEvent e) {
+ // run this after the shell closes
+ if (convertOnClose) {
+
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ ConvertToESboxCppBuildConfigWizard wizard = new ConvertToESboxCppBuildConfigWizard();
+ WizardDialog dialog = new WizardDialog(null, wizard);
+ dialog.open();
+ }
+
+ });
+ }
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performOk()
+ */
+ @Override
+ public boolean performOk() {
+ return true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.properties.BaseESBoxBuildTargetPropertyPage#getInformationText()
+ */
+ @Override
+ protected String getInformationText() {
+ return "This project uses an older project format and must be converted to make changes to its configuration.";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.properties.BaseESBoxBuildTargetPropertyPage#refresh()
+ */
+ @Override
+ protected void refresh() {
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/properties/PathAndSymbolPage.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/properties/PathAndSymbolPage.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/properties/PathAndSymbolPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.ui.properties;
+
+import org.eclipse.cdt.ui.newui.AbstractPage;
+
+/**
+ * @author eswartz
+ *
+ */
+public class PathAndSymbolPage extends AbstractPage {
+
+ /**
+ *
+ */
+ public PathAndSymbolPage() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.ui.newui.AbstractPage#isSingle()
+ */
+ @Override
+ protected boolean isSingle() {
+ return false;
+ }
+
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/CppTemplateProvider.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/CppTemplateProvider.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/CppTemplateProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.ui.templateengine;
+
+import org.eclipse.cdt.core.templateengine.*;
+import org.eclipse.cdt.ui.templateengine.Template;
+import org.maemo.esbox.cpp.project.ui.ESboxCppTemplateWrapper;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+import org.maemo.esbox.project.core.ITemplate;
+import org.maemo.esbox.project.core.ILanguageTemplateProvider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Aggregator of C/C++ templates
+ * @author eswartz
+ *
+ */
+public class CppTemplateProvider implements ILanguageTemplateProvider {
+
+ /**
+ *
+ */
+ public CppTemplateProvider() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ITemplateProvider#getTemplates()
+ */
+ public ITemplate[] getTemplates() {
+ TemplateInfo[] templateInfoArray = ESboxCppTemplateEngine.getDefault().getTemplateInfos();
+ List<Template> templatesList = new ArrayList<Template>();
+ for (int i=0; i<templateInfoArray.length; i++) {
+ try {
+ templatesList.add(new Template(templateInfoArray[i]));
+ } catch (TemplateInitializationException tie) {
+ UIActivator.getErrorLogger().logError("Failed to load template", tie);
+ }
+ }
+
+ ITemplate[] templates = new ITemplate[templatesList.size()];
+ for (int idx = 0; idx < templatesList.size(); idx++) {
+ templates[idx] = new ESboxCppTemplateWrapper(templatesList.get(idx));
+ }
+ return templates;
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/ESboxCppTemplateEngine.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/ESboxCppTemplateEngine.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/ESboxCppTemplateEngine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,416 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.templateengine;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.templateengine.SharedDefaults;
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+import org.eclipse.cdt.core.templateengine.TemplateEngineHelper;
+import org.eclipse.cdt.core.templateengine.TemplateInfo;
+import org.eclipse.cdt.core.templateengine.TemplateInitializationException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.Platform;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * Modified from org.eclipse.cdt.core.templateengine.TemplateEngine
+ *
+ */
+public class ESboxCppTemplateEngine {
+
+ private static final String CATEGORY = "category"; //$NON-NLS-1$
+ private static final String EXECUTION_ENVIRONMENT = "executionEnvironment"; //$NON-NLS-1$
+ private static final String PROJECT_NATURE = "projectNature"; //$NON-NLS-1$
+ // XXX: move out of this plugin
+ public static String TEMPLATES_EXTENSION_ID = "org.maemo.esbox.project.core.esbox_templates"; //$NON-NLS-1$
+ public static String TEMPLATE_ASSOCIATIONS_EXTENSION_ID = "org.maemo.esbox.project.core.esbox_templateAssociations"; //$NON-NLS-1$
+
+ /**
+ * static reference to the Singleton TemplateEngine instance.
+ */
+ private static ESboxCppTemplateEngine TEMPLATE_ENGINE;
+
+ /**
+ * This is a Map <WizardID, TemplateInfo>.
+ */
+ private Map/*<String, List<TemplateInfo>>*/ templateInfoMap;
+
+ /**
+ * TemplateEngine constructor, create and initialize SharedDefaults.
+ */
+ private ESboxCppTemplateEngine() {
+ templateInfoMap = new HashMap/*<String, List<TemplateInfo>>*/();
+ initializeTemplateInfoMap();
+ }
+
+ /**
+ * Returns all the TemplateCore objects, no filtering is done.
+ */
+ public TemplateCore[] getTemplates() {
+ TemplateInfo[] templateInfoArray = getTemplateInfos();
+ List/*<TemplateCore>*/ tcores = new ArrayList/*<TemplateCore>*/();
+ for (int i=0; i<templateInfoArray.length; i++) {
+ TemplateInfo info = templateInfoArray[i];
+ try {
+ tcores.add(TemplateCore.getTemplate(info));
+ } catch (TemplateInitializationException e) {
+ CCorePlugin.log(e);
+ }
+ }
+ return (TemplateCore[]) tcores.toArray(new TemplateCore[tcores.size()]);
+ }
+
+ /**
+ * Returns the TemplateCore for the first template defined for the specified parameters, or null
+ * if no such definition exists, or if there is an error initializing the template (the error will
+ * be logged).
+ * @param projectType may not be null
+ * @param toolChain may be null to indicate no tool-chain filtering
+ * @param usageFilter a regex in java.util.regex.Pattern format, may be null to indicate no filtering
+ * @see java.util.regex.Pattern
+ * @return
+ */
+ public TemplateCore getFirstTemplate(String projectType, String toolChain, String usageFilter) {
+ TemplateInfo[] infos= getTemplateInfos(projectType, toolChain, usageFilter);
+ if(infos.length>0) {
+ try {
+ return TemplateCore.getTemplate(infos[0]);
+ } catch(TemplateInitializationException tie) {
+ CCorePlugin.log(tie);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Equivalent to calling the overloaded version of getFirstTemplate with null arguments for
+ * toolChain and usageFilter.
+ * @see TemplateEngine#getFirstTemplate(String, String, String)
+ * @return the first TemplateCore object registered, or null if this does not exist
+ */
+ public TemplateCore getFirstTemplate(String projectType) {
+ return getFirstTemplate(projectType, null, null);
+ }
+
+ /**
+ * This method will be called by Contianer UIs (Wizard, PropertyPage,
+ * PreferencePage). Create a Template instance, update the ValueStore, with
+ * SharedDefaults. This method calls the getTemplate(URL), after getting URL
+ * for the given String TemplateDescriptor.
+ */
+ public TemplateCore[] getTemplates(String projectType, String toolChain, String usageFilter) {
+ TemplateInfo[] templateInfoArray = getTemplateInfos(projectType, toolChain, usageFilter);
+ List/*<Template>*/ templatesList = new ArrayList/*<Template>*/();
+ for (int i=0; i<templateInfoArray.length; i++) {
+ TemplateInfo info = templateInfoArray[i];
+ try {
+ templatesList.add(TemplateCore.getTemplate(info));
+ } catch (TemplateInitializationException tie) {
+ CCorePlugin.log(tie);
+ }
+ }
+ return (TemplateCore[]) templatesList.toArray(new TemplateCore[templatesList.size()]);
+ }
+
+ public TemplateCore[] getTemplates(String projectType, String toolChain) {
+ return getTemplates(projectType, toolChain, null);
+ }
+
+ public TemplateCore[] getTemplates(String projectType) {
+ return getTemplates(projectType, null);
+ }
+
+ public TemplateCore getTemplateById(String templateId) {
+ TemplateCore[] templates = getTemplates();
+
+ for(int i=0; i<templates.length; i++) {
+ TemplateCore template = templates[i];
+ if (template.getTemplateId().equalsIgnoreCase(templateId)) {
+ return template;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * return the SharedDefaults.
+ *
+ * @return
+ */
+ public static Map/*<String, String>*/ getSharedDefaults() {
+ return SharedDefaults.getInstance().getSharedDefaultsMap();
+ }
+
+ /**
+ * update The SharedDefaults Map. This method will be called by Container
+ * UIs. After collecting data from UIPages, the IDs with Persist attribute
+ * as true, has to be persisted in SharedDefaults XML. For the same this
+ * method is called by passing the ValueStore(updated with user entered
+ * values). Get the PersistTrueIDs from TemplateDescriptor. Persist the
+ * values of IDs in ValueStore, which are also present in PersistTrueIDs
+ * vector.
+ * @param template
+ * @param aSharedValue
+ */
+ public void updateSharedDefaults(TemplateCore template) {
+ Map/*<String, String>*/ tobePersisted = new HashMap/*<String, String>*/();
+ Map/*<String, String>*/ valueStore = template.getValueStore();
+
+ for (Iterator i = template.getPersistTrueIDs().iterator(); i.hasNext();) {
+ String key = (String) i.next();
+ tobePersisted.put(key, valueStore.get(key));
+ }
+ SharedDefaults.getInstance().updateShareDefaultsMap(tobePersisted);
+ }
+
+ /**
+ * create the singleton instance, check for null condition of
+ * TEMPLATE_ENGINE. If TEMPLATE_ENGINE is null create the TemplateEngine
+ * instance assign it to TEMPLATE_ENGINE. There is no need to have
+ * synchronized here(while creating TemplateEngine).
+ *
+ * @return TEMPLATE_ENGINE, instance of TemplateEngine.
+ *
+ * @since 4.0
+ */
+ public static ESboxCppTemplateEngine getDefault() {
+ if(TEMPLATE_ENGINE==null) {
+ TEMPLATE_ENGINE = new ESboxCppTemplateEngine();
+ }
+ return TEMPLATE_ENGINE;
+ }
+
+ /**
+ * From the extension point take the class implementing the required
+ * functionality. Update the local HashMap of page-id and URL. This is for
+ * extension point "templates"
+ */
+ private void initializeTemplateInfoMap() {
+ String templateId = null;
+ String location = null;
+ String pluginId = null;
+ String projectType = null;
+ String filterPattern = null;
+ //String usage = null;
+ boolean isCategory = false;
+ String extraPagesProvider = null;
+ String category = null;
+ String execEnv = null;
+ String projectNature = null;
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(TEMPLATES_EXTENSION_ID).getExtensions();
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ pluginId = extension.getNamespaceIdentifier(); // Plugin-id of the extending plugin.
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+ templateId = config.getAttribute(TemplateEngineHelper.ID);
+ location = config.getAttribute(TemplateEngineHelper.LOCATION);
+ projectType = config.getAttribute(TemplateEngineHelper.PROJECT_TYPE);
+ filterPattern = config.getAttribute(TemplateEngineHelper.FILTER_PATTERN);
+ //usage = config.getAttribute(TemplateEngineHelper.USAGE_DESCRIPTION);
+ isCategory = Boolean.valueOf(config.getAttribute(TemplateEngineHelper.IS_CATEGORY)).booleanValue();
+ extraPagesProvider = config.getAttribute(TemplateEngineHelper.EXTRA_PAGES_PROVIDER);
+ category = config.getAttribute(CATEGORY);
+ execEnv = config.getAttribute(EXECUTION_ENVIRONMENT);
+ projectNature = config.getAttribute(PROJECT_NATURE);
+ IConfigurationElement[] toolChainConfigs = config.getChildren(TemplateEngineHelper.TOOL_CHAIN);
+ Set toolChainIdSet = new HashSet();
+ for (int k=0; k < toolChainConfigs.length; k++) {
+ toolChainIdSet.add(toolChainConfigs[k].getAttribute(TemplateEngineHelper.ID));
+ }
+
+ ESboxTemplateInfo templateInfo = new ESboxTemplateInfo(templateId, projectType, filterPattern, location,
+ pluginId, toolChainIdSet,
+ extraPagesProvider, isCategory,
+ category, execEnv, projectNature);
+ if (!templateInfoMap.containsKey(projectType)) {
+ templateInfoMap.put(projectType, new ArrayList/*<TemplateInfo>*/());
+ }
+ ((List/*<TemplateInfo>*/)templateInfoMap.get(projectType)).add(templateInfo);
+ }
+ }
+ // Check for tool Chains added to the templates outside template info definition
+ addToolChainsToTemplates();
+ }
+
+ private void addToolChainsToTemplates() {
+ String templateId = null;
+ TemplateCore[] templates = getTemplates();
+
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(TEMPLATE_ASSOCIATIONS_EXTENSION_ID).getExtensions();
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+ templateId = config.getAttribute(TemplateEngineHelper.ID);
+
+ IConfigurationElement[] toolChainConfigs = config.getChildren(TemplateEngineHelper.TOOL_CHAIN);
+ Set toolChainIdSet = new HashSet();
+ for (int k=0; k < toolChainConfigs.length; k++) {
+ toolChainIdSet.add(toolChainConfigs[k].getAttribute(TemplateEngineHelper.ID));
+ }
+
+ for (int k=0; k < templates.length; k++) {
+ String id = templates[k].getTemplateInfo().getTemplateId();
+ if (id == null) {
+ id = templates[k].getTemplateId();
+ }
+ if (id != null && id.equals(templateId)) {
+ toolChainIdSet.addAll(Arrays.asList(templates[k].getTemplateInfo().getToolChainIds()));
+ templates[k].getTemplateInfo().setToolChainSet(toolChainIdSet);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Gets an array of template info objects matching the criteria passed as params.
+ * @param projectType may not be null
+ * @param toolChain may be null to indicate no tool-chain
+ * @param usageFilter a usage string which is matched against the filter from the template, may be null
+ * to indicate no usage filtering
+ * @return an array of template infos (never null)
+ */
+ public TemplateInfo[] getTemplateInfos(String projectType, String toolChain, String usageFilter) {
+ List/*<TemplateInfo>*/ templateInfoList = (List/*<TemplateInfo*/) templateInfoMap.get(projectType.trim());
+ List/*<TemplateInfo>*/ matchedTemplateInfoList = new ArrayList/*<TemplateInfo>*/();
+
+ if (templateInfoList != null) {
+ for (Iterator i = templateInfoList.iterator(); i.hasNext(); ) {
+ TemplateInfo templateInfo = (TemplateInfo) i.next();
+ String filterPattern = templateInfo.getFilterPattern();
+ String[] toolChains = templateInfo.getToolChainIds();
+
+ if (toolChain != null) {
+ for (int j=0; j < toolChains.length; j++) {
+ if (toolChains[j].equals(toolChain)) {
+ if (usageFilter != null && filterPattern.matches(usageFilter)) {
+ matchedTemplateInfoList.add(templateInfo);
+ } else if (usageFilter == null) {
+ matchedTemplateInfoList.add(templateInfo);
+ }
+ continue;
+ }
+ }
+ } else {
+ if (usageFilter != null && filterPattern.matches(usageFilter)) {
+ matchedTemplateInfoList.add(templateInfo);
+ } else if (usageFilter == null) {
+ matchedTemplateInfoList.add(templateInfo);
+ }
+ }
+ }
+ }
+ return (TemplateInfo[]) matchedTemplateInfoList.toArray(new TemplateInfo[matchedTemplateInfoList.size()]);
+ }
+
+ public TemplateInfo[] getTemplateInfos(String projectType, String toolChain) {
+ return getTemplateInfos(projectType, toolChain, null);
+ }
+
+ public TemplateInfo[] getTemplateInfos(String projectType) {
+ return getTemplateInfos(projectType, null, null);
+ }
+
+ /**
+ * Returns all TemplateInfo objects known to the TemplateEngine
+ * @return
+ */
+ public TemplateInfo[] getTemplateInfos() {
+ List/*<TemplateInfo>*/ infoList = new ArrayList/*<TemplateInfo>*/();
+ for (Iterator i = templateInfoMap.values().iterator(); i.hasNext();) {
+ infoList.addAll((List/*<TemplateInfo>*/)i.next());
+ }
+
+ return (TemplateInfo[]) infoList.toArray(new TemplateInfo[infoList.size()]);
+ }
+
+
+ /**
+ * Getter for templateInfoMap
+ *
+ * @return
+ */
+ public Map/*<String, List<TemplateInfo>>*/ getTemplateInfoMap() {
+ return templateInfoMap;
+ }
+
+ /**
+ * Returns the Template Schema URL
+ *
+ * @return URL of the Template Schema.
+ * @throws IOException
+ */
+ public URL getTemplateSchemaURL() throws IOException {
+ return FileLocator.toFileURL(Platform.getBundle(CCorePlugin.PLUGIN_ID).getEntry("schema/TemplateDescriptorSchema.xsd")); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the Children of the Element.
+ * @param element
+ * @return List of the child elelments
+ *
+ * @since 4.0
+ */
+ public static List/*<Element>*/ getChildrenOfElement(Element element) {
+ List/*<Element>*/ list = new ArrayList/*<Element>*/();
+ NodeList children = element.getChildNodes();
+ for (int i = 0, l = children.getLength(); i < l; i++) {
+ Node child = children.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE) {
+ list.add((Element) child);
+ }
+ }
+ return list;
+ }
+
+ /**
+ * Returns the child elements by Tag
+ *
+ * @param element
+ * @param tag
+ * @return List of child elements
+ *
+ * @since 4.0
+ */
+ public static List/*<Element>*/ getChildrenOfElementByTag(Element element, String tag) {
+ List/*<Element>*/ list = new ArrayList/*<Element>*/();
+ NodeList children = element.getChildNodes();
+ for (int i = 0, l = children.getLength(); i < l; i++) {
+ Node child = children.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals(tag)) {
+ list.add((Element) child);
+ }
+ }
+ return list;
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/ESboxTemplateInfo.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/ESboxTemplateInfo.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/templateengine/ESboxTemplateInfo.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.templateengine;
+
+import java.util.Set;
+
+import org.eclipse.cdt.core.templateengine.TemplateInfo;
+
+/**
+ * An ESbox template is extended with a category label.
+ * @author eswartz
+ *
+ */
+public class ESboxTemplateInfo extends TemplateInfo {
+
+ private String category;
+ private final String execEnv;
+ private final String projectNature;
+
+ public ESboxTemplateInfo(String templateId, String projectTypeId,
+ String filterPattern, String templatePath, String pluginId,
+ Set<String> toolChainIdSet, Object extraPagesProvider, boolean isCategory,
+ String category, String execEnv,
+ String projectNature) {
+ super(templateId, projectTypeId, filterPattern, templatePath, pluginId,
+ toolChainIdSet, extraPagesProvider, isCategory);
+ this.category = category;
+ this.execEnv = execEnv;
+ this.projectNature = projectNature;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public String getExecutionEnvironment() {
+ return execEnv;
+ }
+
+ public String getProjectNature() {
+ return projectNature;
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ConvertToESboxCppBuildConfigWizard.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ConvertToESboxCppBuildConfigWizard.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ConvertToESboxCppBuildConfigWizard.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+
+package org.maemo.esbox.cpp.project.ui.wizards;
+
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.ui.wizards.conversion.ConversionWizard;
+import org.eclipse.core.resources.IResource;
+
+public class ConvertToESboxCppBuildConfigWizard extends ConversionWizard {
+
+ public void addPages() {
+ mainPage = new ConvertToESboxCppBuildConfigWizardPage(getPrefix());
+ addPage(mainPage);
+ }
+
+ public String getProjectID() {
+ return MakeCorePlugin.MAKE_PROJECT_ID;
+ }
+
+ public String getBuildSystemId() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.wizards.newresource.BasicNewResourceWizard#selectAndReveal(org.eclipse.core.resources.IResource)
+ */
+ @Override
+ protected void selectAndReveal(IResource newResource) {
+ // workaround a npe
+ if (getWorkbench() != null && getWorkbench().getActiveWorkbenchWindow() != null)
+ super.selectAndReveal(newResource);
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ConvertToESboxCppBuildConfigWizardPage.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ConvertToESboxCppBuildConfigWizardPage.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ConvertToESboxCppBuildConfigWizardPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,322 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Intel corporation - customization for New Project model.
+ * Ed Swartz - modify for ESbox
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.wizards;
+
+
+import org.eclipse.cdt.ui.wizards.conversion.ConvertProjectWizardPage;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.execEnv.ExecutionEnvironmentFactory;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.cpp.project.core.*;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+import org.maemo.esbox.project.core.*;
+import org.maemo.esbox.ui.ESboxBuildTargetUI;
+import org.maemo.esbox.ui.ESboxExecutionEnvironmentUI;
+
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+
+public class ConvertToESboxCppBuildConfigWizardPage extends ConvertProjectWizardPage {
+
+ private TreeViewer buildTargetTreeViewer;
+ protected ISDKTarget theSdkTarget;
+ protected IExecutionEnvironment theExecEnv;
+ private TreeViewer execEnvTreeViewer;
+
+ /**
+ * Constructor for ConvertToStdMakeProjectWizardPage.
+ * @param pageName
+ */
+ public ConvertToESboxCppBuildConfigWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ /**
+ * Method getWzTitleResource returns the correct Title Label for this class
+ * overriding the default in the superclass.
+ */
+ protected String getWzTitleResource(){
+ return "Convert C/C++ Projects";
+ }
+
+ /**
+ * Method getWzDescriptionResource returns the correct description
+ * Label for this class overriding the default in the superclass.
+ */
+ protected String getWzDescriptionResource(){
+ return "Convert Project to ESbox Configuration-Based Project";
+ }
+
+ /**
+ * It's a candidate if it's not already an ESbox (new) project.
+ */
+ public boolean isCandidate(IProject project) {
+ return !ESboxCppProjectNature.isNatureInProject(project);
+ }
+
+ public void convertProject(IProject project, String bsId, IProgressMonitor monitor) throws CoreException{
+ convertToESboxProject(project, bsId, null, monitor);
+ }
+
+
+ public void convertProject(IProject project, IProgressMonitor monitor, String projectID) throws CoreException{
+ convertToESboxProject(project, null, projectID, monitor);
+ }
+
+ /**
+ * @param project
+ */
+ private void convertToESboxProject(IProject project, String bsId, String projectId, IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("Converting to ESbox project", 1);
+ try {
+ ESboxCppProjectCreatorConverterBase creator = new ESboxCppBuildConfigProjectCreatorConverter();
+ ESboxCppConfigHandler configHandler = new ESboxCppConfigHandler();
+ configHandler.initializeSingleBuildConfiguration(theSdkTarget);
+ configHandler.setIndexerId(null);
+ configHandler.setExecutionEnvironment(theExecEnv.getId());
+ creator.setup(project, configHandler);
+ IWorkspaceRunnable runnable = creator.getProjectConverterRunnable();
+ invokeRunnable(runnable);
+ monitor.worked(1);
+ } finally {
+ monitor.done();
+ }
+
+ }
+
+ private boolean invokeRunnable(final IWorkspaceRunnable workspaceRunnable) {
+ // CDT still locks the whole workspace
+ //ISchedulingRule rule = projectCreator.getProject();
+ ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
+
+ final WorkspaceModifyOperation operation = new WorkspaceModifyOperation(rule) {
+
+ @Override
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException, InvocationTargetException,
+ InterruptedException {
+ workspaceRunnable.run(monitor);
+ }
+
+ };
+
+ WorkspaceJob job = new WorkspaceJob("Converting project(s)") {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ operation.run(monitor);
+ } catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ } catch (Exception e) {
+ if (e instanceof InvocationTargetException
+ && ((InvocationTargetException) e).getTargetException() instanceof CoreException)
+ e = (CoreException) ((InvocationTargetException) e).getTargetException();
+
+ UIActivator.getErrorLogger().logAndShowError(null, e);
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.setRule(rule);
+ job.setUser(true);
+ job.schedule();
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.ui.wizards.conversion.ConvertProjectWizardPage#validatePage()
+ */
+ @Override
+ protected boolean validatePage() {
+ if (!super.validatePage())
+ return false;
+
+ setMessage(null);
+ setErrorMessage(null);
+
+ // must have a build target and execution environment
+ if (theSdkTarget == null) {
+ setErrorMessage("A build target must be selected.");
+ return false;
+ }
+
+ if (theExecEnv == null) {
+ setErrorMessage("A runtime environment must be selected.");
+ return false;
+ }
+
+ // we can only accept projects which can build from and which are visible from scratchbox
+ Object[] elements = getCheckedElements();
+ for (Object element : elements) {
+ if (element instanceof IProject) {
+ IProject project = (IProject) element;
+ IPath path = project.getRawLocation();
+ if (path == null)
+ path = project.getLocation();
+ try {
+ ProjectManager.getInstance().validateSDKTargetForProjectLocation(
+ path, theSdkTarget);
+ } catch (ESboxException e) {
+ setErrorMessage(e.getMessage());
+ return false;
+ }
+
+ // check for Makefile or autotools -- not fatal but suspicious
+ if (!CppScriptLauncher.getInstance().validateAutomakeState(project, null)) {
+ setMessage(MessageFormat.format("No Makefile or known autotools files exist in the project ''{0}''",
+ project.getName()),
+ WARNING);
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+
+ Composite composite = (Composite) getControl();
+
+ ///
+ Label label = new Label(composite, SWT.NONE);
+ label.setText("Select the build target to use:");
+
+ buildTargetTreeViewer = ESboxBuildTargetUI.createConfiguredBuildTargetViewer(composite,
+ ESboxBuildTargetUI.DEFAULT_STYLE);
+
+ buildTargetTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+ theSdkTarget = null;
+ buildTargetTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) buildTargetTreeViewer.getSelection();
+ Object element = selection.getFirstElement();
+ if (element instanceof ISDKTarget) {
+ theSdkTarget = (ISDKTarget) selection.getFirstElement();
+ } else {
+ theSdkTarget = null;
+ }
+ setPageComplete(validatePage());
+ }
+
+ });
+
+ buildTargetTreeViewer.setInput(new Object());
+
+ ////
+
+ label = new Label(composite, SWT.NONE);
+ label.setText("Select the runtime environment:");
+
+ execEnvTreeViewer = ESboxExecutionEnvironmentUI.createConfiguredExecutionEnvironmentViewer(composite,
+ ESboxExecutionEnvironmentUI.DEFAULT_STYLE);
+
+ execEnvTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+
+ execEnvTreeViewer.getTree().setToolTipText("This is the environment in which the project runs. ESbox will offer to start the environment upon a launch.");
+
+ theExecEnv = null;
+ execEnvTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) execEnvTreeViewer.getSelection();
+ theExecEnv = (IExecutionEnvironment) selection.getFirstElement();
+ setPageComplete(validatePage());
+ }
+
+ });
+
+ execEnvTreeViewer.setInput(new Object());
+
+
+ // try to pick current settings, if known
+ IStructuredSelection sel = ((BasicNewResourceWizard)getWizard()).getSelection();
+ Object[] elements = null;
+ if (sel != null)
+ elements = sel.toArray();
+ if (elements == null || elements.length == 0)
+ elements = ((IStructuredContentProvider) tableViewer.getContentProvider()).getElements(tableViewer.getInput());
+
+ IProjectProperties projectProperties = getCandidateESboxProjectProperties(elements);
+ if (projectProperties != null) {
+ try {
+ theSdkTarget = projectProperties.getSDKTarget();
+ buildTargetTreeViewer.setSelection(new StructuredSelection(theSdkTarget));
+ } catch (ESboxException e) {
+ }
+
+ String execEnvId = projectProperties.getExecutionEnvironmentId();
+ if (execEnvId != null) {
+ // the ids changed, so be looser
+ String baseId = execEnvId;
+ int idx = execEnvId.lastIndexOf('.');
+ if (idx >= 0)
+ baseId = execEnvId.substring(idx + 1);
+ for (IExecutionEnvironment execEnv : ExecutionEnvironmentFactory.getInstance().getExecutionEnvironments()) {
+ if (execEnv.getId().endsWith(baseId)) {
+ theExecEnv = execEnv;
+ execEnvTreeViewer.setSelection(new StructuredSelection(theExecEnv));
+ break;
+ }
+ }
+ }
+ }
+
+ // select all by default
+ if (sel != null) {
+ tableViewer.setCheckedElements(sel.toArray());
+ } else {
+ tableViewer.setAllChecked(true);
+ }
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * Find an existing ESbox project with properties we can use
+ * @return IProject or <code>null</code>
+ */
+ private IProjectProperties getCandidateESboxProjectProperties(Object[] elements) {
+ for (Object obj : elements) {
+ if (obj instanceof IProject) {
+ IProject project = (IProject) obj;
+ IProjectProperties projectProperties;
+ try {
+ projectProperties = ProjectManager.getInstance().getOldStyleProjectProperties(project);
+ // ping it to find one with a valid target
+ projectProperties.getSDKTarget();
+ return projectProperties;
+ } catch (ESboxException e) {
+ // not a candidate
+ }
+ }
+ }
+ return null;
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/CppProjectWizard.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/CppProjectWizard.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/CppProjectWizard.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.ui.wizards;
+
+import org.eclipse.cdt.managedbuilder.ui.wizards.CfgHolder;
+import org.eclipse.cdt.ui.templateengine.Template;
+import org.eclipse.cdt.ui.templateengine.pages.UIWizardPage;
+import org.eclipse.cdt.ui.wizards.IWizardWithMemory;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.ui.INewWizard;
+import org.maemo.esbox.cpp.project.core.*;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+import org.maemo.esbox.project.core.ITemplate;
+import org.maemo.esbox.project.ui.wizards.*;
+
+import java.util.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public class CppProjectWizard extends ESboxCommonNewProjectWizard
+ implements INewWizard, IWizardWithMemory {
+ protected CfgHolder[] cfgs = new CfgHolder[0];
+
+ /**
+ * Constructor.
+ * Creates a wizard to new ESbox projects.
+ */
+ public CppProjectWizard() {
+ super("New Maemo C/C++ Project", "Create a Maemo project inside Scratchbox");
+ setProjectCreator(new ESboxCppBuildConfigProjectCreatorConverter());
+ setConfigHandler(new ESboxCppConfigHandler());
+ }
+
+ @Override
+ protected String getProjectNatureIdPattern() {
+ return ESboxCppProjectNature.ESBOX_CPP_NATURE_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.wizards.ESboxCommonNewProjectWizard#createTargetSelectionPage()
+ */
+ @Override
+ protected ESboxBaseProjectTargetSelectionPage createTargetSelectionPage() {
+ return new ESboxProjectMultiTargetSelectionPage(getConfigHandler());
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+ }
+
+ @Override
+ protected IWizardPage getPageFollowingTemplatePages() {
+ return null;
+ }
+
+ protected IWizardPage[] getTemplateContributedPages(ITemplate itemplate) {
+ // NOTE: CDT has a stupid bug where "getTemplateWizardPages" doesn't allow a NULL next page,
+ // so we have to manually replicate its behavior here
+
+ Template template = (Template) itemplate.getAdapter(Template.class);
+
+ Map<String, UIWizardPage> pageMap = template.getUIPages();
+ IWizardPage[] templatePages = new IWizardPage[pageMap.size()];
+ int idx = 0;
+ for (UIWizardPage page : pageMap.values()) {
+ templatePages[idx] = page;
+ if (idx == 0)
+ templatePages[idx].setPreviousPage(getPageBeforeTemplatePages());
+ idx++;
+ }
+
+ for (int i = 0; i < templatePages.length; i++) {
+ IWizardPage templatePage = templatePages[i];
+ templatePage.setImageDescriptor(UIActivator.getImageDescriptor("./icons/new_maemo_prj_wiz.gif"));
+ this.addPage(templatePage);
+ }
+ return templatePages;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.ui.wizards.ESboxCommonNewProjectWizard#configureTemplate(org.maemo.esbox.project.core.ITemplate)
+ */
+ @Override
+ protected void configureTemplate(ITemplate itemplate, IWizardPage[] templatePages) {
+ Template template = (Template) itemplate.getAdapter(Template.class);
+ if (template == null)
+ return;
+
+ template = initializeTemplateValues(template, templatePages);
+
+ List<Object> configs = new ArrayList<Object>();
+ for(int i = 0; i < cfgs.length; i++){
+ configs.add(cfgs[i].getConfiguration());
+ }
+ template.getTemplateInfo().setConfigurations(configs);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public Template initializeTemplateValues(Template template, IWizardPage[] templatePages) {
+
+ if(template != null){
+ Map valueStore = template.getValueStore();
+ for(int i=0; i < templatePages.length; i++) {
+ IWizardPage page = templatePages[i];
+ if (page instanceof UIWizardPage)
+ valueStore.putAll(((UIWizardPage)page).getPageData());
+ }
+ //valueStore.putAll(getMainPageData());
+ }
+ return template;
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ExternalizeWizard.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ExternalizeWizard.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ExternalizeWizard.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.cpp.project.ui.wizards;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.wizard.Wizard;
+import org.maemo.esbox.internal.cpp.project.ui.UIActivator;
+
+public class ExternalizeWizard extends Wizard {
+
+ private ExternalizeWizardPage page;
+ private IResource[] resource;
+
+ public ExternalizeWizard(IResource[] resource) {
+ this.resource = resource;
+ setNeedsProgressMonitor(true);
+ setForcePreviousAndNextButtons(true);
+ setDefaultPageImageDescriptor(UIActivator.getImageDescriptor("./icons/full/wizban/newmaemoprj_wiz.png"));
+ }
+
+ /**
+ * @see Wizard#addPages()
+ */
+ public void addPages() {
+ page = new ExternalizeWizardPage(resource);
+ addPage(page);
+ }
+
+ /**
+ * @see Wizard#canFinish()
+ */
+ public boolean canFinish() {
+ return page.canFinish();
+ }
+
+ @Override
+ public boolean performFinish() {
+ return page.performFinish();
+ }
+}
\ No newline at end of file
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ExternalizeWizardPage.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ExternalizeWizardPage.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/cpp/project/ui/wizards/ExternalizeWizardPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,1034 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.cpp.project.ui.wizards;
+
+import copiedFromJDT.core.compiler.InvalidInputException;
+import copiedFromJDT.internal.corext.refactoring.nls.*;
+import copiedFromJDT.internal.ui.CopiedFromJDTPluginImages;
+import copiedFromJDT.internal.ui.refactoring.nls.MultiStateCellEditor;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration;
+import org.eclipse.cdt.internal.ui.text.CTextTools;
+import org.eclipse.cdt.internal.ui.util.SWTUtil;
+import org.eclipse.cdt.ui.*;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.*;
+import org.eclipse.jface.text.*;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.project.core.ProjectManager;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+class ExternalizeWizardPage extends WizardPage {
+
+ private static final String[] PROPERTIES;
+ private static final String[] fgTitles;
+ private static final int STATE_PROP = 0;
+ private static final int VAL_PROP = 1;
+ private static final int KEY_PROP = 2;
+ private static final int SIZE = 3; // column counter
+ private static final int ROW_COUNT = 5;
+
+ public static final String PAGE_NAME = "NLSWizardPage1"; //$NON-NLS-1$
+ static {
+ PROPERTIES = new String[SIZE];
+ PROPERTIES[STATE_PROP] = "task"; //$NON-NLS-1$
+ PROPERTIES[KEY_PROP] = "key"; //$NON-NLS-1$
+ PROPERTIES[VAL_PROP] = "value"; //$NON-NLS-1$
+
+ fgTitles = new String[SIZE];
+ fgTitles[STATE_PROP] = ""; //$NON-NLS-1$
+ fgTitles[KEY_PROP] = "msgid";
+ fgTitles[VAL_PROP] = "msgstr";
+ }
+
+ private class CellModifier implements ICellModifier {
+
+ /**
+ * @see ICellModifier#canModify(Object, String)
+ */
+ public boolean canModify(Object element, String property) {
+ if (property == null)
+ return false;
+
+ if (!(element instanceof NLSSubstitution))
+ return false;
+
+ NLSSubstitution subst = (NLSSubstitution) element;
+ if (PROPERTIES[KEY_PROP].equals(property)
+ && subst.getState() != NLSSubstitution.EXTERNALIZED) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @see ICellModifier#getValue(Object, String)
+ */
+ public Object getValue(Object element, String property) {
+ if (element instanceof NLSSubstitution) {
+ NLSSubstitution substitution = (NLSSubstitution) element;
+ String res = null;
+ if (PROPERTIES[KEY_PROP].equals(property)) {
+ res = substitution.getKeyWithoutPrefix();
+ } else if (PROPERTIES[VAL_PROP].equals(property)) {
+ res = substitution.getValue();
+ } else if (PROPERTIES[STATE_PROP].equals(property)) {
+ return new Integer(substitution.getState());
+ }
+ if (res != null) {
+ return unwindEscapeChars(res);
+ }
+ return ""; //$NON-NLS-1$
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @see ICellModifier#modify(Object, String, Object)
+ */
+ public void modify(Object element, String property, Object value) {
+ if (element instanceof TableItem) {
+ Object data = ((TableItem) element).getData();
+ if (data instanceof NLSSubstitution) {
+ NLSSubstitution substitution = (NLSSubstitution) data;
+ if (PROPERTIES[KEY_PROP].equals(property)) {
+ String string = (String) value;
+ string = windEscapeChars(string);
+ substitution.setKey(string);
+ }
+ if (PROPERTIES[VAL_PROP].equals(property)) {
+ String string = (String) value;
+ string = windEscapeChars(string);
+ substitution.setValue(string);
+ }
+ }
+ validateKeys(true);
+ }
+ }
+ }
+
+ private class NLSSubstitutionLabelProvider extends LabelProvider implements
+ ITableLabelProvider, IFontProvider {
+
+ private FontRegistry fFontRegistry;
+
+ public NLSSubstitutionLabelProvider() {
+ fFontRegistry = JFaceResources.getFontRegistry();
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ String columnText = ""; //$NON-NLS-1$
+ if (element instanceof NLSSubstitution) {
+ NLSSubstitution substitution = (NLSSubstitution) element;
+ if (columnIndex == KEY_PROP) {
+ if (substitution.getState() == NLSSubstitution.EXTERNALIZED) {
+ columnText = substitution.getKey();
+ }
+ } else if ((columnIndex == VAL_PROP)
+ && (substitution.getValue() != null)) {
+ columnText = substitution.getValue();
+ }
+ }
+ return unwindEscapeChars(columnText);
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ if ((columnIndex == STATE_PROP)
+ && (element instanceof NLSSubstitution)) {
+ return getNLSImage((NLSSubstitution) element);
+ }
+
+ return null;
+ }
+
+ public Font getFont(Object element) {
+ if (element instanceof NLSSubstitution) {
+ NLSSubstitution substitution = (NLSSubstitution) element;
+ if (substitution.hasPropertyFileChange()
+ || substitution.hasSourceChange()) {
+ return fFontRegistry.getBold(JFaceResources.DIALOG_FONT);
+ }
+ }
+ return null;
+ }
+
+ private Image getNLSImage(NLSSubstitution sub) {
+ if ((sub.getValue() == null) && (sub.getKey() != null)) {
+ // Missing keys
+ CElementImageDescriptor imageDescriptor = new CElementImageDescriptor(
+ getNLSImageDescriptor(sub.getState()),
+ CElementImageDescriptor.WARNING, new Point(16, 16));
+ return CUIPlugin.getImageDescriptorRegistry().get(
+ imageDescriptor);
+
+ } else if (sub.isConflicting(fSubstitutions)
+ || !isKeyValid(sub)) {
+ CElementImageDescriptor imageDescriptor = new CElementImageDescriptor(
+ getNLSImageDescriptor(sub.getState()),
+ CElementImageDescriptor.ERROR, new Point(16, 16));
+ return CUIPlugin.getImageDescriptorRegistry().get(
+ imageDescriptor);
+ } else {
+ return getNLSImage();
+ }
+ }
+
+ private Image getNLSImage() {
+ return CopiedFromJDTPluginImages.get(CopiedFromJDTPluginImages.IMG_OBJS_NLS_TRANSLATE);
+ }
+
+ private ImageDescriptor getNLSImageDescriptor(int task) {
+ switch (task) {
+ case NLSSubstitution.EXTERNALIZED:
+ return CopiedFromJDTPluginImages.DESC_OBJS_NLS_TRANSLATE;
+ case NLSSubstitution.IGNORED:
+ return CopiedFromJDTPluginImages.DESC_OBJS_NLS_NEVER_TRANSLATE;
+ case NLSSubstitution.INTERNALIZED:
+ return CopiedFromJDTPluginImages.DESC_OBJS_NLS_SKIP;
+ default:
+ Assert.isTrue(false);
+ return null;
+ }
+ }
+ }
+
+ private static String unwindEscapeChars(String s) {
+ if (s != null) {
+ StringBuffer sb = new StringBuffer(s.length());
+ int length = s.length();
+ for (int i = 0; i < length; i++) {
+ char c = s.charAt(i);
+ sb.append(getUnwoundString(c));
+ }
+ return sb.toString();
+ }
+ return null;
+ }
+
+ private static String getUnwoundString(char c) {
+ switch (c) {
+ case '\b':
+ return "\\b";//$NON-NLS-1$
+ case '\t':
+ return "\\t";//$NON-NLS-1$
+ case '\n':
+ return "\\n";//$NON-NLS-1$
+ case '\f':
+ return "\\f";//$NON-NLS-1$
+ case '\r':
+ return "\\r";//$NON-NLS-1$
+ case '\\':
+ return "\\\\";//$NON-NLS-1$
+ }
+ return String.valueOf(c);
+ }
+
+ private static String windEscapeChars(String s) {
+ if (s == null)
+ return null;
+
+ char aChar;
+ int len = s.length();
+ StringBuffer outBuffer = new StringBuffer(len);
+
+ for (int x = 0; x < len;) {
+ aChar = s.charAt(x++);
+ if (aChar == '\\') {
+ aChar = s.charAt(x++);
+ if (aChar == 'u') {
+ // Read the xxxx
+ int value = 0;
+ for (int i = 0; i < 4; i++) {
+ aChar = s.charAt(x++);
+ switch (aChar) {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ value = (value << 4) + aChar - '0';
+ break;
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ value = (value << 4) + 10 + aChar - 'a';
+ break;
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ value = (value << 4) + 10 + aChar - 'A';
+ break;
+ default:
+ throw new IllegalArgumentException(
+ "Malformed \\uxxxx encoding."); //$NON-NLS-1$
+ }
+ }
+ outBuffer.append((char) value);
+ } else {
+ if (aChar == 't') {
+ outBuffer.append('\t');
+ } else {
+ if (aChar == 'r') {
+ outBuffer.append('\r');
+ } else {
+ if (aChar == 'n') {
+ outBuffer.append('\n');
+ } else {
+ if (aChar == 'f') {
+ outBuffer.append('\f');
+ } else {
+ outBuffer.append(aChar);
+ }
+ }
+ }
+ }
+ }
+ } else
+ outBuffer.append(aChar);
+ }
+ return outBuffer.toString();
+ }
+
+ private Text fPrefixField;
+ private Text fNameField;
+
+ private Table fTable;
+ private TableViewer fTableViewer;
+ private SourceViewer fSourceViewer;
+
+ private NLSSubstitution[] fSubstitutions;
+ private NLSSubstitution[] substitutions;
+ private Button fFilterCheckBox;
+
+ private IResource[] resources;
+ private IResource resource;
+
+ public ExternalizeWizardPage(IResource[] resource) {
+ super(PAGE_NAME);
+ this.resource = resource[0];
+ setTitle("Externalizes Strings in '" + this.resource.getName() + "'");
+ setDescription("Externalizes strings from code into a properties file. The auto-generated keys should be adjusted.");
+ resources = resource;
+
+ fSubstitutions = getAllSubstitutions();
+ createDefaultExternalization(fSubstitutions, this.resource.getName());
+ }
+
+ public NLSSubstitution[] getAllSubstitutions() {
+ ArrayList<NLSSubstitution> result = new ArrayList<NLSSubstitution>(0);
+ for(IResource choice : resources) {
+ for(NLSSubstitution nls : getSubstitutions(choice))
+ result.add(nls);
+ }
+
+ return (NLSSubstitution[]) result.toArray(new NLSSubstitution[result.size()]);
+ }
+
+ public NLSSubstitution[] getSubstitutions(IResource resource) {
+ try {
+ BufferedReader file = new BufferedReader(new FileReader(resource
+ .getLocation().toOSString()));
+
+ return createSubstitutions(NLSScanner
+ .scan(getContentsSpecial(file)), resource);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InvalidInputException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ private String getContentsSpecial(BufferedReader file) throws IOException {
+ String contents = "";
+ String linha;
+ while ((linha = file.readLine()) != null)
+ contents = contents + contains(linha) + "\n";
+ return contents;
+ }
+
+ private String contains(String element) {
+ if (element.contains("\"\"") || element.contains("#include"))
+ return element.replace("\"", "*");
+ return element;
+ }
+
+ private NLSSubstitution[] createSubstitutions(NLSLine[] lines, IResource resource) {
+ HashMap<String, NLSSubstitution> list = new HashMap<String, NLSSubstitution>();
+ ArrayList<NLSSubstitution> result = new ArrayList<NLSSubstitution>();
+ ArrayList<NLSSubstitution> all = new ArrayList<NLSSubstitution>();
+ for (NLSLine nline : lines) {
+ for (NLSElement nlsElement : nline.getElements()) {
+
+ NLSSubstitution nls = new NLSSubstitution(
+ NLSSubstitution.INTERNALIZED,
+ stripQuotes(nlsElement.getValue()), nlsElement, resource);
+
+ nls.setPrefix(prefix(resource.getName()));
+ if (!list.containsKey(nlsElement.getValue())) {
+ list.put(nlsElement.getValue(),nls);
+ result.add(nls);
+ }
+ all.add(nls);
+ }
+ }
+ substitutions = addSubstitutions((NLSSubstitution[]) all.toArray(new NLSSubstitution[all.size()]));
+
+ return (NLSSubstitution[]) result.toArray(new NLSSubstitution[result.size()]);
+ }
+
+ private NLSSubstitution[] addSubstitutions(NLSSubstitution[] array) {
+ ArrayList<NLSSubstitution> all = new ArrayList<NLSSubstitution>();
+
+ if (substitutions != null)
+ for (NLSSubstitution s : substitutions)
+ all.add(s);
+
+ for (NLSSubstitution s : array)
+ all.add(s);
+
+ return (NLSSubstitution[]) all.toArray(new NLSSubstitution[all.size()]);
+ }
+
+ private String prefix(String name) {
+ String[] names = name.split("\\.");
+ return names[0].replace(names[0].charAt(0) + "",
+ (names[0].charAt(0) + "").toUpperCase());
+ }
+
+ private String stripQuotes(String str) {
+ return str.substring(1, str.length() - 1);
+ }
+
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite supercomposite = new Composite(parent, SWT.NONE);
+ supercomposite.setFont(parent.getFont());
+ supercomposite.setLayout(new GridLayout());
+
+ createFunction(supercomposite);
+ createOutput(supercomposite);
+ createKeyPrefixField(supercomposite);
+
+ SashForm composite = new SashForm(supercomposite, SWT.VERTICAL);
+ composite.setFont(supercomposite.getFont());
+
+ GridData data = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(data);
+
+ createTableViewer(composite);
+ createSourceViewer(composite);
+
+ composite.setWeights(new int[] { 55, 35 });
+
+ validateKeys(false);
+
+ // promote control
+ setControl(supercomposite);
+ Dialog.applyDialogFont(supercomposite);
+ }
+
+
+ private void createFunction(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 1;
+ gl.marginWidth = 0;
+ composite.setLayout(gl);
+
+ Label l2 = new Label(composite, SWT.NONE);
+ l2.setText("&Function: #define _(String) gettext(String)");
+ l2.setLayoutData(new GridData());
+
+ }
+
+ private void createTableViewer(Composite composite) {
+ createTableComposite(composite);
+
+ fTableViewer= new TableViewer(fTable);
+ fTableViewer.setUseHashlookup(true);
+
+ final CellEditor[] editors = createCellEditors();
+ fTableViewer.setCellEditors(editors);
+ fTableViewer.setColumnProperties(PROPERTIES);
+ fTableViewer.setCellModifier(new CellModifier());
+ fTableViewer.cancelEditing();
+ fTableViewer.setContentProvider(new IStructuredContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ return fSubstitutions;
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ });
+ fTableViewer.addFilter(new ViewerFilter() {
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
+ if (!fFilterCheckBox.getSelection()) {
+ return true;
+ }
+ NLSSubstitution curr = (NLSSubstitution) element;
+ return (curr.getInitialState() == NLSSubstitution.INTERNALIZED)
+ || (curr.getInitialState() == NLSSubstitution.EXTERNALIZED && curr
+ .getInitialValue() == null);
+ }
+ });
+
+ fTableViewer.setLabelProvider(new NLSSubstitutionLabelProvider());
+ fTableViewer.setInput(new Object());
+ fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ ExternalizeWizardPage.this.selectionChanged(event);
+ }
+ });
+ }
+
+ private void selectionChanged(SelectionChangedEvent event) {
+
+ for(TableItem item : fTable.getSelection())
+ resource = ((NLSSubstitution)item.getData()).getIResource();
+
+ setTitle("Externalizes Strings in '" + resource.getName() + "'");
+ updateDocument();
+ updateSourceView((IStructuredSelection) event.getSelection());
+ }
+
+
+ private void updateSourceView(IStructuredSelection selection) {
+ NLSSubstitution first = (NLSSubstitution) selection.getFirstElement();
+ if (first != null) {
+ Region region = first.getNLSElement().getPosition();
+ fSourceViewer.setSelectedRange(region.getOffset(), region
+ .getLength());
+ fSourceViewer.revealRange(region.getOffset(), region.getLength());
+ }
+ }
+
+
+ private void createDefaultExternalization(NLSSubstitution[] fSubstitutions,
+ String defaultPrefix) {
+ for (int i = 0; i < fSubstitutions.length; i++) {
+ NLSSubstitution substitution = fSubstitutions[i];
+ if (substitution.getState() == NLSSubstitution.INTERNALIZED) {
+ substitution.setState(NLSSubstitution.EXTERNALIZED);
+ substitution.setKey(i + "");
+ }
+ }
+
+ for (int i = 0; i < substitutions.length; i++) {
+ NLSSubstitution substitution = substitutions[i];
+ if (substitution.getState() == NLSSubstitution.INTERNALIZED) {
+ substitution.setState(NLSSubstitution.EXTERNALIZED);
+ substitution.setKey(i + "");
+ }
+ }
+ }
+
+ private CellEditor[] createCellEditors() {
+ final CellEditor editors[] = new CellEditor[SIZE];
+ editors[STATE_PROP] = new MultiStateCellEditor(fTable,
+ NLSSubstitution.STATE_COUNT, NLSSubstitution.DEFAULT);
+ editors[KEY_PROP] = new TextCellEditor(fTable);
+ editors[VAL_PROP] = new TextCellEditor(fTable);
+ return editors;
+ }
+
+ private void createSourceViewer(Composite parent) {
+ Composite c = new Composite(parent, SWT.NONE);
+ c.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout gl = new GridLayout();
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ c.setLayout(gl);
+
+ Label l = new Label(c, SWT.NONE);
+ l.setText("Conte&xt:");
+ l.setLayoutData(new GridData());
+
+ // source viewer
+ int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER
+ | SWT.FULL_SELECTION;
+ fSourceViewer = new SourceViewer(c, null, null, false, styles);
+
+ updateDocument();
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = convertHeightInCharsToPixels(10);
+ gd.widthHint = convertWidthInCharsToPixels(40);
+ fSourceViewer.getControl().setLayoutData(gd);
+
+ }
+
+ private void updateDocument() {
+
+ try {
+ IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore();
+
+ // XXX: find an API-safe way to do this
+ CTextTools textTools = CUIPlugin.getDefault().getTextTools();
+ fSourceViewer.configure(new CSourceViewerConfiguration(textTools
+ .getColorManager(), store, null, null));
+ fSourceViewer.getControl().setFont(
+ JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
+ BufferedReader file = new BufferedReader(new FileReader(resource
+ .getLocation().toOSString()));
+ IDocument document = new Document(getContents(file));
+ textTools.setupCDocument(document);
+
+ fSourceViewer.setDocument(document);
+ fSourceViewer.setEditable(false);
+
+ } catch (FileNotFoundException e) {
+ CCorePlugin.log(e);
+ } catch (IOException e) {
+ CCorePlugin.log(e);
+ }
+
+ }
+
+ private String getContents(BufferedReader file) throws IOException {
+ String contents = "";
+ String linha;
+ while ((linha = file.readLine()) != null)
+ contents = contents + linha.replace("'", " ") + "\n";
+ return contents;
+ }
+
+ private FileWriter openFile(String path) throws IOException {
+ FileWriter fileWriter;
+ try {
+ fileWriter = new FileWriter(path);
+ } catch (IOException e) {
+ fileWriter = new FileWriter(new File(path));
+ CCorePlugin.log(e);
+ }
+ return fileWriter;
+ }
+
+
+ public boolean performFinish() {
+ try {
+ ISDKTarget target = ProjectManager.getInstance().getSDKTarget(resource.getProject());
+ IProcessLauncherFactory factory = target.getProcessLauncherFactory();
+
+ IPath projectLocation = resource.getProject().getLocation();
+ IPath targetProjectLocation = target.convertHostToTargetPath(projectLocation);
+
+ IPath poDirectoryLocation = projectLocation.append("po");
+ poDirectoryLocation.toFile().mkdirs();
+
+ // refreshing project
+ resource.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+
+
+ //path of project
+ FileWriter fileWriter = openFile(poDirectoryLocation.append("POTFILES.in").toOSString());
+
+ for(IResource resource : resources)
+ fileWriter.write("\n../" + resource.getFullPath().removeFirstSegments(1));
+ fileWriter.close();
+
+ String[] cmdLine = {"xgettext", "-f", "POTFILES.in", "-C", "-a", "-o", fNameField.getText() +".po"};
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(factory, targetProjectLocation,
+ CommandLineArguments.createFromArray(cmdLine));
+
+ Process process = processLauncher.createProcess();
+
+ processLauncher.redirectToConsole(true, target, "xgettext output [" + resource.getProject().getName() + "]");
+
+ process.waitFor(); // wait Runtime process end
+
+ int number = 0;
+ for(IResource resource : resources) {
+ number = updatingChoseFile(resource.getLocation().toOSString(), number); // updating file with new values
+ resource.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+ }
+ fSubstitutions = checkValues(fSubstitutions);
+ updatingPo(poDirectoryLocation.append(fNameField.getText()).addFileExtension("po").toOSString());
+
+ resource.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (Exception e) {
+ CCorePlugin.log(e);
+ MessageDialog.openError(getShell(), "Externalize Wizard Error", "Is not possible Externalize Strings.");
+ return false;
+ }
+ return true;
+ }
+
+ private int updatingChoseFile(String string, int number) throws IOException {
+ BufferedReader bufferedReader = new BufferedReader(new FileReader(string));
+ String linha = null;
+ String buffered = "#define _(String) gettext(String)\n";
+ int i = number;
+
+ while ((linha = bufferedReader.readLine()) != null) {
+ if (i < substitutions.length && linha.contains(checkLine("\"" + substitutions[i].getValue() + "\""))) {
+ linha = linha.replace(checkLine("\"" + substitutions[i].getValue() + "\""), "_(\"" + findKey(substitutions[i]) + "\")");
+ i++;
+ }
+ buffered += linha + "\n";
+ }
+ bufferedReader.close();
+
+ BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(string));
+ bufferedWriter.write(buffered); // write on file
+ bufferedWriter.close();
+ return i;
+ }
+
+
+
+ private String findKey(NLSSubstitution substitution) {
+ for (NLSSubstitution s : fSubstitutions) {
+ if (s.getValue().equals(substitution.getValue()))
+ return s.getKey();
+ }
+ return substitution.getKey();
+
+ }
+
+ private void updatingPo(String string) throws IOException {
+ BufferedReader bufferedReader = new BufferedReader(new FileReader(string));
+ String linha = null;
+ String buffered = "";
+ int i = 0;
+ while ((linha = bufferedReader.readLine()) != null) {
+ while (linha != null && containsResource(linha)) {
+ buffered += linha + "\n";
+ linha = bufferedReader.readLine();
+
+ if (linha.startsWith("#, c")) {
+ buffered += linha + "\n";
+ linha = bufferedReader.readLine();
+ }
+ if (linha.startsWith("msgid")) {
+ if (i >= 0) {
+ buffered += "msgid \"" + fSubstitutions[i].getKey() + "\"\n";
+ buffered += "msgstr \"" + fSubstitutions[i].getValue() + "\"\n";
+ bufferedReader.readLine();
+ linha = bufferedReader.readLine();
+
+ }
+ i++;
+ }
+ }
+ if (linha == null)
+ break;
+ buffered += linha + "\n";
+ }
+ bufferedReader.close();
+
+ BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(string));
+ bufferedWriter.write(buffered); // write on file
+ bufferedWriter.close();
+ }
+
+ private boolean containsResource(String linha) {
+ for(IResource resource: resources)
+ if (linha.contains(resource.getName()))
+ return true;
+
+ return false;
+ }
+
+ public boolean canFinish() {
+ if (super.isPageComplete())
+ return true;
+ return false;
+ }
+
+
+ private void createOutput(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ gl.marginWidth = 0;
+ composite.setLayout(gl);
+
+ Label l = new Label(composite, SWT.NONE);
+ l.setText("&Define the output filename:");
+ l.setLayoutData(new GridData());
+
+ fNameField = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ fNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fNameField.setText("en_GB");
+ fNameField.selectAll();
+ fNameField.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+
+ }
+ });
+ }
+
+
+ private void createKeyPrefixField(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ gl.marginWidth = 0;
+ composite.setLayout(gl);
+
+ Label l = new Label(composite, SWT.NONE);
+ l.setText("&Enter common prefix for generated keys (optional):");
+ l.setLayoutData(new GridData());
+
+ fPrefixField = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ fPrefixField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fPrefixField.setText(prefix(resource.getName()));
+ fPrefixField.selectAll();
+
+ fPrefixField.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ for (NLSSubstitution nls : fSubstitutions)
+ nls.setPrefix(fPrefixField.getText());
+
+ for (NLSSubstitution nls : substitutions)
+ nls.setPrefix(fPrefixField.getText());
+
+ validateKeys(true);
+ }
+ });
+ }
+
+ private void validateKeys(boolean refreshTable) {
+ if (checkInvalidKeys() && checkDuplicateKeys() && checkMissingKeys())
+ setPageComplete(true);
+ else
+ setPageComplete(false);
+
+ if (refreshTable)
+ fTableViewer.refresh(true);
+ }
+
+ private boolean checkInvalidKeys() {
+ for (NLSSubstitution substitution : fSubstitutions) {
+ if (!isKeyValid(substitution))
+ return false;
+ }
+ setErrorMessage(null);
+ return true;
+ }
+
+ private boolean isKeyValid(NLSSubstitution substitution) {
+ if (substitution == null)
+ return false;
+
+ if (substitution.getState() != NLSSubstitution.EXTERNALIZED)
+ return true;
+
+ String key = substitution.getKey();
+
+ if (key == null || key.length() == 0) {
+ setErrorMessage("Some keys are invalid.");
+ return false;
+ }
+ // validation so keys don't contain spaces
+ for (int i = 0; i < key.length(); i++) {
+ if (Character.isWhitespace(key.charAt(i))) {
+ setErrorMessage("Some keys are invalid.");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private NLSSubstitution[] checkValues(NLSSubstitution[] fSubstitutions) {
+ for (NLSSubstitution substitution : fSubstitutions)
+ substitution.setValue( checkLine (substitution.getValue() ));
+ return fSubstitutions;
+ }
+
+ private String checkLine(String linha) {
+ return linha.replace("\n", "\\n");
+ }
+
+ private boolean checkDuplicateKeys() {
+ for (NLSSubstitution substitution : fSubstitutions) {
+ if (conflictingKeys(substitution)) {
+ setErrorMessage("Conflicting entries: Same key but different values");
+ return false;
+ }
+ }
+ setErrorMessage(null);
+ return true;
+ }
+
+ private boolean checkMissingKeys() {
+ for (NLSSubstitution substitution : fSubstitutions) {
+ if ((substitution.getValue() == null)
+ && (substitution.getKey() != null)) {
+ setErrorMessage("Entry is missing in property file.");
+ return false;
+ }
+ }
+ setErrorMessage(null);
+ return true;
+ }
+
+ private boolean conflictingKeys(NLSSubstitution substitution) {
+ if (substitution.getState() == NLSSubstitution.EXTERNALIZED) {
+ return substitution.isConflicting(fSubstitutions);
+ }
+ return false;
+ }
+
+ private void createTableComposite(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setFont(parent.getFont());
+
+ comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ FormLayout fl = new FormLayout();
+ fl.marginWidth = 0;
+ fl.marginHeight = 0;
+ comp.setLayout(fl);
+
+ Label l = new Label(comp, SWT.NONE);
+ l.setText("St&rings to externalize:");
+ FormData formData = new FormData();
+ formData.left = new FormAttachment(0, 0);
+ l.setLayoutData(formData);
+
+ Control tableControl = createTable(comp);
+ formData = new FormData();
+ formData.top = new FormAttachment(l, 5);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ formData.bottom = new FormAttachment(100, 0);
+ tableControl.setLayoutData(formData);
+
+ fFilterCheckBox = new Button(comp, SWT.CHECK);
+ fFilterCheckBox
+ .setText("&Filter all existing ignored and externalized entries");
+ formData = new FormData();
+ formData.right = new FormAttachment(100, 0);
+ fFilterCheckBox.setLayoutData(formData);
+ fFilterCheckBox.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ doFilterCheckBoxPressed();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ fFilterCheckBox.setSelection(hasNewOrMissingSubstitutions());
+ }
+
+ private boolean hasNewOrMissingSubstitutions() {
+ for (NLSSubstitution curr : fSubstitutions) {
+ if (curr.getInitialState() == NLSSubstitution.INTERNALIZED) {
+ return true;
+ }
+ if (curr.getInitialState() == NLSSubstitution.EXTERNALIZED
+ && curr.getInitialValue() == null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected void doFilterCheckBoxPressed() {
+ fTableViewer.refresh();
+ }
+
+ private Control createTable(Composite parent) {
+ Composite c = new Composite(parent, SWT.NONE);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 1;
+ gl.marginWidth = 0;
+ gl.marginHeight = 0;
+ c.setLayout(gl);
+
+ fTable = new Table(c, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI
+ | SWT.FULL_SELECTION | SWT.HIDE_SELECTION | SWT.BORDER);
+ fTable.setFont(parent.getFont());
+
+ GridData tableGD = new GridData(GridData.FILL_BOTH);
+ tableGD.heightHint = SWTUtil.getTableHeightHint(fTable, ROW_COUNT);
+ fTable.setLayoutData(tableGD);
+ fTable.setLinesVisible(true);
+
+ TableLayout layout = new TableLayout();
+ fTable.setLayout(layout);
+ fTable.setHeaderVisible(true);
+
+ ColumnLayoutData[] columnLayoutData = new ColumnLayoutData[SIZE];
+ columnLayoutData[STATE_PROP] = new ColumnPixelData(18, false, true);
+ columnLayoutData[KEY_PROP] = new ColumnWeightData(40, true);
+ columnLayoutData[VAL_PROP] = new ColumnWeightData(40, true);
+
+ for (int i = 0; i < fgTitles.length; i++) {
+ TableColumn tc = new TableColumn(fTable, SWT.NONE, i);
+ tc.setText(fgTitles[i]);
+ layout.addColumnData(columnLayoutData[i]);
+ tc.setResizable(columnLayoutData[i].resizable);
+ }
+ return c;
+ }
+
+ public void dispose() {
+ // widgets will be disposed. only need to null
+ fPrefixField = null;
+ fSourceViewer = null;
+ fTable = null;
+ fTableViewer = null;
+ super.dispose();
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal/cpp/project/ui/UIActivator.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal/cpp/project/ui/UIActivator.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.project.ui/src/org/maemo/esbox/internal/cpp/project/ui/UIActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,147 @@
+package org.maemo.esbox.internal.cpp.project.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.cpp.project.ui";
+
+ // The shared instance
+ private static UIActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public UIActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return UIActivator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ // The plugin registry
+ private static ImageRegistry imageRegistry = new ImageRegistry(Display.getDefault());
+
+ public static Image getImage(String path) {
+ ImageDescriptor descriptor = imageRegistry.getDescriptor(path);
+ if (descriptor == null) {
+ descriptor = getImageDescriptor(path);
+ imageRegistry.put(path, descriptor);
+ }
+ return imageRegistry.get(path);
+ }
+}
+
+
Property changes on: trunk/cpp/org.maemo.esbox.cpp.tests
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/cpp/org.maemo.esbox.cpp.tests/.classpath
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/.classpath (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.cpp.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:58:50 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/cpp/org.maemo.esbox.cpp.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox C/C++ Feature Tests Plug-in
+Bundle-SymbolicName: org.maemo.esbox.cpp.tests
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.cpp.tests.TestActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.junit4;bundle-version="4.3.1",
+ org.eclipse.core.resources;bundle-version="3.4.0",
+ org.maemo.esbox.core.tests;bundle-version="1.5.0",
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.cpp.project.core;bundle-version="1.5.0",
+ org.eclipse.cdt.core;bundle-version="5.0.1",
+ org.eclipse.cdt.make.core;bundle-version="5.0.1",
+ org.eclipse.cdt.ui;bundle-version="5.0.1",
+ org.maemo.esbox.cpp.project.ui;bundle-version="1.5.0",
+ org.maemo.esbox.maemosdk.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: trunk/cpp/org.maemo.esbox.cpp.tests/build.properties
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/build.properties (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ data/
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/.cproject
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/.cproject (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/.cproject 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="org.eclipse.cdt.core.default.config.510725509">
+<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.510725509" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+<buildTargets>
+<target name="all" path="" targetID="MakeTargetBuilder">
+<buildCommand>make</buildCommand>
+<buildArguments></buildArguments>
+<buildTarget>all</buildTarget>
+<stopOnError>false</stopOnError>
+<useDefaultCommand>true</useDefaultCommand>
+<runAllBuilders>true</runAllBuilders>
+</target>
+</buildTargets>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.pathentry">
+<pathentry kind="src" path=""/>
+<pathentry kind="out" path=""/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/gtk-2.0" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/lib/gtk-2.0/include" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/atk-1.0" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/cairo" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/pango-1.0" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/glib-2.0" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/lib/glib-2.0/include" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/freetype2" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/libpng12" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/scratchbox/compilers/cs2005q3.2-glibc-arm/usr/include" kind="inc" path="" system="true"/>
+</storageModule>
+</cconfiguration>
+</storageModule>
+<storageModule executionEnvironment="org.indt.esbox.core.execution_environment.gtk" moduleId="org.indt.esbox.core.properties" scratchboxVersion="1" targetName="CHINOOK_ARMEL"/>
+</cproject>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>gtkhelloworldcproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.indt.esbox.core.esboxMakeBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>org.eclipse.cdt.core.errorOutputParser</key>
+ <value>org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.append_environment</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.arguments</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.command</key>
+ <value>make</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.auto</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.clean</key>
+ <value>clean</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.inc</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.environment</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.stopOnError</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+ <value>true</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.indt.esbox.core.ESboxNature</nature>
+ <nature>org.eclipse.cdt.make.core.cfgSupportNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/COPYING
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/COPYING (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/COPYING.LESSER
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/COPYING.LESSER (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/Makefile
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/Makefile (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = -Wall \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED
+
+all: .PHONY
+ echo Built
+
+clean:
+ echo Cleaned
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/src/helloworld.c
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/src/helloworld.c (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj/src/helloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : helloworld.c
+ Author : Ed
+ Version : 0.1
+ Description : Hello World GTK
+ ============================================================================
+ */
+
+#include <gtk/gtk.h>
+
+/* This is a callback function. The data arguments are ignored
+ * in this example. More on callbacks below. */
+void hello( GtkWidget *widget,
+ gpointer data )
+{
+ g_print ("Hello World\n");
+}
+
+gint delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
+ /* If you return FALSE in the "delete_event" signal handler,
+ * GTK will emit the "destroy" signal. Returning TRUE means
+ * you don't want the window to be destroyed.
+ * This is useful for popping up 'are you sure you want to quit?'
+ * type dialogs. */
+
+ g_print ("delete event occurred\n");
+
+ /* Change TRUE to FALSE and the main window will be destroyed with
+ * a "delete_event". */
+
+ return TRUE;
+}
+
+/* Another callback */
+void destroy( GtkWidget *widget,
+ gpointer data )
+{
+ gtk_main_quit ();
+}
+
+int main( int argc,
+ char *argv[] )
+{
+ /* GtkWidget is the storage type for widgets */
+ GtkWidget *window;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application. */
+ gtk_init (&argc, &argv);
+
+ /* create a new window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ /* When the window is given the "delete_event" signal (this is given
+ * by the window manager, usually by the "close" option, or on the
+ * titlebar), we ask it to call the delete_event () function
+ * as defined above. The data passed to the callback
+ * function is NULL and is ignored in the callback function. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event), NULL);
+
+ /* Here we connect the "destroy" event to a signal handler.
+ * This event occurs when we call gtk_widget_destroy() on the window,
+ * or if we return FALSE in the "delete_event" callback. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy), NULL);
+
+ /* Sets the border width of the window. */
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Creates a new button with the label "Hello World". */
+ button = gtk_button_new_with_label ("Hello World!!!");
+
+ /* When the button receives the "clicked" signal, it will call the
+ * function hello() passing it NULL as its argument. The hello()
+ * function is defined above. */
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hello), NULL);
+
+ /* This will cause the window to be destroyed by calling
+ * gtk_widget_destroy(window) when "clicked". Again, the destroy
+ * signal could come from here, or the window manager. */
+ g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ G_OBJECT (window));
+
+ /* This packs the button into the window (a gtk container). */
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ /* The final step is to display this newly created widget. */
+ gtk_widget_show (button);
+
+ /* and the window */
+ gtk_widget_show (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or
+ * mouse event). */
+ gtk_main ();
+
+ return 0;
+}
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/.cproject
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/.cproject (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/.cproject 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="org.eclipse.cdt.core.default.config.544739746">
+<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.544739746" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
+<externalSettings/>
+<extensions/>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.pathentry">
+<pathentry kind="src" path=""/>
+<pathentry kind="src" path="src"/>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+</storageModule>
+</cproject>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>testproj</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec/>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.indt.esbox.core.ESboxNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/COPYING
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/COPYING (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/COPYING.LESSER
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/COPYING.LESSER (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/Makefile
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/Makefile (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = -Wall \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED
+
+all: .PHONY
+ echo Built
+
+clean:
+ echo Cleaned
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/src/helloworld.c
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/src/helloworld.c (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/esboxproj-nometadata/src/helloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : helloworld.c
+ Author : Ed
+ Version : 0.1
+ Description : Hello World GTK
+ ============================================================================
+ */
+
+#include <gtk/gtk.h>
+
+/* This is a callback function. The data arguments are ignored
+ * in this example. More on callbacks below. */
+void hello( GtkWidget *widget,
+ gpointer data )
+{
+ g_print ("Hello World\n");
+}
+
+gint delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
+ /* If you return FALSE in the "delete_event" signal handler,
+ * GTK will emit the "destroy" signal. Returning TRUE means
+ * you don't want the window to be destroyed.
+ * This is useful for popping up 'are you sure you want to quit?'
+ * type dialogs. */
+
+ g_print ("delete event occurred\n");
+
+ /* Change TRUE to FALSE and the main window will be destroyed with
+ * a "delete_event". */
+
+ return TRUE;
+}
+
+/* Another callback */
+void destroy( GtkWidget *widget,
+ gpointer data )
+{
+ gtk_main_quit ();
+}
+
+int main( int argc,
+ char *argv[] )
+{
+ /* GtkWidget is the storage type for widgets */
+ GtkWidget *window;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application. */
+ gtk_init (&argc, &argv);
+
+ /* create a new window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ /* When the window is given the "delete_event" signal (this is given
+ * by the window manager, usually by the "close" option, or on the
+ * titlebar), we ask it to call the delete_event () function
+ * as defined above. The data passed to the callback
+ * function is NULL and is ignored in the callback function. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event), NULL);
+
+ /* Here we connect the "destroy" event to a signal handler.
+ * This event occurs when we call gtk_widget_destroy() on the window,
+ * or if we return FALSE in the "delete_event" callback. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy), NULL);
+
+ /* Sets the border width of the window. */
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Creates a new button with the label "Hello World". */
+ button = gtk_button_new_with_label ("Hello World!!!");
+
+ /* When the button receives the "clicked" signal, it will call the
+ * function hello() passing it NULL as its argument. The hello()
+ * function is defined above. */
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hello), NULL);
+
+ /* This will cause the window to be destroyed by calling
+ * gtk_widget_destroy(window) when "clicked". Again, the destroy
+ * signal could come from here, or the window manager. */
+ g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ G_OBJECT (window));
+
+ /* This packs the button into the window (a gtk container). */
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ /* The final step is to display this newly created widget. */
+ gtk_widget_show (button);
+
+ /* and the window */
+ gtk_widget_show (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or
+ * mouse event). */
+ gtk_main ();
+
+ return 0;
+}
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>gtkhelloworldcproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures/>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/Makefile
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/Makefile (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = -Wall \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED
+
+helloworld: src/helloworld.c
+ $(CC) src/helloworld.c -g -o helloworld $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
+
+all: helloworld
+
+clean:
+ rm -f *.o helloworld
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/src/helloworld.c
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/src/helloworld.c (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxbareproj/src/helloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : helloworld.c
+ Author : Ed
+ Version : 0.1
+ Description : Hello World GTK
+ ============================================================================
+ */
+
+#include <gtk/gtk.h>
+
+/* This is a callback function. The data arguments are ignored
+ * in this example. More on callbacks below. */
+void hello( GtkWidget *widget,
+ gpointer data )
+{
+ g_print ("Hello World\n");
+}
+
+gint delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
+ /* If you return FALSE in the "delete_event" signal handler,
+ * GTK will emit the "destroy" signal. Returning TRUE means
+ * you don't want the window to be destroyed.
+ * This is useful for popping up 'are you sure you want to quit?'
+ * type dialogs. */
+
+ g_print ("delete event occurred\n");
+
+ /* Change TRUE to FALSE and the main window will be destroyed with
+ * a "delete_event". */
+
+ return TRUE;
+}
+
+/* Another callback */
+void destroy( GtkWidget *widget,
+ gpointer data )
+{
+ gtk_main_quit ();
+}
+
+int main( int argc,
+ char *argv[] )
+{
+ /* GtkWidget is the storage type for widgets */
+ GtkWidget *window;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application. */
+ gtk_init (&argc, &argv);
+
+ /* create a new window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ /* When the window is given the "delete_event" signal (this is given
+ * by the window manager, usually by the "close" option, or on the
+ * titlebar), we ask it to call the delete_event () function
+ * as defined above. The data passed to the callback
+ * function is NULL and is ignored in the callback function. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event), NULL);
+
+ /* Here we connect the "destroy" event to a signal handler.
+ * This event occurs when we call gtk_widget_destroy() on the window,
+ * or if we return FALSE in the "delete_event" callback. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy), NULL);
+
+ /* Sets the border width of the window. */
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Creates a new button with the label "Hello World". */
+ button = gtk_button_new_with_label ("Hello World!!!");
+
+ /* When the button receives the "clicked" signal, it will call the
+ * function hello() passing it NULL as its argument. The hello()
+ * function is defined above. */
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hello), NULL);
+
+ /* This will cause the window to be destroyed by calling
+ * gtk_widget_destroy(window) when "clicked". Again, the destroy
+ * signal could come from here, or the window manager. */
+ g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ G_OBJECT (window));
+
+ /* This packs the button into the window (a gtk container). */
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ /* The final step is to display this newly created widget. */
+ gtk_widget_show (button);
+
+ /* and the window */
+ gtk_widget_show (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or
+ * mouse event). */
+ gtk_main ();
+
+ return 0;
+}
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/.cproject
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/.cproject (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/.cproject 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="org.eclipse.cdt.core.default.config.544739746">
+<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.544739746" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
+<externalSettings/>
+<extensions/>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.pathentry">
+<pathentry kind="src" path=""/>
+<pathentry kind="src" path="src"/>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+</storageModule>
+</cproject>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>gtkhelloworldcproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/COPYING
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/COPYING (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/COPYING.LESSER
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/COPYING.LESSER (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/Makefile
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/Makefile (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = -Wall \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED
+
+helloworld: src/helloworld.c
+ $(CC) src/helloworld.c -g -o helloworld $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
+
+all: helloworld
+
+clean:
+ rm -f *.o helloworld
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/src/helloworld.c
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/src/helloworld.c (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/convert/nonesboxcdtproj/src/helloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : helloworld.c
+ Author : Ed
+ Version : 0.1
+ Description : Hello World GTK
+ ============================================================================
+ */
+
+#include <gtk/gtk.h>
+
+/* This is a callback function. The data arguments are ignored
+ * in this example. More on callbacks below. */
+void hello( GtkWidget *widget,
+ gpointer data )
+{
+ g_print ("Hello World\n");
+}
+
+gint delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
+ /* If you return FALSE in the "delete_event" signal handler,
+ * GTK will emit the "destroy" signal. Returning TRUE means
+ * you don't want the window to be destroyed.
+ * This is useful for popping up 'are you sure you want to quit?'
+ * type dialogs. */
+
+ g_print ("delete event occurred\n");
+
+ /* Change TRUE to FALSE and the main window will be destroyed with
+ * a "delete_event". */
+
+ return TRUE;
+}
+
+/* Another callback */
+void destroy( GtkWidget *widget,
+ gpointer data )
+{
+ gtk_main_quit ();
+}
+
+int main( int argc,
+ char *argv[] )
+{
+ /* GtkWidget is the storage type for widgets */
+ GtkWidget *window;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application. */
+ gtk_init (&argc, &argv);
+
+ /* create a new window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ /* When the window is given the "delete_event" signal (this is given
+ * by the window manager, usually by the "close" option, or on the
+ * titlebar), we ask it to call the delete_event () function
+ * as defined above. The data passed to the callback
+ * function is NULL and is ignored in the callback function. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event), NULL);
+
+ /* Here we connect the "destroy" event to a signal handler.
+ * This event occurs when we call gtk_widget_destroy() on the window,
+ * or if we return FALSE in the "delete_event" callback. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy), NULL);
+
+ /* Sets the border width of the window. */
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Creates a new button with the label "Hello World". */
+ button = gtk_button_new_with_label ("Hello World!!!");
+
+ /* When the button receives the "clicked" signal, it will call the
+ * function hello() passing it NULL as its argument. The hello()
+ * function is defined above. */
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hello), NULL);
+
+ /* This will cause the window to be destroyed by calling
+ * gtk_widget_destroy(window) when "clicked". Again, the destroy
+ * signal could come from here, or the window manager. */
+ g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ G_OBJECT (window));
+
+ /* This packs the button into the window (a gtk container). */
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ /* The final step is to display this newly created widget. */
+ gtk_widget_show (button);
+
+ /* and the window */
+ gtk_widget_show (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or
+ * mouse event). */
+ gtk_main ();
+
+ return 0;
+}
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/.cproject
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/.cproject (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/.cproject 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="Scratchbox 1~CHINOOK_ARMEL">
+<storageModule buildSystemId="org.maemo.esbox.cpp.project.core.ESboxCConfigurationDataProvider" id="Scratchbox 1~CHINOOK_ARMEL" moduleId="org.eclipse.cdt.core.settings" name="CHINOOK_ARMEL">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.gtk" moduleId="buildConfig" sdkName="Scratchbox 1" targetName="CHINOOK_ARMEL"/>
+<storageModule id="Scratchbox 1~CHINOOK_ARMEL" moduleId="defaultConfigurationDataProvider" name="CHINOOK_ARMEL">
+<sourceEntries>
+<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="/gtkhelloworldcproject/src"/>
+</sourceEntries>
+<folderData id="Scratchbox 1~CHINOOK_ARMEL.1177666964" name="" path="">
+<languageData contentTypeIds="org.eclipse.cdt.core.cxxSource;org.eclipse.cdt.core.cxxHeader" id="Scratchbox 1~CHINOOK_ARMEL.1177666964.519945767" languageId="org.eclipse.cdt.core.g++" name="GNU C++" supportedEntryKinds="includePath;includeFile;macro;macroFile">
+<settingEntries>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/gtk-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/gtk-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/atk-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/cairo"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/pango-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/glib-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/glib-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/freetype2"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/libpng12"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/scratchbox/compilers/cs2005q3.2-glibc-arm/usr/include"/>
+</settingEntries>
+</languageData>
+<languageData contentTypeIds="org.eclipse.cdt.core.cSource;org.eclipse.cdt.core.cHeader" id="Scratchbox 1~CHINOOK_ARMEL.1177666964.1882147987" languageId="org.eclipse.cdt.core.gcc" name="GNU C" supportedEntryKinds="includePath;includeFile;macro;macroFile">
+<settingEntries>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/gtk-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/gtk-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/atk-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/cairo"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/pango-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/glib-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/glib-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/freetype2"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/libpng12"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/scratchbox/compilers/cs2005q3.2-glibc-arm/usr/include"/>
+</settingEntries>
+</languageData>
+<languageData contentTypeIds="org.eclipse.cdt.core.asmSource" id="Scratchbox 1~CHINOOK_ARMEL.1177666964.1315296270" languageId="org.eclipse.cdt.core.assembly" name="Assembly" supportedEntryKinds="includePath;includeFile;macro;macroFile">
+<settingEntries>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/gtk-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/gtk-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/atk-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/cairo"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/pango-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/glib-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/glib-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/freetype2"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/libpng12"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/scratchbox/compilers/cs2005q3.2-glibc-arm/usr/include"/>
+</settingEntries>
+</languageData>
+</folderData>
+<buildData errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser" id="Scratchbox 1~CHINOOK_ARMEL.1783294951"/>
+<targetPlatformData binaryParsers="org.eclipse.cdt.core.ELF" id="Scratchbox 1~CHINOOK_ARMEL.1033288217"/>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+</storageModule>
+</cproject>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>gtkhelloworldcproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.maemo.esbox.project.core.esboxAutotoolsBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>org.eclipse.cdt.core.errorOutputParser</key>
+ <value>org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.append_environment</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.arguments</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.command</key>
+ <value>make</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.auto</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.clean</key>
+ <value>clean</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.inc</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.environment</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.stopOnError</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+ <value>true</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.maemo.esbox.cpp.project.core.ESboxCppNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/COPYING
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/COPYING (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/COPYING.LESSER
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/COPYING.LESSER (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/Makefile
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/Makefile (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = -Wall \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED
+
+helloworld: src/helloworld.c
+ $(CC) src/helloworld.c -g -o helloworld $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
+
+all: helloworld
+
+clean:
+ rm -f *.o helloworld
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/src/helloworld.c
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/src/helloworld.c (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject/src/helloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : helloworld.c
+ Author : Ed
+ Version : 0.1
+ Description : Hello World GTK
+ ============================================================================
+ */
+
+#include <gtk/gtk.h>
+
+/* This is a callback function. The data arguments are ignored
+ * in this example. More on callbacks below. */
+void hello( GtkWidget *widget,
+ gpointer data )
+{
+ g_print ("Hello World\n");
+}
+
+gint delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
+ /* If you return FALSE in the "delete_event" signal handler,
+ * GTK will emit the "destroy" signal. Returning TRUE means
+ * you don't want the window to be destroyed.
+ * This is useful for popping up 'are you sure you want to quit?'
+ * type dialogs. */
+
+ g_print ("delete event occurred\n");
+
+ /* Change TRUE to FALSE and the main window will be destroyed with
+ * a "delete_event". */
+
+ return TRUE;
+}
+
+/* Another callback */
+void destroy( GtkWidget *widget,
+ gpointer data )
+{
+ gtk_main_quit ();
+}
+
+int main( int argc,
+ char *argv[] )
+{
+ /* GtkWidget is the storage type for widgets */
+ GtkWidget *window;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application. */
+ gtk_init (&argc, &argv);
+
+ /* create a new window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ /* When the window is given the "delete_event" signal (this is given
+ * by the window manager, usually by the "close" option, or on the
+ * titlebar), we ask it to call the delete_event () function
+ * as defined above. The data passed to the callback
+ * function is NULL and is ignored in the callback function. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event), NULL);
+
+ /* Here we connect the "destroy" event to a signal handler.
+ * This event occurs when we call gtk_widget_destroy() on the window,
+ * or if we return FALSE in the "delete_event" callback. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy), NULL);
+
+ /* Sets the border width of the window. */
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Creates a new button with the label "Hello World". */
+ button = gtk_button_new_with_label ("Hello World!!!");
+
+ /* When the button receives the "clicked" signal, it will call the
+ * function hello() passing it NULL as its argument. The hello()
+ * function is defined above. */
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hello), NULL);
+
+ /* This will cause the window to be destroyed by calling
+ * gtk_widget_destroy(window) when "clicked". Again, the destroy
+ * signal could come from here, or the window manager. */
+ g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ G_OBJECT (window));
+
+ /* This packs the button into the window (a gtk container). */
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ /* The final step is to display this newly created widget. */
+ gtk_widget_show (button);
+
+ /* and the window */
+ gtk_widget_show (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or
+ * mouse event). */
+ gtk_main ();
+
+ return 0;
+}
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/.cproject
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/.cproject (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/.cproject 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="Scratchbox 1~CHINOOK_ARMEL">
+<storageModule buildSystemId="org.maemo.esbox.cpp.project.core.ESboxCConfigurationDataProvider" id="Scratchbox 1~FOOZLE_ARMEL" moduleId="org.eclipse.cdt.core.settings" name="FOOZLE_ARMEL">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.gtk" moduleId="buildConfig" sdkName="Scratchbox 1" targetName="FOOZLE_ARMEL"/>
+<storageModule id="Scratchbox 1~FOOZLE_ARMEL" moduleId="defaultConfigurationDataProvider" name="FOOZLE_ARMEL">
+<sourceEntries>
+<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="/gtkhelloworldcproject/src"/>
+</sourceEntries>
+<folderData id="Scratchbox 1~CHINOOK_ARMEL.1177666964" name="" path="">
+<languageData contentTypeIds="org.eclipse.cdt.core.cxxSource;org.eclipse.cdt.core.cxxHeader" id="Scratchbox 1~CHINOOK_ARMEL.1177666964.519945767" languageId="org.eclipse.cdt.core.g++" name="GNU C++" supportedEntryKinds="includePath;includeFile;macro;macroFile">
+<settingEntries>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/gtk-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/gtk-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/atk-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/cairo"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/pango-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/glib-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/glib-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/freetype2"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/libpng12"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/scratchbox/compilers/cs2005q3.2-glibc-arm/usr/include"/>
+</settingEntries>
+</languageData>
+<languageData contentTypeIds="org.eclipse.cdt.core.cSource;org.eclipse.cdt.core.cHeader" id="Scratchbox 1~CHINOOK_ARMEL.1177666964.1882147987" languageId="org.eclipse.cdt.core.gcc" name="GNU C" supportedEntryKinds="includePath;includeFile;macro;macroFile">
+<settingEntries>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/gtk-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/gtk-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/atk-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/cairo"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/pango-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/glib-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/glib-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/freetype2"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/libpng12"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/scratchbox/compilers/cs2005q3.2-glibc-arm/usr/include"/>
+</settingEntries>
+</languageData>
+<languageData contentTypeIds="org.eclipse.cdt.core.asmSource" id="Scratchbox 1~CHINOOK_ARMEL.1177666964.1315296270" languageId="org.eclipse.cdt.core.assembly" name="Assembly" supportedEntryKinds="includePath;includeFile;macro;macroFile">
+<settingEntries>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/gtk-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/gtk-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/atk-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/cairo"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/pango-1.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/glib-2.0"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/lib/glib-2.0/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/freetype2"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include/libpng12"/>
+<entry flags="" kind="includePath" name="s:/users/devel/targets/CHINOOK_ARMEL/usr/include"/>
+<entry flags="" kind="includePath" name="s:/users/devel/scratchbox/compilers/cs2005q3.2-glibc-arm/usr/include"/>
+</settingEntries>
+</languageData>
+</folderData>
+<buildData errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser" id="Scratchbox 1~CHINOOK_ARMEL.1783294951"/>
+<targetPlatformData binaryParsers="org.eclipse.cdt.core.ELF" id="Scratchbox 1~CHINOOK_ARMEL.1033288217"/>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+</storageModule>
+</cproject>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/.project
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/.project (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>gtkhelloworldcproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.maemo.esbox.project.core.esboxAutotoolsBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>org.eclipse.cdt.core.errorOutputParser</key>
+ <value>org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.append_environment</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.arguments</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.command</key>
+ <value>make</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.auto</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.clean</key>
+ <value>clean</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.inc</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.environment</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.stopOnError</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+ <value>true</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.maemo.esbox.cpp.project.core.ESboxCppNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/COPYING
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/COPYING (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/COPYING.LESSER
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/COPYING.LESSER (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/Makefile
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/Makefile (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = -Wall \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED
+
+helloworld: src/helloworld.c
+ $(CC) src/helloworld.c -g -o helloworld $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
+
+all: helloworld
+
+clean:
+ rm -f *.o helloworld
Added: trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/src/helloworld.c
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/src/helloworld.c (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/data/projects/gtkhelloworldcproject_badconfig/src/helloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : helloworld.c
+ Author : Ed
+ Version : 0.1
+ Description : Hello World GTK
+ ============================================================================
+ */
+
+#include <gtk/gtk.h>
+
+/* This is a callback function. The data arguments are ignored
+ * in this example. More on callbacks below. */
+void hello( GtkWidget *widget,
+ gpointer data )
+{
+ g_print ("Hello World\n");
+}
+
+gint delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
+ /* If you return FALSE in the "delete_event" signal handler,
+ * GTK will emit the "destroy" signal. Returning TRUE means
+ * you don't want the window to be destroyed.
+ * This is useful for popping up 'are you sure you want to quit?'
+ * type dialogs. */
+
+ g_print ("delete event occurred\n");
+
+ /* Change TRUE to FALSE and the main window will be destroyed with
+ * a "delete_event". */
+
+ return TRUE;
+}
+
+/* Another callback */
+void destroy( GtkWidget *widget,
+ gpointer data )
+{
+ gtk_main_quit ();
+}
+
+int main( int argc,
+ char *argv[] )
+{
+ /* GtkWidget is the storage type for widgets */
+ GtkWidget *window;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application. */
+ gtk_init (&argc, &argv);
+
+ /* create a new window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ /* When the window is given the "delete_event" signal (this is given
+ * by the window manager, usually by the "close" option, or on the
+ * titlebar), we ask it to call the delete_event () function
+ * as defined above. The data passed to the callback
+ * function is NULL and is ignored in the callback function. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event), NULL);
+
+ /* Here we connect the "destroy" event to a signal handler.
+ * This event occurs when we call gtk_widget_destroy() on the window,
+ * or if we return FALSE in the "delete_event" callback. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy), NULL);
+
+ /* Sets the border width of the window. */
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Creates a new button with the label "Hello World". */
+ button = gtk_button_new_with_label ("Hello World!!!");
+
+ /* When the button receives the "clicked" signal, it will call the
+ * function hello() passing it NULL as its argument. The hello()
+ * function is defined above. */
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hello), NULL);
+
+ /* This will cause the window to be destroyed by calling
+ * gtk_widget_destroy(window) when "clicked". Again, the destroy
+ * signal could come from here, or the window manager. */
+ g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ G_OBJECT (window));
+
+ /* This packs the button into the window (a gtk container). */
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ /* The final step is to display this newly created widget. */
+ gtk_widget_show (button);
+
+ /* and the window */
+ gtk_widget_show (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or
+ * mouse event). */
+ gtk_main ();
+
+ return 0;
+}
Added: trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/internal/cpp/tests/TestActivator.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/internal/cpp/tests/TestActivator.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/internal/cpp/tests/TestActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,74 @@
+package org.maemo.esbox.internal.cpp.tests;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TestActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.cpp.tests";
+
+ // The shared instance
+ private static TestActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public TestActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static TestActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return TestActivator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/TestESboxProjectInfo.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/TestESboxProjectInfo.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/TestESboxProjectInfo.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.project.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.junit.*;
+import org.maemo.esbox.core.HostUtils;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.core.sdk.SDKFactory;
+import org.maemo.esbox.core.tests.TestUtils;
+import org.maemo.esbox.cpp.project.core.ESboxCppProjectType;
+import org.maemo.esbox.internal.cpp.tests.TestActivator;
+import org.maemo.esbox.maemosdk.core.execEnv.GTKExecutionEnvironment;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox1SDK;
+import org.maemo.esbox.project.core.*;
+
+import java.io.File;
+
+
+/**
+ * Test the new project info / build config APIs
+ * @author eswartz
+ *
+ */
+public class TestESboxProjectInfo {
+
+ private static final String PROJ1_GOOD = "proj1";
+ private static final String PROJ2_BAD = "proj2";
+ private IProject project1;
+ private IProject project2;
+
+ @Before
+ public void setUp() throws Exception {
+ TestUtils.disableAutobuild();
+ File proj1Dir = HostUtils.getTemporaryPath().append(PROJ1_GOOD).toFile();
+ TestUtils.copyTreeNoParent(TestUtils.projectRelativeFile(
+ TestActivator.PLUGIN_ID,
+ "data/projects/gtkhelloworldcproject"), proj1Dir, null);
+ project1 = TestUtils.importProject(PROJ1_GOOD, proj1Dir);
+
+ File proj2Dir = HostUtils.getTemporaryPath().append(PROJ2_BAD).toFile();
+ TestUtils.copyTreeNoParent(TestUtils.projectRelativeFile(
+ TestActivator.PLUGIN_ID,
+ "data/projects/gtkhelloworldcproject_badconfig"), proj2Dir, null);
+ project2 = TestUtils.importProject(PROJ2_BAD, proj2Dir);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ WorkspaceJob job = new WorkspaceJob("deleting") {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ project1.delete(true, null);
+ project2.delete(true, null);
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ job.schedule();
+ job.join();
+ }
+
+
+ /**
+ * Test accessing project info for nonexistent project
+ * @throws Exception
+ */
+ @Test
+ public void testNonExistentProjectInfo() throws Exception {
+ // for nonexistent projects, should work
+ IESboxProjectHandle projectHandle;
+ IProject bogus = ResourcesPlugin.getWorkspace().getRoot().getProject("foozle");
+
+ // trying to get handle for nonexistent project will fail
+ projectHandle = ProjectManager.getInstance().getProjectHandle(bogus);
+ assertNull(projectHandle);
+
+ // but creating anew will work
+ projectHandle = ProjectManager.getInstance().getProjectType(ESboxCppProjectType.ID).createProjectHandle(bogus);
+ assertNotNull(projectHandle);
+
+ assertEquals(bogus, projectHandle.getProject());
+ IESboxBuildConfiguration[] buildConfigurations = projectHandle.getBuildConfigurations();
+ assertNotNull(buildConfigurations);
+ assertEquals(0, buildConfigurations.length);
+ try {
+ projectHandle.save(null);
+ fail("Expected failure due to nonexistent project");
+ } catch (CoreException e) {
+ // ok
+ }
+ }
+
+ /**
+ * Basic test of good project with good config
+ * @throws Exception
+ */
+ @Test
+ public void testExistingProjectInfo() throws Exception {
+ IESboxProjectHandle projectHandle;
+ projectHandle = ProjectManager.getInstance().getProjectHandle(project1);
+ assertNotNull(projectHandle);
+ assertEquals(project1, projectHandle.getProject());
+ IESboxBuildConfiguration[] buildConfigurations = projectHandle.getBuildConfigurations();
+ assertNotNull(buildConfigurations);
+ assertEquals(1, buildConfigurations.length);
+ assertEquals("CHINOOK_ARMEL", buildConfigurations[0].getName());
+ assertEquals("CHINOOK_ARMEL", buildConfigurations[0].getSDKTargetName());
+ projectHandle.save(null);
+ }
+
+ /**
+ * Verify that a bad config is not destroyed
+ * @throws Exception
+ */
+ @Test
+ public void testExistingProjectInfoBadConfig() throws Exception {
+ IESboxProjectHandle projectHandle;
+ projectHandle = ProjectManager.getInstance().getProjectHandle(project2);
+ assertNotNull(projectHandle);
+ assertEquals(project2, projectHandle.getProject());
+
+ IESboxBuildConfiguration[] buildConfigurations = projectHandle.getBuildConfigurations();
+ assertNotNull(buildConfigurations);
+ assertEquals(1, buildConfigurations.length);
+ assertEquals("FOOZLE_ARMEL", buildConfigurations[0].getName());
+ assertEquals("FOOZLE_ARMEL", buildConfigurations[0].getSDKTargetName());
+ assertNull(buildConfigurations[0].getSDKTarget());
+
+ projectHandle.save(null);
+
+ // should not lose bad config
+
+ buildConfigurations = projectHandle.getBuildConfigurations();
+ assertNotNull(buildConfigurations);
+ assertEquals(1, buildConfigurations.length);
+ assertEquals("FOOZLE_ARMEL", buildConfigurations[0].getName());
+ assertEquals("FOOZLE_ARMEL", buildConfigurations[0].getSDKTargetName());
+ assertNull(buildConfigurations[0].getSDKTarget());
+
+ }
+
+ /**
+ * Be sure we can add/remove configs
+ */
+ @Test
+ public void testBuildConfigMgmt() throws Exception {
+ IESboxProjectHandle projectHandle;
+ projectHandle = ProjectManager.getInstance().getProjectHandle(project2);
+ assertNotNull(projectHandle);
+ assertEquals(project2, projectHandle.getProject());
+
+ // this has a bad config
+ IESboxBuildConfiguration[] buildConfigurations = projectHandle.getBuildConfigurations();
+ assertNotNull(buildConfigurations);
+ assertEquals(1, buildConfigurations.length);
+ assertEquals("FOOZLE_ARMEL", buildConfigurations[0].getName());
+
+ // we should be temporarily allowed to remove the last build config (right?)
+ projectHandle.removeBuildConfiguration(buildConfigurations[0]);
+ assertEquals(0, projectHandle.getBuildConfigurations().length);
+
+ // until saved, it's still active
+ assertEquals(buildConfigurations[0].getId(), projectHandle.getCurrentConfiguration().getId());
+
+ // add a new configuration
+ ESboxBuildConfigurationParameters params =
+ new ESboxBuildConfigurationParameters("DIABLO_ARMEL", "DIABLO_ARMEL", "Scratchbox 1");
+ params.setExecutionEnvironmentId("otherexecenv");
+ IESboxBuildConfiguration config = projectHandle.createBuildConfiguration(params);
+
+ assertEquals(1, projectHandle.getBuildConfigurations().length);
+
+ projectHandle.save(null);
+
+ // should be allowed to save twice w/o issue
+ projectHandle.save(null);
+
+ buildConfigurations = projectHandle.getBuildConfigurations();
+ assertNotNull(buildConfigurations);
+ assertEquals(1, buildConfigurations.length);
+ assertEquals("DIABLO_ARMEL", buildConfigurations[0].getName());
+ assertEquals("DIABLO_ARMEL", buildConfigurations[0].getSDKTargetName());
+ assertSDKTargetSetIfExists("DIABLO_ARMEL", buildConfigurations[0].getSDKTarget());
+
+ assertEquals(config.getId(), projectHandle.getCurrentConfiguration().getId());
+ }
+
+ private void assertSDKTargetSetIfExists(String string, ISDKTarget matchTarget) {
+ ISDKTarget[] allSDKTargets = SDKFactory.getInstance().getAllSDKTargets();
+ for (ISDKTarget target : allSDKTargets)
+ if (target.getName().equals(string))
+ assertNotNull(matchTarget);
+
+ }
+
+ /**
+ * Be sure the old APIs for project access will redirect to the active
+ * build configuration.
+ */
+ @Test
+ public void testESboxProjectProperties() throws Exception {
+ IESboxProjectHandle projectHandle;
+ projectHandle = ProjectManager.getInstance().getProjectHandle(project1);
+
+ IProjectProperties properties = ProjectManager.getInstance().getProjectProperties(project1);
+
+ // info from the ESboxProjectProperties should reflect existing configuration
+ assertTrue(ProjectManager.getInstance().isESboxProject(project1));
+ ISDKTarget target = properties.getSDKTarget();
+ assertNotNull(target);
+ assertEquals("CHINOOK_ARMEL", target.getName());
+ assertEquals(GTKExecutionEnvironment.ID, properties.getExecutionEnvironmentId());
+ assertEquals(IScratchbox1SDK.NAME, properties.getSDKName());
+ assertEquals("CHINOOK_ARMEL", properties.getTargetName());
+
+ // add a new configuration
+ ESboxBuildConfigurationParameters params =
+ new ESboxBuildConfigurationParameters("DIABLO_ARMEL", "DIABLO_ARMEL", "Scratchbox 1");
+ params.setExecutionEnvironmentId("otherexecenv");
+ IESboxBuildConfiguration config = projectHandle.createBuildConfiguration(params);
+ //projectInfo.addBuildConfiguration(config);
+ projectHandle.save(null);
+
+ // and switch to it
+ projectHandle.setCurrentConfiguration(config);
+ assertEquals(config.getId(), projectHandle.getCurrentConfiguration().getId());
+
+ // now, the ESboxProjectProperties should reflect this
+ assertTrue(ProjectManager.getInstance().isESboxProject(project1));
+ target = properties.getSDKTarget();
+ assertSDKTargetSetIfExists("DIABLO_ARMEL", target);
+ assertEquals("otherexecenv", properties.getExecutionEnvironmentId());
+ assertEquals(IScratchbox1SDK.NAME, properties.getSDKName());
+ assertEquals("DIABLO_ARMEL", properties.getTargetName());
+ }
+
+}
Added: trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/ui/TestBuildConfigProjectConverter.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/ui/TestBuildConfigProjectConverter.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/ui/TestBuildConfigProjectConverter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.project.tests.ui;
+
+
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
+import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.junit.*;
+import org.maemo.esbox.core.HostUtils;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.core.tests.TestUtils;
+import org.maemo.esbox.core.tests.core.BaseTest;
+import org.maemo.esbox.cpp.project.core.*;
+import org.maemo.esbox.internal.cpp.tests.TestActivator;
+import org.maemo.esbox.maemosdk.core.execEnv.GTKExecutionEnvironment;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+import org.maemo.esbox.project.core.*;
+
+/**
+ * Test that we can convert existing projects to the new format
+ * @author eswartz
+ *
+ */
+public class TestBuildConfigProjectConverter extends BaseTest {
+
+ private static IScratchboxSDKTarget[] sdkTargets;
+ private static ISDKTarget theSB1SDKTarget;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ // disable build automatically while creating the project
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription workspaceDesc = workspace.getDescription();
+ workspaceDesc.setAutoBuilding(false);
+ workspace.setDescription(workspaceDesc);
+
+ sdkTargets = ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets();
+ for (ISDKTarget target : sdkTargets) {
+ // TODO: check platform/target
+ if (target instanceof IScratchbox1SDKTarget
+ && target.getName().equals("CHINOOK_ARMEL")) {
+ theSB1SDKTarget = target;
+ }
+ }
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testConvertBareProject() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("testconvert1");
+
+ _testConvertProject(projectPath, "data/convert/nonesboxbareproj", false);
+ }
+ @Test
+ public void testConvertCdtProject() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("testconvert2");
+
+ _testConvertProject(projectPath, "data/convert/nonesboxcdtproj", false);
+ }
+
+ @Test
+ public void testConvertESboxProject() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("testconvert3");
+
+ // used in testConvertESboxProjectOnBuild too
+ _testConvertProject(projectPath, "data/convert/esboxproj", true);
+ }
+
+ @Test
+ public void testConvertESboxNoMetadataProject() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("testconvert3b");
+
+ // used in testConvertESboxNoMetadataProjectOnBuild too
+ _testConvertProject(projectPath, "data/convert/esboxproj-nometadata", false);
+ }
+
+
+ @Test
+ public void testConvertProjectFail() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ // this is not visible to sbox, we assume
+ IPath projectPath = HostUtils.getTemporaryPath().append("testconvert4");
+
+ try {
+ _testConvertProject(projectPath, "data/convert/nonesboxproj", false);
+ fail("Should not have succeeded");
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+
+ protected void _testConvertProject(IPath destPath, String srcPath, boolean checkIndexerData) throws Exception {
+ ESboxCppConfigHandler configHandler = new ESboxCppConfigHandler();
+ configHandler.initializeSingleBuildConfiguration(theSB1SDKTarget);
+ configHandler.setExecutionEnvironment(GTKExecutionEnvironment.ID);
+
+ _testConvertProject(destPath, srcPath, configHandler, checkIndexerData);
+ }
+
+ protected void _testConvertProject(IPath destPath, String srcPath, ESboxCppConfigHandler configHandler, boolean checkIndexerData) throws Exception {
+ // the default location will be outside scratchbox for this SDK
+
+ IProject project = TestUtils.copyAndImportProject(
+ TestActivator.PLUGIN_ID,
+ srcPath,
+ destPath.lastSegment(),
+ destPath);
+
+ try {
+ // get a creator
+ ESboxProjectCreatorConverter creator = new ESboxCppBuildConfigProjectCreatorConverter();
+ creator.setup(project, configHandler);
+ assertEquals(project, creator.getProject());
+ assertTrue(project.exists());
+
+ // make sure it's not yet known
+
+ IESboxProjectHandle handle = ProjectManager.getInstance().getProjectHandle(project);
+ assertNull("should not be build config project yet", handle);
+
+ // run it
+ IWorkspaceRunnable runnable = creator.getProjectConverterRunnable();
+ assertNotNull(runnable);
+ // allow to throw to caller
+ runnable.run(new NullProgressMonitor());
+
+ // now it should be known
+ handle = ProjectManager.getInstance().getProjectHandle(project);
+ assertNotNull("should be build config project", handle);
+
+ assertEquals(1, handle.getBuildConfigurations().length);
+
+ IESboxBuildConfiguration config = handle.getBuildConfigurations()[0];
+ assertNotNull(config);
+
+ assertEquals(configHandler.getInitialTargetName(), config.getSDKTargetName());
+
+ String envId = config.getExecutionEnvironmentId();
+ assertEquals(configHandler.getExecutionEnvironment(), envId);
+
+ if (checkIndexerData) {
+ verifyESboxIndexerData(handle, config);
+
+ }
+
+ // verify sanity
+ assertNotNull(config.getSDKTarget());
+ IExecutionEnvironment env = config.getExecutionEnvironment();
+ assertNotNull(env);
+ } finally {
+ TestUtils.deleteProject(project);
+ TestUtils.delTree(destPath.toFile());
+ }
+ }
+
+
+ /**
+ * @param handle
+ * @param config
+ */
+ private void verifyESboxIndexerData(IESboxProjectHandle handle,
+ IESboxBuildConfiguration config) {
+ // check that the indexer data was converted
+ ICConfigurationDescription cfgDes = ((ESboxCppProjectHandle) handle).getCConfiguration(config);
+ assertNotNull(cfgDes);
+ CLanguageData[] languageDatas = cfgDes.getConfigurationData().getRootFolderData().getLanguageDatas();
+ for (CLanguageData languageData : languageDatas) {
+ int kindMask = languageData.getSupportedEntryKinds();
+ assertTrue((kindMask & ICLanguageSettingEntry.INCLUDE_PATH) != 0);
+ ICLanguageSettingEntry[] entries = languageData.getEntries(ICLanguageSettingEntry.INCLUDE_PATH);
+ assertEquals("no indexer data?", 11, entries.length);
+ assertEquals("no indexer data?", ICLanguageSettingEntry.INCLUDE_PATH, entries[0].getKind());
+ assertEquals("no indexer data?", "S:/users/devel/targets/CHINOOK_ARMEL/usr/include/gtk-2.0", entries[0].getValue());
+ assertEquals("no indexer data?", ICLanguageSettingEntry.INCLUDE_PATH, entries[1].getKind());
+ assertEquals("no indexer data?", "S:/users/devel/targets/CHINOOK_ARMEL/usr/lib/gtk-2.0/include", entries[1].getValue());
+
+ // #10 is a compiler path, recalculated on import
+ assertEquals(ICLanguageSettingEntry.INCLUDE_PATH, entries[10].getKind());
+ assertTrue("no indexer data for compiler?", entries[10].getValue().contains("compilers"));
+ }
+ }
+}
Added: trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/ui/TestBuildConfigProjectCreator.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/ui/TestBuildConfigProjectCreator.java (rev 0)
+++ trunk/cpp/org.maemo.esbox.cpp.tests/src/org/maemo/esbox/project/tests/ui/TestBuildConfigProjectCreator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,402 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.project.tests.ui;
+
+
+import org.eclipse.cdt.core.model.*;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.junit.*;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.core.tests.TestUtils;
+import org.maemo.esbox.cpp.project.core.ESboxCppBuildConfigProjectCreatorConverter;
+import org.maemo.esbox.cpp.project.core.ESboxCppConfigHandler;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+import org.maemo.esbox.project.core.*;
+import org.maemo.esbox.project.core.ITemplate;
+
+import com.nokia.cpp.internal.api.utils.core.TextUtils;
+
+import java.util.*;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+
+/**
+ * @author eswartz
+ *
+ */
+public class TestBuildConfigProjectCreator extends TestCase {
+
+ private static ITemplate[] templates;
+ private static ITemplate theTemplate;
+ private static IScratchboxSDKTarget[] sdkTargets;
+ private static ISDKTarget theSB1SDKTarget;
+
+ private ESboxConfigHandler configHandler;
+ private ISDKTarget theSB2SDKTarget;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ // disable build automatically while creating the project
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription workspaceDesc = workspace.getDescription();
+ workspaceDesc.setAutoBuilding(false);
+ workspace.setDescription(workspaceDesc);
+
+ templates = ESboxTemplateEngine.getInstance().getTemplates();
+ for (ITemplate template : templates) {
+ if (template.getTemplateId().equals("MaemoProject")) {
+ theTemplate = template;
+ break;
+ }
+ }
+
+ sdkTargets = ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets();
+ for (ISDKTarget target : sdkTargets) {
+ // TODO: check platform/target
+ if (target instanceof IScratchbox1SDKTarget
+ && target.getName().matches("(CHINOOK|DIABLO)_ARMEL")) {
+ theSB1SDKTarget = target;
+ }
+ if (target instanceof IScratchbox2SDKTarget
+ && ((IScratchboxSDKTarget) target).getRootstrapPath() != null
+ && target.getName().matches("(chinook|diablo).*armel")) {
+ theSB2SDKTarget = target;
+ }
+
+ }
+ if (theTemplate == null)
+ TestCase.fail("Cannot find expected hello world template");
+ configHandler = new ESboxCppConfigHandler();
+ configHandler.setTemplate(theTemplate);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testDefaultCreationSB1InvalidLocation() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ configHandler.initializeSingleBuildConfiguration(theSB1SDKTarget);
+
+ // the default location will be outside scratchbox for this SDK
+
+ IProject project = getNonExistingProject("test");
+
+ // get a creator
+ ESboxProjectCreatorConverter creator = createProjectCreator();
+ creator.setup(project, configHandler);
+ assertEquals(project, creator.getProject());
+ assertFalse(project.exists());
+
+ // run it
+ IWorkspaceRunnable runnable = creator.getProjectCreatorRunnable(null);
+ assertNotNull(runnable);
+ try {
+ runnable.run(new NullProgressMonitor());
+ fail("Expected invalid location error");
+ } catch (CoreException e) {
+ assertTrue(e.toString(), e.toString().contains("is not visible"));
+ }
+ }
+
+ /**
+ * @return
+ */
+ private ESboxCppBuildConfigProjectCreatorConverter createProjectCreator() {
+ return new ESboxCppBuildConfigProjectCreatorConverter();
+ }
+
+ @Test
+ public void testDefaultCreationSB1ValidLocation() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ configHandler.initializeSingleBuildConfiguration(theSB1SDKTarget);
+
+ // the default location will be outside scratchbox for this SDK
+
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("__unittest");
+ IProject project = getNonExistingProject("test", projectPath);
+
+ // get a creator
+ ESboxProjectCreatorConverter creator = createProjectCreator();
+ creator.setup(project, configHandler);
+
+ _testMaemoPadProjectCreation(project, projectPath, creator);
+ }
+
+
+ @Test
+ public void testDefaultCreationSB1AndSB2ConfigsValidLocation() throws Exception {
+ if (theSB1SDKTarget == null || theSB2SDKTarget == null)
+ return;
+
+ configHandler.getBuildConfigurationParameters().add(new ESboxBuildConfigurationParameters(theSB1SDKTarget.getName(), theSB1SDKTarget));
+ configHandler.getBuildConfigurationParameters().add(new ESboxBuildConfigurationParameters(theSB2SDKTarget.getName(), theSB2SDKTarget));
+
+ // the default location will be outside scratchbox for this SDK
+
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("__unittest3");
+ IProject project = getNonExistingProject("test", projectPath);
+
+ // get a creator
+ ESboxProjectCreatorConverter creator = createProjectCreator();
+ creator.setup(project, configHandler);
+
+ _testMaemoPadProjectCreation(project, projectPath, creator);
+ }
+
+ private void _testMaemoPadProjectCreation(IProject project, IPath projectPath, ESboxProjectCreatorConverter creator) throws Exception {
+ // handle should exist, but not project
+ assertEquals(project, creator.getProject());
+ assertFalse(project.exists());
+
+ // add listeners for files we want to test
+ final IPath[] paths = {
+ new Path(project.getName()).append("configure"),
+ new Path(project.getName()).append("Makefile.in"),
+ new Path(project.getName()).append("src/Makefile.in"),
+ };
+
+ TestResourceChangeListener listener1 = addResourceListener(paths);
+
+ // generated files from configure -- don't assume it succeeded (checking for Makefile),
+ // with the awful state of maemo SDKs and these templates
+ final IPath[] paths2 = {
+ new Path(project.getName()).append("config.log"),
+ };
+
+ TestResourceChangeListener listener2 = addResourceListener(paths2);
+
+ // run it
+ IWorkspaceRunnable runnable = creator.getProjectCreatorRunnable(projectPath);
+ assertNotNull(runnable);
+ boolean createFailed = false;
+ try {
+ runnable.run(new NullProgressMonitor());
+ } catch (CoreException e) {
+ // we don't expect this to properly configure itself...
+ if (!e.toString().contains("find or create Makefile")
+ && !e.toString().contains("utogen or configure ran")) {
+ throw (AssertionFailedError) new AssertionFailedError().initCause(e);
+ }
+ createFailed = true;
+ }
+
+ // be sure it worked
+ assertNotNull(creator.getProject());
+ project = creator.getProject();
+ assertTrue(project.exists());
+
+ // essential template files
+ assertTrue(project.exists(new Path("configure.ac")));
+ assertTrue(project.exists(new Path("Makefile.am")));
+
+ // we need to wait for background processes to complete
+ waitForResourceListener(listener1, 60);
+ removeResourceListener(listener1);
+
+
+ // we need to wait for background processes to complete
+ waitForResourceListener(listener2, 120);
+ removeResourceListener(listener2);
+
+ IESboxProjectHandle projectHandle = ProjectManager.getInstance().getProjectHandle(project);
+ assertNotNull(projectHandle);
+ IESboxBuildConfiguration[] configs = projectHandle.getBuildConfigurations();
+ assertEquals(creator.getConfigHandler().getBuildConfigurationParameters().size(), configs.length);
+
+ for (IESboxBuildConfiguration config : configs) {
+ projectHandle.setCurrentConfiguration(config);
+
+ // make sure indexer is set up (this API apparently converts modern things in place)
+ IPathEntry[] pathEntries = CoreModel.getRawPathEntries(
+ CoreModel.getDefault().create(project));
+ assertNotNull(pathEntries);
+ int srcFolderCount = 0;
+ int includeCount = 0;
+ int outputCount = 0;
+ for (IPathEntry entry : pathEntries) {
+ if (entry instanceof ISourceEntry) {
+ srcFolderCount++;
+ } else if (entry instanceof IIncludeEntry) {
+ includeCount++;
+ // be sure we have the proper rootstrap location per configuration
+ if (entry.getPath().toPortableString().contains("targets")) {
+ assertTrue(config.getName(), entry.getPath().toPortableString().contains(config.getName()));
+ }
+ } else if (entry instanceof IOutputEntry) {
+ outputCount++;
+ }
+ }
+ assertTrue(config.getId(), srcFolderCount > 0);
+ assertTrue(config.getId(), outputCount > 0);
+
+ // unlikely to have indexer data for this project if create failed
+ // (means hildonmm is missing)
+ if (!createFailed)
+ assertTrue(config.getId(), includeCount > 0);
+ }
+
+
+ // make sure execution environment is set
+ IProjectProperties properties = ProjectManager.getInstance().getProjectProperties(project);
+ assertNotNull(properties.getExecutionEnvironmentId());
+ assertNotNull(properties.getExecutionEnvironment());
+ }
+
+ private void removeResourceListener(IResourceChangeListener listener) {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
+ }
+
+ class TestResourceChangeListener implements IResourceChangeListener {
+
+ private IPath[] entries;
+ private Set<IPath> fired;
+
+ public TestResourceChangeListener(IPath[] entries) {
+ this.entries = entries;
+ this.fired = new HashSet<IPath>();
+ }
+ public synchronized void resourceChanged(IResourceChangeEvent event) {
+ boolean gotHits = false;
+ for (IPath path : entries) {
+ try {
+ event.getDelta().accept(new IResourceDeltaVisitor() {
+
+ public boolean visit(IResourceDelta delta)
+ throws CoreException {
+ System.out.println(delta.getFullPath());
+ return true;
+ }
+
+ });
+ } catch (CoreException e) {
+ }
+ IResourceDelta delta = event.getDelta().findMember(path);
+ if (delta != null) {
+ // honor any added and removed events. for changed events, make sure it's the content
+ // that changed and not the description or marker or something.
+ if (delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.REMOVED ||
+ (delta.getKind() == IResourceDelta.CHANGED && (delta.getFlags() & IResourceDelta.CONTENT) != 0)) {
+ fired.add(path);
+ gotHits = true;
+ }
+ }
+ }
+ if (gotHits)
+ notify();
+ }
+
+ public synchronized boolean allFired() {
+ return fired.size() == entries.length;
+ }
+
+ public synchronized Set<IPath> getFired() {
+ return fired;
+ }
+ };
+
+ protected void waitForResourceListener(final TestResourceChangeListener listener, final int timeoutInSeconds) throws Exception {
+ Job job = new Job("wait for resource change") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ long endTime = System.currentTimeMillis() + timeoutInSeconds * 1000;
+ synchronized (listener) {
+ while (System.currentTimeMillis() < endTime && !listener.allFired()) {
+ try {
+ listener.wait(1000);
+ } catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
+ job.join();
+ if (!listener.allFired())
+ fail("Did not fire all paths, only: " +
+ TextUtils.catenateStrings(listener.getFired().toArray(), ","));
+ }
+
+
+ protected TestResourceChangeListener addResourceListener(IPath[] paths) {
+ TestResourceChangeListener listener = new TestResourceChangeListener(paths);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(
+ listener);
+ return listener;
+ }
+
+ @Test
+ public void testDefaultCreationSB2() throws Exception {
+ if (theSB2SDKTarget == null)
+ return;
+
+ configHandler.initializeSingleBuildConfiguration(theSB2SDKTarget);
+
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("__unittest2");
+ IProject project = getNonExistingProject("testsb2", projectPath);
+
+ // get a creator
+ ESboxProjectCreatorConverter creator = createProjectCreator();
+ creator.setup(project, configHandler);
+ assertEquals(project, creator.getProject());
+ assertFalse(project.exists());
+
+ ErrorLogger.Listener listener = new ErrorLogger.Listener() {
+
+ public void statusLogged(IStatus status) {
+ fail(status.toString());
+ }
+
+ };
+
+ ErrorLogger.addListener(listener);
+ try {
+ _testMaemoPadProjectCreation(project, projectPath, creator);
+ } finally {
+ ErrorLogger.removeListener(listener);
+ }
+ }
+
+ /** Get a project handle for a project in the default location that does not exist (Deleting it if necessary) */
+ protected IProject getNonExistingProject(String name) throws Exception {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ if (project.exists()) {
+ project.delete(true, new NullProgressMonitor());
+ }
+ return project;
+ }
+ /** Get a project handle for a project in a specific location that does not exist (Deleting it if necessary) */
+ protected IProject getNonExistingProject(String name, IPath projectLocation) throws Exception {
+ IProject project = getNonExistingProject(name);
+ TestUtils.delTree(projectLocation.toFile());
+ project.refreshLocal(IProject.DEPTH_INFINITE, null);
+ return project;
+ }
+}
Property changes on: trunk/device/org.maemo.esbox.device-feature
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/device/org.maemo.esbox.device-feature/.project
===================================================================
--- trunk/device/org.maemo.esbox.device-feature/.project (rev 0)
+++ trunk/device/org.maemo.esbox.device-feature/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.device-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/device/org.maemo.esbox.device-feature/build.properties
===================================================================
--- trunk/device/org.maemo.esbox.device-feature/build.properties (rev 0)
+++ trunk/device/org.maemo.esbox.device-feature/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3 @@
+bin.includes = feature.xml,\
+ license.html,\
+ licenses/
Added: trunk/device/org.maemo.esbox.device-feature/feature.xml
===================================================================
--- trunk/device/org.maemo.esbox.device-feature/feature.xml (rev 0)
+++ trunk/device/org.maemo.esbox.device-feature/feature.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.maemo.esbox.device"
+ label="ESbox Device Support Feature"
+ version="1.5.0.qualifier"
+ provider-name="INdT / Nokia">
+
+ <description>
+ Device-specific support for the ESbox project. This provides support for maemo devices running over SSH or SBRSH.
+ </description>
+
+ <copyright>
+ Copyright (c) 2007-2008 INdT, (c) 2007-2008 Nokia. All rights
+reserved.
+ </copyright>
+
+ <license url="http://www.eclipse.org/legal/epl-v10.html">
+ For legal terms, see the Eclipse Public License.
+ </license>
+
+ <url>
+ <update label="Update Site for ESbox project" url="http://esbox.garage.maemo.org/update"/>
+ </url>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.maemo.esbox.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.ssh" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.device.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.launch" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.debug.core" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.debug.ui" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.ui" version="1.5.0" match="greaterOrEqual"/>
+ </requires>
+
+ <plugin
+ id="org.maemo.esbox.device.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.device.launch"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.device.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Added: trunk/device/org.maemo.esbox.device-feature/license.html
===================================================================
--- trunk/device/org.maemo.esbox.device-feature/license.html (rev 0)
+++ trunk/device/org.maemo.esbox.device-feature/license.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+<html>
+<head>
+<title>ESbox License</title>
+</head>
+
+<body>
+<h2>ESbox Software User Agreement</h2>
+<p>16<sup>th</sup> April, 2008</p>
+
+<h3>ESbox</h3>
+
+<p>ESbox is licensed under the terms of the <a href="licenses/epl-v10.html">Eclipse Public License v1.0</a>.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>ESbox has a set of open source templates to help the development of applications. Such templates are distributed
+under <a href="licenses/COPYING.LESSER">LGPL license.</a></p>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THIS CONTENT.</p>
+
+</body>
+</html>
Added: trunk/device/org.maemo.esbox.device-feature/licenses/COPYING
===================================================================
--- trunk/device/org.maemo.esbox.device-feature/licenses/COPYING (rev 0)
+++ trunk/device/org.maemo.esbox.device-feature/licenses/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/device/org.maemo.esbox.device-feature/licenses/COPYING.LESSER
===================================================================
--- trunk/device/org.maemo.esbox.device-feature/licenses/COPYING.LESSER (rev 0)
+++ trunk/device/org.maemo.esbox.device-feature/licenses/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/device/org.maemo.esbox.device-feature/licenses/epl-v10.html
===================================================================
--- trunk/device/org.maemo.esbox.device-feature/licenses/epl-v10.html (rev 0)
+++ trunk/device/org.maemo.esbox.device-feature/licenses/epl-v10.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ at font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+ at page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
Property changes on: trunk/device/org.maemo.esbox.device.core
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/device/org.maemo.esbox.device.core/.classpath
===================================================================
--- trunk/device/org.maemo.esbox.device.core/.classpath (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/device/org.maemo.esbox.device.core/.project
===================================================================
--- trunk/device/org.maemo.esbox.device.core/.project (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.device.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/device/org.maemo.esbox.device.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/device/org.maemo.esbox.device.core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:35:07 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/device/org.maemo.esbox.device.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/device/org.maemo.esbox.device.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Device Support Core Plug-in
+Bundle-SymbolicName: org.maemo.esbox.device.core
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.device.core.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.ssh;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.device.core,
+ org.maemo.esbox.device.core.adapters,
+ org.maemo.esbox.device.core.sbrsh,
+ org.maemo.esbox.internal.device.core;x-friends:="org.maemo.esbox.device.tests,org.maemo.esbox.linux.tests,org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.internal.device.core.sbrsh;x-friends:="org.maemo.esbox.device.tests,org.maemo.esbox.linux.tests,org.maemo.esbox.maemosdk.tests"
Added: trunk/device/org.maemo.esbox.device.core/build.properties
===================================================================
--- trunk/device/org.maemo.esbox.device.core/build.properties (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/DeviceMachineFactory.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/DeviceMachineFactory.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/DeviceMachineFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.device.core;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.device.core.sbrsh.*;
+import org.maemo.esbox.internal.api.ssh.DeviceSSHLinuxMachine;
+import org.maemo.esbox.internal.device.core.sbrsh.SBRSHMachine;
+import org.maemo.esbox.ssh.*;
+
+/**
+ * This class creates instances of device machines dynamically, as opposed to the singleton
+ * host or build machine instances provided by {@link IBuildMachineProvider} and {@link IBuildMachineFactory}.
+ * @author eswartz
+ *
+ */
+public abstract class DeviceMachineFactory {
+
+ /**
+ * Create a new device machine, accessed over SSH, using the given SSH configuration
+ * and provider for shared filesystem access.
+ * @param name the user-visible name of the machine
+ * @param sshConfiguration the configuration for accessing the machine over SSH
+ * @param sharedFilesystemProvider the provider of shared filesystems or <code>null</code>
+ */
+ public static ISSHMachine createSSHMachine(String name,
+ SSHConfiguration sshConfiguration,
+ ISharedFilesystemProvider sharedFilesystemProvider) {
+ return new DeviceSSHLinuxMachine(name, sshConfiguration, sharedFilesystemProvider);
+ }
+
+ /**
+ * Create a new SBRSH machine which is controlled from the given build host machine,
+ * is hosted on the given SSH device backend, and uses the given command configuration.
+ * @param name
+ *
+ * @param hostMachine build host for sbrsh and filesystem
+ * @param deviceMachine device which hosts processes
+ * @param configuration the configuration for launching sbrsh
+ * @param localHostNameFromRemote the IP/hostname of the host, according to the remote machine (TODO: represent this better)
+ * @return new SBRSH machine instance
+ * @throws ESboxException if there was a problem
+ */
+ public static ISBRSHMachine createSBRSHMachine(String name, IMachine hostMachine,
+ ISSHMachine deviceMachine,
+ SBRSHCommandConfiguration configuration,
+ //String sbrshUserName, // TODO: migrate into SBRSHCommandConfiguration
+ String localHostNameFromRemote) throws ESboxException {
+ return new SBRSHMachine(name, hostMachine, deviceMachine, configuration, localHostNameFromRemote);
+ }
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/adapters/ISbrshAutoconfigurationAdapter.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/adapters/ISbrshAutoconfigurationAdapter.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/adapters/ISbrshAutoconfigurationAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.device.core.adapters;
+
+/**
+ * This adapter to ISDKTarget will provide the default template for an SBRSH configuration.
+ * @author eswartz
+ *
+ */
+public interface ISbrshAutoconfigurationAdapter {
+ /**
+ * Create a default SBRSH configuration template which uses these variables:
+ * <p>
+ * <li>${TARGET} -- the IP address or host name of the device
+ * <li>${TARGET_PORT} -- the SBRSH port of the device
+ * <li>${HOST} -- the IP address or host name of the host (as seen from the device)
+ * <li>${HOST_PORT} -- the SSH port of the host
+ * <li>${HOST_PROJECT_PATH} -- the path on the host which contains pertinent project contents on the host;
+ * the "project" may be defined as the workspace or an even larger directory set but will contain at least the current project
+ * <li>${TARGET_PROJECT_PATH} -- the path on the target which will expose the project contents
+ * <p>
+ * The template may optionally expose a "rootstrap mount" (already filled in) for targets
+ * using sandbox mode.
+ * @return String with the above template variables embedded
+ */
+ String getDefaultConfigurationTemplate();
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/ISBRSHMachine.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/ISBRSHMachine.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/ISBRSHMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.device.core.sbrsh;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IMachine;
+
+/**
+ * A specialization of a machine which allows configuring the SBRSH command
+ * configuration.
+ * @author eswartz
+ *
+ */
+public interface ISBRSHMachine extends IMachine {
+ /** Get the current command configuration. */
+ SBRSHCommandConfiguration getCommandConfiguration();
+ /** Set a new command configuration. This takes effect for new process launches.
+ * @throws ESboxException if the configuration references a file that cannot be read or parsed properly */
+ void setCommandConfiguration(SBRSHCommandConfiguration configuration) throws ESboxException;
+
+ /** Get the build machine (hosting sbrsh and filesystem) */
+ IMachine getBuildMachine();
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHCommandConfiguration.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHCommandConfiguration.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHCommandConfiguration.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Mar 19, 2008
+ *******************************************************************************/
+package org.maemo.esbox.device.core.sbrsh;
+
+import org.eclipse.core.runtime.IPath;
+
+
+/**
+ * Settings for invoking "sbrsh" command.
+ *
+ * @author LWang.
+ *
+ */
+public class SBRSHCommandConfiguration {
+ private IPath configurationFile=null; // file name with full path. default is $HOME/.sbrsh
+ private String sbrshCommand=null; // sbrsh command. default is "sbrsh" in /usr/bin.
+ private String targetName=null; // target name from configuration file.
+ // Default is the first in configuration file.
+ //private String targetBinPath=null; // mount point on target for application binary.
+
+ public SBRSHCommandConfiguration(IPath configurationFile,
+ String sbrshCommand, String targetName /*, String targetBinPath*/) {
+ super();
+ this.configurationFile = configurationFile;
+ this.sbrshCommand = sbrshCommand;
+ this.targetName = targetName;
+ //this.targetBinPath = targetBinPath;
+ }
+
+ public SBRSHCommandConfiguration() {
+ // Use default for all.
+ }
+
+ public IPath getConfigurationFile() {
+ return configurationFile;
+ }
+
+ public void setConfigurationFile(IPath configurationFile) {
+ this.configurationFile = configurationFile;
+ }
+
+ public String getSbrshCommand() {
+ return sbrshCommand;
+ }
+
+ public void setSbrshCommand(String sbrshCommand) {
+ this.sbrshCommand = sbrshCommand;
+ }
+
+ public String getTargetName() {
+ return targetName;
+ }
+
+ public void setTargetName(String targetName) {
+ this.targetName = targetName;
+ }
+
+ /*
+ public String getTargetBinPath() {
+ return targetBinPath;
+ }
+
+ public void setTargetBinPath(String targetBinPath) {
+ this.targetBinPath = targetBinPath;
+ }
+ */
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHConfigurationFile.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHConfigurationFile.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHConfigurationFile.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Mar 26, 2008
+ *******************************************************************************/
+package org.maemo.esbox.device.core.sbrsh;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.maemo.esbox.core.*;
+
+/**
+ * Class for handling SBRSH client configuration file.
+ *
+ * @author LWang.
+ */
+public class SBRSHConfigurationFile {
+
+ /**
+ *
+ */
+ private static final String UNIX_PATH_SEP = "/";
+ // A configuration file just contains a list of targets.
+ //
+ private List<SBRSHTarget> targets = new ArrayList<SBRSHTarget>();
+
+
+ /**
+ * Constructs an empty configuration file, though it's not valid.
+ */
+ public SBRSHConfigurationFile() {
+ super();
+ }
+
+ public List<SBRSHTarget> getTargets() {
+ return targets;
+ }
+
+ /**
+ * Get names of all targets in the configuration file.
+ * @return
+ */
+ public String[] getTargetNames() {
+ String names[] = new String[targets.size()];
+
+ int idx = 0;
+ for (SBRSHTarget target : targets) {
+ names[idx++] = target.getTargetName();
+ }
+
+ return names;
+ }
+
+ /**
+ * Find the target with the given name, or the default target.
+ * @param targetName name of target, or <code>null</code> for the default.
+ * @return
+ */
+ public SBRSHTarget getTarget(String targetName) {
+ for (SBRSHTarget target : targets) {
+ if (targetName == null)
+ return target;
+ if (target.getTargetName().equals(targetName))
+ return target;
+ }
+ return null;
+ }
+
+ public void addTarget(SBRSHTarget target) throws ESboxException {
+ if (getTarget(target.getTargetName()) != null)
+ throw new ESboxException("A target with the same name already exists.");
+
+ targets.add(target);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder out = new StringBuilder();
+
+ for (SBRSHTarget t : targets) {
+ out.append(t.getTargetName());
+ out.append(' ');
+ out.append(t.getTargetIP());
+
+ if (t.getSbrshPortNumber().length() > 0) {
+ out.append(':');
+ out.append("" + t.getSbrshPortNumber());
+ }
+
+ out.append('\n');
+
+ for (SBRSHMount m : t.getMounts()) {
+ out.append('\t');
+ out.append(m.toString());
+ out.append('\n');
+ }
+
+ // add a space line indicating end of the target
+ out.append('\n');
+ }
+
+ return out.toString();
+ }
+
+ /**
+ * Save content of this SBRSHConfigurationFile object to the given OutputStream.
+ *
+ * @param fileName
+ * @throws IOException
+ */
+ public void saveTo(OutputStream os) throws IOException {
+ PrintStream ps = new PrintStream(os);
+
+ ps.print("##### Auto generated file. Your changes, if any, may get lost.\n\n");
+
+ ps.print(toString());
+ }
+
+ /**
+ * Save content of this SBRSHConfigurationFile object to the given OutputStream.
+ *
+ * @param fileName
+ * @throws IOException
+ */
+ public void saveToFile(IFileStore store) throws IOException {
+ try {
+ saveTo(store.openOutputStream(EFS.OVERWRITE, new NullProgressMonitor()));
+ } catch (CoreException e) {
+ throw (IOException) new IOException().initCause(e);
+ }
+ }
+
+ public boolean isValid() {
+ if (0 == targets.size())
+ return false;
+
+ for (SBRSHTarget target : targets) {
+ if (! target.isValid())
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Given a path (file or directory) on host, find out where it's mounted on
+ * given target. If there are two mounts that both contain the path (which
+ * indicates overlapped mounts, not good though not illegal), the first one
+ * will be returned.
+ *
+ * @param pathOnHost
+ * @param targetName -
+ * name of SBRSH target (representing a device) in the
+ * configuration file.
+ * <code>null<code> means to use the first target in the file.
+ * @return location of the file or directory on target, or empty string if it's not in the mounts.
+ */
+ public String getMountLocationOnTarget(String pathOnHost, String targetName) {
+ String result = "";
+
+ if (! isValid())
+ return result;
+
+ for (SBRSHTarget t : targets) {
+ if (targetName == null || targetName.equals(t.getTargetName())) {
+ for (SBRSHMount m : t.getMounts()) {
+ if (! m.getType().equals("bind")) // exclude "bind" mount.
+ {
+ String hp = m.getHostPath();
+ String tp = m.getTargetPath();
+
+ // Make sure the paths end with "/" so that
+ // "/home/maemo/" won't be treated as subfolder of
+ // "/home/ma".
+ if (! hp.endsWith(UNIX_PATH_SEP))
+ hp += UNIX_PATH_SEP;
+ if (! tp.endsWith(UNIX_PATH_SEP))
+ tp += UNIX_PATH_SEP;
+
+ if (pathOnHost.startsWith(hp)) {
+ result = pathOnHost.replace(hp, tp);
+ return result;
+ }
+ }
+ }
+ }
+
+ if (targetName == null) // only search the first target
+ break;
+ }
+
+ return result;
+ }
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHConfigurationFileFactory.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHConfigurationFileFactory.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHConfigurationFileFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,324 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar 3, 2008
+ * Ed Swartz (Nokia) - refactoring
+ *******************************************************************************/
+
+package org.maemo.esbox.device.core.sbrsh;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.device.core.adapters.ISbrshAutoconfigurationAdapter;
+import org.maemo.esbox.internal.device.core.Activator;
+
+import java.io.*;
+
+/**
+ * This class creates SBRSHConfigurationFile instances for particular purposes.
+ * @author LWang
+ * @author eswartz
+ *
+ */
+public abstract class SBRSHConfigurationFileFactory {
+
+ private static final int DEFAULT_SBRSH_PORT = 1202;
+ private static final int DEFAULT_SSH_PORT = 22;
+
+ /**
+ * Create a stock SBRSH configuration file (not the physical file, just internal
+ * object representation) for the given parameters. This will set up the environment
+ * for the best filesystem setup that exposes enough of the build machine's
+ * environment to the device without aliasing the device-specific directories that
+ * must still reference the device's filesystem.
+ * @param sdkTarget
+ * @param projectCommonParent the local machine's path for the common parent of project directories
+ * @param hostIP the host address (IP or name) which provides the filesystem
+ * @param hostPort the SSH port to use, or -1 for default
+ * @param targetIP the target address (IP or name) which launches processes
+ * @param targetIP the SBRSH port to use, or -1 for default
+ * @param rootstrapPath root location
+ * @return new SBRSHConfigurationFile
+ * @throws ESboxException
+ */
+ public static SBRSHConfigurationFile createStockSBRSHConfigurationFile(
+ ISDKTarget sdkTarget, String projectCommonParent,
+ String userName,
+ String hostIP, int hostPort,
+ String targetIP, int targetPort) throws ESboxException {
+
+ ISbrshAutoconfigurationAdapter adapter = (ISbrshAutoconfigurationAdapter)
+ sdkTarget.getAdapter(ISbrshAutoconfigurationAdapter.class);
+
+ if (adapter == null)
+ throw new ESboxException("Cannot discover an automatic SBRSH configuration for this target");
+
+ String sbrshConfigData = adapter.getDefaultConfigurationTemplate();
+ SBRSHConfigurationFile cf = new SBRSHConfigurationFile();
+
+ String commonMountPoint = getProjectCommonMountPoint(sdkTarget, projectCommonParent);
+
+ IPath buildMachineProjectCommonParent = sdkTarget.getHostToMachineFileSystemMapping().convertHostToTargetPath(
+ new Path(projectCommonParent));
+ if (buildMachineProjectCommonParent == null)
+ throw new ESboxException("The project is not visible to the build machine (?!)");
+ String sbrshProjectCommonParent = buildMachineProjectCommonParent.toPortableString();
+
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+
+ substitutor.define("TARGET", targetIP);
+ substitutor.define("TARGET_PORT", "" + (targetPort != -1 ? targetPort : DEFAULT_SBRSH_PORT));
+ substitutor.define("USER", userName);
+ substitutor.define("HOST", hostIP);
+ substitutor.define("HOST_PORT", "" + (hostPort != -1 ? hostPort : DEFAULT_SSH_PORT));
+ substitutor.define("HOST_PROJECT_PATH", sbrshProjectCommonParent);
+ substitutor.define("TARGET_PROJECT_PATH", commonMountPoint);
+
+ sbrshConfigData = substitutor.substitute(sbrshConfigData);
+
+ cf = SBRSHConfigurationFileFactory.parse(sbrshConfigData);
+
+ return cf;
+ }
+
+ /**
+ * Get the common mount point on device for mounting all projects via SBRSH.
+ * This takes a path, possibly under an sb1 target, and converts it to its
+ * real path visible under sb. This way, the filesystem view looks the same
+ * from both the emulator and device.
+ * @return a path as used in an sbrsh configuration file
+ */
+ public static String getProjectCommonMountPoint(ISDKTarget sdkTarget, String path) {
+ try {
+ IPath pathInSb = sdkTarget.convertHostToTargetPath(new Path(path));
+ return pathInSb.toPortableString();
+ } catch (ESboxException e) {
+ // path isn't visible: continue with incoming path
+ Activator.getErrorLogger().logError("Can't exactly map project mount point to device", e);
+ return path;
+ }
+ }
+
+ /**
+ * Parse and validate a given sbrsh configuration file.
+ *
+ * @param store
+ * @return a SBRSHConfigurationFile object.
+ * @throws ESboxException
+ */
+ public static SBRSHConfigurationFile parse(IFileStore store) throws ESboxException {
+ InputStream stream = null;
+ try {
+ stream = store.openInputStream(EFS.NONE, new NullProgressMonitor());
+ } catch (CoreException e) {
+ throw new ESboxException(e);
+ }
+
+ return parse(stream);
+ }
+
+ /**
+ * Parse a string representation of a SBRSH configuration (e.g.
+ * configuration file content) to get an object of SBRSHConfigurationFile.
+ *
+ * @param configData
+ * @return
+ * @throws ESboxException
+ */
+ public static SBRSHConfigurationFile parse(String configData) throws ESboxException {
+ if (configData == null || configData.length() == 0)
+ throwException("Invalid configuration data.");
+
+ ByteArrayInputStream stream = new ByteArrayInputStream(configData.getBytes());
+
+ return parse(stream);
+ }
+
+ static private SBRSHConfigurationFile parse(InputStream stream) throws ESboxException {
+
+ SBRSHConfigurationFile configFile = new SBRSHConfigurationFile();
+
+ BufferedReader in = null;
+ try {
+ in = new BufferedReader(new InputStreamReader(stream));
+
+ SBRSHTarget target;
+
+ while (true) {
+ target = parseTarget(in);
+ if (! target.isValid()) // no more valid targets
+ break;
+
+ configFile.addTarget(target);
+ }
+ } finally {
+ Policy.close(in);
+ }
+
+ return configFile;
+ }
+
+ static public SBRSHTarget parseTarget(InputStream stream) throws ESboxException {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
+
+ return parseTarget(reader);
+ }
+
+ static private SBRSHTarget parseTarget(BufferedReader in) throws ESboxException {
+
+ SBRSHTarget target = new SBRSHTarget();
+
+ try {
+ String line;
+
+ // Skip white lines before beginning of a target.
+ while (true) {
+ line = in.readLine();
+ if (line == null) // end of file
+ return target;
+
+ line = line.trim();
+ if (line.length() > 0 && !isCommentLine(line))
+ break;
+ }
+
+ // Expected format: TargetName IPAddress[:PortNumber]
+ String[] tokens = line.split("(\\s)+|:");
+
+ if (tokens.length >= 1)
+ target.setTargetName(tokens[0]);
+
+ if (tokens.length >= 2) {
+ if (! GeneralUtils.isValidNameOrIP(tokens[1]))
+ throwException("Invalid target IP: " + tokens[1]);
+ target.setTargetIP(tokens[1]);
+ }
+ else
+ throwException("Target IP address expected.");
+
+ // error case: "MyTarget 1.2.3.4:"
+ if (line.contains(":") && tokens.length == 2)
+ throwException("Port number expected after ':'");
+
+ if (tokens.length >= 3) {
+ if (tokens[2].charAt(0) != '#') { // not comment
+ if (GeneralUtils.isValidPortNumber(tokens[2]))
+ target.setSbrshPortNumber(tokens[2]);
+ else
+ throwException("Invalid port number after target IP address: " + tokens[2]);
+ }
+ }
+
+ if (tokens.length >= 4 && tokens[3].charAt(0) != '#') // not comment
+ throwException("Illegal text after target IP: "+tokens[3]);
+
+ // Parse mount entries.
+ // Note a configuration file may not have mounts.
+ //
+ while ((line = in.readLine()) != null && line.trim().length() > 0) {
+ // Skip comment lines
+ if (! isCommentLine(line)) {
+ line = line.trim();
+
+ SBRSHMount mountEntry = parseMount(line);
+
+ target.addMount(mountEntry);
+ }
+ }
+
+ } catch (IOException e) {
+ }
+
+ return target;
+ }
+
+ static public SBRSHMount parseMount(String line) throws ESboxException {
+
+ SBRSHMount mount = new SBRSHMount();
+ String[] tokens;
+
+ tokens = line.split("(\\s)+");
+
+ if (SBRSHMount.isValidMountType(tokens[0]))
+ mount.setType(tokens[0]);
+ else
+ throwException("Invalid mount type: "+tokens[0]);
+
+ if (tokens.length < 2)
+ throwException("Invalid mount: missing host file system to mount.");
+
+ // Get host share to mount
+ //
+ String hostShare = tokens[1];
+ String subTokens[];
+ if (mount.getType().equals("nfs")) {
+ // Example:
+ // nfs 1.2.3.4:/playground / rw,nolock,noac
+
+ subTokens = hostShare.split(":");
+ if (subTokens.length != 2)
+ throwException("Invalid host share for NFS mount: "+hostShare);
+
+ if (! GeneralUtils.isValidNameOrIP(subTokens[0]))
+ throwException("Invalid host name or IP address: " + subTokens[0]);
+
+ mount.setHost(subTokens[0]);
+
+ mount.setHostPath(subTokens[1]);
+ }
+ else if (mount.getType().equals("ssh")) { // "ssh".
+ // Example:
+ // ssh user at 1.2.3.4:/playground / rw,nonempty,allow_other
+
+ subTokens = hostShare.split("@|:");
+ if (subTokens.length != 3)
+ throwException("Invalid host share for SSHFS mount: "+hostShare);
+
+ mount.setHostUser(subTokens[0]);
+
+ if (! GeneralUtils.isValidNameOrIP(subTokens[1]))
+ throwException("Invalid host name or IP address: " + subTokens[1]);
+
+ mount.setHost(subTokens[1]);
+
+ mount.setHostPath(subTokens[2]);
+ }
+ else { // bind
+ // Example: bin olddir newdir
+ mount.setHostPath(hostShare);
+ }
+
+ if (tokens.length < 3)
+ throwException("Invalid mount: missing destination mount point.");
+
+ mount.setTargetPath(tokens[2]);
+
+ if (tokens.length > 3) // mount options are optional
+ mount.setMountOptions(tokens[3]);
+
+ return mount;
+ }
+
+ static private void throwException(String errorMsg) throws ESboxException {
+ throw new ESboxException(errorMsg);
+ }
+
+ /**
+ * Is the given line a comment line in configuration file ?
+ */
+ static private boolean isCommentLine(String line) {
+ line = line.trim();
+ return line.startsWith("#");
+ }
+
+
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHDeviceMachineController.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHDeviceMachineController.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHDeviceMachineController.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.device.core.sbrsh;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.internal.api.ssh.SSHDeviceMachineController;
+import org.maemo.esbox.internal.device.core.Activator;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+import java.io.IOException;
+import java.net.Socket;
+import java.text.MessageFormat;
+
+/**
+ * Controller for an SBRSH machine which additionally verifies that an SBRSH server is
+ * running.
+ * @author eswartz
+ *
+ */
+public class SBRSHDeviceMachineController extends SSHDeviceMachineController {
+
+ private final SBRSHTarget target;
+
+ /**
+ * @param configuration
+ * @param name
+ */
+ public SBRSHDeviceMachineController(SBRSHTarget target, SSHConfiguration configuration, String name) {
+ super(configuration, name);
+ this.target = target;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.machine.SSHMachineControllerBase#doProbeMachine()
+ */
+ @Override
+ protected IStatus doProbeMachine(IProgressMonitor monitor) {
+ IStatus status = super.doProbeMachine(monitor);
+ if (!status.isOK())
+ return status;
+
+ final int portNum;
+ if (target.getSbrshPortNumber().length() > 0)
+ portNum = Integer.parseInt(target.getSbrshPortNumber());
+ else
+ portNum = 1202;
+
+ final boolean[] opened = { false };
+ Thread thread = new Thread("Testing SBRSH connection") {
+ /* (non-Javadoc)
+ * @see java.lang.Thread#run()
+ */
+ @Override
+ public void run() {
+ try {
+ Socket socket = new Socket(target.getTargetIP(), portNum);
+ opened[0] = true;
+ try {
+ socket.close();
+ } catch (IOException e) {
+ }
+ } catch (IOException e) {
+ opened[0] = false;
+ }
+ }
+ };
+
+ thread.start();
+ JobUtils.waitForThread(thread, monitor);
+
+ if (!opened[0]) {
+ return Activator.createErrorStatus(
+ MessageFormat.format("Could not detect SBRSH server on {2} at {0}:{1}; please verify that it is installed and running, and that it is connected",
+ configuration.getTargetIPAddress(),
+ ""+configuration.getTargetPort(),
+ getName()), null);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHMount.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHMount.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHMount.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Mar 26, 2008
+ *******************************************************************************/
+package org.maemo.esbox.device.core.sbrsh;
+
+import org.maemo.esbox.core.GeneralUtils;
+
+/**
+ * @author LWang.
+ *
+ */
+public class SBRSHMount {
+
+ private String type = "";
+ private String hostUser = ""; // required for ssh, not nfs.
+ private String host = "";
+ private String hostPath = "";
+ private String targetPath = "";
+ private String mountOptions = "";
+
+ public SBRSHMount() {
+ super();
+ }
+
+ static public boolean isValidMountType(String type) {
+ // note the type name is case sensitive.
+ return type.equals("ssh") ||
+ type.equals("nfs") ||
+ type.equals("bind");
+ }
+
+ @Override
+ public boolean equals(Object arg0) {
+ if (! (arg0 instanceof SBRSHMount))
+ return false;
+
+ SBRSHMount that = (SBRSHMount)arg0;
+
+ return this.toString().equals(that.toString());
+ }
+
+ @Override
+ public String toString() {
+ if (type.equals("nfs"))
+ return type + "\t" + host + ":" + hostPath + "\t" + targetPath + "\t" + mountOptions;
+ else if (type.equals("ssh")) // ssh
+ return type + "\t" + hostUser + "@" + host + ":" + hostPath + "\t" + targetPath + "\t" + mountOptions;
+ else if (type.equals("bind")) // bind
+ return type + "\t" + hostPath + "\t" + targetPath;
+ else
+ return "<UnknownType>";
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getHostPath() {
+ return hostPath;
+ }
+
+ public void setHostPath(String hostPath) {
+ this.hostPath = hostPath;
+ }
+
+ public String getHostUser() {
+ return hostUser;
+ }
+
+ public void setHostUser(String hostUser) {
+ this.hostUser = hostUser;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public String getTargetPath() {
+ return targetPath;
+ }
+
+ public void setTargetPath(String targetPath) {
+ this.targetPath = targetPath;
+ }
+
+ public String getMountOptions() {
+ return mountOptions;
+ }
+
+ public void setMountOptions(String mountOptions) {
+ this.mountOptions = mountOptions;
+ }
+
+ /**
+ * Loose validation of the mount.
+ *
+ * @return
+ */
+ public boolean isValid() {
+ if (! isValidMountType(type))
+ return false;
+
+ if (hostPath.length() == 0) // no check on validity of the path
+ return false;
+
+ if (targetPath.length() == 0)
+ return false;
+
+ if (type.equals("ssh") || type.equals("nfs")) {
+ if (! GeneralUtils.isValidNameOrIP(host))
+ return false;
+ }
+
+ if (type.equals("ssh")) {
+ return hostUser.length() > 0;
+ }
+
+ return true;
+ }
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHTarget.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHTarget.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/device/core/sbrsh/SBRSHTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Mar 24, 2008
+ *******************************************************************************/
+package org.maemo.esbox.device.core.sbrsh;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.maemo.esbox.core.GeneralUtils;
+
+/**
+ * @author LWang.
+ *
+ */
+public class SBRSHTarget {
+
+ private String targetName;
+ private String targetIP;
+ private String sbrshPortNumber; // sbrsh port number
+
+ private List<SBRSHMount> mounts;
+
+ /**
+ *
+ */
+ public SBRSHTarget() {
+ targetName = "";
+ targetIP = "";
+ sbrshPortNumber = "";
+ mounts = new ArrayList<SBRSHMount>();
+ }
+
+ public String getTargetName() {
+ return targetName;
+ }
+
+ public void setTargetName(String targetName) {
+ this.targetName = targetName;
+ }
+
+ public String getTargetIP() {
+ return targetIP;
+ }
+
+ public void setTargetIP(String targetIP) {
+ this.targetIP = targetIP;
+ }
+
+ public List<SBRSHMount> getMounts() {
+ return mounts;
+ }
+
+ public void setMounts(List<SBRSHMount> mounts) {
+ this.mounts = mounts;
+ }
+
+ public String getSbrshPortNumber() {
+ return sbrshPortNumber;
+ }
+
+ public void setSbrshPortNumber(String targetPort) {
+ this.sbrshPortNumber = targetPort;
+ }
+
+ public void addMount(SBRSHMount mountEntry) {
+ if (! mounts.contains(mountEntry))
+ mounts.add(mountEntry);
+ }
+
+ public boolean isValid() {
+ if (targetName.length() == 0)
+ return false;
+
+ if (! GeneralUtils.isValidNameOrIP(targetIP))
+ return false;
+
+ // Check mounts, if any.
+ for (SBRSHMount mount : mounts) {
+ if (!mount.isValid())
+ return false;
+ }
+
+ return true;
+ }
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/Activator.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/Activator.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,118 @@
+package org.maemo.esbox.internal.device.core;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.device.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHFileSystemAccess.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHFileSystemAccess.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHFileSystemAccess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,221 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.device.core.sbrsh;
+
+import org.eclipse.core.filesystem.*;
+import org.eclipse.core.filesystem.provider.FileStore;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.core.machine.IFileSystemMapping;
+
+import org.maemo.esbox.internal.device.core.Activator;
+
+import java.io.*;
+import java.net.URI;
+
+/**
+ * Implement filesystem access over SBRSH. This is a little tricky since the filesystem is a
+ * mixture of the build machine's filesystem and the device's filesystem. So, for every
+ * IFileStore, we need to check where it really lives, and further, we need to
+ * wrap each IFileStore we generate through this accessor so that its parent and children
+ * will be created from the proper filesystem.
+ * @author eswartz
+ *
+ */
+public class SBRSHFileSystemAccess implements IFileSystemAccess {
+
+ /**
+ * @author eswartz
+ *
+ */
+ public static class WrappedSBRSHFileStore extends FileStore {
+ /**
+ *
+ */
+ private final IFileStore fileStore;
+
+ /**
+ *
+ */
+ private final IPath fileStorePath;
+
+ private SBRSHFileSystemAccess access;
+
+ /**
+ * @param fileStore
+ * @param fileStorePath
+ */
+ public WrappedSBRSHFileStore(SBRSHFileSystemAccess access, IFileStore fileStore, IPath fileStorePath) {
+ this.access = access;
+ this.fileStore = fileStore;
+ this.fileStorePath = fileStorePath;
+ }
+
+ /**
+ * @param newPath
+ * @return
+ */
+ private IFileStore createWrappedFileStore(IPath newPath) {
+ try {
+ return new WrappedSBRSHFileStore(access, EFS.getStore(access.getURIForPath(newPath)), newPath);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Error retrieving SBRSH file store for " + newPath, e);
+ return EFS.getNullFileSystem().getStore(newPath);
+ }
+ }
+
+ public String[] childNames(int options, IProgressMonitor monitor) throws CoreException {
+ return fileStore.childNames(options, monitor);
+ }
+
+ public IFileInfo fetchInfo() {
+ return fileStore.fetchInfo();
+ }
+
+ public IFileInfo fetchInfo(int options, IProgressMonitor monitor)
+ throws CoreException {
+ return fileStore.fetchInfo(options, monitor);
+ }
+
+ public IFileStore getChild(IPath path) {
+ IPath newPath = fileStorePath.append(path);
+ return createWrappedFileStore(newPath);
+ }
+
+ public IFileStore getChild(String name) {
+ IPath newPath = fileStorePath.append(name);
+ return createWrappedFileStore(newPath);
+ }
+
+ public IFileStore getFileStore(IPath path) {
+ IPath newPath = fileStorePath.append(path);
+ return createWrappedFileStore(newPath);
+ }
+
+ public IFileSystem getFileSystem() {
+ return fileStore.getFileSystem();
+ }
+
+ public String getName() {
+ return fileStore.getName();
+ }
+
+ public IFileStore getParent() {
+ if (fileStorePath.segmentCount() == 0)
+ return null;
+ IPath newPath = fileStorePath.removeLastSegments(1);
+ return createWrappedFileStore(newPath);
+ }
+
+ public boolean isParentOf(IFileStore other) {
+ return this.equals(other.getParent());
+ }
+
+ public IFileStore mkdir(int options, IProgressMonitor monitor)
+ throws CoreException {
+ return fileStore.mkdir(options, monitor);
+ }
+
+ public InputStream openInputStream(int options,
+ IProgressMonitor monitor) throws CoreException {
+ return fileStore.openInputStream(options, monitor);
+ }
+
+ public OutputStream openOutputStream(int options,
+ IProgressMonitor monitor) throws CoreException {
+ return fileStore.openOutputStream(options, monitor);
+ }
+
+ public void putInfo(IFileInfo info, int options,
+ IProgressMonitor monitor) throws CoreException {
+ fileStore.putInfo(info, options, monitor);
+ }
+
+ public File toLocalFile(int options, IProgressMonitor monitor)
+ throws CoreException {
+ return fileStore.toLocalFile(options, monitor);
+ }
+
+ public URI toURI() {
+ return fileStore.toURI();
+ }
+
+ public Object getAdapter(Class adapter) {
+ return fileStore.getAdapter(adapter);
+ }
+
+ public void move(IFileStore destination, int options,
+ IProgressMonitor monitor) throws CoreException {
+ super.move(destination, options, monitor);
+ }
+
+ public void copy(IFileStore destination, int options,
+ IProgressMonitor monitor) throws CoreException {
+ super.copy(destination, options, monitor);
+ }
+
+ public void delete(int options, IProgressMonitor monitor)
+ throws CoreException {
+ // TODO: check recursion
+ fileStore.delete(options, monitor);
+ }
+ }
+
+ private final IFileSystemAccess hostFileSystemAccess;
+ private final IFileSystemMapping fileSystemMapping;
+ private final IFileSystemAccess remoteFileSystemAccess;
+
+ /**
+ * @param sbrshTarget
+ * @param hostFileSystemAccess
+ * @param fileSystemAccess2
+ * @param fileSystemMapping
+ */
+ public SBRSHFileSystemAccess(IFileSystemAccess hostFileSystemAccess, IFileSystemAccess remoteFileSystemAccess,
+ IFileSystemMapping fileSystemMapping) {
+ this.hostFileSystemAccess = hostFileSystemAccess;
+ this.remoteFileSystemAccess = remoteFileSystemAccess;
+ this.fileSystemMapping = fileSystemMapping;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemAccess#getURIForPath(org.eclipse.core.runtime.IPath)
+ */
+ public URI getURIForPath(IPath path) {
+ // where does this sbrsh-machine path live?
+ IPath hostPath = fileSystemMapping.convertTargetToHostPath(path);
+ if (hostPath != null) {
+ return hostFileSystemAccess.getURIForPath(hostPath);
+ } else {
+ return remoteFileSystemAccess.getURIForPath(path);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemAccess#getFileStore(org.eclipse.core.runtime.IPath)
+ */
+ public IFileStore getFileStore(IPath path) {
+ final IPath fileStorePath = path;
+ final IFileStore fileStore;
+ try {
+ fileStore = EFS.getStore(getURIForPath(path));
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Cannot map SBRSH path " + path, e);
+ return EFS.getNullFileSystem().getStore(path);
+ }
+
+ // return a wrapper that will properly retarget the appropriate file system
+ // when we ask for a parent or child
+ return new WrappedSBRSHFileStore(this, fileStore, fileStorePath);
+ }
+
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHFileSystemMapping.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHFileSystemMapping.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHFileSystemMapping.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.device.core.sbrsh;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.device.core.sbrsh.SBRSHMount;
+import org.maemo.esbox.device.core.sbrsh.SBRSHTarget;
+
+import org.maemo.esbox.internal.api.core.machine.FileSystemMapping;
+import org.maemo.esbox.internal.device.core.Activator;
+
+import java.util.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public class SBRSHFileSystemMapping implements IFileSystemMapping {
+
+ private final IPathCanonicalizer hostCanonicalizer;
+ private final IPathCanonicalizer targetCanonicalizer;
+ private final SBRSHTarget target;
+ private final String mappedHostName;
+
+ /**
+ * @param target the target whose mounts are in effect
+ * @param hostCanoncalizer the canonicalizer for the files exposed to sbrsh
+ * @param mappedHostName the host IP/name as seen from the sbrsh side
+ */
+ public SBRSHFileSystemMapping(SBRSHTarget target, IPathCanonicalizer hostCanoncalizer, String mappedHostName) {
+ if (target == null || hostCanoncalizer == null || mappedHostName == null)
+ throw new IllegalArgumentException();
+ this.hostCanonicalizer = hostCanoncalizer;
+ this.targetCanonicalizer = FileSystemMapping.remoteCaseSensitiveCanonicalizer;
+ this.target = target;
+ this.mappedHostName = mappedHostName;
+ }
+
+ public IPath[] convertHostToTargetPaths(IPath hostPath) {
+ hostPath = getHostPathCanonicalizer().getCanonicalPath(hostPath);
+
+ /*
+ * Go forward through the mounts, which are in order of increasing depth,
+ * in order to find the best candidate.
+ *
+ * for:
+ * host:/some/local/path /
+ * host:/some/local/path/other /home
+ * bind /tmp /tmp
+ *
+ * then:
+ * /some/local/path/foo -> /foo
+ * /some/local/path/other/foo -> /home/foo, /other/foo
+ * /some/local/path/tmp -> null
+ *
+ * Bind mounts specifically turn off mapping.
+ */
+ List<IPath> candidatePaths = new ArrayList<IPath>();
+
+ for (SBRSHMount mount : target.getMounts()) {
+ // binds being read from other hosts aren't visible
+ boolean fromThisHost = mappedHostName.equals(mount.getHost());
+
+ IPath hostBasePath = new Path(mount.getHostPath());
+ IPath targetBasePath = new Path(mount.getTargetPath());
+
+ boolean matchedMount = false;
+
+ if (mount.getType().equals("ssh") || mount.getType().equals("nfs")) {
+ if (hostBasePath.isPrefixOf(hostPath)) {
+ if (fromThisHost) {
+ IPath candidate = targetBasePath.append(hostPath.removeFirstSegments(hostBasePath.segmentCount()));
+ candidatePaths.add(candidate);
+ matchedMount = true;
+ } else {
+ // remove any matches masked by the other host's filesystem
+ for (Iterator<IPath> iter = candidatePaths.iterator(); iter.hasNext(); ) {
+ IPath candidate = iter.next();
+ if (hostBasePath.isPrefixOf(candidate)) {
+ iter.remove();
+ }
+ }
+ }
+ }
+ }
+ if (!matchedMount) {
+ // remove any matches that are masked by a bind or by other mounts
+ for (Iterator<IPath> iter = candidatePaths.iterator(); iter.hasNext(); ) {
+ IPath candidate = iter.next();
+ if (targetBasePath.isPrefixOf(candidate)) {
+ iter.remove();
+ }
+ }
+ }
+ //CoreActivator.getErrorLogger().logError("Cannot interpret unknown mount type: " + mount.getType(), null);
+ }
+
+ return candidatePaths.toArray(new IPath[candidatePaths.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemMapping#convertTargetToHostPath(org.eclipse.core.runtime.IPath)
+ */
+ public IPath convertTargetToHostPath(IPath targetPath) {
+ targetPath = getTargetPathCanonicalizer().getCanonicalPath(targetPath);
+
+ /*
+ * Go through the mounts in reverse order and find the mapping for the file.
+ *
+ * for:
+ * host:/some/local/path /
+ * host:/some/local/path/other /home
+ * bind /tmp /tmp
+ *
+ * then:
+ * /foo -> /some/local/path/foo
+ * /home/foo -> /some/local/path/other/foo
+ * /tmp/foo -> null
+ */
+
+ for (ListIterator<SBRSHMount> iter = target.getMounts().listIterator(target.getMounts().size());
+ iter.hasPrevious();) {
+ SBRSHMount mount = iter.previous();
+
+ // binds being read from other hosts aren't visible
+ boolean fromThisHost = mappedHostName.equals(mount.getHost());
+
+ IPath hostBasePath = new Path(mount.getHostPath());
+ IPath targetBasePath = new Path(mount.getTargetPath());
+
+ if (mount.getType().equals("ssh") || mount.getType().equals("nfs")) {
+ if (targetBasePath.isPrefixOf(targetPath)) {
+ if (fromThisHost) {
+ return hostBasePath.append(targetPath.removeFirstSegments(targetBasePath.segmentCount()));
+ } else {
+ // remove any matches masked by the other host's filesystem
+ return null;
+ }
+ }
+ } else if (mount.getType().equals("bind")) {
+ // remove any matches that are masked by the bind
+ if (targetBasePath.isPrefixOf(targetPath)) {
+ return null;
+ }
+ } else {
+ Activator.getErrorLogger().logError("Cannot interpret unknown mount type: " + mount.getType(), null);
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemMapping#convertHostToTargetPath(org.eclipse.core.runtime.IPath)
+ */
+ public IPath convertHostToTargetPath(IPath hostPath) {
+ IPath[] targetPaths = convertHostToTargetPaths(hostPath);
+ if (targetPaths.length == 0)
+ return null;
+ return targetPaths[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemMapping#getHostPathCanonicalizer()
+ */
+ public IPathCanonicalizer getHostPathCanonicalizer() {
+ return hostCanonicalizer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IFileSystemMapping#getTargetPathCanonicalizer()
+ */
+ public IPathCanonicalizer getTargetPathCanonicalizer() {
+ return targetCanonicalizer;
+ }
+
+
+
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHMachine.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHMachine.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.device.core.sbrsh;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.device.core.sbrsh.*;
+import org.maemo.esbox.internal.api.core.machine.Machine;
+import org.maemo.esbox.internal.api.core.machine.UnixProcessLister;
+import org.maemo.esbox.internal.api.ssh.SSHDeviceMachineController;
+import org.maemo.esbox.internal.device.core.Activator;
+import org.maemo.esbox.ssh.ISSHMachine;
+
+import java.net.URI;
+import java.text.MessageFormat;
+import java.util.*;
+
+/**
+ * This represents a machine that runs over sbrsh.
+ * @author eswartz
+ *
+ */
+public class SBRSHMachine extends Machine implements IMachineBackend, ISBRSHMachine, IDeviceMachine {
+ public final static String ID = Activator.PLUGIN_ID + ".sbrsh_machine";
+ private URI uri;
+ private IMachine hostMachine;
+ private IFileSystemAccess fileSystemAccess;
+ private IFileSystemMapping fileSystemMapping;
+ private IProcessLister processLister;
+ private SBRSHCommandConfiguration configuration;
+ private final String localHostNameFromRemote;
+ private SBRSHConfigurationFile sbrshFile;
+ private SBRSHTarget sbrshTarget;
+ private ISSHMachine deviceMachine;
+
+ /**
+ * @param hostMachine
+ * @param configuration
+ * @param localHostNameFromRemote
+ * @throws ESboxException
+ */
+ public SBRSHMachine(String name,
+ IMachine hostMachine,
+ ISSHMachine deviceMachine,
+ SBRSHCommandConfiguration configuration,
+ //String sbrshUserName, // TODO: migrate into SBRSHCommandConfiguration
+ String localHostNameFromRemote) throws ESboxException {
+ // NOTE: the machine controller becomes an SBRSH machine controller once the configuration file is parsed
+ super(name, Platform.OS_LINUX, new SSHDeviceMachineController(deviceMachine.getSshConfiguration(), name));
+ if (hostMachine == null || deviceMachine == null || configuration == null || localHostNameFromRemote == null)
+ throw new IllegalArgumentException();
+ this.hostMachine = hostMachine;
+ this.deviceMachine = deviceMachine;
+ this.localHostNameFromRemote = localHostNameFromRemote;
+ this.configuration = configuration;
+
+ parseConfiguration();
+ this.uri = URI.create("sbrsh://" + deviceMachine.getUserName() + "@" + configuration.getTargetName() + "@" + deviceMachine.getURI().getHost());
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getURI()
+ */
+ public URI getURI() {
+ return uri;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getUserHome()
+ */
+ public IPath getUserHome() {
+ IPath userHome = deviceMachine.getUserHome();
+ IPath convertedHome = getFileSystemMapping().convertHostToTargetPath(userHome);
+ if (convertedHome != null)
+ return convertedHome;
+ else
+ return userHome;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#getUserName()
+ */
+ public String getUserName() {
+ return deviceMachine.getUserName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.IMachine#isAlive()
+ */
+ public boolean isAlive() {
+ // we access infrequently so don't delay
+ return getMachineController().probeMachine(this, null).isOK();
+ }
+
+ /**
+ *
+ */
+ private void parseConfiguration() throws ESboxException {
+ IPath remoteSbrshFile = configuration.getConfigurationFile();
+ if (remoteSbrshFile == null) {
+ remoteSbrshFile = hostMachine.getUserHome().append(".sbrsh");
+ }
+ this.sbrshFile = SBRSHConfigurationFileFactory.parse(hostMachine.getFileSystemAccess().getFileStore(remoteSbrshFile));
+ this.sbrshTarget = sbrshFile.getTarget(configuration.getTargetName());
+ if (sbrshTarget == null) {
+ throw new ESboxException(MessageFormat.format(
+ "Unknown SBRSH target ''{0}'' in ''{1}''",
+ configuration.getTargetName(),
+ remoteSbrshFile));
+ }
+ setMachineController(new SBRSHDeviceMachineController(sbrshTarget, deviceMachine.getSshConfiguration(), getName()));
+
+ // these change when the sbrshTarget changes
+ fileSystemAccess = null;
+ fileSystemMapping = null;
+ }
+
+ public SBRSHCommandConfiguration getCommandConfiguration() {
+ return configuration;
+ }
+
+ public void setCommandConfiguration(SBRSHCommandConfiguration configuration) throws ESboxException {
+ if (configuration == null)
+ throw new IllegalArgumentException();
+ this.configuration = configuration;
+ parseConfiguration();
+ }
+
+ public synchronized IFileSystemAccess getFileSystemAccess() {
+ if (fileSystemAccess == null) {
+ fileSystemAccess = new SBRSHFileSystemAccess(
+ hostMachine.getFileSystemAccess(),
+ deviceMachine.getFileSystemAccess(),
+ getFileSystemMapping());
+ }
+ return fileSystemAccess;
+ }
+
+ public synchronized IFileSystemMapping getFileSystemMapping() {
+ if (fileSystemMapping == null) {
+ fileSystemMapping = new SBRSHFileSystemMapping(
+ sbrshTarget,
+ hostMachine.getFileSystemMapping().getTargetPathCanonicalizer(),
+ localHostNameFromRemote);
+ }
+ return fileSystemMapping;
+ }
+
+ public synchronized IProcessLister getProcessLister() {
+ if (processLister == null) {
+ processLister = new UnixProcessLister(getProcessLauncherFactory());
+ }
+ return processLister;
+ }
+
+ public Process createProcess(IPath workingDirectory, List<String> commandLine, Properties environment,
+ boolean usePty) throws Exception {
+ // check early if the device is inaccessible, otherwise the launch hangs forever
+ // (esp. or only under a VM environment?)
+ IStatus status = getMachineController().probeMachine(this, null);
+ if (!status.isOK()) {
+ throw new CoreException(status);
+ }
+
+ return hostMachine.createProcess(workingDirectory, commandLine, environment, usePty);
+ }
+
+ public String getEnvironmentVariablePrefix() {
+ return "SBRSH";
+ }
+
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return new SBRSHProcessLauncherFactory(configuration, this);
+ }
+
+ public Map<String, String> getStandardEnvironment() {
+ // it will be the host's environment
+ return hostMachine.getStandardEnvironment();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.machine.ISBRSHMachine#getBuildMachine()
+ */
+ public IMachine getBuildMachine() {
+ return hostMachine;
+ }
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHProcessLauncher.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHProcessLauncher.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHProcessLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Mar 19, 2008
+ *******************************************************************************/
+package org.maemo.esbox.internal.device.core.sbrsh;
+
+import java.util.*;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.process.BaseProcessLauncher;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.device.core.sbrsh.SBRSHCommandConfiguration;
+
+/**
+ * This launches a process under sbrsh using a given command configuration which specifies
+ * how to find sbrsh, the configuration file, and the target.
+ * @author LWang.
+ *
+ */
+public class SBRSHProcessLauncher extends BaseProcessLauncher {
+
+ private IMachine machine;
+
+ public SBRSHProcessLauncher(
+ SBRSHCommandConfiguration configuration,
+ IMachine machine, List<String> cmdLine,
+ Properties environment,
+ IPath workingDirectory,
+ IPreferenceProvider prefProvider)
+ {
+ super(encodeArgumentArray(configuration, cmdLine, workingDirectory),
+ environment, // "sbrsh" copies all env on host to target. So just set the env on host.
+ null,
+ prefProvider); // needed for logging command. See super class.
+ this.machine = machine;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoPrefix()
+ */
+ @Override
+ protected String getLaunchInfoPrefix() {
+ return "sbrsh:" + machine.getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoStandardEnvironment()
+ */
+ @Override
+ protected Map<String, String> getLaunchInfoStandardEnvironment() {
+ return machine.getStandardEnvironment();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#setupForLaunch()
+ */
+ @Override
+ protected void setupForLaunch() throws ESboxException {
+ // do nothing.
+ }
+
+ public static List<String> encodeArgumentArray(
+ SBRSHCommandConfiguration configuration,
+ List<String> cmdLine,
+ IPath workingDirectory)
+ {
+ /*
+ * With Scratchbox1, "sbrsh" command can be launched either inside
+ * scratchbox or outside of Scratchbox. But latest SBRSH that supports
+ * sshfs mount only works outside of Scratchbox. Also we don't see real
+ * advantage of running sbrsh in Scratchbox. One possible advantage is
+ * selecting sbrsh as CPUTRANSPARENCY in Sbox1 and then you can directly
+ * enter application command on host side (e.g. enter "helloworld"
+ * instead of "sbrsh helloworld") while it's actually started on remote
+ * device. But with CPUTRANSPARENCY being sbrsh, we cannot run/debug the
+ * applicatoin in emulator (qemu), which is a big disadvantage.
+ *
+ * So we just launch sbrsh command outside of scratchbox.
+ * .......... LWang. 03/18/2008
+ */
+
+ List<String> hostCmdLine = new ArrayList<String>();
+
+ // sbrsh -c configFile -t targetName -d targetPath cmd1 cmd2 ..."
+
+ hostCmdLine.add(configuration.getSbrshCommand()==null?
+ "sbrsh" :
+ configuration.getSbrshCommand());
+
+ if (configuration.getConfigurationFile() != null) {
+ hostCmdLine.add("-c");
+ hostCmdLine.add(configuration.getConfigurationFile().toPortableString());
+ }
+
+ if (null != configuration.getTargetName() && configuration.getTargetName().length() > 0) {
+ hostCmdLine.add("-t");
+ hostCmdLine.add(configuration.getTargetName());
+ }
+
+ //String targetWD = workingDirectory == null ?
+ // configuration.getTargetBinPath() : workingDirectory.toPortableString();
+ String targetWD = workingDirectory == null ? null : workingDirectory.toPortableString();
+
+ if (targetWD != null) {
+ hostCmdLine.add("-d");
+ hostCmdLine.add(targetWD);
+ }
+
+ // just add device commands
+ hostCmdLine.addAll(cmdLine);
+
+ return hostCmdLine;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#doCreateProcess()
+ */
+ @Override
+ protected Process doCreateProcess() throws Exception {
+ return machine.createProcess(getLaunchCurrentWorkingDirectory(), getLaunchCommandArguments(),
+ getLaunchEnvironment(), isUsePTY());
+ }
+}
Added: trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHProcessLauncherFactory.java
===================================================================
--- trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHProcessLauncherFactory.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.core/src/org/maemo/esbox/internal/device/core/sbrsh/SBRSHProcessLauncherFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Mar 19, 2008
+ * Ed Swartz (Nokia) - refactoring
+ *******************************************************************************/
+package org.maemo.esbox.internal.device.core.sbrsh;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.machine.IMachine;
+
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.device.core.sbrsh.SBRSHCommandConfiguration;
+import org.maemo.esbox.internal.api.core.BaseProcessLauncherFactory;
+
+/**
+ * @author LWang.
+ */
+public class SBRSHProcessLauncherFactory extends BaseProcessLauncherFactory {
+
+ private SBRSHCommandConfiguration configuration;
+ private IMachine machine;
+
+ /**
+ * Create a factory which will launch a process under sbrsh using the given machine as
+ * the host (where 'sbrsh' is found, where the config file is hosted, and whose filesystem
+ * is exposed).
+ * @param config the configuration describing how 'sbrsh' is invoked.
+ * @param sbrshHostMachine
+ */
+ public SBRSHProcessLauncherFactory(SBRSHCommandConfiguration config, IMachine sbrshHostMachine) {
+ super(false);
+ configuration = config;
+ this.machine = sbrshHostMachine;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncherFactory#doCreateProcessLaunchHandler(org.eclipse.core.runtime.IPath, java.util.List, java.util.Properties, org.eclipse.cdt.utils.pty.PTY)
+ */
+ @Override
+ protected IProcessLauncher doCreateProcessLaunchHandler(
+ IPath workingDirectory, List<String> cmdLine,
+ Properties environment) {
+ return new SBRSHProcessLauncher(
+ configuration,
+ machine,
+ cmdLine,
+ environment != null ? environment : readStandardEnvironment(),
+ workingDirectory,
+ CorePlugin.getDefault().getCorePreferenceProvider());
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncherFactory#readStandardEnvironment()
+ */
+ @Override
+ protected Properties readStandardEnvironment() {
+ // Do nothing. "sbrsh" will just use default host environment.
+ return null;
+ }
+
+ /**
+ * Get reference to underlying configuration. You can change the
+ * configuration if needed before creating a process launcher from this
+ * factory.
+ *
+ * @return
+ */
+ public SBRSHCommandConfiguration getConfiguration() {
+ return configuration;
+ }
+
+ public void setConfiguration(SBRSHCommandConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+}
Property changes on: trunk/device/org.maemo.esbox.device.launch
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/device/org.maemo.esbox.device.launch/.classpath
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/.classpath (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/device/org.maemo.esbox.device.launch/.project
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/.project (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.device.launch</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/device/org.maemo.esbox.device.launch/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:35:57 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/device/org.maemo.esbox.device.launch/META-INF/MANIFEST.MF
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/META-INF/MANIFEST.MF (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Device Launch Support Plug-in
+Bundle-SymbolicName: org.maemo.esbox.device.launch;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.device.launch.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.device.core;bundle-version="1.5.0",
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.maemo.esbox.ssh;bundle-version="1.5.0",
+ org.eclipse.debug.core;bundle-version="3.4.0",
+ org.eclipse.debug.ui;bundle-version="3.4.0",
+ org.maemo.esbox.ui;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.device.launch
Added: trunk/device/org.maemo.esbox.device.launch/build.properties
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/build.properties (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/device/org.maemo.esbox.device.launch/plugin.xml
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/plugin.xml (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.maemo.esbox.launch.LaunchProtocolType">
+ <launch_protocol
+ name="SSH"
+ id="org.maemo.esbox.launch.launch_protocol.ssh"
+ description="See "http://maemo.org/development/documentation/pc_connectivity/" for how to set up SSH for Maemo development. When used for downloading, this protocol will copy program files to the remote device."
+ class="org.maemo.esbox.device.launch.SSHLaunchProtocolType">
+ </launch_protocol>
+ <launch_protocol
+ name="SBRSH"
+ id="org.maemo.esbox.launch.launch_protocol.sbrsh"
+ description="See "http://www.scratchbox.org/documentation/user/scratchbox-1.0/html/sbrsh.html" on what's SBRSH. See "http://maemo.org/development/documentation/pc_connectivity/" for how to set up SBRSH. When used for downloading, the protocol will mount the project folder from host PC to remote device."
+ class="org.maemo.esbox.device.launch.SBRSHLaunchProtocolType">
+ </launch_protocol>
+ </extension>
+
+
+ <extension
+ id="org.maemo.esbox.launch.launchprotocolpages"
+ name="Built-in launch protocol pages"
+ point="org.maemo.esbox.launch.LaunchProtocolPage">
+ <launch_protocol_page
+ class="org.maemo.esbox.device.launch.ui.SSHLaunchProtocolPage"
+ launch_protocol_id="org.maemo.esbox.launch.launch_protocol.ssh">
+ </launch_protocol_page>
+ <launch_protocol_page
+ class="org.maemo.esbox.device.launch.ui.SBRSHLaunchProtocolPage"
+ launch_protocol_id="org.maemo.esbox.launch.launch_protocol.sbrsh">
+ </launch_protocol_page>
+ </extension>
+
+</plugin>
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/FileToTransfer.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/FileToTransfer.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/FileToTransfer.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial Implementation. Mar. 2008
+ * Raul Herbster (UFCG)
+ *******************************************************************************/
+package org.maemo.esbox.device.launch;
+
+/**
+ * Denote a file to download.
+ * The host path contains file name, while the target path is just a directory
+ * without file name.
+ *
+ */
+public class FileToTransfer {
+
+ private String fHostPath;
+ private String fTargetPath;
+ private boolean fEnabled;
+
+ public static final String SEPARATOR = ";";
+ public static final String FIELD_SEPARATOR = ",";
+
+ public FileToTransfer() {
+ fHostPath = ""; //$NON-NLS-1$
+ fTargetPath = ""; //$NON-NLS-1$
+ fEnabled = true;
+ }
+
+ public FileToTransfer(String hostPath, String targetPath, boolean enabled) {
+ fHostPath = hostPath;
+ fTargetPath = targetPath;
+ fEnabled = enabled;
+ }
+
+ public String getHostPath() {
+ return fHostPath;
+ }
+
+ public void setHostPath(String path) {
+ fHostPath = path;
+ }
+
+ public String getTargetPath() {
+ return fTargetPath;
+ }
+
+ public void setTargetPath(String path) {
+ fTargetPath = path;
+ }
+
+ public boolean getEnabled() {
+ return fEnabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ fEnabled = enabled;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof FileToTransfer))
+ return false;
+ FileToTransfer file = (FileToTransfer)obj;
+ return getHostPath().equals(file.getHostPath()) && getTargetPath().equals(file.getTargetPath()) &&
+ Boolean.toString(getEnabled()).equals(Boolean.toString(file.getEnabled()));
+ }
+
+ @Override
+ public int hashCode() {
+ return getHostPath().hashCode() + getTargetPath().hashCode() + (getEnabled() ? 1 : 0);
+ }
+
+ @Override
+ public String toString() {
+ return getHostPath() + FIELD_SEPARATOR + getTargetPath() + FIELD_SEPARATOR + (getEnabled() ? "1" : "0");
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/IESboxDeviceLaunchHelpContextID.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/IESboxDeviceLaunchHelpContextID.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/IESboxDeviceLaunchHelpContextID.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar 6, 2008
+ *******************************************************************************/
+package org.maemo.esbox.device.launch;
+
+import org.maemo.esbox.internal.device.launch.Activator;
+
+/**
+ * @author LWang.
+ *
+ */
+public interface IESboxDeviceLaunchHelpContextID {
+ public static final String PREFIX = Activator.PLUGIN_ID + "."; //$NON-NLS-1$
+
+ // Launch configuration dialog pages
+ public static final String LAUNCH_CONFIGURATION_DIALOG_DOWNLOAD_TAB_ADDEDITFILEDIALOG = PREFIX + "launch_configuration_dialog_download_tab_addeditfiledialog"; //$NON-NLS-1$
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocol.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocol.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocol.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. 02/17/2008
+ * Ed Swartz (Nokia) - refactoring
+ *******************************************************************************/
+package org.maemo.esbox.device.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.ProcessLauncherParameters;
+import org.maemo.esbox.device.core.sbrsh.ISBRSHMachine;
+import org.maemo.esbox.launch.AbstractLaunchProtocol;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+
+import java.util.*;
+
+/**
+ * @author LWang.
+ * @author eswartz
+ *
+ */
+public class SBRSHLaunchProtocol extends AbstractLaunchProtocol {
+
+ private IMachine fBuildMachine;
+ private ISBRSHMachine fMachine;
+ private boolean runAsRoot;
+ private String sudoPassword;
+
+ /**
+ * Construct based on given launch configuration.
+ * @throws CoreException
+ */
+ public SBRSHLaunchProtocol(ILaunchConfiguration configuration) throws CoreException {
+ super(configuration);
+
+ fMachine = SBRSHLaunchProtocolType.createSBRSHMachineForLaunchConfiguration(configuration);
+ fBuildMachine = fMachine.getBuildMachine();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#getDeviceMachine()
+ */
+ public IMachine getDeviceMachine() {
+ return fMachine;
+ }
+
+ public IStatus downloadFiles(Map<IPath, List<IPath>> targetPathFiles,
+ IProgressMonitor monitor) {
+ // With SBRSH, no downloading is usually needed. We make an automated .sbrsh configuration
+ // that ensures the project (and usually the workspace as a whole) is visible to
+ // the device. But there may be cases still where other files need to be copied over.
+ //
+ Map<IPath, List<IPath>> copyFiles = new HashMap<IPath, List<IPath>>();
+ for (Map.Entry<IPath, List<IPath>> entry : targetPathFiles.entrySet()) {
+ IPath targetPath = convertTargetToHostPath(entry.getKey());
+ if (targetPath == null) {
+ // not visible
+ copyFiles.put(entry.getKey(), entry.getValue());
+ }
+ }
+ return ESboxLaunchUtils.downloadFiles(getDeviceMachine().getFileSystemAccess(), copyFiles, monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#getFileLocationOnTarget(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
+ */
+ public IPath getFileLocationOnTarget(IPath localPath) {
+ IPath buildHostPath = fBuildMachine.getFileSystemMapping().convertHostToTargetPath(localPath);
+ if (buildHostPath == null)
+ return null;
+
+ IPath remotePath = fMachine.getFileSystemMapping().convertHostToTargetPath(buildHostPath);
+ if (remotePath != null) {
+ return remotePath;
+ } else {
+ return null; // failure
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#convertHostToTargetPath(org.eclipse.core.runtime.IPath)
+ */
+ public IPath convertHostToTargetPath(IPath localPath) {
+
+ // the device is "connected" to the build machine
+ IPath buildHostPath = fBuildMachine.getFileSystemMapping().convertHostToTargetPath(localPath);
+ if (buildHostPath == null)
+ return null;
+
+ IPath remotePath = fMachine.getFileSystemMapping().convertHostToTargetPath(buildHostPath);
+ return remotePath;
+ }
+
+ public IPath convertTargetToHostPath(IPath remotePath) {
+
+ // the device is "connected" to the build machine
+ IPath buildHostPath = fMachine.getFileSystemMapping().convertTargetToHostPath(remotePath);
+ if (buildHostPath == null)
+ return null;
+
+ IPath localPath = fBuildMachine.getFileSystemMapping().convertTargetToHostPath(buildHostPath);
+ return localPath;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#getTargetFoldersForHostFileMappings()
+ */
+ public Map<IPath, List<IPath>> getTargetFoldersForHostFileMappings() {
+ // nothing is explicitly copied
+ return Collections.emptyMap();
+ }
+
+ public IStatus downloadFiles(IProgressMonitor monitor) {
+ // nothing special needed from the launch configuration (ultimately the user) yet.
+ // See comment in downloadFiles(Map, IProgressMonitor) for more.
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#requireRunAsRoot()
+ */
+ public void requireRunAsRoot() {
+ runAsRoot = true;
+
+ sudoPassword = promptSudoPassword();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.AbstractLaunchProtocol#updateLaunchParameters(org.maemo.esbox.core.process.ProcessLauncherParameters)
+ */
+ @Override
+ protected void updateLaunchParameters(ProcessLauncherParameters parameters) {
+ if (runAsRoot) {
+ if (sudoPassword != null) {
+ // Current user is not root, need to run command as sudoer.
+ // "echo password | sudo -S ..."
+ // TODO: this does not work. Support SBRSH later....04/30/08
+ String prefix = "echo " + sudoPassword + " | sudo -S ";
+ parameters.getCommandLine().addAll(0, CommandLineArguments.createFromCommandLine(prefix));
+ }
+ }
+ }
+
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocolType.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocolType.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocolType.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Aug 8, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.device.launch;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.device.core.DeviceMachineFactory;
+import org.maemo.esbox.device.core.sbrsh.*;
+import org.maemo.esbox.internal.device.launch.Activator;
+import org.maemo.esbox.launch.*;
+import org.maemo.esbox.ssh.ISSHMachine;
+
+import java.io.IOException;
+
+/**
+ * @author LWang
+ * TODO: this should share UI with SBRSH and be easily switchable with a "device connection" concept
+ */
+public class SBRSHLaunchProtocolType extends
+ AbstractLaunchProtocolType implements
+ ILaunchProtocolType {
+
+ // !!!Note: Don't change this ID for backward-compatibility with ESbox 1.4.
+ public static final String PREFIX_ID = "org.indt.esbox.launch";
+
+ public static final String ATTR_SBRSH_CONFIG_METHOD = PREFIX_ID + ".sbrsh_config_method"; //$NON-NLS-1$
+ public static final String V_SBRSH_CONFIG_METHOD_AUTOMATIC = "Automatic"; // this will show on UI
+ public static final String V_SBRSH_CONFIG_METHOD_CUSTOM = "Custom"; // this will show on UI
+ public static final String[] V_SBRSH_CONFIG_METHODS = new String[] { V_SBRSH_CONFIG_METHOD_AUTOMATIC, V_SBRSH_CONFIG_METHOD_CUSTOM };
+ public static final int DEFAULT_SBRSH_CONFIG_METHOD_ID = 0; // index to the above array.
+
+ public static final String ATTR_SBRSH_AUTO_CONFIG_HOST_IP = PREFIX_ID + ".sbrsh_auto_config_host_ip"; //$NON-NLS-1$
+
+ public static final String ATTR_SBRSH_AUTO_CONFIG_TARGET_IP = PREFIX_ID + ".sbrsh_auto_config_target_ip"; //$NON-NLS-1$
+
+ public static final String ATTR_SBRSH_CUSTOM_CONFIG_CONFIG_FILE = PREFIX_ID + ".sbrsh_custom_config_config_file"; //$NON-NLS-1$
+ public static final String DEFAULT_CUSTOM_SBRSH_CONFIG_FILE_NAME = ".sbrsh";
+
+ public static final String ATTR_SBRSH_CUSTOM_CONFIG_SBRSH_TARGET = PREFIX_ID + ".sbrsh_custom_config_sbrsh_target"; //$NON-NLS-1$
+
+ public SBRSHLaunchProtocolType() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocolType#getLaunchProtocol(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public ILaunchProtocol getLaunchProtocol(ILaunchConfiguration configuration) throws CoreException {
+ return new SBRSHLaunchProtocol(configuration);
+ }
+
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(configuration);
+
+ // SBRSH configuration method.
+ configuration.setAttribute(ATTR_SBRSH_CONFIG_METHOD,
+ V_SBRSH_CONFIG_METHODS[DEFAULT_SBRSH_CONFIG_METHOD_ID]);
+
+ // For automatic SBRSH configuration
+ configuration.setAttribute(ATTR_SBRSH_AUTO_CONFIG_HOST_IP, IESboxCDTLaunchConfigurationConstants.DEFAULT_HOST_IP);
+ configuration.setAttribute(ATTR_SBRSH_AUTO_CONFIG_TARGET_IP, IESboxCDTLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
+
+ // Default SBRSH config file name for custom configuration.
+ String configFileName;
+ configFileName = getDefaultCustomSBRSHConfigFileName(sdkTarget.getSDK().getMachine());
+ configuration.setAttribute(ATTR_SBRSH_CUSTOM_CONFIG_CONFIG_FILE, configFileName);
+ }
+
+ static public String getDefaultCustomSBRSHConfigFileName(IMachine machine) {
+ return machine.getUserHome().append(DEFAULT_CUSTOM_SBRSH_CONFIG_FILE_NAME).toPortableString();
+ }
+
+ /**
+ * Create a SBRSH configuration file (not the physical file, just internal
+ * object representation) for the given launch configuration. This is for
+ * automatic SBRSH configuration.
+ *
+ * @param configuration
+ * @param hostIP
+ * @param targetIP
+ * @return
+ * @throws ESboxException --
+ * e.g. when the configuration has no associated project or
+ * scratchbox SDKTarget. check the message of the exception for
+ * what's wrong.
+ */
+ public static SBRSHConfigurationFile createAutoSBRSHConfiguration(
+ ILaunchConfiguration configuration,
+ String hostIP,
+ String targetIP) throws ESboxException {
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(configuration);
+ if (sdkTarget == null)
+ throw new ESboxException("The build target for the configuration is not yet known (is the project set?)");
+
+ // XXX: if the device needs to talk back to the host, it must do so through the same SSH
+ // port the build machine uses
+ int sshPort = -1;
+ IMachine buildMachine = sdkTarget.getSDK().getMachine();
+ if (buildMachine instanceof ISSHMachine) {
+ sshPort = ((ISSHMachine) buildMachine).getSshConfiguration().getTargetPort();
+ }
+
+ String projectCommonParent = LaunchConfigurationData.getProjectCommonParentFolder(configuration);
+
+ // TODO: review for better IMachine integration
+ return SBRSHConfigurationFileFactory.createStockSBRSHConfigurationFile(
+ sdkTarget,
+ projectCommonParent,
+ sdkTarget.getSDK().getMachine().getUserName(),
+ hostIP, sshPort,
+ targetIP, -1);
+ }
+
+ /*
+ * Get automatic SBRSH configuration for the given launch configuration.
+ *
+ * @param configuration
+ * @return
+ * @throws ESboxException
+ */
+ private static SBRSHConfigurationFile getAutoSBRSHConfiguration(ILaunchConfiguration configuration) throws ESboxException {
+
+ SBRSHConfigurationFile scf = new SBRSHConfigurationFile();
+
+ String hostIP = "", targetIP = "";
+ try {
+ hostIP = configuration.getAttribute(ATTR_SBRSH_AUTO_CONFIG_HOST_IP, IESboxLaunchConfigurationConstants.DEFAULT_HOST_IP);
+ targetIP = configuration.getAttribute(ATTR_SBRSH_AUTO_CONFIG_TARGET_IP, IESboxLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
+ } catch (CoreException e) {
+ // Should not happen.
+ throw new ESboxException("Failed to get SBRSH host IP or target IP from the launch configuration");
+ }
+
+ try {
+ scf = createAutoSBRSHConfiguration(configuration, hostIP, targetIP);
+ } catch (ESboxException e) {
+ throw new ESboxException("Failed to create automatic SBRSH configuration for launch config: " + configuration.getName(), e);
+ }
+
+ return scf;
+ }
+
+ public static SBRSHCommandConfiguration createSBRSHCommandConfigurationForLaunchConfiguration(ILaunchConfiguration configuration) throws CoreException {
+
+ // Construct SBRSHCommandConfiguration from the launch configuration.
+
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(configuration);
+ if (sdkTarget == null)
+ throw new CoreException(new ESboxDebuggerStatus("Cannot resolve build target for " + configuration.getName()));
+
+ String command = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SBRSH_EXEC_FILE_LOCATION);
+
+ String configMethod = V_SBRSH_CONFIG_METHOD_AUTOMATIC;
+ try {
+ configMethod = configuration.getAttribute(
+ ATTR_SBRSH_CONFIG_METHOD,
+ V_SBRSH_CONFIG_METHOD_AUTOMATIC);
+ } catch (CoreException e1) {
+ // ignore, just use automatic.
+ }
+
+ boolean autoConfig = configMethod.equals(V_SBRSH_CONFIG_METHOD_AUTOMATIC);
+
+ SBRSHConfigurationFile scf = new SBRSHConfigurationFile();
+
+ IPath sbrshConfigFile = null;
+ String sbrshTargetName = null;
+
+ // The launch configuration should contain valid configuration data at this point.
+
+ if (autoConfig) {
+
+ try {
+ scf = getAutoSBRSHConfiguration(configuration);
+ } catch (ESboxException e) {
+ // Should not happen.
+ throw new CoreException(new ESboxDebuggerStatus(e.getMessage()));
+ }
+
+ sbrshConfigFile = LaunchConfigurationData.getAutoSBRSHConfigurationFileName(configuration);
+ IFileStore store = sdkTarget.getTargetFileSystemAccess().getFileStore(sbrshConfigFile);
+ try {
+ scf.saveToFile(store);
+ } catch (IOException e) {
+ throw new CoreException(new ESboxDebuggerStatus("Failed to create SBRSH configuration file: "+sbrshConfigFile));
+ }
+
+ // there is only one target in the auto-generated config file. So this does not matter.
+ sbrshTargetName = null;
+ }
+ else {
+ try {
+ sbrshConfigFile = new Path(configuration.getAttribute(
+ ATTR_SBRSH_CUSTOM_CONFIG_CONFIG_FILE, ""));
+ sbrshTargetName = configuration.getAttribute(ATTR_SBRSH_CUSTOM_CONFIG_SBRSH_TARGET, "");
+ } catch (CoreException e) {
+ // Should not happen.
+ throw new CoreException(new ESboxDebuggerStatus("Failed to get custom SBRSH configuration file."));
+ }
+
+ // XXX: sbrsh config file assumed to live on machine, not host, since sbrsh works only in Linux
+ IFileStore store = sdkTarget.getTargetFileSystemAccess().getFileStore(sbrshConfigFile);
+ try {
+ scf = SBRSHConfigurationFileFactory.parse(store);
+ } catch (ESboxException e) {
+ throw new CoreException(new ESboxDebuggerStatus("Error parsing SBRSH configuration file: " + e.getMessage()));
+ }
+ }
+
+ if (! scf.isValid())
+ throw new CoreException(new ESboxDebuggerStatus("Invalid SBRSH configuration file: " + sbrshConfigFile));
+
+ /*
+ String program = ESboxLaunchUtils.getProgramFullPath(configuration);
+ int i = program.lastIndexOf(File.separatorChar);
+ program = program.substring(0, i);
+ String targetBinPath = scf.getMountLocationOnTarget(program, sbrshTargetName);
+ if (targetBinPath.length() == 0)
+ throw new CoreException(new ESboxDebuggerStatus("The debugged program is not mounted by the SBRSH configuration file: " + sbrshConfigFile));
+ */
+
+ SBRSHCommandConfiguration cmdConfig = new SBRSHCommandConfiguration();
+
+ cmdConfig.setSbrshCommand(command);
+ cmdConfig.setConfigurationFile(sbrshConfigFile);
+ //cmdConfig.setTargetBinPath(targetBinPath);
+ cmdConfig.setTargetName(sbrshTargetName);
+
+ return cmdConfig;
+ }
+
+ /**
+ * Create the SBRSH device machine corresponding to the launch configuration.
+ * @param launchParameterAccessor
+ * @return new IMachine
+ */
+ public static ISBRSHMachine createSBRSHMachineForLaunchConfiguration(ILaunchConfiguration launchConfiguration) throws CoreException {
+ SBRSHCommandConfiguration commandConfig = createSBRSHCommandConfigurationForLaunchConfiguration(launchConfiguration);
+
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(launchConfiguration);
+ IMachine buildMachine = sdkTarget.getSDK().getMachine();
+ String userName = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SSH_USERNAME);
+ ISSHMachine sshMachine = SSHLaunchProtocolType.createSSHMachineForLaunchConfiguration(
+ launchConfiguration, userName);
+
+ String hostIP = launchConfiguration.getAttribute(ATTR_SBRSH_AUTO_CONFIG_HOST_IP, IESboxLaunchConfigurationConstants.DEFAULT_HOST_IP);
+ try {
+ return DeviceMachineFactory.createSBRSHMachine(
+ "Device over SBRSH",
+ buildMachine,
+ sshMachine,
+ commandConfig,
+ hostIP);
+ } catch (ESboxException e) {
+ // should not happen
+ Activator.getErrorLogger().logAndShowError("Could not create SBRSH device machine", e);
+ throw new CoreException(new ESboxDebuggerStatus(e));
+ }
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocol.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocol.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocol.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. 02/17/2008
+ * Ed Swartz (Nokia) - refactoring
+ *******************************************************************************/
+package org.maemo.esbox.device.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.launch.*;
+import org.maemo.esbox.ssh.ISSHMachine;
+
+import java.util.*;
+
+/**
+ * Remote connection to device via SSH protocol.
+ * @author LWang.
+ * @author eswartz
+ *
+ */
+public class SSHLaunchProtocol extends AbstractLaunchProtocol {
+
+ private ISSHMachine machine;
+
+ /**
+ * Constructor based on given launch configuration.
+ */
+ public SSHLaunchProtocol(ILaunchConfiguration configuration) throws CoreException {
+ super(configuration);
+
+ String userName = ESboxLaunchUtils.getSDKTarget(configuration).getPreferenceValue(ESboxPreferenceConstants.SSH_USERNAME);
+ init(userName);
+ }
+
+ /**
+ * Initialize the protocol for the given user
+ * @param userName
+ */
+ private void init(String userName) throws CoreException {
+ machine = SSHLaunchProtocolType.createSSHMachineForLaunchConfiguration(
+ getLaunchConfiguration(), userName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#getDeviceMachine()
+ */
+ public IMachine getDeviceMachine() {
+ return machine;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#downloadFiles(ILaunchConfiguration)
+ */
+ public IStatus downloadFiles(IProgressMonitor monitor) {
+
+ // Make a map of lists of files copied to each target path.
+ //
+ Map<IPath, List<IPath>> targetPathFiles = getTargetFoldersForHostFileMappings();
+
+ if (targetPathFiles.size() == 0) // no file to download.
+ return Status.OK_STATUS;
+
+ // Download them
+ //
+ return downloadFiles(targetPathFiles, monitor);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#getTargetFoldersForHostFileMappings()
+ */
+ public Map<IPath, List<IPath>> getTargetFoldersForHostFileMappings() {
+ ILaunchConfiguration configuration = getLaunchConfiguration();
+ IPreferenceProvider prefProvider = getPreferenceProvider(configuration);
+ IPath basePath = getBaseTargetPath(prefProvider);
+
+ List<FileToTransfer> files = SSHLaunchProtocolType.getFilesToDownload(configuration);
+ Map<IPath, List<IPath>> targetPathFiles = new HashMap<IPath, List<IPath>>();
+
+ for (FileToTransfer file : files) {
+ if (file.getEnabled()) {
+ IPath path = resolveTargetPath(basePath, new Path(file.getTargetPath()));
+
+ List<IPath> pathFiles = targetPathFiles.get(path);
+ if (pathFiles == null) {
+ pathFiles = new ArrayList<IPath>();
+ targetPathFiles.put(path, pathFiles);
+ }
+ pathFiles.add(new Path(file.getHostPath()));
+ }
+ }
+ return targetPathFiles;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#downloadFiles(java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStatus downloadFiles(Map<IPath, List<IPath>> targetPathToHostFiles,
+ IProgressMonitor monitor) {
+ return ESboxLaunchUtils.downloadFiles(getDeviceMachine().getFileSystemAccess(), targetPathToHostFiles, monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#getFileLocationOnTarget(java.lang.String)
+ */
+ public IPath getFileLocationOnTarget(IPath filePath) {
+ IPath location = null;
+
+ if (filePath != null) {
+ ILaunchConfiguration config = getLaunchConfiguration();
+ IPath basePath = getBaseTargetPath(getPreferenceProvider(config));
+
+ ArrayList<FileToTransfer> files = SSHLaunchProtocolType.getFilesToDownload(config);
+
+ for (FileToTransfer f : files) {
+ if (new Path(f.getHostPath()).equals(filePath)) {
+ IPath target = new Path(f.getTargetPath()).append(filePath.lastSegment());
+ location = resolveTargetPath(basePath, target);
+ break;
+ }
+ }
+ }
+
+ return location;
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#convertHostToTargetPath(org.eclipse.core.runtime.IPath)
+ */
+ public IPath convertHostToTargetPath(IPath localPath) {
+
+ // the device is "connected" to the local machine
+ IPath remotePath = machine.getFileSystemMapping().convertHostToTargetPath(localPath);
+ return remotePath;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocol#requireRunAsRoot()
+ */
+ public void requireRunAsRoot() throws CoreException {
+ init("root");
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocolType.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocolType.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocolType.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Aug 8, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.device.launch;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.device.core.DeviceMachineFactory;
+import org.maemo.esbox.launch.*;
+import org.maemo.esbox.ssh.ISSHMachine;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+import java.util.*;
+
+/**
+ * @author LWang
+ *
+ */
+public class SSHLaunchProtocolType extends
+ AbstractLaunchProtocolType implements
+ ILaunchProtocolType {
+
+ // !!!Note: Don't change this ID for backward-compatibility with ESbox 1.4.
+ public static final String PREFIX_ID = "org.indt.esbox.launch";
+
+ public static final String ATTR_FILES_TO_DOWNLOAD = PREFIX_ID + ".files_to_download"; //$NON-NLS-1$
+
+ public static final String ATTR_HOST_IP = PREFIX_ID + ".ssh_host_ip"; //$NON-NLS-1$
+ public static final String ATTR_HOST_PORT = PREFIX_ID + ".ssh_host_port"; //$NON-NLS-1$
+ public static final String ATTR_TARGET_IP = PREFIX_ID + ".ssh_target_ip"; //$NON-NLS-1$
+ public static final String ATTR_TARGET_PORT = PREFIX_ID + ".ssh_target_port"; //$NON-NLS-1$
+
+ public SSHLaunchProtocolType() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.ILaunchProtocolType#getLaunchProtocol(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public ILaunchProtocol getLaunchProtocol(ILaunchConfiguration configuration) throws CoreException {
+ return new SSHLaunchProtocol(configuration);
+ }
+
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // Default files to download for SSH.
+ configuration.setAttribute(ATTR_HOST_IP, IESboxLaunchConfigurationConstants.DEFAULT_HOST_IP);
+ configuration.setAttribute(ATTR_HOST_PORT, IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
+ configuration.setAttribute(ATTR_TARGET_IP, IESboxLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
+ configuration.setAttribute(ATTR_TARGET_PORT, IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
+ setDefaultFilesToDownload(configuration);
+ }
+
+ /**
+ * Create the SSH device machine corresponding to the launch configuration.
+ * @param configuration
+ * @return new IMachine
+ */
+ public static ISSHMachine createSSHMachineForLaunchConfiguration(ILaunchConfiguration configuration,
+ String userName) throws CoreException {
+ SSHConfiguration sshConfiguration = createSSHConfigurationForLaunchConfiguration(configuration, userName);
+
+ return DeviceMachineFactory.createSSHMachine("Device over SSH", sshConfiguration, null);
+ }
+
+ /**
+ * Get the SSHConfiguration reflecting the settings in the given launch configuration
+ * @param configuration
+ * @param userName
+ * @return new SSHConfiguration
+ */
+ private static SSHConfiguration createSSHConfigurationForLaunchConfiguration(ILaunchConfiguration configuration,
+ String userName) throws CoreException {
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(configuration);
+
+ String deviceName, devicePort;
+ deviceName = configuration.getAttribute(ATTR_TARGET_IP, IESboxLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
+ try {
+ devicePort = configuration.getAttribute(ATTR_TARGET_PORT, IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
+ } catch (NumberFormatException e) {
+ devicePort = IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER;
+ }
+
+ String connectionTimeout = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SSH_CONNECTION_TIMEOUT);
+
+ SSHConfiguration sshConfiguration = new SSHConfiguration();
+ sshConfiguration.setTargetIPAddress(deviceName);
+ sshConfiguration.setTargetPort(Integer.parseInt(devicePort));
+ sshConfiguration.setUserName(userName);
+ sshConfiguration.setConnectionTimeout(Integer.parseInt(connectionTimeout));
+
+ //XXX: set user password if possible
+
+ return sshConfiguration;
+ }
+
+ static private Set<FileToTransfer> toSet(String filesString) {
+ StringTokenizer filesTokens = new StringTokenizer(filesString,FileToTransfer.SEPARATOR);
+ Set<FileToTransfer> filesToTransfer = new LinkedHashSet<FileToTransfer>();
+ while(filesTokens.hasMoreTokens()) {
+ String token = filesTokens.nextToken();
+ FileToTransfer file = createFile(token);
+ if (file != null && !filesToTransfer.contains(file))
+ filesToTransfer.add(file);
+ }
+ return filesToTransfer;
+ }
+
+ static private FileToTransfer createFile(String fileString) {
+ StringTokenizer fileTokens = new StringTokenizer(fileString,FileToTransfer.FIELD_SEPARATOR);
+ FileToTransfer file = null;
+ if(fileTokens.countTokens() > 2) {
+ String hostPath = fileTokens.nextToken();
+ String targetPath = fileTokens.nextToken();
+ boolean isEnable = fileTokens.nextToken().equals("1");
+ file = new FileToTransfer(hostPath,targetPath,isEnable);
+ }
+ return file;
+ }
+
+ /**
+ * Restore the encoded representation of the files to download.
+ */
+ static public ArrayList<FileToTransfer> getFilesToDownload(ILaunchConfiguration configuration) {
+ ArrayList<FileToTransfer> files = new ArrayList<FileToTransfer>();
+
+ String filesString = "";
+ try {
+ filesString = configuration.getAttribute(ATTR_FILES_TO_DOWNLOAD, ""); //$NON-NLS-1$
+ } catch (CoreException e) {
+ return files;
+ }
+
+ if (filesString.length() > 0) {
+ Set<FileToTransfer> filesAsSet = toSet(filesString);
+ for (FileToTransfer fileToTransfer : filesAsSet) {
+ files.add(fileToTransfer);
+ }
+ }
+
+ return files;
+ }
+
+ /**
+ * Get default path where to locate files for downloading.
+ * It's project location by default, if the given launch configuration has associated project.
+ *
+ * @see LaunchConfigurationData#getDefaultTargetPathForDownload()
+ * @param configuration
+ * @return path on success, empty string "" otherwise.
+ */
+ static public String getDefaultSourcePathForDownload(ILaunchConfiguration configuration) {
+
+ String sp = "";
+
+ // Use project path as default.
+ IProject proj = null;
+ try {
+ proj = ESboxLaunchUtils.getProject(configuration);
+ } catch (CoreException e) {
+ // ignore error. as the configuration may not have associated project yet.
+ }
+ if (proj != null && proj.exists()) {
+ sp = proj.getLocation().toPortableString();
+ }
+
+ return sp;
+ }
+
+ /**
+ * Get default path on target device where to download files.
+ *
+ * @see LaunchConfigurationData#getDefaultSourcePathForDownload(ILaunchConfiguration)
+ * @return path on success, empty string "" otherwise.
+ */
+ static public String getDefaultTargetPathForDownload() {
+
+ // Use the setting on the global ESBOX => SSH preference panel.
+ //
+ // do not detour with this as we don't want to have dependency on an SDKTarget.
+ // tp = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SSH_DEST_FOLDER);
+ //
+ // String tp = CoreActivator.getDefault().getPluginPreferences().getString(ESboxPreferenceConstants.SSH_DEST_FOLDER.toString());
+
+ // Yes, the default path is the above global setting.
+ // But what we need here is a path relative to the above global setting.
+ // So this is sufficient.
+ String tp = "./";
+
+ return tp;
+ }
+
+ /**
+ * Store the encoded representation of the files to download.
+ */
+ static public void storeFilesToDownload(ILaunchConfigurationWorkingCopy configuration, FileToTransfer[] files) {
+ StringBuilder filesToDownload = new StringBuilder();
+ Set<FileToTransfer> uniqueFiles = new LinkedHashSet<FileToTransfer>(Arrays.asList(files));
+ for (FileToTransfer fileToTransfer : uniqueFiles) {
+ filesToDownload.append(fileToTransfer.toString()).append(FileToTransfer.SEPARATOR);
+ }
+
+ configuration.setAttribute(ATTR_FILES_TO_DOWNLOAD, filesToDownload.toString());
+ }
+
+ /**
+ * Set default files that need be downloaded to run the application.
+ * Currently just the program file is to download.
+ * We should automatically add other required data files when we can detect them.
+ *
+ * @param configuration
+ * @return
+ */
+ static public void setDefaultFilesToDownload(ILaunchConfigurationWorkingCopy configuration) {
+
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(configuration);
+ if ( sdkTarget == null) // the configuration has no project or SDKTarget yet.
+ return;
+
+ String hp = null;
+ try {
+ hp = ESboxLaunchUtils.getProgramFullPath(configuration);
+ } catch (CoreException e) {
+ }
+
+ if (hp == null) // not available yet
+ return;
+
+ String tp = getDefaultTargetPathForDownload();
+
+ FileToTransfer[] files = new FileToTransfer[] { new FileToTransfer(hp, tp, true)}; //$NON-NLS-1$
+
+ storeFilesToDownload(configuration, files);
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/AddEditFileToDownloadDialog.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/AddEditFileToDownloadDialog.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/AddEditFileToDownloadDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar, 2008
+ *******************************************************************************/
+package org.maemo.esbox.device.launch.ui;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.PlatformUI;
+import org.maemo.esbox.device.launch.FileToTransfer;
+import org.maemo.esbox.device.launch.IESboxDeviceLaunchHelpContextID;
+import org.maemo.esbox.launch.ui.StatusInfo;
+import org.maemo.esbox.ssh.ui.SSHPreferenceUtils;
+
+import java.io.File;
+
+public class AddEditFileToDownloadDialog extends StatusDialog {
+
+ private FileToTransfer fFile;
+ private Text hostPath;
+ private Button hostBrowse;
+ private Text targetPath;
+ private Link targetLabel;
+
+ private String defaultSrcPath = ""; //$NON-NLS-1$ // the default source path for download
+ private String defaultDstPath = ""; //$NON-NLS-1$ // the default destination path for download
+
+ private static String targetLabelNoHint = LaunchUIMessages.getString("AddEditFileToDownloadDialog.5"); //$NON-NLS-1$
+ private static String targetLabelWithHint = LaunchUIMessages.getString("AddEditFileToDownloadDialog.0"); //$NON-NLS-1$
+
+ /**
+ * Create the dialog
+ * @param parent
+ * @param file
+ */
+ public AddEditFileToDownloadDialog(Shell parent, FileToTransfer file) {
+ super(parent);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ fFile = file;
+ }
+
+ /**
+ * @see Windows#configureShell
+ */
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell,
+ IESboxDeviceLaunchHelpContextID.LAUNCH_CONFIGURATION_DIALOG_DOWNLOAD_TAB_ADDEDITFILEDIALOG);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+ initializeDialogUnits(parent);
+ Composite composite= (Composite) super.createDialogArea(parent);
+
+ GridLayout layout = (GridLayout) composite.getLayout();
+ layout.numColumns = 2;
+
+ final Label hostLabel = new Label(composite, SWT.NONE);
+ hostLabel.setText(LaunchUIMessages.getString("AddEditFileToDownloadDialog.1")); //$NON-NLS-1$
+ GridData data = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ data.horizontalSpan = 2;
+ hostLabel.setLayoutData(data);
+ hostLabel.setToolTipText(LaunchUIMessages.getString("AddEditFileToDownloadDialog.2")); //$NON-NLS-1$
+
+ hostPath = new Text(composite, SWT.BORDER);
+ hostPath.setText(fFile.getHostPath());
+ data = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ hostPath.setLayoutData(data);
+ hostPath.setToolTipText(LaunchUIMessages.getString("AddEditFileToDownloadDialog.2")); //$NON-NLS-1$
+ hostPath.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ checkValues();
+ }
+ });
+
+ hostBrowse = new Button(composite, SWT.PUSH);
+ hostBrowse.setFont(parent.getFont());
+ hostBrowse.setText(LaunchUIMessages.getString("AddEditFileToDownloadDialog.3")); //$NON-NLS-1$
+ data = new GridData();
+ hostBrowse.setLayoutData(data);
+ hostBrowse.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
+
+ dialog.setText(LaunchUIMessages.getString("AddEditFileToDownloadDialog.4")); //$NON-NLS-1$
+ dialog.setFilterExtensions(new String[] {"*"}); //$NON-NLS-1$
+ dialog.setFilterNames(new String[] {LaunchUIMessages.getString("AddEditFileToDownloadDialog.11")}); //$NON-NLS-1$
+
+ String currentFile = hostPath.getText();
+ if (currentFile.length() == 0)
+ currentFile = defaultSrcPath;
+
+ if (currentFile.length() > 0) {
+ File f = new File(currentFile);
+ if (f.isFile()) {
+ dialog.setFilterPath(f.getParent());
+ dialog.setFileName(f.getName());
+ }
+ else { // directory
+ dialog.setFilterPath(currentFile);
+ }
+ }
+
+ String result = dialog.open();
+ if (result != null) {
+ IPath path = new Path(result);
+ if (path.toFile().exists()) {
+ hostPath.setText(result);
+
+ // remember current selection as default path.
+ defaultSrcPath = result;
+
+ // if target path is empty, set it to default.
+ if (targetPath.getText().trim().length() < 1) {
+ targetPath.setText(defaultDstPath);
+ }
+ }
+ }
+ }
+ });
+
+ targetLabel = new Link(composite, SWT.NONE);
+ targetLabel.setText(targetLabelNoHint);
+ data = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ data.horizontalSpan = 2;
+ targetLabel.setLayoutData(data);
+ targetLabel.setToolTipText(LaunchUIMessages.getString("AddEditFileToDownloadDialog.6")); //$NON-NLS-1$
+
+ targetLabel.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ // Display our global SSH preference panel.
+ SSHPreferenceUtils.showGlobalSSHPanel(getShell());
+ }
+ });
+
+
+ targetPath = new Text(composite, SWT.BORDER);
+ data = new GridData(GridData.FILL, GridData.CENTER, true, false);
+ targetPath.setLayoutData(data);
+ targetPath.setToolTipText(LaunchUIMessages.getString("AddEditFileToDownloadDialog.6")); //$NON-NLS-1$
+ targetPath.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ checkValues();
+
+ // Modify the targetLabel accordingly.
+
+ String tp = targetPath.getText().trim();
+ if (tp.length() == 0) {
+ targetLabel.setText(targetLabelNoHint);
+ }
+ else {
+ IPath path = new Path(tp);
+ if (path.isAbsolute()) {
+ targetLabel.setText(targetLabelNoHint);
+ }
+ else {
+ targetLabel.setText(targetLabelWithHint);
+ }
+ }
+ }
+ });
+ targetPath.setText(fFile.getTargetPath());
+
+ applyDialogFont(composite);
+
+ return composite;
+ }
+
+ public void create() {
+ super.create();
+ checkValues();
+ }
+
+ protected void okPressed() {
+ fFile.setHostPath(hostPath.getText());
+ fFile.setTargetPath(targetPath.getText());
+
+ super.okPressed();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#getInitialSize()
+ */
+ protected Point getInitialSize() {
+ Point size = super.getInitialSize();
+
+ // make the initial size of the dialog big enough to show all text.
+ int charCnt = java.lang.Math.max(hostPath.getText().length(), targetLabelWithHint.length());
+ int charWidth = 8; // rough estimate
+ if (charCnt * charWidth > size.x) { // a rough estimate
+ size.x = charCnt * charWidth + 10;
+ }
+
+ return size;
+ }
+
+ protected void checkValues() {
+ StatusInfo status= new StatusInfo();
+ status.setOK();
+
+ String hp = hostPath.getText().trim();
+ if (hp.length() > 0) {
+ if (!new File(hp).exists()) {
+ status.setError(LaunchUIMessages.getString("AddEditFileToDownloadDialog.7")); //$NON-NLS-1$
+ }
+ }
+ else {
+ status.setError(LaunchUIMessages.getString("AddEditFileToDownloadDialog.8")); //$NON-NLS-1$
+ }
+
+ // if we already have an error then no need to check the rest of the stuff
+ if (status.isOK()) {
+ String tp = targetPath.getText().trim();
+ if (tp.length() == 0) {
+ status.setError(LaunchUIMessages.getString("AddEditFileToDownloadDialog.10")); //$NON-NLS-1$
+ }
+ }
+
+ updateStatus(status);
+ }
+
+ public void setDefaultPaths(String defaultSrcPath, String defaultDstPath) {
+ this.defaultSrcPath = defaultSrcPath;
+ this.defaultDstPath = defaultDstPath;
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/AddFilesToDownloadDialog.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/AddFilesToDownloadDialog.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/AddFilesToDownloadDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,366 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar, 2008
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.device.launch.ui;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.PlatformUI;
+import org.maemo.esbox.device.launch.FileToTransfer;
+import org.maemo.esbox.device.launch.IESboxDeviceLaunchHelpContextID;
+import org.maemo.esbox.launch.ui.StatusInfo;
+import org.maemo.esbox.ssh.ui.SSHPreferenceUtils;
+
+import java.io.File;
+import java.util.*;
+import java.util.List;
+
+public class AddFilesToDownloadDialog extends StatusDialog {
+
+ private Text hostPath;
+ private Button hostBrowse;
+ private Text targetPath;
+ private Link targetLabel;
+
+ private String defaultSrcPath = ""; //$NON-NLS-1$ // the default source path for download
+ private String defaultDstPath = ""; //$NON-NLS-1$ // the default destination path for download
+ private Label directoryLabel;
+ private CheckboxTreeViewer directoryTreeViewer;
+ private Tree directoryTree;
+ private FilesystemProvider filesystemProvider;
+ private List<FileToTransfer> filesToTransfer;
+ private List<File> existingFiles;
+
+ private static String targetLabelNoHint = LaunchUIMessages.getString("AddFilesToDownloadDialog.TargetPathLabel"); //$NON-NLS-1$
+ private static String targetLabelWithHint = LaunchUIMessages.getString("AddFilesToDownloadDialog.TargetPathTooltip"); //$NON-NLS-1$
+
+ /**
+ * Create the dialog
+ * @param parent
+ * @param file
+ */
+ public AddFilesToDownloadDialog(Shell parent, String defaultSrcPath, String defaultDstPath) {
+ super(parent);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ this.defaultSrcPath = defaultSrcPath;
+ this.defaultDstPath = defaultDstPath;
+ this.existingFiles = new ArrayList<File>(0);
+ }
+
+ public void setExistingFiles(Collection<FileToTransfer> existingFiles) {
+ this.existingFiles = new ArrayList<File>(existingFiles.size());
+ for (FileToTransfer file : existingFiles) {
+ File hostFile = new File(file.getHostPath()).getAbsoluteFile();
+ this.existingFiles.add(hostFile);
+ }
+ }
+
+ /** Get the list of files selected for download. Only available after dialog exits with Ok. */
+ public List<FileToTransfer> getFiles() {
+ return filesToTransfer;
+ }
+
+ /**
+ * @see Windows#configureShell
+ */
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ setTitle(LaunchUIMessages.getString("AddFilesToDownloadDialog.DialogTitle")); //$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell,
+ IESboxDeviceLaunchHelpContextID.LAUNCH_CONFIGURATION_DIALOG_DOWNLOAD_TAB_ADDEDITFILEDIALOG);
+ }
+
+ /**
+ * The filesystem provider is initialized with a String as the root
+ * path, which shows up as a node in the tree. The child elements are Files.
+ * @author eswartz
+ *
+ */
+ static class FilesystemProvider extends LabelProvider implements ITreeContentProvider {
+
+ public Object[] getChildren(Object parentElement) {
+ return ((File) parentElement).listFiles();
+ }
+
+ public Object getParent(Object element) {
+ return ((File) element).getParentFile();
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element) != null;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof String)
+ return new Object[] { new File(inputElement.toString()) };
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ viewer.refresh();
+ }
+
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ public String getText(Object element) {
+ return ((File) element).getName();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+ initializeDialogUnits(parent);
+ Composite composite= (Composite) super.createDialogArea(parent);
+
+ GridLayout layout = (GridLayout) composite.getLayout();
+ layout.numColumns = 2;
+
+ /////// row 1
+
+ final Label hostLabel = new Label(composite, SWT.NONE);
+ hostLabel.setText(LaunchUIMessages.getString("AddFilesToDownloadDialog.DirectoryLabel")); //$NON-NLS-1$
+ GridData data = new GridData(SWT.LEFT, SWT.CENTER, false, false);
+ data.horizontalSpan = 2;
+ hostLabel.setLayoutData(data);
+ hostLabel.setToolTipText(LaunchUIMessages.getString("AddFilesToDownloadDialog.DirectoryTooltip")); //$NON-NLS-1$
+
+ ////// row 2
+
+ hostPath = new Text(composite, SWT.BORDER);
+ hostPath.setText(defaultSrcPath);
+ data = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ hostPath.setLayoutData(data);
+ hostPath.setToolTipText(LaunchUIMessages.getString("AddFilesToDownloadDialog.DirectoryTooltip")); //$NON-NLS-1$
+ hostPath.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ File file = new File(hostPath.getText());
+ if (file.isDirectory()) {
+ // input of String is root
+ directoryTreeViewer.setInput(hostPath.getText());
+ directoryTreeViewer.setGrayedElements(existingFiles.toArray());
+ }
+ checkValues();
+ }
+ });
+
+ hostBrowse = new Button(composite, SWT.PUSH);
+ hostBrowse.setText(LaunchUIMessages.getString("AddFilesToDownloadDialog.BrowseButtonLabel")); //$NON-NLS-1$
+ data = new GridData(SWT.LEFT, SWT.CENTER, false, false);
+ hostBrowse.setLayoutData(data);
+ hostBrowse.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.OPEN);
+
+ dialog.setText(LaunchUIMessages.getString("AddFilesToDownloadDialog.BrowseLabel")); //$NON-NLS-1$
+
+ String currentFile = hostPath.getText();
+ if (currentFile.length() == 0)
+ currentFile = defaultSrcPath;
+
+ if (currentFile.length() > 0) {
+ File f = new File(currentFile);
+ if (f.isFile()) {
+ dialog.setFilterPath(f.getParent());
+ }
+ else { // directory
+ dialog.setFilterPath(currentFile);
+ }
+ }
+
+ String result = dialog.open();
+ if (result != null) {
+ IPath path = new Path(result);
+ if (path.toFile().exists()) {
+ // remember current selection as default path.
+ defaultSrcPath = result;
+
+ hostPath.setText(result);
+
+ // if target path is empty, set it to default.
+ if (targetPath.getText().trim().length() < 1) {
+ targetPath.setText(defaultDstPath);
+ }
+ }
+ }
+ }
+ });
+
+ /// row 3
+
+ directoryLabel = new Label(composite, SWT.NONE);
+ data = new GridData(SWT.LEFT, SWT.CENTER, true, false);
+ data.horizontalSpan = 2;
+ directoryLabel.setLayoutData(data);
+ directoryLabel.setText(LaunchUIMessages.getString("AddFilesToDownloadDialog.FileTreeLabel")); //$NON-NLS-1$
+ directoryLabel.setToolTipText(LaunchUIMessages.getString("AddFilesToDownloadDialog.FileTreeTooltip")); //$NON-NLS-1$
+
+ /// row 4
+
+ directoryTreeViewer = new CheckboxTreeViewer(composite, SWT.CHECK | SWT.MULTI | SWT.V_SCROLL);
+ directoryTree = directoryTreeViewer.getTree();
+ data = new GridData(SWT.FILL, SWT.CENTER, true, true);
+ data.horizontalSpan = 2;
+ data.minimumHeight = 300;
+ directoryTree.setLayoutData(data);
+
+ filesystemProvider = new FilesystemProvider();
+
+ directoryTreeViewer.setContentProvider(filesystemProvider);
+ directoryTreeViewer.setLabelProvider(filesystemProvider);
+ // input of String is root
+ directoryTreeViewer.setInput(defaultSrcPath);
+ directoryTreeViewer.setGrayedElements(existingFiles.toArray());
+
+ directoryTreeViewer.expandToLevel(2);
+
+ directoryTreeViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(final CheckStateChangedEvent event) {
+ // don't recursively expand -- although this may be desirable, it's very easy to get trapped
+ directoryTreeViewer.expandToLevel(event.getElement(), 1);
+ directoryTreeViewer.setSubtreeChecked(event.getElement(), event.getChecked());
+ }
+ });
+
+ /// row 5
+
+ targetLabel = new Link(composite, SWT.NONE);
+ targetLabel.setText(targetLabelNoHint);
+ data = new GridData(SWT.LEFT, SWT.CENTER, true, false);
+ data.horizontalSpan = 2;
+ targetLabel.setLayoutData(data);
+ targetLabel.setToolTipText(LaunchUIMessages.getString("AddFilesToDownloadDialog.TargetDirTooltip")); //$NON-NLS-1$
+
+ targetLabel.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ // Display our global SSH preference panel.
+ SSHPreferenceUtils.showGlobalSSHPanel(getShell());
+ }
+ });
+
+ //// row 6
+
+ targetPath = new Text(composite, SWT.BORDER);
+ data = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ data.horizontalSpan = 2;
+ targetPath.setLayoutData(data);
+ targetPath.setToolTipText(LaunchUIMessages.getString("AddFilesToDownloadDialog.TargetDirTooltip")); //$NON-NLS-1$
+ targetPath.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ checkValues();
+
+ // Modify the targetLabel accordingly.
+
+ String tp = targetPath.getText().trim();
+ if (tp.length() == 0) {
+ targetLabel.setText(targetLabelNoHint);
+ }
+ else {
+ IPath path = new Path(tp);
+ if (path.isAbsolute()) {
+ targetLabel.setText(targetLabelNoHint);
+ }
+ else {
+ targetLabel.setText(targetLabelWithHint);
+ }
+ }
+ }
+ });
+ targetPath.setText(defaultDstPath);
+
+ applyDialogFont(composite);
+
+ return composite;
+ }
+
+ public void create() {
+ super.create();
+ checkValues();
+ }
+
+ protected void okPressed() {
+ filesToTransfer = new ArrayList<FileToTransfer>();
+
+ IPath defaultHostPath = new Path(defaultSrcPath);
+ IPath defaultTargetPath = new Path(targetPath.getText());
+
+ for (Object element : directoryTreeViewer.getCheckedElements()) {
+ File hostFile = (File) element;
+ if (hostFile.isDirectory())
+ continue;
+ IPath hostFileDir = new Path(hostFile.getAbsolutePath()).removeLastSegments(1);
+ IPath targetSuffixPath = hostFileDir.removeFirstSegments(defaultHostPath.segmentCount());
+ String targetRelativePath = defaultTargetPath.append(targetSuffixPath).toPortableString();
+ FileToTransfer file = new FileToTransfer(hostFile.getAbsolutePath(), targetRelativePath, true);
+ filesToTransfer.add(file);
+ }
+
+ super.okPressed();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#getInitialSize()
+ */
+ protected Point getInitialSize() {
+ Point size = super.getInitialSize();
+
+ // make the initial size of the dialog big enough to show all text.
+ int charCnt = java.lang.Math.max(hostPath.getText().length(), targetLabelWithHint.length());
+ int charWidth = 8; // rough estimate
+ if (charCnt * charWidth > size.x) { // a rough estimate
+ size.x = charCnt * charWidth + 10;
+ }
+
+ return size;
+ }
+
+ protected void checkValues() {
+ StatusInfo status= new StatusInfo();
+ status.setOK();
+
+ String hp = hostPath.getText().trim();
+ if (hp.length() > 0) {
+ if (!new File(hp).exists()) {
+ status.setError("Source directory does not exist"); //$NON-NLS-1$
+ }
+ }
+ else {
+ status.setError("No source directory specified"); //$NON-NLS-1$
+ }
+
+ // if we already have an error then no need to check the rest of the stuff
+ if (status.isOK()) {
+ String tp = targetPath.getText().trim();
+ if (tp.length() == 0) {
+ status.setError("Target directory is not specified"); //$NON-NLS-1$
+ }
+ }
+
+ updateStatus(status);
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/FilesBlock.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/FilesBlock.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/FilesBlock.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,475 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial API and implementation. Mar, 2008
+ *******************************************************************************/
+package org.maemo.esbox.device.launch.ui;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.device.launch.FileToTransfer;
+
+import java.util.*;
+import java.util.List;
+
+/**
+ * A composite that displays files in a table. Files can be
+ * added, removed, and edited..
+ */
+public class FilesBlock {
+
+ Observer fParentTab;
+
+ /**
+ * This block's control
+ */
+ private Composite fControl;
+
+ /**
+ * Files being displayed
+ */
+ private Set<FileToTransfer> fFiles = new LinkedHashSet<FileToTransfer>();
+
+ /**
+ * The main list control
+ */
+ private CheckboxTableViewer fFileList;
+
+ // Action buttons
+ private Button fAddButton;
+ private Button fRemoveButton;
+ private Button fEditButton;
+ private Button fSelectAllButton;
+ private Button fDeSelectAllButton;
+
+ // index of column used for sorting
+ /*private*/ int fSortColumn = 1;
+
+ private String defaultHostPath = ""; //$NON-NLS-1$
+
+ private String defaultTargetPath = ""; //$NON-NLS-1$
+ private TableColumn enabledColumn;
+ private TableColumn hostFileColumn;
+ private TableColumn targetFileColumn;
+
+ /**
+ * Content provider to show a list of files to be transferred
+ */
+ class FilesContentProvider implements IStructuredContentProvider {
+
+ public Object[] getElements(Object input) {
+ return fFiles.toArray();
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public void dispose() {
+ }
+
+ }
+
+ /**
+ * Label provider for files to transfer table.
+ */
+ class FilesLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ /**
+ * @see ITableLabelProvider#getColumnText(Object, int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof FileToTransfer) {
+ FileToTransfer file = (FileToTransfer)element;
+ switch(columnIndex) {
+ case 0:
+ return ""; //$NON-NLS-1$
+ case 1:
+ return file.getHostPath();
+ case 2:
+ return file.getTargetPath();
+ }
+ }
+ return element.toString();
+ }
+
+ /**
+ * @see ITableLabelProvider#getColumnImage(Object, int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ }
+
+ FilesBlock(Observer launchTab) {
+ fParentTab = launchTab;
+ }
+
+ /**
+ * Creates this block's control in the given control.
+ *
+ * @param ancestor containing control
+ */
+ public void createControl(Composite ancestor, int columns) {
+
+ Composite parent = new Composite(ancestor, SWT.NULL);
+
+ GridLayout layout= new GridLayout();
+ layout.numColumns= 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ parent.setLayout(layout);
+ Font font = ancestor.getFont();
+ parent.setFont(font);
+
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 1;
+ data.horizontalIndent = 5;
+ data.verticalIndent = 5;
+ data.horizontalSpan = columns;
+ parent.setLayoutData(data);
+
+ fControl = parent;
+
+ Table table= new Table(parent, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
+ data= new GridData(GridData.FILL_BOTH);
+ table.setLayoutData(data);
+ table.setFont(font);
+
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ TableLayout tableLayout= new TableLayout();
+ table.setLayout(tableLayout);
+
+ enabledColumn= new TableColumn(table, SWT.NULL);
+ enabledColumn.setText(LaunchUIMessages.getString("ESboxDownloadTab.2")); //$NON-NLS-1$
+ enabledColumn.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ sortByEnabled();
+ }
+ });
+ enabledColumn.setWidth(60);
+
+ hostFileColumn= new TableColumn(table, SWT.NULL);
+ hostFileColumn.setText(LaunchUIMessages.getString("ESboxDownloadTab.3")); //$NON-NLS-1$
+ hostFileColumn.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ sortByHostPath();
+ }
+ });
+ hostFileColumn.setWidth(80);
+
+ targetFileColumn= new TableColumn(table, SWT.NULL);
+ targetFileColumn.setText(LaunchUIMessages.getString("ESboxDownloadTab.4")); //$NON-NLS-1$
+ targetFileColumn.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ sortByTargetPath();
+ }
+ });
+ targetFileColumn.setWidth(80);
+
+ fFileList= new CheckboxTableViewer(table);
+ fFileList.setLabelProvider(new FilesLabelProvider());
+ fFileList.setContentProvider(new FilesContentProvider());
+ fFileList.setInput(fFiles);
+
+ fFileList.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent evt) {
+ enableButtons();
+ }
+ });
+
+ fFileList.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent e) {
+ if (!fFileList.getSelection().isEmpty()) {
+ editFile();
+ }
+ }
+ });
+
+ fFileList.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent e) {
+ FileToTransfer file = (FileToTransfer)e.getElement();
+ file.setEnabled(e.getChecked());
+ fParentTab.update(null, null);
+ }
+ });
+
+ table.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent event) {
+ if (event.character == SWT.DEL && event.stateMask == 0) {
+ removeFiles();
+ }
+ }
+ });
+
+ Composite buttons= new Composite(parent, SWT.NULL);
+ buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+ layout= new GridLayout();
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ buttons.setLayout(layout);
+ buttons.setFont(font);
+
+ fAddButton = createPushButton(buttons, LaunchUIMessages.getString("ESboxDownloadTab.5")); //$NON-NLS-1$
+ fAddButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ addFiles();
+ }
+ });
+
+ fEditButton= createPushButton(buttons, LaunchUIMessages.getString("ESboxDownloadTab.6")); //$NON-NLS-1$
+ fEditButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ editFile();
+ }
+ });
+
+ fRemoveButton= createPushButton(buttons, LaunchUIMessages.getString("ESboxDownloadTab.7")); //$NON-NLS-1$
+ fRemoveButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ removeFiles();
+ }
+ });
+
+ fSelectAllButton= createPushButton(buttons, LaunchUIMessages.getString("ESboxDownloadTab.10")); //$NON-NLS-1$
+ fSelectAllButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ for (FileToTransfer file : fFiles) {
+ file.setEnabled(true);
+ fFileList.setChecked(file, true);
+ }
+ fParentTab.update(null, null);
+ }
+ });
+
+ fDeSelectAllButton= createPushButton(buttons, LaunchUIMessages.getString("ESboxDownloadTab.11")); //$NON-NLS-1$
+ fDeSelectAllButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ for (FileToTransfer file : fFiles) {
+ file.setEnabled(false);
+ fFileList.setChecked(file, false);
+ }
+ fParentTab.update(null, null);
+ }
+ });
+
+ enableButtons();
+ fAddButton.setEnabled(true);
+ }
+
+ /**
+ * Sorts by enabled.
+ */
+ private void sortByEnabled() {
+ fFileList.setSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if ((e1 instanceof FileToTransfer) && (e2 instanceof FileToTransfer)) {
+ FileToTransfer left= (FileToTransfer)e1;
+ FileToTransfer right= (FileToTransfer)e2;
+ if (left.getEnabled() == right.getEnabled()) {
+ return 0;
+ } else if (left.getEnabled()) {
+ return 1;
+ }
+ else
+ return -1;
+ }
+ return super.compare(viewer, e1, e2);
+ }
+
+ public boolean isSorterProperty(Object element, String property) {
+ return true;
+ }
+ });
+ fSortColumn = 1;
+ }
+
+ /**
+ * Sorts by host path.
+ */
+ private void sortByHostPath() {
+ fFileList.setSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if ((e1 instanceof FileToTransfer) && (e2 instanceof FileToTransfer)) {
+ FileToTransfer left= (FileToTransfer)e1;
+ FileToTransfer right= (FileToTransfer)e2;
+ return left.getHostPath().compareToIgnoreCase(right.getHostPath());
+ }
+ return super.compare(viewer, e1, e2);
+ }
+
+ public boolean isSorterProperty(Object element, String property) {
+ return true;
+ }
+ });
+ fSortColumn = 3;
+ }
+
+ /**
+ * Sorts by target path.
+ */
+ private void sortByTargetPath() {
+ fFileList.setSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if ((e1 instanceof FileToTransfer) && (e2 instanceof FileToTransfer)) {
+ FileToTransfer left= (FileToTransfer)e1;
+ FileToTransfer right= (FileToTransfer)e2;
+ return left.getTargetPath().compareToIgnoreCase(right.getTargetPath());
+ }
+ return super.compare(viewer, e1, e2);
+ }
+
+ public boolean isSorterProperty(Object element, String property) {
+ return true;
+ }
+ });
+ fSortColumn = 2;
+ }
+
+ private void enableButtons() {
+ int selectionCount= ((IStructuredSelection)fFileList.getSelection()).size();
+ fEditButton.setEnabled(selectionCount == 1);
+ fRemoveButton.setEnabled(selectionCount > 0);
+ }
+
+ protected Button createPushButton(Composite parent, String label) {
+ Button button = new Button(parent, SWT.PUSH);
+ button.setFont(parent.getFont());
+ if (label != null) {
+ button.setText(label);
+ }
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ button.setLayoutData(gd);
+ return button;
+ }
+
+ /**
+ * Returns this block's control
+ *
+ * @return control
+ */
+ public Control getControl() {
+ return fControl;
+ }
+
+ /**
+ * Sets the files to be displayed in this block
+ *
+ * @param files files to be displayed
+ */
+ protected void setFiles(List<FileToTransfer> files) {
+ fFiles.clear();
+ for (int i = 0; i < files.size(); i++) {
+ FileToTransfer file = files.get(i);
+ fFiles.add(file);
+ }
+ fFileList.setInput(fFiles);
+ fFileList.refresh();
+
+ for (FileToTransfer file : fFiles) {
+ fFileList.setChecked(file, file.getEnabled());
+ }
+
+// fFileList.getTable().pack();
+ TableColumn[] cols = fFileList.getTable().getColumns();
+ for (int i = 0; i < cols.length; i++)
+ if (cols[i].getResizable())
+ cols[i].pack();
+ }
+
+ /**
+ * Returns the files currently being displayed in this block
+ *
+ * @return files currently being displayed in this block
+ */
+ public FileToTransfer[] getFiles() {
+ return fFiles.toArray(new FileToTransfer[fFiles.size()]);
+ }
+
+ /**
+ * Bring up a dialog that lets the user add new files to transfer.
+ */
+ private void addFiles() {
+ AddFilesToDownloadDialog dialog= new AddFilesToDownloadDialog(getShell(), defaultHostPath, defaultTargetPath);
+ dialog.setTitle(LaunchUIMessages.getString("FilesBlock.AddFilesToDownload")); //$NON-NLS-1$
+
+ dialog.setExistingFiles(fFiles);
+
+ if (dialog.open() != Window.OK) {
+ return;
+ }
+
+ List<FileToTransfer> files = dialog.getFiles();
+ fFiles.addAll(files);
+ fFileList.refresh();
+
+ for (FileToTransfer file : files) {
+ fFileList.setChecked(file, file.getEnabled());
+ }
+
+ fParentTab.update(null, null);
+ }
+
+ private void editFile() {
+ IStructuredSelection selection= (IStructuredSelection)fFileList.getSelection();
+ FileToTransfer file= (FileToTransfer)selection.getFirstElement();
+ if (file == null) {
+ return;
+ }
+ AddEditFileToDownloadDialog dialog= new AddEditFileToDownloadDialog(getShell(), file);
+ dialog.setTitle(LaunchUIMessages.getString("ESboxDownloadTab.9")); //$NON-NLS-1$
+
+ IPath hostFileFolder = new Path(file.getHostPath());
+ hostFileFolder = hostFileFolder.removeLastSegments(1);
+ dialog.setDefaultPaths(hostFileFolder.toPortableString(), null);
+
+ if (dialog.open() != Window.OK) {
+ return;
+ }
+ fFileList.refresh(file);
+ fParentTab.update(null, null);
+ }
+
+ private void removeFiles() {
+ IStructuredSelection selection= (IStructuredSelection)fFileList.getSelection();
+ removeFiles(selection.toArray());
+ }
+
+ /**
+ * Removes the given files from the table.
+ *
+ * @param files
+ */
+ private void removeFiles(Object[] files) {
+ for (int i = 0; i < files.length; i++) {
+ fFiles.remove(files[i]);
+ }
+ fFileList.refresh();
+ fParentTab.update(null, null);
+ }
+
+ protected Shell getShell() {
+ return getControl().getShell();
+ }
+
+ public void setDefaultPaths(String defaultSrcPath, String defaultDstPath) {
+ defaultHostPath = defaultSrcPath;
+ defaultTargetPath = defaultDstPath;
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/LaunchUIMessages.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/LaunchUIMessages.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/LaunchUIMessages.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (nokia) - initial API and implementation. Mar, 2008
+ *******************************************************************************/
+package org.maemo.esbox.device.launch.ui;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class LaunchUIMessages {
+ private static final String BUNDLE_NAME = "org.maemo.esbox.device.launch.ui.LaunchUIMessages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private LaunchUIMessages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/LaunchUIMessages.properties
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/LaunchUIMessages.properties (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/LaunchUIMessages.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,34 @@
+ESboxDownloadTab.1=File Download
+ESboxDownloadTab.2=Enabled
+ESboxDownloadTab.3=File to download
+ESboxDownloadTab.4=Target path
+ESboxDownloadTab.5=Add...
+ESboxDownloadTab.6=Edit...
+ESboxDownloadTab.7=Remove
+ESboxDownloadTab.8=Add File to Download
+ESboxDownloadTab.9=Edit File to Download
+ESboxDownloadTab.10=Enable All
+ESboxDownloadTab.11=Disable All
+AddEditFileToDownloadDialog.0=Target path: (relative to the destination folder in the global <a href="dummy">SSH panel</a>)
+AddEditFileToDownloadDialog.1=File to download:
+AddEditFileToDownloadDialog.2=The absolute path on your PC of the file to download to the device
+AddEditFileToDownloadDialog.3=Browse...
+AddEditFileToDownloadDialog.4=Select directory to browse
+AddEditFileToDownloadDialog.5=Target path:
+AddEditFileToDownloadDialog.6=The directory on the device to download the file to
+AddEditFileToDownloadDialog.7=File to download does not exist
+AddEditFileToDownloadDialog.8=No file to download specified
+AddEditFileToDownloadDialog.9=Invalid target path specified
+AddEditFileToDownloadDialog.10=No target path specified
+AddEditFileToDownloadDialog.11=All Files
+AddFilesToDownloadDialog.TargetPathLabel=Target path:
+AddFilesToDownloadDialog.TargetPathTooltip=Target path: (relative to the destination folder in the global <a href="dummy">SSH panel</a>)
+AddFilesToDownloadDialog.DirectoryLabel=Source directory:
+AddFilesToDownloadDialog.DirectoryTooltip=Specifies the top-level directory for files to add
+AddFilesToDownloadDialog.BrowseButtonLabel=Browse...
+AddFilesToDownloadDialog.BrowseLabel=Select the directory to browse:
+AddFilesToDownloadDialog.DialogTitle=Select Files to Download
+AddFilesToDownloadDialog.FileTreeLabel=Files to download:
+AddFilesToDownloadDialog.FileTreeTooltip=Select all the files you wish to copy
+AddFilesToDownloadDialog.TargetDirTooltip=Specifies the target directory where files will be copied
+FilesBlock.AddFilesToDownload=Add files to download
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHFileGUIEditorDialog.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHFileGUIEditorDialog.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHFileGUIEditorDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,438 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Apr 1, 2008
+ *******************************************************************************/
+package org.maemo.esbox.device.launch.ui;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.device.core.sbrsh.*;
+
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * A dialog to view or edit a SBRSH client configuration file.
+ *
+ * @author LWang.
+ *
+ */
+public class SBRSHFileGUIEditorDialog extends StatusDialog {
+
+ private TableViewer fMountsTableViewer;
+ private TableColumn columnType;
+ private TableColumn columnHost;
+ private TableColumn columnDevice;
+ private Button buttonNew;
+ private Button buttonRemove;
+ private Button buttonEdit;
+ private Table table;
+ private Text fTargetIPText;
+ private Text fPortNumText;
+ private boolean fAllowEdit;
+ private Combo fTargetCombo = null;
+
+ private static class SbrshTableSorter extends ViewerSorter {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ return getComparator().compare(((SBRSHMount) e1).getType(), ((SBRSHMount) e2).getType());
+ }
+
+ @Override
+ protected Comparator<String> getComparator() {
+
+ return new Comparator<String>() {
+ public int compare(String o1, String o2) {
+ return (-1) * ((String) o1).compareTo((String) o1);
+ }
+ };
+ }
+ }
+
+ private class MountsTableContentProvider implements IStructuredContentProvider {
+
+ @SuppressWarnings("unchecked")
+ public Object[] getElements(Object inputElement) {
+
+ if (inputElement instanceof List) {
+ List<SBRSHMount> list;
+ try {
+ list = (List<SBRSHMount>)inputElement;
+ }
+ catch (ClassCastException e) {
+ return null;
+ }
+
+ SBRSHMount mounts[] = new SBRSHMount[list.size()];
+ return list.toArray(mounts);
+ }
+
+ return null;
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+
+ private class MountsTableLabelProvider extends LabelProvider implements ITableLabelProvider, IFontProvider {
+
+ public MountsTableLabelProvider() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element) {
+ return getColumnText(element, 0);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ if (! (element instanceof SBRSHMount))
+ return "";
+
+ SBRSHMount entry = (SBRSHMount) element;
+ switch (columnIndex) {
+ case 0:
+ return entry.getType();
+ case 1:
+ return entry.getHostPath();
+ case 2:
+ return entry.getTargetPath();
+ default:
+ return "";
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
+ */
+ public Font getFont(Object element) {
+ return null;
+ }
+ }
+
+ /**
+ * @param parent
+ */
+ public SBRSHFileGUIEditorDialog(Shell parent, boolean allowEdit) {
+ super(parent);
+
+ setShellStyle(SWT.RESIZE);
+
+ fAllowEdit = allowEdit;
+
+ if (fAllowEdit)
+ setTitle("SBRSH Configuration Editor");
+ else
+ setTitle("SBRSH Configuration Viewer");
+
+ // Create the dialog, which would call createDialogArea() below.
+ create();
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+
+ Composite comp= (Composite) super.createDialogArea(parent);
+
+ GridLayout layout = (GridLayout) comp.getLayout();
+ layout.numColumns = 4;
+ layout.makeColumnsEqualWidth = false;
+
+ GridData data;
+
+ Label label = new Label(comp, SWT.LEFT);
+ label.setText("SBRSH Target:");
+
+ fTargetCombo = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN );
+ fTargetCombo.setItems(new String[] {"MyN800", "MyN810"} );
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ fTargetCombo.setLayoutData(data);
+ // Paddings.
+ label = new Label(comp, SWT.LEFT);
+ label = new Label(comp, SWT.LEFT);
+
+ label = new Label(comp, SWT.LEFT);
+ label.setText("Target IP:");
+ fTargetIPText = new Text(comp, SWT.BORDER);
+ fTargetIPText.setText("");
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.minimumWidth = 80;
+ fTargetIPText.setLayoutData(data);
+ fTargetIPText.addModifyListener( new ModifyListener() {
+ public void modifyText( ModifyEvent evt ) {
+ dataChanged();
+ }
+ } );
+
+ label = new Label(comp, SWT.LEFT);
+ label.setText("Port (optional):");
+ fPortNumText = new Text(comp, SWT.BORDER);
+ fPortNumText.setText("");
+ data = new GridData(/*GridData.FILL_HORIZONTAL*/);
+ data.minimumWidth = 30;
+ fPortNumText.setLayoutData(data);
+ fPortNumText.addModifyListener( new ModifyListener() {
+ public void modifyText( ModifyEvent evt ) {
+ dataChanged();
+ }
+ } );
+
+ if (! fAllowEdit) {
+ fTargetIPText.setEditable(false);
+ fPortNumText.setEditable(false);
+ }
+
+ createSeparator(comp, 4);
+
+ createMountsPage(comp, 4);
+
+ createSeparator(comp, 4);
+
+ return comp;
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ if (fAllowEdit)
+ super.createButtonsForButtonBar(parent);
+ else {
+ // Just need one OK button.
+ createButton(parent, IDialogConstants.OK_ID,
+ IDialogConstants.OK_LABEL, false);
+ }
+ }
+
+ protected void dataChanged() {
+ }
+
+ private void createMountsPage(Composite parent, int colSpanOnParent) {
+
+ GridData gridData;
+
+ final Composite pane = new Composite(parent, SWT.NONE);
+ pane.setLayout(new GridLayout(2, false));
+ gridData = new GridData(GridData.FILL_BOTH);
+ gridData.horizontalSpan = colSpanOnParent;
+ pane.setLayoutData(gridData);
+
+ Label label = new Label(pane, SWT.NONE);
+ label.setText("Mount Points:");
+ gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = 2;
+ label.setLayoutData(gridData);
+
+ // Create the table viewer for mounts.
+
+ Composite tablePane = new Composite(pane, SWT.NONE);
+ GridLayout tablePaneLayout = new GridLayout();
+ tablePaneLayout.marginHeight = 0;
+ tablePaneLayout.marginWidth = 0;
+ tablePane.setLayout(tablePaneLayout);
+
+ gridData = new GridData(GridData.FILL_BOTH);
+ gridData.minimumHeight = 280;
+ tablePane.setLayoutData(gridData);
+
+ fMountsTableViewer = new TableViewer(tablePane, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+ fMountsTableViewer.setSorter(new SbrshTableSorter());
+ fMountsTableViewer.setLabelProvider(new MountsTableLabelProvider());
+ fMountsTableViewer.setContentProvider(new MountsTableContentProvider());
+
+ table = fMountsTableViewer.getTable();
+
+ gridData = new GridData(GridData.FILL_BOTH);
+ if (fAllowEdit)
+ gridData.horizontalSpan = 2;
+ else
+ gridData.horizontalSpan = 1; // the other column for button pane
+ table.setLayoutData(gridData);
+
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ //adds a selection listener. This listener guarantees that just one item is checked (and also selected).
+ table.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+
+ }
+ });
+
+ columnType = new TableColumn(table,SWT.CENTER);
+ columnType.setText("Type");
+ columnType.setWidth(80);
+
+ columnHost = new TableColumn(table,SWT.LEFT);
+ columnHost.setText("Source");
+ columnHost.setWidth(260);
+
+ columnDevice = new TableColumn(table,SWT.LEFT);
+ columnDevice.setText("Target");
+ columnDevice.setWidth(130);
+
+ table.pack();
+
+ if (fAllowEdit)
+ createButtonPane(pane);
+ }
+
+ void createButtonPane(final Composite pane) {
+ // Create the button pane
+ GridData gridData;
+
+ Composite buttonPane = new Composite(pane, SWT.NONE);
+ GridLayout buttonPaneLayout = new GridLayout();
+
+ buttonPaneLayout.marginHeight = 0;
+ buttonPaneLayout.marginWidth = 0;
+
+ buttonPane.setLayout(buttonPaneLayout);
+ buttonPane
+ .setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+
+ // New button
+ buttonNew = new Button(buttonPane, SWT.PUSH);
+ buttonNew.setText("New");
+
+ gridData = new GridData(GridData.FILL_HORIZONTAL);
+ buttonNew.setLayoutData(gridData);
+
+ buttonNew.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event e) {
+ showAddEditDialog(null);
+ validate();
+ }
+ });
+
+ // Remove button
+ buttonEdit = new Button(buttonPane, SWT.PUSH);
+ buttonEdit.setText("Edit");
+
+ gridData = new GridData(GridData.FILL_HORIZONTAL);
+ buttonEdit.setLayoutData(gridData);
+ buttonEdit.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event e) {
+ SBRSHMount mount = (SBRSHMount) ((StructuredSelection)fMountsTableViewer.getSelection()).getFirstElement();
+ if (mount != null)
+ showAddEditDialog(mount);
+
+ validate();
+ }
+ });
+
+ // Remove button
+ buttonRemove = new Button(buttonPane, SWT.PUSH);
+ buttonRemove.setText("Remove");
+
+ gridData = new GridData(GridData.FILL_HORIZONTAL);
+ //gridData.widthHint = SWTUtil.getButtonWidthHint(buttonRemove);
+ //gridData.heightHint = SWTUtil.getButtonHeigthHint(buttonRemove);
+ buttonRemove.setLayoutData(gridData);
+ buttonRemove.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event e) {
+ removeEntry();
+ validate();
+ }
+ });
+ }
+
+ private void showAddEditDialog(SBRSHMount entryToEdit) {
+ SBRSHMountEditorDialog dialog = new SBRSHMountEditorDialog(getShell(), entryToEdit);
+ if (dialog.open() == Window.OK) {
+ if (entryToEdit != null) {
+ fMountsTableViewer.replace(dialog.getResult(), table.getSelectionIndex());
+ } else {
+ fMountsTableViewer.add(dialog.getResult());
+ }
+ }
+ }
+
+ /**
+ * Remove the select entry.
+ */
+ private void removeEntry() {
+ int index = table.getSelectionIndex();
+ table.remove(index);
+ table.redraw();
+ }
+
+ /**
+ * Returns the selected value of the table.
+ *
+ * @return the selected value of the table.
+ */
+ public String getSelectValue() {
+ TableItem item[] = table.getSelection();
+ if(item.length > 0)
+ return item[0].getText();
+ else
+ return null;
+ }
+
+ public void setData(SBRSHConfigurationFile scf) {
+ if (scf == null || ! scf.isValid())
+ return;
+
+ fTargetCombo.setItems(scf.getTargetNames());
+ fTargetCombo.select(0);
+
+ SBRSHTarget firstTarget = scf.getTargets().get(0);
+ fTargetIPText.setText(firstTarget.getTargetIP());
+ fPortNumText.setText(firstTarget.getSbrshPortNumber());
+
+ fMountsTableViewer.setInput(firstTarget.getMounts());
+
+ columnHost.pack();
+ columnDevice.pack();
+ }
+
+ protected void validate() {
+ }
+
+ /**
+ * Create a horizontal separator.
+ *
+ * @param comp parent widget
+ * @param colSpan number of columns to span
+ */
+ protected void createSeparator(Composite comp, int colSpan) {
+ Label label = new Label(comp, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = colSpan;
+ label.setLayoutData(gd);
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHFileTextEditorDialog.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHFileTextEditorDialog.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHFileTextEditorDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Apr 3, 2008
+ *******************************************************************************/
+package org.maemo.esbox.device.launch.ui;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.*;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.device.core.sbrsh.SBRSHConfigurationFileFactory;
+import org.maemo.esbox.internal.device.launch.Activator;
+import org.maemo.esbox.launch.ui.StatusInfo;
+
+import java.io.*;
+
+/**
+ * @author LWang.
+ *
+ */
+public class SBRSHFileTextEditorDialog extends StatusDialog {
+
+ private IFileStore fFile;
+ private Text fTextArea;
+ private boolean fTextChanged;
+ private Button fSaveButton;
+
+ private Button fExampleButton;
+ private boolean fExampleShown = false;
+ private Text fExampleArea;
+ private String fExampleConfiguration = "Hello";
+
+ public SBRSHFileTextEditorDialog(Shell parent, IFileStore fileStore, String exampleConfiguration) {
+ super(parent);
+
+ fFile = fileStore;
+ fTextChanged = false;
+
+ fExampleConfiguration = exampleConfiguration;
+
+ setShellStyle(SWT.RESIZE); // make dialog resizeable
+
+ setTitle("SBRSH Configuration File Editor");
+
+ // This will createDialogArea and createButtonBar.
+ create();
+
+ fSaveButton = getButton(IDialogConstants.OK_ID);
+ fSaveButton.setText("Save");
+ fSaveButton.setEnabled(false);
+
+ String fileContent = "";
+ try {
+ fileContent = GeneralUtils.readTextFileToString(fFile);
+ } catch (IOException e) {
+ setErrorMessage(e.getMessage());
+ }
+
+ fTextArea.setText(fileContent);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+
+ Composite pane = (Composite)super.createDialogArea(parent);
+
+ // label to show file name.
+ //
+ Label label = new Label(pane, SWT.NONE);
+ label.setText("File: " + fFile.toURI());
+ GridData gData = new GridData();
+ label.setLayoutData(gData);
+ FontData f = label.getFont().getFontData()[0];
+ f.setStyle(SWT.BOLD);
+ label.setFont(new Font(getShell().getDisplay(), f));
+
+
+ fTextArea = new Text(pane,SWT.BORDER | SWT.MULTI |SWT.H_SCROLL | SWT.V_SCROLL);
+ fTextArea.setText("");
+ fTextArea.addKeyListener(new KeyListener(){
+
+ public void keyPressed(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ fTextChanged = true;
+ fSaveButton.setEnabled(true);
+ validate();
+ }});
+
+ gData = new GridData(GridData.FILL_BOTH);
+ gData.minimumWidth = 700;
+ gData.minimumHeight = 300;
+ fTextArea.setLayoutData(gData);
+
+ // Use font from global preference:
+ // General=>Appearance=>Color and fonts=>Basic=>Text Font.
+ fTextArea.setFont(JFaceResources.getTextFont());
+
+ return pane;
+ }
+
+ protected void validate() {
+ StatusInfo status= new StatusInfo();
+ status.setOK();
+
+ String content = fTextArea.getText();
+
+ try {
+ SBRSHConfigurationFileFactory.parse(content);
+ } catch (ESboxException e) {
+ status.setWarning(e.getMessage());
+ }
+
+ updateStatus(status);
+ }
+
+ private void setErrorMessage(String message) {
+ StatusInfo status= new StatusInfo();
+ status.setError(message);
+
+ updateStatus(status);
+ }
+
+ @Override
+ protected void okPressed() {
+ if (fTextChanged) {
+ OutputStream os = null;
+ try {
+ os = fFile.openOutputStream(EFS.OVERWRITE, null);
+ OutputStreamWriter writer = new OutputStreamWriter(os);
+ writer.write(fTextArea.getText());
+ writer.close();
+ } catch (IOException e) {
+ Activator.getErrorLogger().showError("Failed to save the file. Got error: " + e, e);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().showError("Failed to save the file. Got error: " + e, e);
+ } finally {
+ Policy.close(os);
+ }
+ }
+
+ super.okPressed();
+ }
+
+ @Override
+ protected void cancelPressed() {
+ if (!queryCancel())
+ return;
+
+ // close the dialog.
+ super.cancelPressed();
+ }
+
+ @Override
+ protected boolean canHandleShellCloseEvent() {
+ if (!super.canHandleShellCloseEvent())
+ return false;
+
+ return queryCancel();
+ }
+
+ private boolean queryCancel() {
+ if (fTextChanged) {
+ // ask user if he wants to quit ?
+ boolean yes = MessageDialog.openQuestion(
+ fTextArea.getShell(),
+ "Warning",
+ "Your changes are not saved yet. Are you sure to discard them?");
+ return yes;
+ } else {
+ return true;
+ }
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+
+ // Create our example button.
+ //
+ if (fExampleConfiguration != null && fExampleConfiguration.length() > 0) {
+ fExampleButton = createButton(parent, IDialogConstants.DETAILS_ID,
+ "Example >>", false);
+ fExampleButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ toggleExampleArea();
+ }});
+ }
+ }
+
+ /**
+ * Toggles the unfolding of the example area. This is triggered by the user
+ * pressing the example button.
+ */
+ private void toggleExampleArea() {
+ Point windowSize = getShell().getSize();
+ Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ if (fExampleShown) {
+ fExampleArea.dispose();
+ fExampleShown = false;
+ fExampleButton.setText("Example >>");
+ } else {
+ fExampleArea = createExampleArea((Composite) getContents());
+ fExampleButton.setText("<< Example");
+ fExampleShown = true;
+ }
+ Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y)));
+ }
+
+ private Text createExampleArea(Composite parent) {
+ Text area = new Text(parent, SWT.BORDER | SWT.MULTI |SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ gData.minimumWidth = 700;
+ gData.minimumHeight = 300;
+ area.setLayoutData(gData);
+
+ // Use font from global preference:
+ // General=>Appearance=>Color and fonts=>Basic=>Text Font.
+ area.setFont(JFaceResources.getTextFont());
+
+ area.setText(fExampleConfiguration);
+
+ return area;
+ }
+
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHLaunchProtocolPage.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHLaunchProtocolPage.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHLaunchProtocolPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,661 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Mar 26, 2008.
+ * implemented as extension. Aug, 2008.
+ *******************************************************************************/
+
+package org.maemo.esbox.device.launch.ui;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.device.core.sbrsh.SBRSHConfigurationFile;
+import org.maemo.esbox.device.core.sbrsh.SBRSHConfigurationFileFactory;
+import org.maemo.esbox.device.launch.*;
+import org.maemo.esbox.internal.device.launch.Activator;
+import org.maemo.esbox.launch.*;
+import org.maemo.esbox.launch.ui.AbstractLaunchProtocolPage;
+
+import java.io.File;
+
+/**
+ * UI page that contains SBRSH configuration related controls.
+ *
+ * @author LWang
+ *
+ */
+public class SBRSHLaunchProtocolPage extends AbstractLaunchProtocolPage {
+
+ private Composite fSBRSHPage = null;
+
+ private Combo fSBRSHConfigMethodCombo;
+
+ private Composite fConfigMethodStack = null;
+ private Composite fAutoConfigPage = null;
+ private Composite fCustomConfigPage = null;
+
+ // Controls on auto-config (AC) page.
+ //
+ private Text fAuto_HostIPText;
+ private Text fAuto_TargetIPText;
+ private Button fAuto_ViewButton;
+
+ // Controls on custom-config (CC) page.
+ //
+ private Text fCustom_ConfigFileText;
+ private Button fCustom_BrowseButton;
+ private Button fCustom_EditButton;
+ private Combo fCustom_TargetCombo;
+
+ private ErrorLogger fErrorLogger = Activator.getErrorLogger();
+
+ private SBRSHConfigurationFile fAuto_SCFile = new SBRSHConfigurationFile();
+ private SBRSHConfigurationFile fCustom_SCFile = new SBRSHConfigurationFile();
+
+ private String fCustom_CurrentTargetName = "";
+
+ private ILaunchConfiguration fCurrentLaunchConfig = null;;
+
+ /**
+ * Creates composite control and sets the specified layout data.
+ *
+ * @param parent the parent of the new composite
+ * @param numColumns the number of columns for the new composite
+ * @param layoutMode - GridData modes that should be applied to this control
+ * @return the newly-created composite
+ */
+ public static Composite createCompositeEx(Composite parent, int numColumns, int layoutMode) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setFont(parent.getFont());
+
+ composite.setLayout(new GridLayout(numColumns, true));
+ composite.setLayoutData(new GridData(layoutMode));
+ return composite;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ fSBRSHPage = createCompositeEx( parent, 2, GridData.FILL_BOTH );
+
+ GridLayout gd =(GridLayout)fSBRSHPage.getLayout();
+ gd.makeColumnsEqualWidth = false;
+ gd.marginHeight = 0;
+ gd.marginWidth = 10;
+
+ GridData data;
+
+ // Combo box for configuration type: auto or custom
+
+ Label label;
+ label = new Label( fSBRSHPage, SWT.NONE );
+ label.setText( "SBRSH Client Configuration Method:" );
+ fSBRSHConfigMethodCombo = new Combo( fSBRSHPage, SWT.READ_ONLY | SWT.DROP_DOWN );
+ fSBRSHConfigMethodCombo.setItems( SBRSHLaunchProtocolType.V_SBRSH_CONFIG_METHODS );
+ data = new GridData(/*GridData.FILL_BOTH*/);
+ data.horizontalSpan = 1;
+ fSBRSHConfigMethodCombo.setLayoutData(data);
+
+ fSBRSHConfigMethodCombo.addSelectionListener( new SelectionListener() {
+
+ public void widgetDefaultSelected( SelectionEvent e ) {
+ update(null, null);
+ updateUI();
+ }
+
+ public void widgetSelected( SelectionEvent e ) {
+ update(null, null);
+ updateUI();
+ }
+ } );
+
+ createSeparator(fSBRSHPage, 2);
+
+ // Stack page that will show either SSH page or SBRSH page.
+ fConfigMethodStack = new Composite(fSBRSHPage, SWT.NONE);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ gData.horizontalSpan = 2;
+ fConfigMethodStack.setLayoutData(gData);
+ fConfigMethodStack.setLayout(new StackLayout());
+
+ fAutoConfigPage = createAutoConfigPage(fConfigMethodStack);
+
+ fCustomConfigPage = createCustomConfigPage(fConfigMethodStack);
+ }
+
+ private Composite createCustomConfigPage(Composite parent) {
+ GridData data;
+ Label label;
+
+ Composite page = createCompositeEx( parent, 4, GridData.FILL_BOTH );
+ GridLayout gd =(GridLayout)page.getLayout();
+ gd.makeColumnsEqualWidth = false;
+ gd.marginHeight = 0;
+ gd.marginWidth = 20;
+
+ // SBRSH configuration file
+
+ label = new Label(page, SWT.LEFT);
+ label.setText("Configuration File:");
+
+ fCustom_ConfigFileText = new Text(page, SWT.BORDER);
+ fCustom_ConfigFileText.setText("");
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ // data.horizontalSpan = 4;
+ data.minimumWidth = 200;
+ fCustom_ConfigFileText.setLayoutData(data);
+ fCustom_ConfigFileText.addModifyListener( new ModifyListener() {
+ public void modifyText( ModifyEvent evt ) {
+ update(null, null);
+ }
+ } );
+
+ fCustom_BrowseButton = new Button(page, SWT.PUSH);
+ fCustom_BrowseButton.setText("Browse...");
+ fCustom_BrowseButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dialog = new FileDialog(fSBRSHPage.getShell(), SWT.NONE);
+
+ dialog.setText("Select SBRSH configuration file");
+ dialog.setFilterExtensions(new String[] {"*"}); //$NON-NLS-1$
+ dialog.setFilterNames(new String[] {"All Files"});
+
+ String currentFile = fCustom_ConfigFileText.getText();
+ if (currentFile.length() > 0) {
+ File f = new File(currentFile);
+ dialog.setFilterPath(f.getParent());
+ dialog.setFileName(f.getName());
+ }
+
+ String fileName = dialog.open();
+ if (fileName != null) {
+ fCustom_ConfigFileText.setText(fileName);
+ }
+ }
+ });
+
+ fCustom_EditButton = new Button(page, SWT.PUSH);
+ fCustom_EditButton.setText("Edit...");
+ // editorButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fCustom_EditButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ /*
+ * No, does not work with a configuration file that has many
+ * errors where we cannot get a meaningful
+ * SBRSHConfigurationFile object, and thus there is no way to
+ * display the wrong file in the GUI editor. Note a user may
+ * select any file as the configuration file on the UI and we
+ * must be bullet proof.
+ *
+ * So a text editor is used instead..... LWang. 04/02/08
+ */
+ /*
+ SBRSHFileGUIEditorDialog editor =
+ new SBRSHFileGUIEditorDialog(fSBRSHPage.getShell(), true);
+ editor.setData(fCustom_SCFile);
+ editor.open();
+ */
+ String fileName = fCustom_ConfigFileText.getText().trim();
+ if (fileName.length() > 0) {
+ String example;
+ SBRSHConfigurationFile scf;
+ try {
+ // This is an example that fits user environment better.
+ scf = SBRSHLaunchProtocolType.createAutoSBRSHConfiguration(fCurrentLaunchConfig, "192.168.2.14", "192.168.2.15");
+ example = scf.toString();
+ } catch (ESboxException e1) {
+ // Use static example
+ example =
+ "AutoTarget 192.168.2.15 \n" +
+ "\t ssh user at 192.168.2.12:/scratchbox/users/user/targets/CHINOOK_ARMEL / rw,nonempty,allow_other\n"+
+ "\t ssh user at 192.168.2.12:/home/user/workspace /user_workspace rw,nonempty,allow_other \n" +
+ "\t bind /tmp /tmp \n" +
+ "\t bind /dev /dev \n" +
+ "\t bind /dev/pts /dev/pts \n" +
+ "\t bind /proc /proc \n" +
+ "\t bind /sys /sys \n";
+ }
+
+ ISDKTarget target = ESboxLaunchUtils.getSDKTarget(fCurrentLaunchConfig);
+ SBRSHFileTextEditorDialog editor =
+ new SBRSHFileTextEditorDialog(fSBRSHPage.getShell(),
+ target.getMachineFileSystemAccess().getFileStore(new Path(fileName)),
+ example);
+
+ int saved = editor.open();
+ if (saved == Window.OK) {
+ update(null, null);
+ }
+ }
+ }
+ });
+
+ label = new Label(page, SWT.LEFT);
+ label.setText("Current SBRSH Target:");
+
+ fCustom_TargetCombo = new Combo(page, SWT.DROP_DOWN | SWT.READ_ONLY);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ data.minimumWidth = 200;
+ fCustom_TargetCombo.setLayoutData(data);
+
+ fCustom_TargetCombo.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ update(null, null);
+ }});
+
+ return page;
+ }
+
+ private Composite createAutoConfigPage(Composite parent) {
+ GridData data;
+ Label label;
+
+ Composite page = createCompositeEx( parent, 2, GridData.FILL_BOTH );
+ GridLayout gd =(GridLayout)page.getLayout();
+ gd.makeColumnsEqualWidth = false;
+ gd.marginHeight = 0;
+ gd.marginWidth = 20;
+
+ String toolTip;
+
+ label = new Label(page, SWT.LEFT);
+ label.setText("Host address:");
+ fAuto_HostIPText = new Text(page, SWT.BORDER);
+ fAuto_HostIPText.setText("");
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.minimumWidth = 200;
+ fAuto_HostIPText.setLayoutData(data);
+ fAuto_HostIPText.addModifyListener( new ModifyListener() {
+ public void modifyText( ModifyEvent evt ) {
+ update(null, null);
+ }
+ } );
+
+ toolTip = "Enter name or IP address of host PC known to the target device. "+
+ "A name entered should be resolvable in the /etc/hosts file on the target.";
+ label.setToolTipText(toolTip);
+ fAuto_HostIPText.setToolTipText(toolTip);
+
+ // Target IP address.
+ label = new Label(page, SWT.LEFT);
+ label.setText("Target address:");
+ fAuto_TargetIPText = new Text(page, SWT.BORDER);
+ fAuto_TargetIPText.setText("");
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.minimumWidth = 200;
+ fAuto_TargetIPText.setLayoutData(data);
+ fAuto_TargetIPText.addModifyListener( new ModifyListener() {
+ public void modifyText( ModifyEvent evt ) {
+ update(null, null);
+ }
+ } );
+
+ toolTip = "Enter name or IP address of target device. "+
+ "A name entered should be resolvable in the /etc/hosts file on the host PC.";
+ label.setToolTipText(toolTip);
+ fAuto_TargetIPText.setToolTipText(toolTip);
+
+ fAuto_ViewButton = new Button(page, SWT.PUSH);
+ fAuto_ViewButton.setText("View Configuration...");
+ // editorButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fAuto_ViewButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ SBRSHFileGUIEditorDialog viewer =
+ new SBRSHFileGUIEditorDialog(fSBRSHPage.getShell(), false/*allowEdit*/);
+ viewer.setData(fAuto_SCFile);
+ viewer.open();
+ }
+ });
+
+ return page;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return "SBRSH Page";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration configuration) {
+
+ setInitializing(true);
+
+ fCurrentLaunchConfig = configuration;
+
+ String configMethod = "";
+ try {
+ configMethod = configuration.getAttribute(
+ SBRSHLaunchProtocolType.ATTR_SBRSH_CONFIG_METHOD,
+ SBRSHLaunchProtocolType.V_SBRSH_CONFIG_METHODS[SBRSHLaunchProtocolType.DEFAULT_SBRSH_CONFIG_METHOD_ID]);
+ } catch (CoreException e) {
+ fErrorLogger.logError("Failed to get launch config attribute: SBRSH configuration method. ", e);
+ }
+
+ int cmID = getSBRSHConfigMethodIDByName(configMethod);
+ fSBRSHConfigMethodCombo.select(cmID);
+
+ // Initialize controls in auto config block.
+ //
+ String hostIP = "", targetIP = "";
+ try {
+ hostIP = configuration.getAttribute(SBRSHLaunchProtocolType.ATTR_SBRSH_AUTO_CONFIG_HOST_IP,
+ IESboxLaunchConfigurationConstants.DEFAULT_HOST_IP);
+ targetIP = configuration.getAttribute(SBRSHLaunchProtocolType.ATTR_SBRSH_AUTO_CONFIG_TARGET_IP,
+ IESboxLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
+ } catch (CoreException e) {
+ fErrorLogger.logError("Failed to get SBRSH host IP or target IP from the launch configuration", e);
+ }
+
+ fAuto_HostIPText.setText(hostIP);
+ fAuto_TargetIPText.setText(targetIP);
+
+ try {
+ fAuto_SCFile = SBRSHLaunchProtocolType.createAutoSBRSHConfiguration(configuration, hostIP, targetIP);
+ } catch (ESboxException e) {
+ // Ignore
+ }
+
+ // Initialize controls in custom config block.
+ //
+ String configFileName = "";
+ try {
+ configFileName = configuration.getAttribute(
+ SBRSHLaunchProtocolType.ATTR_SBRSH_CUSTOM_CONFIG_CONFIG_FILE, "");
+
+ fCustom_CurrentTargetName = configuration.getAttribute(
+ SBRSHLaunchProtocolType.ATTR_SBRSH_CUSTOM_CONFIG_SBRSH_TARGET, "");
+ } catch (CoreException e) {
+ fErrorLogger.logError("Failed to get launch config attribute: SBRSH config data for custom configuration. ", e);
+ }
+
+ fCustom_ConfigFileText.setText(configFileName);
+
+
+ try {
+ // XXX: sbrsh config file must live on machine, not host
+ ISDKTarget target = ESboxLaunchUtils.getSDKTarget(fCurrentLaunchConfig);
+ if (target != null) {
+ IFileStore store = target.getMachineFileSystemAccess().getFileStore(new Path(configFileName));
+ fCustom_SCFile = SBRSHConfigurationFileFactory.parse(store);
+ }
+ } catch (ESboxException e) {
+ // Ignore. Error check will be done in validate().
+ }
+
+ if (fCustom_SCFile.isValid()) {
+ String[] targets = fCustom_SCFile.getTargetNames();
+ fCustom_TargetCombo.setItems(targets);
+
+ int i = targets.length;
+ while (--i >= 0) {
+ if (targets[i].equals(fCustom_CurrentTargetName))
+ break;
+ }
+ if (i < 0) // should not happen.
+ i = 0;
+
+ fCustom_TargetCombo.select(i);
+ }
+
+ updateUI();
+
+ setInitializing(false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ // Save UI data in the working copy.
+ // Note validity of the data will be checked later in Validate().
+ //
+ String selectedConfigMethod = SBRSHLaunchProtocolType.V_SBRSH_CONFIG_METHODS[fSBRSHConfigMethodCombo.getSelectionIndex()];
+ configuration.setAttribute(SBRSHLaunchProtocolType.ATTR_SBRSH_CONFIG_METHOD, selectedConfigMethod);
+
+ boolean isAuto = selectedConfigMethod.equals(SBRSHLaunchProtocolType.V_SBRSH_CONFIG_METHOD_AUTOMATIC);
+
+ if (isAuto) {
+ // Update hostIP and targetIP in the configuration of auto-config.
+ // Note: the configuration of auto-config contains only one SBRSH target and
+ // only supports mounts from the same host PC.
+
+ String hostIP = fAuto_HostIPText.getText();
+ String targetIP = fAuto_TargetIPText.getText();
+
+ configuration.setAttribute(SBRSHLaunchProtocolType.ATTR_SBRSH_AUTO_CONFIG_HOST_IP, hostIP);
+ configuration.setAttribute(SBRSHLaunchProtocolType.ATTR_SBRSH_AUTO_CONFIG_TARGET_IP, targetIP);
+
+ // Enable/disable this button based on validity of data.
+ boolean valid = GeneralUtils.isValidNameOrIP(hostIP) &&
+ GeneralUtils.isValidNameOrIP(targetIP);
+ fAuto_ViewButton.setEnabled(valid);
+
+ if (valid) {
+ try {
+ fAuto_SCFile = SBRSHLaunchProtocolType.createAutoSBRSHConfiguration(configuration, hostIP, targetIP);
+ } catch (ESboxException e) {
+ // Ignore
+ }
+ }
+
+ }
+ else { // custom config
+ updateTargetComboInCustomConfig();
+
+ configuration.setAttribute(SBRSHLaunchProtocolType.ATTR_SBRSH_CUSTOM_CONFIG_CONFIG_FILE,
+ fCustom_ConfigFileText.getText());
+
+ configuration.setAttribute(SBRSHLaunchProtocolType.ATTR_SBRSH_CUSTOM_CONFIG_SBRSH_TARGET,
+ fCustom_CurrentTargetName);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ /* not needed. Done by
+ * @see SBRSHLaunchProtocolType#setDefaults(configuration).
+ */
+ }
+
+ @Override
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ setErrorMessage(null);
+ setMessage(null);
+
+ // Validate SBRSH settings.
+ try {
+ validate(launchConfig);
+ }
+ catch (ESboxException e) {
+ setErrorMessage(e.getMessage());
+ return false;
+ }
+
+ return true;
+ }
+
+ private static int getSBRSHConfigMethodIDByName(String name) {
+ int id = SBRSHLaunchProtocolType.DEFAULT_SBRSH_CONFIG_METHOD_ID;
+ // convert to index.
+ for (int i=0; i < SBRSHLaunchProtocolType.V_SBRSH_CONFIG_METHODS.length; i++) {
+ if (name.equals(SBRSHLaunchProtocolType.V_SBRSH_CONFIG_METHODS[i])) {
+ id = i;
+ break;
+ }
+ }
+
+ return id;
+ }
+
+ private void updateTargetComboInCustomConfig() {
+ SBRSHConfigurationFile scf = new SBRSHConfigurationFile();
+
+ String sbrshConfigFile = "";
+
+ boolean fileValid = true;
+
+ sbrshConfigFile = fCustom_ConfigFileText.getText().trim();
+
+ String[] items = fCustom_TargetCombo.getItems();
+ if (items.length > 0)
+ fCustom_CurrentTargetName = items[fCustom_TargetCombo.getSelectionIndex()];
+
+
+ try {
+ // XXX: sbrsh config file must live on machine, not host
+ ISDKTarget target = ESboxLaunchUtils.getSDKTarget(fCurrentLaunchConfig);
+ IFileStore store = target.getMachineFileSystemAccess().getFileStore(new Path(sbrshConfigFile));
+ scf = SBRSHConfigurationFileFactory.parse(store);
+ } catch (ESboxException e) {
+ fileValid = false;
+ }
+
+ // Update the list in target combo.
+ if (fileValid) {
+ String[] newTargets = scf.getTargetNames();
+
+ fCustom_TargetCombo.setItems(newTargets);
+
+ int i = newTargets.length;
+ while (--i >= 0) {
+ if (newTargets[i].equals(fCustom_CurrentTargetName))
+ break;
+ }
+ if (i < 0)
+ i = 0;
+
+ fCustom_TargetCombo.select(i);
+ fCustom_CurrentTargetName = newTargets[i];
+ }
+ else {
+ // Clear the target list.
+ fCustom_TargetCombo.setItems(new String[0]);
+ fCustom_CurrentTargetName = "";
+ }
+ }
+
+ /**
+ * Change UI based on change of certain options.
+ */
+ private void updateUI() {
+ // Note: some UI change is done in performApply() based on validity of data.
+
+ String configMethod = SBRSHLaunchProtocolType.
+ V_SBRSH_CONFIG_METHODS[fSBRSHConfigMethodCombo.getSelectionIndex()];
+
+ if (configMethod.equals(SBRSHLaunchProtocolType.V_SBRSH_CONFIG_METHOD_AUTOMATIC)) {
+ ((StackLayout)fConfigMethodStack.getLayout()).topControl = fAutoConfigPage;
+ }
+ else // custom
+ ((StackLayout)fConfigMethodStack.getLayout()).topControl = fCustomConfigPage;
+
+ fConfigMethodStack.layout();
+ }
+
+ private void validate(ILaunchConfiguration config) throws ESboxException {
+
+ String configMethod = SBRSHLaunchProtocolType.V_SBRSH_CONFIG_METHOD_AUTOMATIC;
+ try {
+ configMethod = config.getAttribute(
+ SBRSHLaunchProtocolType.ATTR_SBRSH_CONFIG_METHOD,
+ SBRSHLaunchProtocolType.V_SBRSH_CONFIG_METHOD_AUTOMATIC);
+ } catch (CoreException e1) {
+ throw new ESboxException("SBRSH configuration method is unknown.");
+ }
+
+ boolean autoConfig = configMethod.equals(SBRSHLaunchProtocolType.V_SBRSH_CONFIG_METHOD_AUTOMATIC);
+
+ SBRSHConfigurationFile scf = new SBRSHConfigurationFile();
+
+ String sbrshConfigFile = "";
+
+ if (autoConfig) {
+ String hostIP = "", targetIP = "";
+ try {
+ hostIP = config.getAttribute(SBRSHLaunchProtocolType.ATTR_SBRSH_AUTO_CONFIG_HOST_IP,
+ IESboxLaunchConfigurationConstants.DEFAULT_HOST_IP);
+ targetIP = config.getAttribute(SBRSHLaunchProtocolType.ATTR_SBRSH_AUTO_CONFIG_TARGET_IP,
+ IESboxLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
+ } catch (CoreException e) {
+ throw new ESboxException("Failed to get SBRSH host IP or target IP from the launch configuration");
+ }
+
+ if (! GeneralUtils.isValidNameOrIP(hostIP))
+ throw new ESboxException("Invalid host IP address: " + hostIP);
+
+ if (! GeneralUtils.isValidNameOrIP(targetIP))
+ throw new ESboxException("Invalid target IP address: " + targetIP);
+ }
+ else {
+ String currentTargetName = "";
+
+ try {
+ sbrshConfigFile = config.getAttribute(
+ SBRSHLaunchProtocolType.ATTR_SBRSH_CUSTOM_CONFIG_CONFIG_FILE, "");
+
+ // Get current target name.
+ currentTargetName = config.getAttribute(SBRSHLaunchProtocolType.ATTR_SBRSH_CUSTOM_CONFIG_SBRSH_TARGET, "");
+ } catch (CoreException e) {
+ throw new ESboxException("No SBRSH configuration file specified.");
+ }
+
+ ISDKTarget target = ESboxLaunchUtils.getSDKTarget(config);
+
+ try {
+ // XXX: sbrsh config file must live on machine, not host
+ IFileStore store = target.getMachineFileSystemAccess().getFileStore(new Path(sbrshConfigFile));
+ scf = SBRSHConfigurationFileFactory.parse(store);
+ } catch (ESboxException e) {
+ throw new ESboxException("Invalid SBRSH configuration file: " + e.getMessage());
+ }
+
+ // check if the file contains mount for the program.
+ //
+ String program;
+ try {
+ program = ESboxLaunchUtils.getProgramFullPath(config);
+ } catch (CoreException e) {
+ throw new ESboxException("No application specified yet in the Main tab.");
+ }
+
+ // convert to machine
+ IPath machineProgram = target.getHostToMachineFileSystemMapping().convertHostToTargetPath(new Path(program));
+ if (machineProgram != null)
+ program = machineProgram.toPortableString();
+
+ if (scf.getMountLocationOnTarget(program, currentTargetName).length() == 0)
+ throw new ESboxException("SBRSH configuration file has no matching mount for program: " + program);
+ }
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHMountEditorDialog.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHMountEditorDialog.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHMountEditorDialog.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.device.launch.ui;
+
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.device.core.sbrsh.SBRSHMount;
+import org.maemo.esbox.launch.ui.StatusInfo;
+import org.maemo.esbox.ui.common.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ *
+ */
+public class SBRSHMountEditorDialog extends StatusDialog {
+
+ public static final String BIND = "bind";
+
+ public static final String SSH = "ssh";
+
+ public static final String NFS = "nfs";
+
+ private class CompilerSbrshInputAdapter implements IDialogFieldListener {
+ public void dialogFieldChanged(DialogField field) {
+ doValidation();
+ }
+ }
+
+ private StringDialogField fHostDialogField;
+
+ private StringDialogField fDeviceDialogField;
+
+ private StringDialogField fOptionsDialogField;
+
+ private ComboDialogField fTypeDialogField;
+
+ private List<String> items;
+
+ public SBRSHMountEditorDialog(Shell parent, SBRSHMount entry) {
+ super(parent);
+
+ if (entry == null) {
+ setTitle("Create Mount Point");
+ } else {
+ setTitle("Edit Mount Point");
+ }
+
+ CompilerSbrshInputAdapter adapter = new CompilerSbrshInputAdapter();
+
+ fHostDialogField = new StringDialogField();
+ fHostDialogField.setLabelText("Host Mount Point: ");
+ fHostDialogField.setDialogFieldListener(adapter);
+
+ fDeviceDialogField = new StringDialogField();
+ fDeviceDialogField.setLabelText("Device Mount Point: ");
+ fDeviceDialogField.setDialogFieldListener(adapter);
+
+ fOptionsDialogField = new StringDialogField();
+ fOptionsDialogField.setLabelText("Options: ");
+ fOptionsDialogField.setDialogFieldListener(adapter);
+
+ fHostDialogField.setText((entry != null) ? entry.getHostPath() : "");
+ fDeviceDialogField.setText((entry != null) ? entry.getTargetPath() : "");
+ fOptionsDialogField.setText((entry != null) ? entry.getMountOptions() : "");
+
+ items = new ArrayList<String>();
+ items.add(BIND);
+ items.add(NFS);
+ items.add(SSH);
+
+ fTypeDialogField = new ComboDialogField(SWT.READ_ONLY);
+ fTypeDialogField.setLabelText("Mount type");
+ fTypeDialogField.setItems(items.toArray(new String[] {} ));
+
+ if (entry != null) {
+ int index = items.indexOf(entry.getType());
+ fTypeDialogField.selectItem(index);
+ if (items.get(index).equals(BIND))
+ fOptionsDialogField.setEnabled(false);
+ } else {
+ fTypeDialogField.selectItem(1);
+ }
+
+ }
+
+ public SBRSHMount getResult() {
+ SBRSHMount entry = new SBRSHMount();
+ entry.setType(items.get(fTypeDialogField.getSelectionIndex()));
+ entry.setHostPath(fHostDialogField.getText().trim());
+ entry.setTargetPath(fDeviceDialogField.getText().trim());
+ entry.setMountOptions(fOptionsDialogField.getText().trim());
+ return entry;
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ Composite inner = new Composite(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ inner.setLayout(layout);
+
+ fHostDialogField.doFillIntoGrid(inner, 2);
+ fDeviceDialogField.doFillIntoGrid(inner, 2);
+ fOptionsDialogField.doFillIntoGrid(inner, 2);
+ fTypeDialogField.doFillIntoGrid(inner, 2);
+
+ LayoutUtil.setHorizontalGrabbing(fHostDialogField.getTextControl(null));
+ LayoutUtil.setWidthHint(fHostDialogField.getTextControl(null), convertWidthInCharsToPixels(45));
+ fHostDialogField.postSetFocusOnDialogField(parent.getDisplay());
+
+ LayoutUtil.setHorizontalGrabbing(fDeviceDialogField.getTextControl(null));
+ LayoutUtil.setWidthHint(fDeviceDialogField.getTextControl(null), convertWidthInCharsToPixels(45));
+ fDeviceDialogField.postSetFocusOnDialogField(parent.getDisplay());
+
+ LayoutUtil.setHorizontalGrabbing(fOptionsDialogField.getTextControl(null));
+ LayoutUtil.setWidthHint(fOptionsDialogField.getTextControl(null), convertWidthInCharsToPixels(45));
+ fOptionsDialogField.postSetFocusOnDialogField(parent.getDisplay());
+
+ final Combo combo = fTypeDialogField.getComboControl(null);
+ combo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String itemSelect = combo.getItem(combo.getSelectionIndex());
+ if (itemSelect.equals(BIND))
+ fOptionsDialogField.setEnabled(false);
+ else
+ fOptionsDialogField.setEnabled(true);
+ }
+ });
+
+ applyDialogFont(composite);
+
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ICHelpContextIds.TODO_TASK_INPUT_DIALOG);
+
+ return composite;
+ }
+
+ private void doValidation() {
+ StatusInfo status = new StatusInfo();
+ String newHostMountPoint = fHostDialogField.getText().trim();
+ String newDeviceMountPoint = fDeviceDialogField.getText().trim();
+
+ if (newHostMountPoint.length() == 0 || newDeviceMountPoint.length() == 0) {
+ status.setError("Empty value is not allowed.");
+ }
+
+ updateStatus(status);
+ }
+
+ /*
+ * @see org.eclipse.jface.window.Window#configureShell(Shell)
+ */
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, ICHelpContextIds.TODO_TASK_INPUT_DIALOG);
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SSHLaunchProtocolPage.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SSHLaunchProtocolPage.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SSHLaunchProtocolPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,275 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Aug 12, 2008
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.device.launch.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Link;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.GeneralUtils;
+import org.maemo.esbox.device.launch.FileToTransfer;
+import org.maemo.esbox.device.launch.SSHLaunchProtocolType;
+import org.maemo.esbox.launch.*;
+import org.maemo.esbox.launch.ui.AbstractLaunchProtocolPage;
+import org.maemo.esbox.ssh.ui.SSHPreferenceUtils;
+import org.maemo.esbox.ui.common.*;
+
+import java.util.ArrayList;
+
+/**
+ * @author LWang
+ * @author eswartz
+ * TODO: this should share UI with SBRSH and be easily switchable with a "device connection" concept
+ */
+public class SSHLaunchProtocolPage extends AbstractLaunchProtocolPage {
+
+ private StringDialogField hostIPAddressField;
+ private StringDialogField hostPortField;
+ private StringDialogField targetIPAddressField;
+ private StringDialogField targetPortField;
+ private FilesBlock fFilesBlock;
+
+ /**
+ * Creates composite control and sets the specified layout data.
+ *
+ * @param parent the parent of the new composite
+ * @param numColumns the number of columns for the new composite
+ * @param layoutMode - GridData modes that should be applied to this control
+ * @return the newly-created composite
+ */
+ public static Composite createCompositeEx(Composite parent, int numColumns, int layoutMode) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setFont(parent.getFont());
+
+ composite.setLayout(new GridLayout(numColumns, false));
+ composite.setLayoutData(new GridData(layoutMode));
+ return composite;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite page = createCompositeEx( parent, 2, GridData.FILL_BOTH );
+
+ GridLayout gd =(GridLayout)page.getLayout();
+ gd.marginHeight = 0;
+ gd.marginWidth = 0;
+
+ hostIPAddressField = new StringDialogField();
+ hostIPAddressField.setLabelText("Host address:");
+ hostIPAddressField.doFillIntoGrid(page, 2);
+ hostIPAddressField.getTextControl(page).setToolTipText("Specify the address of the host as seen from the device, as an IP address or host name.");
+
+ hostPortField = new StringDialogField();
+ hostPortField.setLabelText("Host port:");
+ hostPortField.doFillIntoGrid(page, 2);
+ hostPortField.getTextControl(page).setToolTipText("Specify the SSH port for the host as seen from the device.");
+
+ targetIPAddressField = new StringDialogField();
+ targetIPAddressField.setLabelText("Target address:");
+ targetIPAddressField.doFillIntoGrid(page, 2);
+ targetIPAddressField.getTextControl(page).setToolTipText("Specify the address of the device, as an IP address or host name.");
+
+ targetPortField = new StringDialogField();
+ targetPortField.setLabelText("Target port:");
+ targetPortField.doFillIntoGrid(page, 2);
+ targetPortField.getTextControl(page).setToolTipText("Specify the SSH port for the device.");
+
+ IDialogFieldListener validator = new IDialogFieldListener() {
+
+ public void dialogFieldChanged(DialogField field) {
+ if (!isInitializing()) {
+ updateLaunchConfigurationDialog();
+ }
+ }
+
+ };
+ targetIPAddressField.setDialogFieldListener(validator);
+ hostIPAddressField.setDialogFieldListener(validator);
+ targetPortField.setDialogFieldListener(validator);
+ hostPortField.setDialogFieldListener(validator);
+
+ Link noteWithLink = new Link(page, SWT.NONE);
+ noteWithLink.setText("(Note: If target path is relative, it's relative to the base folder in the global <a href=\"dummy\">SSH panel</a>)");
+ GridData data = new GridData(GridData.FILL, GridData.BEGINNING, true, false);
+ data.horizontalIndent = 5;
+ data.horizontalSpan = 2;
+
+ noteWithLink.setLayoutData(data);
+ noteWithLink.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ // Display our global SSH preference panel.
+ SSHPreferenceUtils.showGlobalSSHPanel(getShell());
+ }
+ });
+
+ // TableViewer of files to download
+ fFilesBlock = new FilesBlock(this);
+ fFilesBlock.createControl(page, 2);
+ }
+
+ @Override
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ setErrorMessage(null);
+ setMessage(null);
+
+ // Validate SSH settings.
+ try {
+ validate(launchConfig);
+ }
+ catch (ESboxException e) {
+ setErrorMessage(e.getMessage());
+ return false;
+ }
+
+ return true;
+ }
+
+ private void validate(ILaunchConfiguration config) throws ESboxException {
+
+ String hostIP;
+ try {
+ hostIP = config.getAttribute(
+ SSHLaunchProtocolType.ATTR_HOST_IP,
+ IESboxLaunchConfigurationConstants.DEFAULT_HOST_IP);
+ } catch (CoreException e1) {
+ throw new ESboxException("Host address is unknown.");
+ }
+
+ if (!GeneralUtils.isValidNameOrIP(hostIP)) {
+ throw new ESboxException("Host address is invalid: " + hostIP);
+ }
+
+ String hostPort;
+ try {
+ hostPort = config.getAttribute(
+ SSHLaunchProtocolType.ATTR_HOST_PORT,
+ IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
+ } catch (CoreException e1) {
+ throw new ESboxException("Host port is unknown.");
+ }
+ if (!GeneralUtils.isValidPortNumber(hostPort)) {
+ throw new ESboxException("Host port is invalid: " + hostPort);
+ }
+
+ String targetIP;
+ try {
+ targetIP = config.getAttribute(
+ SSHLaunchProtocolType.ATTR_TARGET_IP,
+ IESboxLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
+ } catch (CoreException e1) {
+ throw new ESboxException("Target address is unknown.");
+ }
+
+ if (!GeneralUtils.isValidNameOrIP(targetIP)) {
+ throw new ESboxException("Target address is invalid: " + targetIP);
+ }
+
+ String targetPort;
+ try {
+ targetPort = config.getAttribute(
+ SSHLaunchProtocolType.ATTR_TARGET_PORT,
+ IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
+ } catch (CoreException e1) {
+ throw new ESboxException("Target port is unknown.");
+ }
+ if (!GeneralUtils.isValidPortNumber(targetPort)) {
+ throw new ESboxException("Target port is invalid: " + targetPort);
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return "SSH Download Page";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ setInitializing(true);
+
+ initializeField(hostIPAddressField, configuration,
+ SSHLaunchProtocolType.ATTR_HOST_IP, IESboxLaunchConfigurationConstants.DEFAULT_HOST_IP);
+ initializeField(hostPortField, configuration,
+ SSHLaunchProtocolType.ATTR_HOST_PORT, IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
+ initializeField(targetIPAddressField, configuration,
+ SSHLaunchProtocolType.ATTR_TARGET_IP, IESboxLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
+ initializeField(targetPortField, configuration,
+ SSHLaunchProtocolType.ATTR_TARGET_PORT, IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
+
+ ArrayList<FileToTransfer> files = SSHLaunchProtocolType.getFilesToDownload(configuration);
+ String defaultHostPath = null;
+ String defaultTargetPath = null;
+ IPath p = null;
+
+ if (files.size() > 0) {
+ fFilesBlock.setFiles(files);
+
+ // use first file's paths as default paths.
+ p = new Path(files.get(0).getHostPath()); // this contains file name
+ defaultHostPath = p.removeLastSegments(1).toPortableString();
+ defaultTargetPath = files.get(0).getTargetPath();
+ }
+ else {
+ defaultHostPath = SSHLaunchProtocolType.getDefaultSourcePathForDownload(configuration);
+ defaultTargetPath = SSHLaunchProtocolType.getDefaultTargetPathForDownload();
+ }
+
+ fFilesBlock.setDefaultPaths(defaultHostPath, defaultTargetPath);
+
+ setInitializing(false);
+ }
+
+ private void initializeField(StringDialogField field,
+ ILaunchConfiguration configuration, String key,
+ String defaultValue) {
+ try {
+ field.setText(configuration.getAttribute(key, defaultValue));
+ } catch (CoreException e) {
+ field.setText(defaultValue);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(SSHLaunchProtocolType.ATTR_HOST_IP, hostIPAddressField.getText());
+ configuration.setAttribute(SSHLaunchProtocolType.ATTR_HOST_PORT, hostPortField.getText());
+ configuration.setAttribute(SSHLaunchProtocolType.ATTR_TARGET_IP, targetIPAddressField.getText());
+ configuration.setAttribute(SSHLaunchProtocolType.ATTR_TARGET_PORT, targetPortField.getText());
+ SSHLaunchProtocolType.storeFilesToDownload(configuration, fFilesBlock.getFiles());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ /* Not needed. Done in SSHLaunchProtocolType#setDefaults().
+ *
+ */
+ }
+}
Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/internal/device/launch/Activator.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/internal/device/launch/Activator.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/internal/device/launch/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,119 @@
+package org.maemo.esbox.internal.device.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.device.launch";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+}
Property changes on: trunk/device/org.maemo.esbox.device.tests
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/device/org.maemo.esbox.device.tests/.classpath
===================================================================
--- trunk/device/org.maemo.esbox.device.tests/.classpath (rev 0)
+++ trunk/device/org.maemo.esbox.device.tests/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/device/org.maemo.esbox.device.tests/.project
===================================================================
--- trunk/device/org.maemo.esbox.device.tests/.project (rev 0)
+++ trunk/device/org.maemo.esbox.device.tests/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.device.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/device/org.maemo.esbox.device.tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/device/org.maemo.esbox.device.tests/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/device/org.maemo.esbox.device.tests/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 13:40:50 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/device/org.maemo.esbox.device.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/device/org.maemo.esbox.device.tests/META-INF/MANIFEST.MF (rev 0)
+++ trunk/device/org.maemo.esbox.device.tests/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Device Tests Plug-in
+Bundle-SymbolicName: org.maemo.esbox.device.tests
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.device.tests.TestActivator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.core.tests;bundle-version="1.5.0",
+ org.maemo.esbox.device.core;bundle-version="1.5.0",
+ org.maemo.esbox.device.ui;bundle-version="1.5.0",
+ org.junit4;bundle-version="4.3.1",
+ org.maemo.esbox.ssh;bundle-version="1.5.0",
+ org.maemo.esbox.maemosdk.core;bundle-version="1.5.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: INdT / Nokia
Added: trunk/device/org.maemo.esbox.device.tests/build.properties
===================================================================
--- trunk/device/org.maemo.esbox.device.tests/build.properties (rev 0)
+++ trunk/device/org.maemo.esbox.device.tests/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/TestSSHFileSystemOnMaemoDevice.java
===================================================================
--- trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/TestSSHFileSystemOnMaemoDevice.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/TestSSHFileSystemOnMaemoDevice.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,37 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.device.tests;
+
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.tests.core.TestSSHFileSystem;
+import org.maemo.esbox.device.core.DeviceMachineFactory;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+
+/**
+ * Manually test the implementation of an EFS filesystem over SSH
+ * @author lwang
+ *
+ */
+public class TestSSHFileSystemOnMaemoDevice extends TestSSHFileSystem {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.tests.core.TestSSHFileSystem#createMachine()
+ */
+ @Override
+ protected IMachine createMachine() {
+ SSHConfiguration configuration = new SSHConfiguration(
+ "192.168.2.15", 22, "root", "qatest", 3);
+
+ return DeviceMachineFactory.createSSHMachine("Maemo_Device",
+ configuration, null);
+ }
+
+ protected boolean cannotRunTest() {
+ if (!machine.isAlive())
+ fail("Machine " + machine.getURI() + " is not alive");
+
+ return false;
+ }
+}
Added: trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHConfigurationFile.java
===================================================================
--- trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHConfigurationFile.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHConfigurationFile.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,364 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Mar 26, 2008
+ *******************************************************************************/
+package org.maemo.esbox.device.tests.sbrsh;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.junit.Test;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.tests.TestUtils;
+import org.maemo.esbox.device.core.sbrsh.*;
+import org.maemo.esbox.internal.device.tests.TestActivator;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+/**
+ * @author LWang.
+ *
+ */
+public class TestSBRSHConfigurationFile extends TestCase {
+
+ /**
+ * Test method for {@link org.maemo.esbox.core.sbrsh.SBRSHConfigurationFileFactory#parse(File)}.
+ */
+ @Test
+ public void testParse() {
+ String[] goodFiles = {
+ "v0.sbrsh",
+ "v1.sbrsh",
+ "v2.sbrsh"
+ };
+
+ String[] wrongFiles = {
+ "err0.sbrsh",
+ "err1.sbrsh",
+ "err2.sbrsh"
+ };
+
+ File testFile = null;
+
+ SBRSHConfigurationFile scf = null;
+
+ //===== Positive cases ===================
+
+ for (String fileName : goodFiles) {
+ try {
+ testFile = TestUtils.projectRelativeFile(TestActivator.PLUGIN_ID, "data/" + fileName);
+ } catch (Exception e) {
+ fail("Cannot find test data file: " + fileName);
+ }
+
+ scf = new SBRSHConfigurationFile();
+
+ try {
+ scf = SBRSHConfigurationFileFactory.parse(EFS.getLocalFileSystem().fromLocalFile(testFile));
+ } catch (ESboxException e) {
+ fail("Error parsing " + fileName + ": " + e.getMessage());
+ }
+
+ assertTrue(scf.isValid());
+
+ System.out.println("\n====== reconstructed " + fileName);
+ System.out.print(scf.toString());
+
+ System.out.print("\n====== List of target names: \n\t");
+ for (String name : scf.getTargetNames())
+ System.out.print(name + " ");
+
+ System.out.println("\n");
+ }
+
+ // test saveToFile() based on the last good file.
+ IFileStore store = EFS.getLocalFileSystem().getStore(HostUtils.getTemporaryPath().append("_generated.sbrsh"));
+
+ try {
+ scf.saveToFile(store);
+ } catch (IOException e1) {
+ fail("Save to file fail: " + e1.getMessage());
+ }
+
+ System.out.println("Please examine the auto-generated configuration file: \n\t " + testFile.getAbsolutePath());
+
+ //======= Negative cases ================================
+
+ System.out.print("\n=========== Negative cases: \n\n");
+
+ for (String fileName : wrongFiles) {
+ try {
+ testFile = TestUtils.projectRelativeFile(TestActivator.PLUGIN_ID, "data/" + fileName);
+ } catch (Exception e) {
+ fail("Cannot find test data file: " + fileName);
+ }
+
+ scf = new SBRSHConfigurationFile();
+
+ try {
+ scf = SBRSHConfigurationFileFactory.parse(EFS.getLocalFileSystem().fromLocalFile(testFile));
+ } catch (ESboxException e) {
+ System.out.println("Got expected error parsing " + fileName + ": " + e.getMessage());
+ }
+
+ assertFalse(scf.isValid());
+ }
+ }
+
+ /**
+ * Test method for {@link org.maemo.esbox.core.sbrsh.SBRSHConfigurationFileFactory#parse(String)}.
+ */
+ @Test
+ public void testParseString() {
+ String fileData =
+ "sshfs-target tablet\n" +
+ "\t ssh maemo at host:/home/chinook40_armel/ / rw,nonempty,allow_other \n" +
+ "\t ssh maemo at host:/home/maemo/ /home/maemo rw,nonempty,allow_other \n" +
+ "\t bind /tmp /tmp \n" +
+ "\t bind /dev /dev \n";
+
+ SBRSHConfigurationFile scf = new SBRSHConfigurationFile();
+
+ try {
+ scf = SBRSHConfigurationFileFactory.parse(fileData);
+ } catch (ESboxException e) {
+ fail("Got error: " + e.getMessage());
+ }
+
+ assertTrue(scf.isValid());
+ assertEquals(1, scf.getTargets().size());
+ assertEquals(4, scf.getTargets().get(0).getMounts().size());
+
+ //======= Error cases ==============
+
+ // Case #1:
+ fileData = "sshfs-target tablet:\n";
+ scf = new SBRSHConfigurationFile();
+ try {
+ scf = SBRSHConfigurationFileFactory.parse(fileData);
+ } catch (ESboxException e) {
+ assertTrue(e.getMessage().contains("Port number expected"));
+ }
+ assertFalse(scf.isValid());
+
+ // Case #2
+ fileData = "MyTarget tablet:a123\n";
+ scf = new SBRSHConfigurationFile();
+ try {
+ scf = SBRSHConfigurationFileFactory.parse(fileData);
+ } catch (ESboxException e) {
+ assertTrue(e.getMessage().contains("Invalid port number"));
+ }
+ assertFalse(scf.isValid());
+
+ // Case #3
+ fileData = "MyTarget tablet:123 illegaltext\n";
+ scf = new SBRSHConfigurationFile();
+ try {
+ scf = SBRSHConfigurationFileFactory.parse(fileData);
+ } catch (ESboxException e) {
+ assertTrue(e.getMessage().contains("Illegal text"));
+ }
+ assertFalse(scf.isValid());
+ }
+
+ /**
+ * Test method for {@link org.maemo.esbox.core.sbrsh.SBRSHConfigurationFileFactory#parseMount(java.lang.String)}.
+ */
+ @Test
+ public void testParseMount() {
+ SBRSHMount mount = new SBRSHMount();
+ String line;
+
+ try {
+ line = "nfs 1.2.3.4:/a/b/c / rw,nolock";
+ mount = SBRSHConfigurationFileFactory.parseMount(line);
+ } catch (ESboxException e) {
+ fail("Failed: " + e.getMessage());
+ }
+ assertEquals("nfs", mount.getType());
+ assertEquals("1.2.3.4", mount.getHost());
+ assertEquals("/a/b/c", mount.getHostPath());
+ assertEquals("/", mount.getTargetPath());
+ assertEquals("rw,nolock", mount.getMountOptions());
+
+ assertTrue(mount.isValid());
+
+ System.out.println(mount.toString());
+
+ try {
+ line = "ssh maemo at 1.2.3.4:/a/b/c /target/a rw,allow_other";
+ mount = SBRSHConfigurationFileFactory.parseMount(line);
+ } catch (ESboxException e) {
+ fail("Failed: " + e.getMessage());
+ }
+ assertEquals("ssh", mount.getType());
+ assertEquals("maemo", mount.getHostUser());
+ assertEquals("1.2.3.4", mount.getHost());
+ assertEquals("/a/b/c", mount.getHostPath());
+ assertEquals("/target/a", mount.getTargetPath());
+ assertEquals("rw,allow_other", mount.getMountOptions());
+
+ assertTrue(mount.isValid());
+
+ System.out.println(mount.toString());
+
+ try {
+ line = "bind /abc /def";
+ mount = SBRSHConfigurationFileFactory.parseMount(line);
+ } catch (ESboxException e) {
+ fail("Failed: " + e.getMessage());
+ }
+ assertEquals("bind", mount.getType());
+ assertEquals("/abc", mount.getHostPath());
+ assertEquals("/def", mount.getTargetPath());
+
+ assertTrue(mount.isValid());
+
+ System.out.println(mount.toString());
+
+ //=========== Error case test. ========================
+
+ mount = new SBRSHMount(); // an invalid mount
+
+ try {
+ line = "sSh maemo at 1.2.3.4:/a/b /target/a rw";
+ mount = SBRSHConfigurationFileFactory.parseMount(line);
+ } catch (ESboxException e) {
+ assertTrue(e.getMessage().contains("Invalid mount type"));
+ }
+ assertFalse(mount.isValid());
+
+ try {
+ line = "nfs maemo at 1.2.3.4:/a/b /target/a rw";
+ mount = SBRSHConfigurationFileFactory.parseMount(line);
+ } catch (ESboxException e) {
+ assertTrue(e.getMessage().contains("Invalid host"));
+ }
+ assertFalse(mount.isValid());
+
+ try {
+ line = "nfs";
+ mount = SBRSHConfigurationFileFactory.parseMount(line);
+ } catch (ESboxException e) {
+ assertTrue(e.getMessage().contains("missing host"));
+ }
+
+ try {
+ line = "nfs wronghostshare /a/b";
+ mount = SBRSHConfigurationFileFactory.parseMount(line);
+ } catch (ESboxException e) {
+ assertTrue(e.getMessage().contains("Invalid host share"));
+ }
+
+ try {
+ line = "nfs user at host:/tmp /a/b";
+ mount = SBRSHConfigurationFileFactory.parseMount(line);
+ } catch (ESboxException e) {
+ assertTrue(e.getMessage().contains("Invalid host name"));
+ }
+
+ try {
+ line = "ssh user at host /a/b";
+ mount = SBRSHConfigurationFileFactory.parseMount(line);
+ } catch (ESboxException e) {
+ assertTrue(e.getMessage().contains("Invalid host share"));
+ }
+
+ try {
+ line = "ssh user at host:/a/b";
+ mount = SBRSHConfigurationFileFactory.parseMount(line);
+ } catch (ESboxException e) {
+ assertTrue(e.getMessage().contains("missing destination"));
+ }
+
+
+ assertFalse(mount.isValid());
+ }
+
+ /**
+ * Test method for {@link org.maemo.esbox.core.sbrsh.SBRSHConfigurationFile#isValidPortNumber(java.lang.String)}.
+ */
+ @Test
+ public void testIsValidPortNumber() {
+ assertTrue(GeneralUtils.isValidPortNumber("5432"));
+ assertFalse(GeneralUtils.isValidPortNumber("5a32"));
+ }
+
+ /**
+ * Test method for {@link org.maemo.esbox.core.sbrsh.SBRSHConfigurationFile#isValidNameOrIP(java.lang.String)}.
+ */
+ @Test
+ public void testIsValidNameOrIP() {
+ assertTrue(GeneralUtils.isValidNameOrIP("hostname"));
+ assertTrue(GeneralUtils.isValidNameOrIP("host_123"));
+ assertTrue(GeneralUtils.isValidNameOrIP("1.23.345.0"));
+
+ assertFalse(GeneralUtils.isValidPortNumber("wrong+hostname"));
+ assertFalse(GeneralUtils.isValidPortNumber("1.2"));
+ assertFalse(GeneralUtils.isValidPortNumber("1234.2.3.4"));
+ assertFalse(GeneralUtils.isValidPortNumber("1.3.f.5"));
+ assertFalse(GeneralUtils.isValidPortNumber("1.3,4.5"));
+ }
+
+ @Test
+ public void testGetMountLocationOnTarget() {
+ String fileData =
+ // Target #1
+ "Target01 1.2.3.4\n" +
+ "\t ssh maemo at host:/home/chinook40_armel/ / rw,nonempty,allow_other \n" +
+ "\t ssh maemo at host:/home/maemo/ /mnt/home/maemo rw,nonempty,allow_other \n" +
+ // Overlapped mounts
+ "\t ssh maemo at host:/home/maemo/sub /mnt/home/maemosub rw,nonempty,allow_other \n" +
+ "\t bind /tmp /tmp \n" +
+ "\t bind /dev /dev \n" +
+ "\n" +
+ // target #2
+ "Target02 4.3.2.1\n" +
+ "\t ssh maemo at host:/home/abc/def /usr/mnt rw,nonempty,allow_other \n";
+
+ SBRSHConfigurationFile scf = new SBRSHConfigurationFile();
+
+ try {
+ scf = SBRSHConfigurationFileFactory.parse(fileData);
+ } catch (ESboxException e) {
+ fail("Got error:" + e.getMessage());
+ }
+
+ assertTrue(scf.isValid());
+ assertEquals(2, scf.getTargets().size());
+ assertEquals(5, scf.getTargets().get(0).getMounts().size());
+
+ //===== Positive cases.========
+
+ assertEquals("/mnt/home/maemo/a",
+ scf.getMountLocationOnTarget("/home/maemo/a", null));
+
+ // test with overlapped mounts.
+ assertEquals("/mnt/home/maemo/sub/a", // not "/mnt/home/maemosub/a".
+ scf.getMountLocationOnTarget("/home/maemo/sub/a", null));
+
+ assertEquals("/mnt/home/maemo/project/subdir",
+ scf.getMountLocationOnTarget("/home/maemo/project/subdir", null));
+
+ assertEquals("/usr/mnt/1/2/3.c",
+ scf.getMountLocationOnTarget("/home/abc/def/1/2/3.c", "Target02"));
+
+ //====== negative cases:
+
+ // Paths not in the mounts
+ assertEquals("", scf.getMountLocationOnTarget("/home/ubuntu/project/subdir", null));
+ // "/home/maemo2" not child of "/home/maemo"
+ assertEquals("", scf.getMountLocationOnTarget("/home/maemo2", null));
+ // Folder in "bind" mount.
+ assertEquals("", scf.getMountLocationOnTarget("/tmp/maemo2", null));
+ }
+}
Added: trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHFileSystemMapping.java
===================================================================
--- trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHFileSystemMapping.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHFileSystemMapping.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,243 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.device.tests.sbrsh;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
+import org.maemo.esbox.core.tests.core.BaseTest;
+import org.maemo.esbox.device.core.sbrsh.*;
+import org.maemo.esbox.internal.device.core.sbrsh.SBRSHFileSystemMapping;
+import org.maemo.esbox.internal.ssh.QemuMachine;
+import org.maemo.esbox.internal.ssh.StockQemuConfiguration;
+
+/**
+ * @author eswartz
+ *
+ */
+public class TestSBRSHFileSystemMapping extends BaseTest {
+ private IMachine machine;
+ private SBRSHConfigurationFile sbrshFile;
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ machine = new QemuMachine(new StockQemuConfiguration());
+
+ String fileTemplate =
+ "MAEMO ${TARGET}\n" +
+ "\t ssh ${USER}@${HOST}:/scratchbox/users/devel/targets/CHINOOK_ARMEL/ / rw,nonempty,allow_other,port=${HOST_PORT}\n" +
+ "\t ssh ${USER}@${HOST}:/scratchbox/users/devel/home/devel/ /home/devel/ rw,nonempty,allow_other,port=${HOST_PORT}\n" +
+ "\t bind /tmp /tmp \n" +
+ "\t bind /dev /dev \n" +
+ "\t bind /dev/pts /dev/pts \n" +
+ "\t bind /proc /proc \n" +
+ "\t bind /sys /sys \n" +
+ "\t bind /var /var \n" +
+ "\n" +
+ "MAEMO_MIXED ${TARGET}\n" +
+ "\t ssh ${USER}@${HOST}:/scratchbox/users/devel/targets/CHINOOK_ARMEL/ / rw,nonempty,allow_other,port=${HOST_PORT}\n" +
+ "\t ssh someone at anotherhost:/scratchbox/users/devel/home/devel/ /home/devel/ rw,nonempty,allow_other,port=${HOST_PORT}\n" +
+ "\t bind /tmp /tmp \n" +
+ "\t bind /dev /dev \n" +
+ "\t bind /dev/pts /dev/pts \n" +
+ "\t bind /proc /proc \n" +
+ "\t bind /sys /sys \n" +
+ "\t bind /var /var \n" +
+ "\n" +
+ "MAEMO_ALIASING ${TARGET}\n" +
+ "\t ssh ${USER}@${HOST}:/scratchbox/users/devel/targets/CHINOOK_ARMEL/ / rw,nonempty,allow_other,port=${HOST_PORT}\n" +
+ "\t ssh ${USER}@${HOST}:/scratchbox/users/devel/targets/CHINOOK_ARMEL/usr/local/bin /usr/bin/ rw,nonempty,allow_other,port=${HOST_PORT}\n" +
+ "\t bind /tmp /tmp \n" +
+ "\t bind /dev /dev \n" +
+ "\t bind /dev/pts /dev/pts \n" +
+ "\t bind /proc /proc \n" +
+ "\t bind /sys /sys \n" +
+ "\t bind /var /var \n";
+
+
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+
+ substitutor.define("TARGET", machine.getURI().getHost());
+ substitutor.define("TARGET_PORT", "1202");
+ substitutor.define("USER", machine.getUserName());
+ substitutor.define("HOST", "192.168.2.14");
+ substitutor.define("HOST_PORT", "2222");
+
+ String sbrshConfig = substitutor.substitute(fileTemplate);
+
+ sbrshFile = SBRSHConfigurationFileFactory.parse(sbrshConfig);
+ }
+
+ /**
+ * @param target
+ * @return
+ * @throws ESboxException
+ */
+ private SBRSHFileSystemMapping createFileSystemMapping(SBRSHTarget target)
+ throws ESboxException {
+ return new SBRSHFileSystemMapping(target,
+ machine.getFileSystemMapping().getTargetPathCanonicalizer(),
+ "192.168.2.14");
+ }
+
+ public void testHostToTargetMappingExpected() throws Exception {
+ SBRSHTarget target = sbrshFile.getTarget("MAEMO");
+ SBRSHFileSystemMapping mapping = createFileSystemMapping(target);
+
+ IPath[] targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/"));
+ assertNotNull(targetRoots);
+ assertEquals(1, targetRoots.length);
+ assertEquals(new Path("/"), targetRoots[0]);
+
+ // child of first mount
+ targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/usr/bin/ls"));
+ assertNotNull(targetRoots);
+ assertEquals(1, targetRoots.length);
+ assertEquals(new Path("/usr/bin/ls"), targetRoots[0]);
+
+ // child of second mount
+ targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/devel/home/devel/foo"));
+ assertNotNull(targetRoots);
+ assertEquals(1, targetRoots.length);
+ assertEquals(new Path("/home/devel/foo"), targetRoots[0]);
+ }
+
+ public void testHostToTargetMappingMisses() throws Exception {
+ SBRSHTarget target = sbrshFile.getTarget("MAEMO");
+ SBRSHFileSystemMapping mapping = createFileSystemMapping(target);
+
+ IPath[] targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/blah"));
+ assertNotNull(targetRoots);
+ assertEquals(0, targetRoots.length);
+
+ // this is not at all visible
+ targetRoots = mapping.convertHostToTargetPaths(new Path("/tmpo/bad"));
+ assertNotNull(targetRoots);
+ assertEquals(0, targetRoots.length);
+
+ // this resolves to /tmp which is a bind mount
+ targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/tmp"));
+ assertNotNull(targetRoots);
+ assertEquals(0, targetRoots.length);
+
+ // this resolves to /var which is a bind mount
+ targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/var/log/sbrshd.log"));
+ assertNotNull(targetRoots);
+ assertEquals(0, targetRoots.length);
+
+ // not to be confused
+ targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/devel/home/devel/tmp/foo"));
+ assertNotNull(targetRoots);
+ assertEquals(1, targetRoots.length);
+ assertEquals(new Path("/home/devel/tmp/foo"), targetRoots[0]);
+
+ }
+
+ public void testHostToTargetMappingMixedHosts() throws Exception {
+ SBRSHTarget target = sbrshFile.getTarget("MAEMO_MIXED");
+ SBRSHFileSystemMapping mapping = createFileSystemMapping(target);
+
+ // not visible because it's not on the same machine
+ IPath[] targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/devel/home/devel/foo"));
+ assertNotNull(targetRoots);
+ assertEquals(0, targetRoots.length);
+
+ // child of first mount
+ targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/usr/bin/ls"));
+ assertNotNull(targetRoots);
+ assertEquals(1, targetRoots.length);
+ assertEquals(new Path("/usr/bin/ls"), targetRoots[0]);
+
+ }
+
+ public void testTargetToHostMappingExpected() throws Exception {
+ SBRSHTarget target = sbrshFile.getTarget("MAEMO");
+ SBRSHFileSystemMapping mapping = createFileSystemMapping(target);
+
+ // first mount
+ IPath hostPath = mapping.convertTargetToHostPath(new Path("/"));
+ assertNotNull(hostPath);
+ assertEquals(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL"), hostPath);
+
+ // child of first mount
+ hostPath = mapping.convertTargetToHostPath(new Path("/usr/bin/ls"));
+ assertNotNull(hostPath);
+ assertEquals(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/usr/bin/ls"), hostPath);
+
+ // child of second mount
+ hostPath = mapping.convertTargetToHostPath(new Path("/home/devel/foo"));
+ assertNotNull(hostPath);
+ assertEquals(new Path("/scratchbox/users/devel/home/devel/foo"), hostPath);
+ }
+
+ public void testTargetToHostMappingMisses() throws Exception {
+ SBRSHTarget target = sbrshFile.getTarget("MAEMO");
+ SBRSHFileSystemMapping mapping = createFileSystemMapping(target);
+
+ // bind mounts
+ IPath hostPath = mapping.convertTargetToHostPath(new Path("/tmp/foo"));
+ assertNull(hostPath);
+
+ hostPath = mapping.convertTargetToHostPath(new Path("/var"));
+ assertNull(hostPath);
+
+ hostPath = mapping.convertTargetToHostPath(new Path("/dev/pts/0"));
+ assertNull(hostPath);
+ }
+
+ public void testTargetToHostMappingMixed() throws Exception {
+ SBRSHTarget target = sbrshFile.getTarget("MAEMO_MIXED");
+ SBRSHFileSystemMapping mapping = createFileSystemMapping(target);
+
+ // not visible because it's from another host
+ IPath hostPath = mapping.convertTargetToHostPath(new Path("/home/devel/foo"));
+ assertNull(hostPath);
+
+ hostPath = mapping.convertTargetToHostPath(new Path("/bin/ls"));
+ assertNotNull(hostPath);
+ assertEquals(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/bin/ls"), hostPath);
+ }
+
+ public void testMappingAliasing() throws Exception {
+ SBRSHTarget target = sbrshFile.getTarget("MAEMO_ALIASING");
+ SBRSHFileSystemMapping mapping = createFileSystemMapping(target);
+
+ // this is aliased to two places
+ IPath[] targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/usr/local/bin/ls"));
+ assertNotNull(targetRoots);
+ assertEquals(2, targetRoots.length);
+ assertEquals(new Path("/usr/local/bin/ls"), targetRoots[0]);
+ assertEquals(new Path("/usr/bin/ls"), targetRoots[1]);
+
+ // not aliased, but also not visible, since /usr/bin is hidden
+ targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/usr/bin/ls"));
+ assertNotNull(targetRoots);
+ assertEquals(0, targetRoots.length);
+
+ // unrelated
+ targetRoots = mapping.convertHostToTargetPaths(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/bin/ls"));
+ assertNotNull(targetRoots);
+ assertEquals(1, targetRoots.length);
+ assertEquals(new Path("/bin/ls"), targetRoots[0]);
+
+ // go through alias
+ IPath hostPath = mapping.convertTargetToHostPath(new Path("/usr/bin/ls"));
+ assertEquals(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/usr/local/bin/ls"), hostPath);
+
+ // go through normal
+ hostPath = mapping.convertTargetToHostPath(new Path("/usr/local/bin/ls"));
+ assertEquals(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/usr/local/bin/ls"), hostPath);
+
+ // unrelated
+ hostPath = mapping.convertTargetToHostPath(new Path("/usr/sbin/snog"));
+ assertEquals(new Path("/scratchbox/users/devel/targets/CHINOOK_ARMEL/usr/sbin/snog"), hostPath);
+ }
+
+
+}
Added: trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHMachine.java
===================================================================
--- trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHMachine.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHMachine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,253 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.device.tests.sbrsh;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.core.tests.TestUtils;
+import org.maemo.esbox.core.tests.core.BaseTest;
+import org.maemo.esbox.device.core.sbrsh.*;
+import org.maemo.esbox.internal.api.ssh.DeviceSSHLinuxMachine;
+import org.maemo.esbox.internal.device.core.sbrsh.SBRSHMachine;
+import org.maemo.esbox.internal.ssh.*;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+import org.maemo.esbox.ssh.*;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.List;
+import java.util.Properties;
+
+
+/**
+ * @author eswartz
+ *
+ */
+public class TestSBRSHMachine extends BaseTest {
+ private static IScratchboxSDKTarget[] sdkTargets;
+ private static IScratchboxSDKTarget theSB1SDKTarget;
+
+
+ private SBRSHCommandConfiguration sbrshConfiguration;
+ private IMachine sbrshHostMachine;
+ private SBRSHConfigurationFile sbrshFile;
+ private IPath sbrshPath;
+ private SBRSHMachine sbrshMachine;
+ private DeviceSSHLinuxMachine deviceMachine;
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ if (HostUtils.isWindows())
+ sbrshHostMachine = new QemuMachine(new StockQemuConfiguration());
+ else
+ sbrshHostMachine = MachineRegistry.getInstance().getLocalMachine();
+ MachineManager.getInstance().acquireMachine(sbrshHostMachine, null);
+
+ sdkTargets = ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets();
+ for (ISDKTarget target : sdkTargets) {
+ // TODO: check platform/target
+ if (target instanceof IScratchbox1SDKTarget
+ && target.getName().equals("CHINOOK_ARMEL")) {
+ theSB1SDKTarget = (IScratchboxSDKTarget) target;
+ }
+ }
+ assertNotNull(theSB1SDKTarget);
+
+ sbrshConfiguration = new SBRSHCommandConfiguration();
+
+ IPath sharedPathHost = TestUtils.getKnownSBVisibleWorkspacePath();
+ IPath sharedPath = sbrshHostMachine.getFileSystemMapping().convertHostToTargetPath(sharedPathHost);
+
+ sbrshPath = sharedPath.append(".sbrsh_unittest");
+ sbrshConfiguration.setConfigurationFile(sbrshPath);
+
+ sbrshFile = SBRSHConfigurationFileFactory.createStockSBRSHConfigurationFile(
+ theSB1SDKTarget, sharedPathHost.toPortableString(),
+ "devel",
+ // these are from the perspective of the remote machine
+ "192.168.2.14", 2222,
+ //machine.getURI().getHost(), machine.getURI().getPort(),
+ "192.168.2.15", -1);
+
+ sbrshFile.saveToFile(sbrshHostMachine.getFileSystemAccess().getFileStore(sbrshPath));
+
+ SSHConfiguration deviceSSHConfiguration = new SSHConfiguration(
+ "192.168.2.15", -1, "devel", "qatest", 10);
+ deviceMachine = new DeviceSSHLinuxMachine("Nokia N95 (SSH)", deviceSSHConfiguration, null);
+
+ sbrshMachine = new SBRSHMachine("Nokia N95 (SBRSH)", sbrshHostMachine, deviceMachine, sbrshConfiguration, "192.168.2.14");
+ MachineManager.getInstance().acquireMachine(sbrshMachine, null);
+
+ }
+
+ /** Ensure that a simple launch works */
+ public void testSimple() throws Exception {
+ if (!validateMachine(sbrshMachine)) return;
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine("ls -m");
+ IProcessLauncherFactory factory = sbrshMachine.getProcessLauncherFactory();
+ IProcessLauncher launcher = factory.createProcessLaunchHandler(null, cmdLine, null);
+ Process process = launcher.createProcess();
+
+ // this variant waits for the process to finish before consuming output
+ //
+ // this is unsafe in normal cases!
+ int exit = process.waitFor();
+
+ InputStream is = process.getInputStream();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ int ch;
+ while ((ch = is.read()) != -1)
+ out.write(ch);
+ is = process.getErrorStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ while ((ch = is.read()) != -1)
+ err.write(ch);
+ System.out.println("out:\n" + out + "\n\nerr:\n"+ err);
+ assertEquals(0, exit);
+
+ }
+
+ /** Ensure environment variables are passed properly */
+ public void testEnvVars() throws Exception {
+ if (!validateMachine(sbrshMachine)) return;
+ List<String> cmdLine = CommandLineArguments.wrapScriptCommandLineForShell(
+ CommandLineArguments.createFromCommandLine("echo $CC,$LD/"));
+ Properties env = new Properties();
+ env.put("CC", "gcc");
+ env.put("LD", "1 2 3");
+
+ IProcessLauncherFactory factory = sbrshMachine.getProcessLauncherFactory();
+ IProcessLauncher launcher = factory.createProcessLaunchHandler(null, cmdLine, env);
+ Process process = launcher.createProcess();
+ int exit = process.waitFor();
+
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ InputStream is = process.getErrorStream();
+ int ch;
+ while ((ch = is.read()) != -1)
+ err.write(ch);
+ assertEquals("", err.toString());
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ is = process.getInputStream();
+ while ((ch = is.read()) != -1)
+ out.write(ch);
+ assertStdTextEquals("gcc,1 2 3/\n", out.toString());
+
+ assertEquals(0, exit);
+
+ }
+
+ public void testFileSystemMapping() throws Exception {
+ if (!validateMachine(sbrshMachine)) return;
+
+ IPath target = sbrshMachine.getFileSystemMapping().convertHostToTargetPath(theSB1SDKTarget.getSDKTargetRoot());
+ assertEquals(new Path("/"), target);
+ }
+
+ public void testFileSystemAccess() throws Exception {
+ if (!validateMachine(sbrshMachine)) return;
+
+ IFileSystemAccess access = sbrshMachine.getFileSystemAccess();
+
+ // root is mounted as root on ssh host
+ URI uri = access.getURIForPath(new Path("/"));
+ assertIsSbrshHost(uri);
+
+ // /dev is bound to device
+ uri = access.getURIForPath(new Path("/dev"));
+ assertIsDevice(uri);
+
+ doTestChildren(access);
+ }
+
+ /**
+ * @param access
+ * @throws CoreException
+ */
+ private void doTestChildren(IFileSystemAccess access) throws CoreException {
+ // ensure the child/parent relationships work
+ IFileStore dir = access.getFileStore(new Path("/"));
+ IFileStore[] stores = dir.childStores(0, null);
+ assertNotNull(stores);
+ assertTrue(stores.length > 8);
+ for (IFileStore store : stores) {
+ assertTrue(store.fetchInfo().exists());
+ if (store.getName().equals("dev")
+ || store.getName().equals("tmp")) {
+ assertIsDevice(store.toURI());
+ assertEquals(dir, store.getParent());
+ assertIsDevice(store.getParent().getChild(store.getName()).toURI());
+ } else if (store.getName().equals("usr")
+ || store.getName().equals("sbin")) {
+ assertIsSbrshHost(store.toURI());
+ assertEquals(dir, store.getParent());
+ }
+ }
+ }
+
+ /**
+ * @param uri
+ */
+ private void assertIsDevice(URI uri) {
+ assertEquals("ssh", uri.getScheme());
+ assertEquals("192.168.2.15", uri.getHost());
+ assertTrue(!uri.getPath().contains("scratchbox"));
+ }
+
+ /**
+ * @param uri
+ */
+ private void assertIsSbrshHost(URI uri) {
+ assertEquals(sbrshHostMachine.getURI().getScheme(), uri.getScheme());
+ if (!uri.getScheme().equals("file"))
+ assertEquals(sbrshHostMachine.getURI().getHost(), uri.getHost());
+ assertTrue(uri.getPath().contains("scratchbox"));
+ }
+
+ public void testChangingTarget() throws Exception {
+ if (!validateMachine(sbrshMachine)) return;
+
+
+ IFileSystemAccess access = sbrshMachine.getFileSystemAccess();
+
+ // home is mounted in sbrsh host
+ URI uri = access.getURIForPath(new Path("/"));
+ assertIsSbrshHost(uri);
+
+ ////
+ // now, change the target (+ configuration)
+
+ IPath sharedPathHost = TestUtils.getKnownSBVisibleWorkspacePath();
+ IPath sharedPath = sbrshHostMachine.getFileSystemMapping().convertHostToTargetPath(sharedPathHost);
+ sbrshPath = sharedPath.append(".sbrsh_unittest_2");
+ sbrshConfiguration.setConfigurationFile(sbrshPath);
+
+ sbrshFile = SBRSHConfigurationFileFactory.parse(
+ "NewTarget 192.168.2.14\n"+
+ "ssh devel at 192.168.2.14:/scratchbox/another/root / rw,allow_other\n"+
+ "bind /dev /dev\n");
+
+ sbrshFile.saveToFile(sbrshHostMachine.getFileSystemAccess().getFileStore(sbrshPath));
+ sbrshMachine.setCommandConfiguration(sbrshConfiguration);
+ ////////
+
+ access = sbrshMachine.getFileSystemAccess();
+
+ // root is mounted in sbrsh host, but another location
+ URI uri2 = access.getURIForPath(new Path("/"));
+ assertIsSbrshHost(uri2);
+
+ assertFalse(uri.equals(uri2));
+ }
+}
Added: trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHProcessLauncherFactory.java
===================================================================
--- trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHProcessLauncherFactory.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/device/tests/sbrsh/TestSBRSHProcessLauncherFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,141 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.device.tests.sbrsh;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.core.tests.TestUtils;
+import org.maemo.esbox.core.tests.core.BaseTest;
+import org.maemo.esbox.device.core.sbrsh.*;
+import org.maemo.esbox.internal.device.core.sbrsh.SBRSHProcessLauncherFactory;
+import org.maemo.esbox.internal.ssh.QemuMachine;
+import org.maemo.esbox.internal.ssh.StockQemuConfiguration;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Properties;
+
+
+/**
+ * This tests the basic SBRSH process launcher.
+ *
+ * <p>
+ * <b>NOTE</b>: a device MUST be connected and enabled for this test to work -- it will
+ * hang otherwise, since sbrsh is stupid and has no timeouts on connect.
+ * @author eswartz
+ *
+ */
+public class TestSBRSHProcessLauncherFactory extends BaseTest {
+ private static IScratchboxSDKTarget[] sdkTargets;
+ private static IScratchboxSDKTarget theSB1SDKTarget;
+
+
+ private SBRSHCommandConfiguration sbrshConfiguration;
+ private IMachine machine;
+ private SBRSHConfigurationFile sbrshFile;
+ private IPath sbrshPath;
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ if (HostUtils.isWindows())
+ machine = new QemuMachine(new StockQemuConfiguration());
+ else
+ machine = MachineRegistry.getInstance().getLocalMachine();
+ MachineManager.getInstance().acquireMachine(machine, null);
+
+ sdkTargets = ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets();
+ for (ISDKTarget target : sdkTargets) {
+ // TODO: check platform/target
+ if (target instanceof IScratchbox1SDKTarget
+ && target.getName().equals("CHINOOK_ARMEL")) {
+ theSB1SDKTarget = (IScratchboxSDKTarget) target;
+ }
+ }
+ assertNotNull(theSB1SDKTarget);
+
+ sbrshConfiguration = new SBRSHCommandConfiguration();
+
+ IPath sharedPathHost = TestUtils.getKnownSBVisibleWorkspacePath();
+ IPath sharedPath = machine.getFileSystemMapping().convertHostToTargetPath(sharedPathHost);
+
+ sbrshPath = sharedPath.append(".sbrsh_unittest");
+ sbrshConfiguration.setConfigurationFile(sbrshPath);
+
+ sbrshFile = SBRSHConfigurationFileFactory.createStockSBRSHConfigurationFile(
+ theSB1SDKTarget, sharedPathHost.toPortableString(),
+ "devel",
+ // TODO: these are from the perspective of the remote machine
+ "192.168.2.14", 2222,
+ //machine.getURI().getHost(), machine.getURI().getPort(),
+ "192.168.2.15", -1);
+
+ sbrshFile.saveToFile(machine.getFileSystemAccess().getFileStore(sbrshPath));
+ }
+
+ /** Ensure that a simple launch works */
+ public void testSimple() throws Exception {
+ if (!validateMachine(machine)) return;
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine("ls -m");
+ IProcessLauncherFactory factory = new SBRSHProcessLauncherFactory(sbrshConfiguration, machine);
+ IProcessLauncher launcher = factory.createProcessLaunchHandler(null, cmdLine, null);
+ Process process = launcher.createProcess();
+
+ // this variant waits for the process to finish before consuming output
+ //
+ // this is unsafe in normal cases!
+ int exit = process.waitFor();
+
+ InputStream is = process.getInputStream();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ int ch;
+ while ((ch = is.read()) != -1)
+ out.write(ch);
+ is = process.getErrorStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ while ((ch = is.read()) != -1)
+ err.write(ch);
+ System.out.println("out:\n" + out + "\n\nerr:\n"+ err);
+ assertEquals(0, exit);
+
+ }
+
+ /** Ensure environment variables are passed properly */
+ public void testEnvVars() throws Exception {
+ if (!validateMachine(machine)) return;
+ List<String> cmdLine = CommandLineArguments.wrapScriptCommandLineForShell(
+ CommandLineArguments.createFromCommandLine("echo $CC,$LD/"));
+ Properties env = new Properties();
+ env.put("CC", "gcc");
+ env.put("LD", "1 2 3");
+
+ IProcessLauncherFactory factory = new SBRSHProcessLauncherFactory(sbrshConfiguration, machine);
+ IProcessLauncher launcher = factory.createProcessLaunchHandler(null, cmdLine, env);
+ Process process = launcher.createProcess();
+ int exit = process.waitFor();
+
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ InputStream is = process.getErrorStream();
+ int ch;
+ while ((ch = is.read()) != -1)
+ err.write(ch);
+ assertEquals("", err.toString());
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ is = process.getInputStream();
+ while ((ch = is.read()) != -1)
+ out.write(ch);
+ assertStdTextEquals("gcc,1 2 3/\n", out.toString());
+
+ assertEquals(0, exit);
+
+ }
+
+}
Added: trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/internal/device/tests/TestActivator.java
===================================================================
--- trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/internal/device/tests/TestActivator.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.tests/src/org/maemo/esbox/internal/device/tests/TestActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,50 @@
+package org.maemo.esbox.internal.device.tests;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TestActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.device.tests";
+
+ // The shared instance
+ private static TestActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public TestActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static TestActivator getDefault() {
+ return plugin;
+ }
+
+}
Property changes on: trunk/device/org.maemo.esbox.device.ui
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/device/org.maemo.esbox.device.ui/.classpath
===================================================================
--- trunk/device/org.maemo.esbox.device.ui/.classpath (rev 0)
+++ trunk/device/org.maemo.esbox.device.ui/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/device/org.maemo.esbox.device.ui/.project
===================================================================
--- trunk/device/org.maemo.esbox.device.ui/.project (rev 0)
+++ trunk/device/org.maemo.esbox.device.ui/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.device.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/device/org.maemo.esbox.device.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/device/org.maemo.esbox.device.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/device/org.maemo.esbox.device.ui/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:35:31 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/device/org.maemo.esbox.device.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/device/org.maemo.esbox.device.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/device/org.maemo.esbox.device.ui/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Device Support UI Plug-in
+Bundle-SymbolicName: org.maemo.esbox.device.ui
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.device.ui.UIActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: trunk/device/org.maemo.esbox.device.ui/build.properties
===================================================================
--- trunk/device/org.maemo.esbox.device.ui/build.properties (rev 0)
+++ trunk/device/org.maemo.esbox.device.ui/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/device/org.maemo.esbox.device.ui/src/org/maemo/esbox/internal/device/ui/UIActivator.java
===================================================================
--- trunk/device/org.maemo.esbox.device.ui/src/org/maemo/esbox/internal/device/ui/UIActivator.java (rev 0)
+++ trunk/device/org.maemo.esbox.device.ui/src/org/maemo/esbox/internal/device/ui/UIActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,132 @@
+package org.maemo.esbox.internal.device.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.device.ui";
+
+ // The shared instance
+ private static UIActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public UIActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return UIActivator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+
+}
Property changes on: trunk/linux/org.maemo.esbox.linux-feature
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/linux/org.maemo.esbox.linux-feature/.project
===================================================================
--- trunk/linux/org.maemo.esbox.linux-feature/.project (rev 0)
+++ trunk/linux/org.maemo.esbox.linux-feature/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.linux-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/linux/org.maemo.esbox.linux-feature/build.properties
===================================================================
--- trunk/linux/org.maemo.esbox.linux-feature/build.properties (rev 0)
+++ trunk/linux/org.maemo.esbox.linux-feature/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3 @@
+bin.includes = feature.xml,\
+ license.html,\
+ licenses/
Added: trunk/linux/org.maemo.esbox.linux-feature/feature.xml
===================================================================
--- trunk/linux/org.maemo.esbox.linux-feature/feature.xml (rev 0)
+++ trunk/linux/org.maemo.esbox.linux-feature/feature.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.maemo.esbox.linux"
+ label="ESbox Linux Support Feature"
+ version="1.5.0.qualifier"
+ provider-name="INdT / Nokia">
+
+ <description>
+ Linux-specific support for the ESbox project. This provides support for autotools projects, Debian package creation, apt package manager support, and pkg-config knowledge.
+ </description>
+
+ <copyright>
+ Copyright (c) 2007-2008 INdT, (c) 2007-2008 Nokia. All rights
+reserved.
+ </copyright>
+
+ <license url="http://www.eclipse.org/legal/epl-v10.html">
+ For legal terms, see the Eclipse Public License.
+ </license>
+
+ <url>
+ <update label="Update Site for ESbox project" url="http://esbox.garage.maemo.org/update"/>
+ </url>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.maemo.esbox.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.resources" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.project.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.expressions" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.linux.packages.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.ui" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.linux.autotools.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.ssh" version="1.5.0" match="greaterOrEqual"/>
+ <import feature="com.redhat.eclipse.cdt.autotools.feature" version="0.9.7"/>
+ <import feature="org.maemo.esbox.core" version="1.5.0.qualifier"/>
+ <import plugin="com.redhat.eclipse.cdt.autotools" version="0.9.7" match="greaterOrEqual"/>
+ </requires>
+
+ <plugin
+ id="org.maemo.esbox.linux.autotools.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.linux.autotools.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.linux.packages.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.linux.packages.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Added: trunk/linux/org.maemo.esbox.linux-feature/license.html
===================================================================
--- trunk/linux/org.maemo.esbox.linux-feature/license.html (rev 0)
+++ trunk/linux/org.maemo.esbox.linux-feature/license.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+<html>
+<head>
+<title>ESbox License</title>
+</head>
+
+<body>
+<h2>ESbox Software User Agreement</h2>
+<p>16<sup>th</sup> April, 2008</p>
+
+<h3>ESbox</h3>
+
+<p>ESbox is licensed under the terms of the <a href="licenses/epl-v10.html">Eclipse Public License v1.0</a>.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>ESbox has a set of open source templates to help the development of applications. Such templates are distributed
+under <a href="licenses/COPYING.LESSER">LGPL license.</a></p>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THIS CONTENT.</p>
+
+</body>
+</html>
Added: trunk/linux/org.maemo.esbox.linux-feature/licenses/COPYING
===================================================================
--- trunk/linux/org.maemo.esbox.linux-feature/licenses/COPYING (rev 0)
+++ trunk/linux/org.maemo.esbox.linux-feature/licenses/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/linux/org.maemo.esbox.linux-feature/licenses/COPYING.LESSER
===================================================================
--- trunk/linux/org.maemo.esbox.linux-feature/licenses/COPYING.LESSER (rev 0)
+++ trunk/linux/org.maemo.esbox.linux-feature/licenses/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/linux/org.maemo.esbox.linux-feature/licenses/epl-v10.html
===================================================================
--- trunk/linux/org.maemo.esbox.linux-feature/licenses/epl-v10.html (rev 0)
+++ trunk/linux/org.maemo.esbox.linux-feature/licenses/epl-v10.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ at font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+ at page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
Property changes on: trunk/linux/org.maemo.esbox.linux.autotools.core
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/.classpath
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/.classpath (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/.project
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/.project (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.linux.autotools.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:24:36 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Linux Autotools Core Plug-in
+Bundle-SymbolicName: org.maemo.esbox.linux.autotools.core
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.linux.autotools.core.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ com.redhat.eclipse.cdt.autotools;bundle-version="0.9.7"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.linux.autotools.core.model
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/build.properties
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/build.properties (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/Activator.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/Activator.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,118 @@
+package org.maemo.esbox.internal.linux.autotools.core;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.linux.autotools.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfConfigurationFile.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfConfigurationFile.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfConfigurationFile.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.autotools.core.model;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.linux.autotools.core.model.IAutoconfConfigurationFile;
+
+/**
+ * Implementation.
+ * @author eswartz
+ *
+ */
+public class AutoconfConfigurationFile extends AutoconfModelObject implements IAutoconfConfigurationFile {
+
+ private final IPath output;
+ private final IPath[] inputs;
+
+ /**
+ * @param output
+ * @param inputs
+ */
+ public AutoconfConfigurationFile(IPath output, IPath[] inputs) {
+ this.output = output;
+ this.inputs = inputs;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfConfigurationFile#getInputs()
+ */
+ public IPath[] getInputs() {
+ return inputs;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfConfigurationFile#getOutput()
+ */
+ public IPath getOutput() {
+ return output;
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfMacroCallVisitor.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfMacroCallVisitor.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfMacroCallVisitor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.autotools.core.model;
+
+import com.redhat.eclipse.cdt.autotools.ui.editors.parser.AutoconfElement;
+import com.redhat.eclipse.cdt.autotools.ui.editors.parser.AutoconfMacroElement;
+
+/**
+ * Visit the AutoconfMacro elements in an Autoconf tree
+ * @author eswartz
+ *
+ */
+public abstract class AutoconfMacroCallVisitor {
+ private final boolean visitArguments;
+
+ /**
+ * Create a visitor.
+ * @param visitArguments if true, search for macro calls inside
+ * macro call arguments
+ */
+ public AutoconfMacroCallVisitor(boolean visitArguments) {
+ this.visitArguments = visitArguments;
+ }
+
+ public void accept(AutoconfElement element) {
+ if (element instanceof AutoconfMacroElement) {
+ visit((AutoconfMacroElement) element);
+ if (!visitArguments)
+ return;
+ }
+
+ AutoconfElement[] kids = element.getChildren();
+ for (AutoconfElement kid : kids) {
+ accept(kid);
+ }
+ }
+
+ abstract public void visit(AutoconfMacroElement macro);
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfMacroUtils.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfMacroUtils.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfMacroUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.autotools.core.model;
+
+import com.nokia.cpp.internal.api.utils.core.TextUtils;
+
+import org.maemo.esbox.linux.autotools.core.model.IAutoconfModelMacroCall;
+
+import java.util.*;
+
+/**
+ * This class contains utilities that deal with macro calls, bridging the gap
+ * between the abstract m4 macro expansion and our knowledge about how such
+ * macros are used.
+ *
+ * @author eswartz
+ *
+ */
+public abstract class AutoconfMacroUtils {
+
+ /**
+ * Get the arguments, interpreted as a space-separated list of
+ * strings with line-catenation backslashes.
+ * @param call the macro call
+ * @return non-<code>null</code> list of Strings
+ */
+ public static String[] getShellListInterpretedArguments(IAutoconfModelMacroCall call) {
+ List<String> args = new ArrayList<String>();
+ for (String macroArg : call.getArguments()) {
+ args.addAll(Arrays.asList(getShellListInterpretedArgument(macroArg)));
+ }
+ return (String[]) args.toArray(new String[args.size()]);
+ }
+
+ /**
+ * Get the argument interpreted as a space-separated list of
+ * strings with line-catenation backslashes.
+ * @param macroArg an argument to a macro
+ * @return non-<code>null</code> list of Strings
+ */
+ public static String[] getShellListInterpretedArgument(String macroArg) {
+ String oneLineArg = TextUtils.catenateBrokenLines(macroArg);
+ String[] parts = oneLineArg.split("\\s+");
+ return parts;
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModel.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModel.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModel.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,601 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.autotools.core.model;
+
+import com.nokia.cpp.internal.api.utils.core.*;
+import com.redhat.eclipse.cdt.autotools.ui.editors.parser.*;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.maemo.esbox.core.model.ModelBaseBase;
+import org.maemo.esbox.internal.linux.autotools.core.Activator;
+import org.maemo.esbox.linux.autotools.core.model.*;
+
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author eswartz
+ *
+ */
+public class AutoconfModel extends ModelBaseBase implements IAutoconfOwnedModel {
+
+ private static final Pattern AC_CONFIG_FILES_or_OUTPUT =
+ Pattern.compile("AC_CONFIG_FILES|AC_OUTPUT");
+ private static final Pattern AM_INIT_AUTOMAKE =
+ Pattern.compile("AM_INIT_AUTOMAKE");
+ private static final Pattern AC_INIT =
+ Pattern.compile("AC_INIT");
+ private static final Pattern PKG_CHECK_MODULES_or_EXISTS =
+ Pattern.compile("PKG_CHECK_(MODULES|EXISTS)");
+
+ private static final String PKG_CHECK_EXISTS = "PKG_CHECK_EXISTS";
+ private static final String PKG_CHECK_MODULES = "PKG_CHECK_MODULES";
+
+ private AutoconfElement root;
+ private IAutoconfModelMacroCall[] macroCalls;
+ private List<IAutoconfConfigurationFile> confFiles;
+ private IAutoconfModelMacroCall acInitMacroCall;
+ private IAutoconfModelMacroCall amInitAutomakeMacroCall;
+ private String packageName;
+ private String version;
+ private String bugReportAddress;
+ private String tarballName;
+ private List<IAutoconfPackageCheck> packageChecks;
+
+ /**
+ * @param path
+ * @param document
+ */
+ public AutoconfModel(IPath path, IDocument document) {
+ super(path, document);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.model.ModelBaseBase#modelParse()
+ */
+ @Override
+ protected IMessage[] modelParse() {
+ final List<IMessage> messages = new ArrayList<IMessage>();
+
+ this.root = parseFile(getPath(), getDocument(), messages);
+
+ this.macroCalls = null;
+ this.confFiles = null;
+ this.acInitMacroCall = null;
+ this.amInitAutomakeMacroCall = null;
+ this.packageName = null;
+ this.version = null;
+ this.bugReportAddress = null;
+ this.tarballName = null;
+ this.packageChecks = null;
+
+ parseConstructs(messages);
+
+ return (IMessage[]) messages.toArray(new IMessage[messages.size()]);
+ }
+
+ /**
+ * Get the element used to define the model object.
+ * @param call
+ * @return {@link AutoconfElement} or null
+ */
+ private AutoconfElement elementOf(Object model) {
+ if (model instanceof IAutoconfElementAccess)
+ return ((IAutoconfElementAccess) model).getElement();
+ return null;
+ }
+
+ /**
+ * Parse the macro calls in the model and create the high-level data
+ * structures from them. Record errors in messages.
+ * @param messages
+ */
+ private void parseConstructs(List<IMessage> messages) {
+ parseMacroCalls(messages);
+ parseInitMacros(messages);
+ parseConfigurationFiles(messages);
+ parsePackageChecks(messages);
+
+ }
+
+ /**
+ * Parse every macro call into an {@link IAutoconfModelMacroCall} entry
+ */
+ private void parseMacroCalls(List<IMessage> messages) {
+ final List<IAutoconfModelMacroCall> calls = new ArrayList<IAutoconfModelMacroCall>();
+ AutoconfMacroCallVisitor visitor = new AutoconfMacroCallVisitor(false) {
+
+ @Override
+ public void visit(AutoconfMacroElement macro) {
+ AutoconfModelMacroCall macroModel = new AutoconfModelMacroCall(macro);
+ macroModel.setElement(macro);
+ calls.add(macroModel);
+ }
+
+ };
+ visitor.accept(root);
+ macroCalls = (IAutoconfModelMacroCall[]) calls
+ .toArray(new IAutoconfModelMacroCall[calls.size()]);
+ }
+
+ /**
+ * Scan the macros to find all the files that will be generated by
+ * way of AC_CONFIG_FILES and AC_OUTPUT.
+ */
+ private void parseConfigurationFiles(List<IMessage> messages) {
+ if (confFiles == null) {
+ confFiles = new ArrayList<IAutoconfConfigurationFile>();
+
+ // AC_CONFIG_FOOS(tag..., [commands], [init-cmds])
+ // AC_OUTPUT
+ //
+ // The macros AC_CONFIG_FILES and AC_CONFIG_HEADERS use special
+ // tag values:
+ // they may have the form `output' or `output:inputs'. The file
+ // output is instantiated from its templates, inputs (defaulting
+ // to `output.in').
+ //
+ // Obsolete AC_OUTPUT:
+ //
+ // AC_OUTPUT ([file]..., [extra-cmds], [init-cmds])
+ //
+ // Both forms have argument 0 as the list of files so treat them the same.
+ //
+ IAutoconfModelMacroCall[] configFileCalls = getMacroCalls(
+ AC_CONFIG_FILES_or_OUTPUT);
+ for (IAutoconfModelMacroCall call : configFileCalls) {
+ String[] macroArgs = call.getArguments();
+ if (macroArgs.length > 0) {
+ // read tags
+ String[] tags = AutoconfMacroUtils.getShellListInterpretedArgument(macroArgs[0]);
+ for (String tag : tags) {
+ String[] inout = tag.split(":");
+ if (inout.length == 1) {
+ // the input is assumed to be output + ".in"
+ inout = new String[] {
+ inout[0],
+ inout[0] + ".in"
+ };
+ }
+ IPath output = new Path(inout[0]);
+ IPath[] inputs = new IPath[inout.length - 1];
+ for (int idx = 1; idx < inout.length; idx++) {
+ inputs[idx-1] = new Path(inout[idx]);
+ }
+ AutoconfConfigurationFile confFile =
+ new AutoconfConfigurationFile(output, inputs);
+ confFile.setElement(elementOf(call));
+
+ confFiles.add(confFile);
+ }
+ } else if (!call.getName().equals("AC_OUTPUT")) {
+ Activator.getErrorLogger().logError("Missing arguments in " + call, null);
+ }
+ }
+ }
+ }
+
+ private void parseInitMacros(List<IMessage> messages) {
+ IAutoconfModelMacroCall[] calls;
+ calls = getMacroCalls(AC_INIT);
+ if (calls.length > 0) {
+ acInitMacroCall = calls[0];
+ }
+ calls = getMacroCalls(AM_INIT_AUTOMAKE);
+ if (calls.length > 0) {
+ amInitAutomakeMacroCall = calls[0];
+ }
+
+ packageName = parsePackageName(messages);
+ version = parseVersion(messages);
+ bugReportAddress = parseBugReportAddress(messages);
+ tarballName = parseTarballName(messages);
+ }
+
+
+ /**
+ * @param messages
+ * @return
+ */
+ private String parsePackageName(List<IMessage> messages) {
+ // determine the package name
+ if (acInitMacroCall != null) {
+ // new format: AC_INIT (package, version, [bug-report], [tarname])
+ // old format: AC_INIT (unique-file-in-source-dir)
+ String[] args = acInitMacroCall.getArguments();
+ if (args.length >= 2) {
+ return args[0];
+ }
+ }
+
+ if (amInitAutomakeMacroCall != null) {
+ // new format: AM_INIT_AUTOMAKE([OPTIONS])
+ // old format: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+ String[] args = amInitAutomakeMacroCall.getArguments();
+ if (args.length >= 2) {
+ return args[0];
+ }
+ }
+
+ return null;
+ }
+
+ private String parseVersion(List<IMessage> messages) {
+ if (acInitMacroCall != null) {
+ // new format: AC_INIT (package, version, [bug-report], [tarname])
+ // old format: AC_INIT (unique-file-in-source-dir)
+ String[] args = acInitMacroCall.getArguments();
+ if (args.length >= 2) {
+ return args[1];
+ }
+ }
+
+ if (amInitAutomakeMacroCall != null) {
+ // new format: AM_INIT_AUTOMAKE([OPTIONS])
+ // old format: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+ String[] args = amInitAutomakeMacroCall.getArguments();
+ if (args.length >= 2) {
+ return args[1];
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @param messages
+ * @return
+ */
+ private String parseBugReportAddress(List<IMessage> messages) {
+ if (acInitMacroCall != null) {
+ // new format: AC_INIT (package, version, [bug-report], [tarname])
+ // old format: AC_INIT (unique-file-in-source-dir)
+ String[] args = acInitMacroCall.getArguments();
+ if (args.length >= 2) {
+ if (args.length >= 3)
+ return args[2];
+ else
+ return "";
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @param messages
+ * @return
+ */
+ private String parseTarballName(List<IMessage> messages) {
+ if (acInitMacroCall != null) {
+ // new format: AC_INIT (package, version, [bug-report], [tarname])
+ // old format: AC_INIT (unique-file-in-source-dir)
+ String[] args = acInitMacroCall.getArguments();
+ if (args.length >= 2) {
+ if (args.length >= 4) {
+ return args[3];
+ }
+ // else derive from package
+ String tarname = args[0];
+ if (tarname.startsWith("GNU ")) { //$NON-NLS-1$
+ tarname = tarname.substring(4);
+ }
+ return tarname.toLowerCase();
+ }
+ }
+
+ if (amInitAutomakeMacroCall != null) {
+ // new format: AM_INIT_AUTOMAKE([OPTIONS])
+ // old format: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+
+ // The first argument to AC_INIT should be the name of your package
+ // (e.g., GNU Automake), not the tarball name (e.g., automake)
+ // that you used to pass to AM_INIT_AUTOMAKE.
+ String[] args = amInitAutomakeMacroCall.getArguments();
+ if (args.length >= 2) {
+ return args[0];
+ }
+ }
+
+ return null;
+ }
+
+ private void parsePackageChecks(List<IMessage> messages) {
+ packageChecks = new ArrayList<IAutoconfPackageCheck>();
+ IAutoconfModelMacroCall[] calls = getMacroCalls(
+ PKG_CHECK_MODULES_or_EXISTS);
+ for (IAutoconfModelMacroCall call : calls) {
+ IAutoconfPackageCheck check = parsePackageCheck(call, messages);
+ if (check != null) {
+ packageChecks.add(check);
+ }
+ }
+ }
+
+ /**
+ * Create a package check from the given macro call
+ * @param call
+ * @param messages
+ * @return non-<code>null</code> check
+ */
+ private IAutoconfPackageCheck parsePackageCheck(
+ IAutoconfModelMacroCall call, List<IMessage> messages) {
+ String[] args = call.getArguments();
+ String variableBase;
+ String moduleList;
+ AutoconfElement moduleElement;
+ if (PKG_CHECK_EXISTS.equals(call.getName())) {
+ if (args.length < 1 || args[0].length() == 0) {
+ messages.add(createError(
+ elementOf(call),
+ "AutoconfModel.BadPkgCheckExistsError",
+ "Not enough non-empty arguments for PKG_CHECK_EXISTS macro"
+ ));
+ return null;
+ }
+ variableBase = null;
+ moduleList = args[0];
+ moduleElement = ((AutoconfModelMacroCall) call).getElementOfArgument(0);
+ }
+ else if (PKG_CHECK_MODULES.equals(call.getName())) {
+ if (args.length < 2 || args[0].length() == 0 || args[1].length() == 0) {
+ messages.add(createError(
+ elementOf(call),
+ "AutoconfModel.BadPkgCheckModulesError",
+ "Not enough non-empty arguments for PKG_CHECK_MODULES macro"
+ ));
+ return null;
+ }
+ variableBase = args[0];
+ moduleList = args[1];
+ moduleElement = ((AutoconfModelMacroCall) call).getElementOfArgument(1);
+ }
+ else {
+ throw new IllegalStateException("Unknown macro: " + call);
+ }
+
+ IAutoconfPackageCheckModule[] modules = parseModules(moduleList, messages);
+ AutoconfPackageCheck pkgCheck = new AutoconfPackageCheck(variableBase, modules);
+ pkgCheck.setElement(elementOf(call));
+ pkgCheck.setModuleListElement(moduleElement);
+ return pkgCheck;
+ }
+
+ /**
+ * Parse the module names and version checks in the PKG_CHECK macro argument:
+ * <pre>
+ * PKG_CHECK_MODULES(MYSTUFF, gtk+-2.0 >= 1.3.5 libxml = 1.8.4)
+ * </pre>
+ * The spaces are required.
+ * @param moduleList
+ * @param messages
+ * @return non-<code>null</code> array of {@link IAutoconfPackageCheckModule}
+ */
+ private IAutoconfPackageCheckModule[] parseModules(
+ String moduleList,
+ List<IMessage> messages) {
+ List<IAutoconfPackageCheckModule> modules = new ArrayList<IAutoconfPackageCheckModule>();
+
+ String[] tokens = moduleList.split("\\s");
+ for (int idx = 0; idx < tokens.length; ) {
+ // either [PKG] or [PKG] [OPERATOR] [VERSION]
+
+ // module name
+ String moduleName = tokens[idx++];
+
+ EAutoconfPackageCheckOperator operator = null;
+ String version = null;
+ if (idx + 2 <= tokens.length) {
+ // possible operator
+ operator = EAutoconfPackageCheckOperator.fromToken(tokens[idx]);
+ if (operator != null) {
+ idx++;
+ version = tokens[idx++];
+ }
+ }
+
+ AutoconfPackageCheckModule module =
+ new AutoconfPackageCheckModule(moduleName, operator, version);
+ module.setElement(null); // a subelement, not the whole thing
+ modules.add(module);
+ }
+
+ return (IAutoconfPackageCheckModule[]) modules
+ .toArray(new IAutoconfPackageCheckModule[modules.size()]);
+ }
+
+ /**
+ * Create an error message
+ * @param element associated element, or <code>null</code> for whole file
+ * @param key message key (for testing)
+ * @param msg message text
+ * @return new IMessage
+ */
+ private IMessage createError(AutoconfElement element, String key,
+ String msg) {
+ int severity = IMessage.ERROR;
+ return createMessage(severity, element, key, msg);
+ }
+
+ /**
+ * Create a message
+ * @param severity
+ * @param element associated element, or <code>null</code> for whole file
+ * @param key message key (for testing)
+ * @param msg message text
+ * @return new IMessage
+ */
+ private IMessage createMessage(int severity, AutoconfElement element,
+ String key, String msg) {
+ return new Message(severity,
+ createMessageLocation(element != null ? element : root),
+ key,
+ msg);
+ }
+
+ /**
+ * Create a message location starting where the source for 'element'
+ * starts.
+ * @param element
+ * @return new MessageLocation
+ */
+ private MessageLocation createMessageLocation(AutoconfElement element) {
+ int line = 0;
+ int column = 0;
+ try {
+ line = element.getDocument().getLineOfOffset(element.getStartOffset());
+ column = element.getStartOffset() - element.getDocument().getLineOffset(line);
+ } catch (BadLocationException e) {
+ Activator.getErrorLogger().logError("Problem with autoconf AST", e);
+ }
+ return new MessageLocation(
+ getPathForDocument(element.getDocument()),
+ line + 1,
+ column + 1);
+ }
+
+ /**
+ * Get the path for the given document
+ * @param document
+ * @return IPath, never <code>null</code>
+ * @throws IllegalStateException
+ */
+ private IPath getPathForDocument(IDocument document) {
+ for (Map.Entry<IPath, IDocument> entry : getDocumentMap().entrySet()) {
+ if (entry.getValue().equals(document))
+ return entry.getKey();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * Parse a single document/file for autotools. This does not
+ * resolve any m4includes() or other includes.
+ * @param path
+ * @param document
+ * @return root of document
+ */
+ private AutoconfElement parseFile(final IPath path, final IDocument document, final List<IMessage> messages) {
+ IAutoconfErrorHandler errorHandler = new IAutoconfErrorHandler() {
+
+ public void handleError(ParseException exception) {
+ messages.add(createMessage(exception));
+ }
+
+ private IMessage createMessage(ParseException exception) {
+ return new Message(IMessage.ERROR,
+ new MessageLocation(
+ path,
+ exception.getLineNumber(),
+ exception.getStartColumn()),
+ "AutoconfModel.ParseError",
+ exception.getLocalizedMessage());
+ }
+
+ };
+
+ IAutoconfMacroDetector macroDetector = new AutoconfMacroDetector();
+
+ IAutoconfMacroValidator macroValidator = new IAutoconfMacroValidator() {
+
+ public void validateMacroCall(AutoconfMacroElement element)
+ throws ParseException {
+ // they're all okay from this perspective;
+ // we parse them later once all the info is known
+ }
+
+ };
+
+ AutoconfParser parser = new AutoconfParser(errorHandler, macroDetector, macroValidator);
+
+ AutoconfElement root = parser.parse(document);
+
+ return root;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfModel#getMacroCalls()
+ */
+ public IAutoconfModelMacroCall[] getMacroCalls() {
+ return macroCalls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfModel#getMacroCalls(java.util.regex.Pattern)
+ */
+ public IAutoconfModelMacroCall[] getMacroCalls(final Pattern namePattern) {
+ final List<IAutoconfModelMacroCall> calls = new ArrayList<IAutoconfModelMacroCall>();
+ for (IAutoconfModelMacroCall call : getMacroCalls()) {
+ Matcher matcher = namePattern.matcher(call.getName());
+ if (matcher.matches()) {
+ calls.add(call);
+ }
+ };
+ return (IAutoconfModelMacroCall[]) calls.toArray(new IAutoconfModelMacroCall[calls.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfModel#getConfigurationFiles()
+ */
+ public IAutoconfConfigurationFile[] getConfigurationFiles() {
+ return (IAutoconfConfigurationFile[]) confFiles.toArray(new IAutoconfConfigurationFile[confFiles.size()]);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfModel#getPackage()
+ */
+ public String getPackage() {
+ return packageName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfModel#getVersion()
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfModel#getBugReportAddress()
+ */
+ public String getBugReportAddress() {
+ return bugReportAddress;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfModel#getTarballName()
+ */
+ public String getTarballName() {
+ return tarballName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfModel#usesAutomake()
+ */
+ public boolean usesAutomake() {
+ // this is the only one automake really needs; AC_CONFIG_FILES and AC_OUTPUT
+ // are influenced by automake as well.
+ return amInitAutomakeMacroCall != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfModel#getPackageChecks()
+ */
+ public IAutoconfPackageCheck[] getPackageChecks() {
+ return (IAutoconfPackageCheck[]) packageChecks.toArray(new IAutoconfPackageCheck[packageChecks.size()]);
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModelMacroCall.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModelMacroCall.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModelMacroCall.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.autotools.core.model;
+
+import com.redhat.eclipse.cdt.autotools.ui.editors.parser.*;
+
+import org.maemo.esbox.linux.autotools.core.model.IAutoconfModelMacroCall;
+
+/**
+ * Implementation.
+ * @author eswartz
+ *
+ */
+public class AutoconfModelMacroCall extends AutoconfModelObject implements IAutoconfModelMacroCall {
+
+ private final AutoconfMacroElement macro;
+ private String[] arguments;
+ private AutoconfElement[] argumentElements;
+
+ /**
+ * Create an instance for the given element.
+ * @param macro
+ */
+ public AutoconfModelMacroCall(AutoconfMacroElement macro) {
+ this.macro = macro;
+ arguments = new String[macro.getParameterCount()];
+ argumentElements = new AutoconfMacroArgumentElement[macro.getParameterCount()];
+ AutoconfElement[] kids = macro.getChildren();
+ for (int i = 0; i < arguments.length; i++) {
+ arguments[i] = macro.getParameter(i);
+ argumentElements[i] = kids[i];
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return macro.getName() + "(" + stringArrayToString(getArguments()) + ")";
+ }
+
+ private String stringArrayToString(String[] args) {
+ StringBuilder builder = new StringBuilder();
+ for (String arg : args) {
+ if (builder.length() > 0)
+ builder.append(',');
+ builder.append("\n\t");
+ builder.append(arg);
+ }
+ return builder.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfModelMacroCall#getArguments()
+ */
+ public String[] getArguments() {
+ return arguments;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfModelMacroCall#getName()
+ */
+ public String getName() {
+ return macro.getName();
+ }
+
+ /**
+ * Get the element defining the given argument
+ * @param idx
+ * @return element or <code>null</code>
+ */
+ public AutoconfElement getElementOfArgument(int idx) {
+ if (idx >= argumentElements.length)
+ return null;
+ return argumentElements[idx];
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModelObject.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModelObject.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfModelObject.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.autotools.core.model;
+
+import com.redhat.eclipse.cdt.autotools.ui.editors.parser.AutoconfElement;
+
+/**
+ * Base class for objects created from AutoconfElements, implementing
+ * the access to allow associating them.
+ * @author eswartz
+ *
+ */
+public abstract class AutoconfModelObject implements IAutoconfElementAccess {
+
+ private AutoconfElement element;
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.linux.autotools.core.model.IAutoconfElementAccess#getElement()
+ */
+ public AutoconfElement getElement() {
+ return element;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.linux.autotools.core.model.IAutoconfElementAccess#setElement(com.redhat.eclipse.cdt.autotools.ui.editors.parser.AutoconfElement)
+ */
+ public void setElement(AutoconfElement element) {
+ this.element = element;
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfPackageCheck.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfPackageCheck.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfPackageCheck.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.autotools.core.model;
+
+import com.redhat.eclipse.cdt.autotools.ui.editors.parser.AutoconfElement;
+
+import org.maemo.esbox.linux.autotools.core.model.*;
+
+/**
+ * Implementation.
+ * @author eswartz
+ *
+ */
+public class AutoconfPackageCheck extends AutoconfModelObject implements IAutoconfPackageCheck {
+ private AutoconfElement moduleListElement;
+ private final String variableBase;
+ private final IAutoconfPackageCheckModule[] modules;
+
+ public AutoconfPackageCheck(String variableBase, IAutoconfPackageCheckModule[] modules) {
+ if (modules == null)
+ throw new IllegalArgumentException();
+ this.variableBase = variableBase;
+ this.modules = modules;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfPackageCheck#getModules()
+ */
+ public IAutoconfPackageCheckModule[] getModules() {
+ return modules;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfPackageCheck#getVariableBase()
+ */
+ public String getVariableBase() {
+ return variableBase;
+ }
+
+ public AutoconfElement getModuleListElement() {
+ return moduleListElement;
+ }
+ public void setModuleListElement(AutoconfElement element) {
+ moduleListElement = element;
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfPackageCheckModule.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfPackageCheckModule.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/AutoconfPackageCheckModule.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.autotools.core.model;
+
+import org.maemo.esbox.linux.autotools.core.model.EAutoconfPackageCheckOperator;
+import org.maemo.esbox.linux.autotools.core.model.IAutoconfPackageCheckModule;
+
+/**
+ * Implementation.
+ * @author eswartz
+ *
+ */
+public class AutoconfPackageCheckModule extends AutoconfModelObject implements IAutoconfPackageCheckModule {
+
+ private final String moduleName;
+ private final EAutoconfPackageCheckOperator operator;
+ private final String version;
+
+ /**
+ * @param moduleName
+ * @param operator
+ * @param version
+ */
+ public AutoconfPackageCheckModule(String moduleName,
+ EAutoconfPackageCheckOperator operator, String version) {
+ this.moduleName = moduleName;
+ this.operator = operator;
+ this.version = version;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfPackageCheckModule#getModuleName()
+ */
+ public String getModuleName() {
+ return moduleName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfPackageCheckModule#getOperator()
+ */
+ public EAutoconfPackageCheckOperator getOperator() {
+ return operator;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.autotools.core.model.IAutoconfPackageCheckModule#getVersion()
+ */
+ public String getVersion() {
+ return version;
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/IAutoconfElementAccess.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/IAutoconfElementAccess.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/internal/linux/autotools/core/model/IAutoconfElementAccess.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.autotools.core.model;
+
+import com.redhat.eclipse.cdt.autotools.ui.editors.parser.AutoconfElement;
+
+/**
+ * Get back to the AutoconfElement from a high-level model.
+ * Any model that was created from a parse will have this,
+ * and newly created elements will report <code>null</code>.
+ * @author eswartz
+ *
+ */
+public interface IAutoconfElementAccess {
+ /** Get the element used to create this model; <code>null</code> for
+ * newly created models.
+ * @return AutoconfElement or <code>null</code>
+ */
+ AutoconfElement getElement();
+
+ /**
+ * Set the element defining this model
+ */
+ void setElement(AutoconfElement element);
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/AutoconfModelProvider.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/AutoconfModelProvider.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/AutoconfModelProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.model.IModelProvider;
+import org.maemo.esbox.linux.autotools.core.model.IAutoconfModel;
+import org.maemo.esbox.linux.autotools.core.model.IAutoconfOwnedModel;
+
+/**
+ * @author eswartz
+ *
+ */
+public class AutoconfModelProvider implements
+ IModelProvider<IAutoconfOwnedModel, IAutoconfModel> {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.model.IModelProvider#createModel(org.eclipse.core.runtime.IPath)
+ */
+ public IAutoconfOwnedModel createModel(IPath workspacePath) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.model.IModelProvider#findSharedModel(org.eclipse.core.runtime.IPath)
+ */
+ public IAutoconfModel findSharedModel(IPath workspacePath) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.model.IModelProvider#getSharedModel(org.eclipse.core.runtime.IPath)
+ */
+ public IAutoconfModel getSharedModel(IPath workspacePath)
+ throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.model.IModelProvider#load(org.maemo.esbox.core.model.IOwnedModel)
+ */
+ public void load(IAutoconfOwnedModel model) throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.model.IModelProvider#registerModel(org.maemo.esbox.core.model.IOwnedModel)
+ */
+ public void registerModel(IAutoconfOwnedModel model) throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.model.IModelProvider#releaseSharedModel(org.maemo.esbox.core.model.IModel)
+ */
+ public void releaseSharedModel(IAutoconfModel model)
+ throws IllegalStateException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.model.IModelProvider#save(org.maemo.esbox.core.model.IOwnedModel)
+ */
+ public void save(IAutoconfOwnedModel model) throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.model.IModelProvider#unregisterModel(org.maemo.esbox.core.model.IOwnedModel)
+ */
+ public void unregisterModel(IAutoconfOwnedModel model) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.model.IModelProvider#updateModelDocumentMappings(org.maemo.esbox.core.model.IOwnedModel)
+ */
+ public void updateModelDocumentMappings(IAutoconfOwnedModel model) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfAutomakeBridge.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfAutomakeBridge.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfAutomakeBridge.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core.model;
+
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * This class handles the logic that binds Autoconf and Automake with
+ * respect to an actual filesystem.
+ * @author eswartz
+ *
+ */
+public abstract class AutoconfAutomakeBridge {
+
+ /**
+ * For the given {@link IAutoconfConfigurationFile} entry, determine which
+ * automake source would be used (*.am) to generate the input.
+ *
+ * <pre>
+ * Automake uses these to determine which files to create (see Creating Output
+ * Files). A listed file is considered to be an Automake generated Makefile
+ * if there exists a file with the same name and the .am extension appended.
+ * Typically, AC_CONFIG_FILES([foo/Makefile]) will cause Automake to
+ * generate foo/Makefile.in if foo/Makefile.am exists.
+ *
+ * When using AC_CONFIG_FILES with multiple input files, as in
+ *
+ * AC_CONFIG_FILES([Makefile:top.in:Makefile.in:bot.in])
+ *
+ * automake will generate the first .in input file for which a .am file
+ * exists. If no such file exists the output file is not considered to be
+ * Automake generated.
+ * </pre>
+ *
+ * @param confFile
+ * IAutoconfConfigurationFile entry
+ * @return IPath or <code>null</code> if no matching file is found
+ */
+ public static IPath getAutomakeInput(IAutoconfModel model, IAutoconfConfigurationFile confFile) {
+ IPath basePath = model.getPath().removeLastSegments(1);
+ for (IPath input : confFile.getInputs()) {
+ IPath amFile = input.removeFileExtension().addFileExtension("am");
+ if (basePath.append(amFile).toFile().exists()) {
+ return amFile;
+ }
+ }
+ return null;
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfModelFactory.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfModelFactory.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfModelFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core.model;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.text.IDocument;
+import org.maemo.esbox.core.model.IModelFactory;
+import org.maemo.esbox.internal.linux.autotools.core.model.AutoconfModel;
+
+/**
+ * @author eswartz
+ *
+ */
+public class AutoconfModelFactory implements IModelFactory<IAutoconfOwnedModel> {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.model.IModelFactory#createModel(org.eclipse.core.runtime.IPath, org.eclipse.jface.text.IDocument)
+ */
+ public IAutoconfOwnedModel createModel(IPath path, IDocument document) {
+ return new AutoconfModel(path, document);
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfWorkspaceModelProvider.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfWorkspaceModelProvider.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutoconfWorkspaceModelProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core.model;
+
+import org.maemo.esbox.core.model.IModelProvider;
+import org.maemo.esbox.core.model.WorkspaceModelProvider;
+
+/**
+ * This is the stock provider of autoconf models.
+ * @author eswartz
+ *
+ */
+public class AutoconfWorkspaceModelProvider extends WorkspaceModelProvider<IAutoconfOwnedModel, IAutoconfModel> {
+
+ private static AutoconfWorkspaceModelProvider provider;
+
+ public static IModelProvider<IAutoconfOwnedModel, IAutoconfModel> getInstance() {
+ if (provider == null) {
+ provider = new AutoconfWorkspaceModelProvider();
+ }
+ return provider;
+ }
+
+ private AutoconfWorkspaceModelProvider() {
+ super(new AutoconfModelFactory());
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutotoolsPackageManagerBridge.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutotoolsPackageManagerBridge.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/AutotoolsPackageManagerBridge.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core.model;
+
+
+/**
+ * Bridge the package checks in autoconf and automake files with
+ * the package manager.
+ * @author eswartz
+ *
+ */
+public abstract class AutotoolsPackageManagerBridge {
+ private static final String DIGIT = "0123456789";
+ private static final String ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ private static final String ALNUM = DIGIT + ALPHA;
+
+ /**
+ * Compare two pkg-config package versions and return an integer indicating
+ * the ordering.
+ * <p>
+ * This uses the RPM-style version comparison where alphanumeric segments of the
+ * version are compared with each other and ordered by those. A segment is
+ * deemed alphabetic or numeric based on its initial character. If
+ * corresponding segments have different types, arbitrarily return -1.
+ * Otherwise, compare segments numerically or alphabetically. Ignore other
+ * characters in the comparison. The string with more ignored characters at
+ * the end is considered greater if everything else matches.
+ *
+ * @param ver1
+ * @param ver2
+ * @return < 0 for ver1 less than ver2, > 0 for ver1 greater than
+ * ver2, 0 for equal
+ */
+ public static int compareVersions(String ver1, String ver2) {
+ // easy check
+ if (ver1.equals(ver2))
+ return 0;
+
+ int idx1, idx2;
+
+ for (idx1 = 0, idx2 = 0; idx1 < ver1.length() && idx2 < ver2.length(); ) {
+ // skip non-alphanumeric
+ while (idx1 < ver1.length() && ALNUM.indexOf(ver1.charAt(idx1)) < 0) idx1++;
+ while (idx2 < ver2.length() && ALNUM.indexOf(ver2.charAt(idx2)) < 0) idx2++;
+
+ // a segment may have a mix of numbers and letters;
+ // compare subsegments of the same type, and bail if types differ
+ int beg1 = idx1;
+ int beg2 = idx2;
+
+ boolean isNumber = false;
+ if (idx1 < ver1.length() && DIGIT.indexOf(ver1.charAt(idx1)) >= 0) {
+ isNumber = true;
+ while (idx1 < ver1.length() && DIGIT.indexOf(ver1.charAt(idx1)) >= 0)
+ idx1++;
+ } else {
+ while (idx1 < ver1.length() && ALPHA.indexOf(ver1.charAt(idx1)) >= 0)
+ idx1++;
+ }
+ if (idx2 < ver2.length()) {
+ if (isNumber) {
+ // different type
+ if (DIGIT.indexOf(ver2.charAt(idx2)) < 0)
+ return -1;
+ while (idx2 < ver2.length() && DIGIT.indexOf(ver2.charAt(idx2)) >= 0)
+ idx2++;
+
+ // compare parts
+ long cmp = Long.parseLong(ver1.substring(beg1, idx1)) -
+ Long.parseLong(ver2.substring(beg2, idx2));
+ if (cmp != 0)
+ return cmp < 0 ? -1 : 1;
+ } else {
+ // different type
+ if (ALPHA.indexOf(ver2.charAt(idx2)) < 0)
+ return -1;
+ while (idx2 < ver2.length() && ALPHA.indexOf(ver2.charAt(idx2)) >= 0)
+ idx2++;
+
+ int cmp = ver1.substring(beg1, idx1).compareTo(ver2.substring(beg2, idx2));
+ if (cmp != 0)
+ return cmp < 0 ? -1 : 1;
+ }
+
+ } else {
+ // nothing to compare; ver1 is longer
+ return 1;
+ }
+ }
+
+ // separators differed
+ if (idx1 >= ver1.length() && idx2 >= ver2.length())
+ return 0;
+
+ // longer one is greater
+ if (ver1.length() - idx1 > ver2.length() - idx2)
+ return 1;
+ else
+ return -1;
+ }
+
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/EAutoconfPackageCheckOperator.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/EAutoconfPackageCheckOperator.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/EAutoconfPackageCheckOperator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core.model;
+
+/**
+ * This enumerates the operators used to verify package versions.
+ * @author eswartz
+ *
+ */
+public enum EAutoconfPackageCheckOperator {
+ GREATER,
+ GREATER_OR_EQUAL,
+ LESS,
+ LESS_OR_EQUAL,
+ EQUAL,
+ NOT_EQUAL,
+ ANY;
+
+ /**
+ * Get the enumerator from its token.
+ * @param string
+ * @return {@link EAutoconfPackageCheckOperator} or <code>null</code>
+ */
+ public static EAutoconfPackageCheckOperator fromToken(String string) {
+ if (string.equals(">"))
+ return GREATER;
+ if (string.equals(">="))
+ return GREATER_OR_EQUAL;
+ if (string.equals("<"))
+ return LESS;
+ if (string.equals("<="))
+ return LESS_OR_EQUAL;
+ if (string.equals("="))
+ return EQUAL;
+ if (string.equals("!="))
+ return NOT_EQUAL;
+ if (string.equals("(any)"))
+ return ANY;
+ return null;
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfConfigurationFile.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfConfigurationFile.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfConfigurationFile.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core.model;
+
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * This represents a file created by configure.ac, using AC_CONFIG_FILES and
+ * AC_OUTPUT. This interface literally reflects the contents in the file and
+ * does not incorporate any automake-specific logic;
+ * see {@link AutoconfAutomakeBridge#getAutomakeInput(IAutoconfModel, IAutoconfConfigurationFile)}
+ * instead.
+ * @author eswartz
+ */
+public interface IAutoconfConfigurationFile {
+ /**
+ * Get the model-relative location to the output file.
+ * @return path, never <code>null</code>
+ */
+ IPath getOutput();
+
+ /**
+ * Get the model-relative location to the input file(s).
+ * @return array of paths, never <code>null</code>; at least one element long
+ */
+ IPath[] getInputs();
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfModel.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfModel.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfModel.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core.model;
+
+import org.maemo.esbox.core.model.IModel;
+
+import java.util.regex.Pattern;
+
+
+/**
+ * This models an autoconf (configure.ac) file.
+ * <p>
+ * It represents the high-level constructs indicated by the presence of various
+ * autoconf and automake macros. It may include contents that span various
+ * files (m4_include'd or the like).
+ * <p>
+ * When created, it uses the current contents from an IDocument and is
+ * associated with an IPath, yet remains an in-memory construct. Unless
+ * explicitly reparsed or recreated, it may diverge from the underlying
+ * content on disk.
+ *
+ * @author eswartz
+ */
+public interface IAutoconfModel extends IModel {
+
+ /**
+ * Get the name of the package from AC_INIT() (new-style)
+ * or AM_INIT_AUTOMAKE() (old-style).
+ * @return name of package, which is a human-readable string,
+ * or <code>null</code> for misconfigured file
+ */
+ String getPackage();
+
+ /**
+ * Get the version of the package from AC_INIT() (new-style)
+ * or AM_INIT_AUTOMAKE() (old-style).
+ * @return version of package; this is a freeform string,
+ * or <code>null</code> for misconfigured file
+ */
+ String getVersion();
+
+ /**
+ * Get the bug-reporting address from AC_INIT().
+ * @return bug reporting email address or <code>null</code> if not specified
+ */
+ String getBugReportAddress();
+
+ /**
+ * Get the tarball name from AC_INIT() (new-style) or AM_INIT_AUTOMAKE()
+ * (old-style).
+ * <p>
+ * From the manual:
+ * <pre>
+ * The package tarname differs from package: the latter designates the full
+ * package name (e.g., `GNU Autoconf'), while the former is meant for
+ * distribution tar ball names (e.g., `autoconf'). It defaults to package
+ * with `GNU ' stripped, lower-cased, and all characters other than
+ * alphanumerics and underscores are changed to `-'.
+ * </pre>
+ * @return tarball name (derived from package name or explicitly specified),
+ * or <code>null</code> for misconfigured file
+ */
+ String getTarballName();
+
+ /**
+ * Get the configuration files, as described by AC_CONFIG_FILES
+ * and/or AC_OUTPUT macro calls.
+ * <p>
+ * The recommended pattern is one or more AC_CONFIG_FILE() calls
+ * followed at the end by AC_OUTPUT with no arguments.
+ * <p>
+ * A deprecated pattern, where AC_OUTPUT() is called with the
+ * list of files to create, is also supported.
+ * <p>
+ * This reflects the contents of the file, and is not influenced
+ * by the presence of automake files.
+ * @return a non-<code>null</code> array of IAutoconfConfigurationFile
+ * @see AutoconfAutomakeBridge
+ */
+ IAutoconfConfigurationFile[] getConfigurationFiles();
+
+ /**
+ * Get the pkg-config references implied by PKG_CHECK_[EXISTS|MODULES] calls.
+ * @return a non-<code>null</code> array of IAutoconfPackageCheck
+ */
+ IAutoconfPackageCheck[] getPackageChecks();
+
+ /**
+ * Tell whether this model uses Automake.
+ * @return true: appropriate Automake macros detected
+ */
+ boolean usesAutomake();
+
+
+ /// lower-level access
+
+ /**
+ * Get the macro calls in the model
+ * @return a non-<code>null</code> array of IAutoconfModelMacroCall
+ */
+ IAutoconfModelMacroCall[] getMacroCalls();
+
+ /**
+ * Get the macro calls in the model whose names match the given
+ * regex.
+ * @param namePattern a regex for the name
+ * @return a non-<code>null</code> array of IAutoconfModelMacroCall
+ */
+ IAutoconfModelMacroCall[] getMacroCalls(Pattern namePattern);
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfModelMacroCall.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfModelMacroCall.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfModelMacroCall.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core.model;
+
+/**
+ * This is the high-level representation of a macro call.
+ * @author eswartz
+ *
+ */
+public interface IAutoconfModelMacroCall {
+
+ /**
+ * Get the name of the macro called.
+ * @return name, never <code>null</code>
+ */
+ String getName();
+
+ /**
+ * Get the array of arguments passed. The arguments will
+ * be trimmed of whitespace and surrounding quotes will be removed.
+ * The text of such arguments will not be expanded.
+ *
+ * @return a non-<code>null</code> array of macro arguments.
+ */
+ String[] getArguments();
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfOwnedModel.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfOwnedModel.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfOwnedModel.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core.model;
+
+import org.maemo.esbox.core.model.IOwnedModel;
+
+/**
+ * @author eswartz
+ *
+ */
+public interface IAutoconfOwnedModel extends IAutoconfModel, IOwnedModel {
+
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfPackageCheck.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfPackageCheck.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfPackageCheck.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core.model;
+
+/**
+ * Represent the information in a PKG_CHECK_MODULES call:
+ * <p>
+ *
+ * <pre>
+ * PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+ *
+ * Check to see whether a particular set of modules exists. Similar
+ * to PKG_CHECK_MODULES(), but does not set variables or print errors.
+ *
+ * </pre>
+ *
+ * or
+ *
+ * <pre>
+ * PKG_CHECK_MODULES(VARIABLEBASE,MODULELIST[,ACTION-IF-FOUND,[ACTION-IF-NOT-FOUND]])
+ *
+ * The macro PKG_CHECK_MODULES can be used in configure.in to check whether modules
+ * exist. A typical usage would be:
+ * PKG_CHECK_MODULES(MYSTUFF, gtk+-2.0 >= 1.3.5 libxml = 1.8.4)
+ *
+ * This would result in MYSTUFF_LIBS and MYSTUFF_CFLAGS substitution variables, set to
+ * the libs and cflags for the given module list. If a module is missing or has the
+ * wrong version, by default configure will abort with a message. To replace the
+ * default action, specify an ACTION-IF-NOT-FOUND. PKG_CHECK_MODULES will not print
+ * any error messages if you specify your own ACTION-IF-NOT-FOUND. However, it will
+ * set the variable MYSTUFF_PKG_ERRORS, which you can use to display what went wrong.
+ *
+ * If you want to use MYSTUFF_LIBS and MYSTUFF_CFLAGS as Makefile.am variables (i.e.
+ * $(MYSTUFF_LIBS)) then you have to add AC_SUBST(MYSTUFF_LIBS) to your configure.in
+ * so automake can find the variable. You don't need to do this if you use the
+ *
+ * @MYSTUFF_LIBS@ syntax in your Makefile.am instead of $(MYSTUFF_LIBS).
+ *
+ * </pre>
+ *
+ * The syntax for the module list is like that passed to the "--exists"
+ * option. From a hint in the Requires: text in the *.pc file, we can assume
+ * any operator is supported:
+ * <pre>
+ * $ pkg-config --exists 'glib-2.0 >= 1.3.4 libxml = 1.8.3'
+ * </pre>
+ * @author eswartz
+ *
+ */
+public interface IAutoconfPackageCheck {
+ /**
+ * Get the base variable defined by the check, or <code>null</code>
+ * for PKG_CHECK_EXISTS
+ * @return variable base, to which _CFLAGS and _LIBS should be added,
+ * or <code>null</code> if no variable defined by the check
+ */
+ String getVariableBase();
+
+ /**
+ * Get the modules and versions checked.
+ * @return non-<code>null</code> array of IAutoconfPackageCheckModule
+ */
+ IAutoconfPackageCheckModule[] getModules();
+}
Added: trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfPackageCheckModule.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfPackageCheckModule.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.core/src/org/maemo/esbox/linux/autotools/core/model/IAutoconfPackageCheckModule.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.autotools.core.model;
+
+/**
+ * This represents a single module tested by a PKG_CHECK_MODULES
+ * or PKG_CHECK_EXISTS macro.
+ * @author eswartz
+ *
+ */
+public interface IAutoconfPackageCheckModule {
+ /** Get the name of the module
+ * @return module name (same as used in IPkgConfigBuildPackage)
+ */
+ String getModuleName();
+
+ /**
+ * Get the operator used to check the version
+ * @return EAutoconfPackageCheckOperator, or <code>null</code> for no check
+ */
+ EAutoconfPackageCheckOperator getOperator();
+
+ /**
+ * Get the version checked
+ * @return version string or <code>null</code> for no check
+ */
+ String getVersion();
+}
Property changes on: trunk/linux/org.maemo.esbox.linux.autotools.ui
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/linux/org.maemo.esbox.linux.autotools.ui/.classpath
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.ui/.classpath (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.ui/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/linux/org.maemo.esbox.linux.autotools.ui/.project
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.ui/.project (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.ui/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.linux.autotools.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/linux/org.maemo.esbox.linux.autotools.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.ui/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:25:08 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/linux/org.maemo.esbox.linux.autotools.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.ui/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Linux Autotools UI Plug-in
+Bundle-SymbolicName: org.maemo.esbox.linux.autotools.ui
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.linux.autotools.ui.UIActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: trunk/linux/org.maemo.esbox.linux.autotools.ui/build.properties
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.ui/build.properties (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.ui/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal/linux/autotools/ui/UIActivator.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal/linux/autotools/ui/UIActivator.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.autotools.ui/src/org/maemo/esbox/internal/linux/autotools/ui/UIActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,50 @@
+package org.maemo.esbox.internal.linux.autotools.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.linux.autotools.ui";
+
+ // The shared instance
+ private static UIActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public UIActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIActivator getDefault() {
+ return plugin;
+ }
+
+}
Property changes on: trunk/linux/org.maemo.esbox.linux.packages.core
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/linux/org.maemo.esbox.linux.packages.core/.classpath
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/.classpath (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/linux/org.maemo.esbox.linux.packages.core/.project
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/.project (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.linux.packages.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/linux/org.maemo.esbox.linux.packages.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:26:10 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/linux/org.maemo.esbox.linux.packages.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Linux Packages Core Plug-in
+Bundle-SymbolicName: org.maemo.esbox.linux.packages.core;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.linux.packages.core.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.eclipse.core.resources;bundle-version="3.4.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.internal.linux.packages.core;x-friends:="org.maemo.esbox.device.tests,org.maemo.esbox.linux.tests,org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.internal.linux.packages.core.aptpkgconfig;x-friends:="org.maemo.esbox.device.tests,org.maemo.esbox.linux.tests,org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.linux.packages.core,
+ org.maemo.esbox.linux.packages.core.aptpkgconfig,
+ org.maemo.esbox.linux.packages.core.debian
Added: trunk/linux/org.maemo.esbox.linux.packages.core/build.properties
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/build.properties (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ schema/,\
+ utils/
Added: trunk/linux/org.maemo.esbox.linux.packages.core/plugin.xml
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/plugin.xml (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="packageMapping" name="Package Mapping" schema="schema/packageMapping.exsd"/>
+ <extension-point id="packageManagerProvider" name="Package Manager Provider" schema="schema/packageManagerProvider.exsd"/>
+
+
+</plugin>
Added: trunk/linux/org.maemo.esbox.linux.packages.core/schema/packageManagerProvider.exsd
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/schema/packageManagerProvider.exsd (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/schema/packageManagerProvider.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,104 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.linux.packages.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.maemo.esbox.linux.packages.core" id="packageManagerProvider" name="Package Manager Provider"/>
+ </appinfo>
+ <documentation>
+ This extension provides an IPackageManagerProvider instance.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="packageManagerProvider" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="packageManagerProvider">
+ <complexType>
+ <sequence>
+ </sequence>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.maemo.esbox.linux.packages.core.IPackageManagerProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: trunk/linux/org.maemo.esbox.linux.packages.core/schema/packageMapping.exsd
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/schema/packageMapping.exsd (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/schema/packageMapping.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,193 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.maemo.esbox.core" id="packageMapping" name="Package Mapping"/>
+ </appinfo>
+ <documentation>
+ This extension point specifies static mappings from build packages to system packages (see IPackageManager, ISystemPackage, IBuildPackage). In some environments it is not obvious how to map from one to the other.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ <documentation>
+ A set of mappings is considered in declaration order. Thus, more specific mappings (platform-specific exceptions) should be listed ahead of any more generic mappings.
+
+Usually all the mappings for one package manager should be in one plug-in, or else the resolution ordering is undefined. (TODO: see if this is a problem)
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="mappings"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="mappings">
+ <annotation>
+ <documentation>
+ A list of mapping elements. Every 'mapping' or 'metapackage_mapping' element is considered during the runtime lookup process in the order provided.
+
+Elements for which system packages are missing in a given SDK target are ignored; the search proceeds to find other possible matches. Thus, you may should metapackages before the official upstream packages if these are deemed desirable.
+ </documentation>
+ </annotation>
+ <complexType>
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element ref="mapping"/>
+ <element ref="metapackage_mapping"/>
+ </choice>
+ <attribute name="platformPattern" type="string" use="required">
+ <annotation>
+ <documentation>
+ The regular expression indicating for which platforms (ISDKPlatform#getName()) these mappings apply.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="mapping">
+ <annotation>
+ <documentation>
+ This element defines one build package -> system package mapping.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="build" type="string" use="required">
+ <annotation>
+ <documentation>
+ The build package name
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="system" type="string" use="required">
+ <annotation>
+ <documentation>
+ The system package name
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="systemRuntime" type="string">
+ <annotation>
+ <documentation>
+ If specified, this package is the runtime-only portion of the package, and 'system' is the development package. If unspecified, 'system' serves as both the development and runtime package.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="systemDebug" type="string">
+ <annotation>
+ <documentation>
+ If specified, this package contains the debug symbols for the system package. If unspecified, the 'system' package is either not debuggable or contains its own debug symbols.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="metapackage_mapping">
+ <annotation>
+ <documentation>
+ This element defines a group of preferred metapackages for any of the given build packages. This may be used, e.g., at project creation time, runtime, or debug time, to ensure the user starts out with the most complete set of related packages as possible.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="builds" type="string" use="required">
+ <annotation>
+ <documentation>
+ The space-separated list of build packages.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="system" type="string" use="required">
+ <annotation>
+ <documentation>
+ The system metapackage which (is expected to) provide all the given build packages.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="systemRuntime" type="string">
+ <annotation>
+ <documentation>
+ If specified, this package is the runtime-only variant of the metapackage, and 'system' is the development metapackage. If unspecified, 'system' serves as both the development and runtime metapackage.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="systemDebug" type="string">
+ <annotation>
+ <documentation>
+ If specified, this package contains the debug symbols for the system metapackage. If unspecified, the 'system' metapackage is either not debuggable or contains its own debug symbols.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 1.5
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ org.maemo.esbox.core.packages.ISystemPackage
+org.maemo.esbox.core.packages.IBuildPackage
+org.maemo.esbox.core.packages.IBuildPackage#findSystemPackage()
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ The core plugin provides an implementation for the "apt" system package manager and the "pkg-config" build package format, providing mappings that apply to the Chinook, Diablo, and Fremantle platforms.
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/Activator.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/Activator.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,118 @@
+package org.maemo.esbox.internal.linux.packages.core;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.linux.packages.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/AptSystemPackage.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/AptSystemPackage.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/AptSystemPackage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.linux.packages.core.aptpkgconfig;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.internal.linux.packages.core.Activator;
+import org.maemo.esbox.linux.packages.core.*;
+import org.maemo.esbox.linux.packages.core.aptpkgconfig.AptPackageManager;
+
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Matcher;
+
+/**
+ * Debian APT package.
+ * @author eswartz
+ *
+ */
+public class AptSystemPackage extends BasePackage implements ISystemPackage {
+
+ /**
+ * Create an apt package whose version is not yet known.
+ */
+ public AptSystemPackage(IPackageManager manager, String packageName) {
+ super(manager, packageName, null);
+ }
+
+ /**
+ * Create an apt package with a configured version number.
+ */
+ public AptSystemPackage(IPackageManager manager, String packageName, String version) {
+ super(manager, packageName, version);
+ }
+
+ @Override
+ protected void doGetVersion() {
+ try {
+ ProcessLauncherUtils.Results results = ProcessLauncherUtils.launchAndReadStandardStreams(
+ getAptProcessLauncherFactory(),
+ CommandLineArguments.createFromVarArgs("apt-cache", "show", getName()));
+
+ String[] pkgLines = results.getStdoutLines();
+ for (String line : pkgLines) {
+ Matcher matcher = AptPackageManager.VERSION_PATTERN.matcher(line);
+ if (matcher.matches()) {
+ setVersion(matcher.group(1));
+ return;
+ }
+ }
+ throw new IllegalStateException("Cannot parse the version from package " + getName() + ":\n" + results.stdout);
+
+ } catch (Exception e) {
+ Activator.getErrorLogger().logError("Error parsing package " + getName(), e);
+ }
+ setVersion(VERSION_STRING_UNKNOWN);
+ }
+
+ private IProcessLauncherFactory getAptProcessLauncherFactory() {
+ return ((AptPackageManager) getPackageManager()).getAptProcessLauncherFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.ISystemPackage#installSystemPackage(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStatus installSystemPackage(IProgressMonitor monitor) {
+ IStatus status = Status.OK_STATUS;
+ monitor.beginTask(
+ MessageFormat.format("Installing package''{0}''", getName() ),
+ IProgressMonitor.UNKNOWN);
+
+ try {
+ IProcessLauncherFactory launcherFactory = getAptProcessLauncherFactory();
+
+ List<String> cmdLine = CommandLineArguments.createFromVarArgs(
+ "apt-get", "--force-yes", "-y", "install", getName());
+
+ Properties env = launcherFactory.getStandardEnvironment();
+ env = ProcessLauncherUtils.defineProxyVariables(env);
+
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(launcherFactory,
+ null,
+ cmdLine,
+ env);
+
+ Process process = processLauncher.createProcess();
+ processLauncher.redirectToConsole(false, getPackageManager().getSDKTarget(), "Installing apt package(s)");
+
+ int exit = process.waitFor();
+
+ if (exit != 0) {
+ return Activator.createErrorStatus(
+ MessageFormat.format("The installation of package ''{0}'' appeared to fail, check the System Console",
+ getName() ), null);
+ }
+
+ getPackageManager().refreshBuildPackages(new SubProgressMonitor(monitor, 1));
+ } catch (CoreException e) {
+ status = e.getStatus();
+ } catch (Exception e) {
+ status = Activator.createErrorStatus("Failed to install package " + getName(), e);
+ } finally {
+ monitor.done();
+ }
+ // debug
+ if (!status.isOK()) {
+ Activator.getErrorLogger().logError(status.getMessage(), status.getException());
+ }
+ return status;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.ISystemPackage#isInstalled()
+ */
+ public boolean isInstalled() {
+ return getPackageManager().getUninstalledPackages(new ISystemPackage[] { this }).length == 0;
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/BasePackage.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/BasePackage.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/BasePackage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.linux.packages.core.aptpkgconfig;
+
+import org.maemo.esbox.linux.packages.core.IPackage;
+import org.maemo.esbox.linux.packages.core.IPackageManager;
+
+/**
+ * Base package class.
+ * @author eswartz
+ *
+ */
+public abstract class BasePackage implements IPackage {
+
+ private IPackageManager manager;
+ private String name;
+ private String versionString;
+
+ /**
+ * Create a stub package.
+ * @param manager
+ * @param packageName the name, may not be <code>null</code>
+ * @param versionString the version, may be <code>null</code> to scan later
+ */
+ public BasePackage(IPackageManager manager, String packageName, String versionString) {
+ this.manager = manager;
+ this.name = packageName;
+ this.versionString = versionString;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return name + " " + versionString;
+ }
+
+ public IPackageManager getPackageManager() {
+ return manager;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IBuildPackage#getPackageName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /** Finalize the version fields
+ * @see #versionString
+ */
+ abstract protected void doGetVersion();
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IBuildPackage#getPackageVersionString()
+ */
+ public String getVersionString() {
+ if (versionString == null) {
+ doGetVersion();
+ }
+ return versionString;
+ }
+
+ public void setVersion(String versionString) {
+ this.versionString = versionString;
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/BuildPackageMapping.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/BuildPackageMapping.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/BuildPackageMapping.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.packages.core.aptpkgconfig;
+
+import org.maemo.esbox.linux.packages.core.EPackageCategory;
+import org.maemo.esbox.linux.packages.core.IBuildPackageMapping;
+
+import java.util.Map;
+
+public class BuildPackageMapping implements IBuildPackageMapping {
+
+ private final String buildPackage;
+ private final Map<EPackageCategory, String> systemPackages;
+
+ public BuildPackageMapping(String buildPackage, Map<EPackageCategory, String> systemPackages) {
+ this.buildPackage = buildPackage;
+ this.systemPackages = systemPackages;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IBuildPackageMapping#getBuildPackageName()
+ */
+ public String getBuildPackageName() {
+ return buildPackage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IBuildPackageMapping#getSystemPackageName(org.maemo.esbox.core.packages.EPackageCategory, boolean)
+ */
+ public String getSystemPackageName(EPackageCategory category) {
+ String match = systemPackages.get(category);
+ return match;
+ }
+
+}
\ No newline at end of file
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PackageManagerBase.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PackageManagerBase.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PackageManagerBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.linux.packages.core.aptpkgconfig;
+
+import org.maemo.esbox.linux.packages.core.*;
+
+import java.util.*;
+
+/**
+ * The base implementation of a package manager.
+ * @author eswartz
+ *
+ */
+public abstract class PackageManagerBase implements IPackageManager {
+
+ private List<ISystemPackage> systemPackages;
+ private Map<String, ISystemPackage> systemPackageMap;
+
+ private List<IBuildPackage> buildPackages;
+ private Map<String, IBuildPackage> buildPackageMap;
+ private String name;
+
+ public PackageManagerBase(String name) {
+ this.name = name;
+ reset();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IPackageManager#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Clear out the database.
+ */
+ protected void reset() {
+ systemPackages = new ArrayList<ISystemPackage>();
+ systemPackageMap = new HashMap<String, ISystemPackage>();
+ buildPackages = new ArrayList<IBuildPackage>();
+ buildPackageMap = new HashMap<String, IBuildPackage>();
+ }
+
+ /**
+ * Add a package to the database. This overrides any existing package
+ * with the same name.
+ * @param SystemPackage
+ */
+ protected void addSystemPackage(ISystemPackage systemPackage) {
+ ISystemPackage existing = systemPackageMap.get(systemPackage.getName());
+ if (existing != null) {
+ systemPackages.remove(existing);
+ }
+ systemPackages.add(systemPackage);
+ systemPackageMap.put(systemPackage.getName(), systemPackage);
+ }
+
+ /**
+ * Add a build package to the database. This overrides any existing package
+ * with the same name.
+ * @param buildPackage
+ */
+ protected void addBuildPackage(IBuildPackage buildPackage) {
+ IBuildPackage existing = buildPackageMap.get(buildPackage.getName());
+ if (existing != null) {
+ buildPackages.remove(existing);
+ }
+ buildPackages.add(buildPackage);
+ buildPackageMap.put(buildPackage.getName(), buildPackage);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IPackageManager#getSystemPackage(java.lang.String)
+ */
+ public synchronized ISystemPackage getSystemPackage(String pkg) {
+ return systemPackageMap.get(pkg);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IPackageManager#getBuildPackage(java.lang.String)
+ */
+ public synchronized IBuildPackage getBuildPackage(String packageName) {
+ return buildPackageMap.get(packageName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IPackageManager#getSystemPackages()
+ */
+ public synchronized ISystemPackage[] getSystemPackages() {
+ return (ISystemPackage[]) systemPackages.toArray(new ISystemPackage[systemPackages.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IPackageManager#getBuildPackages()
+ */
+ public synchronized IBuildPackage[] getBuildPackages() {
+ return (IBuildPackage[]) buildPackages.toArray(new IBuildPackage[buildPackages.size()]);
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PackageMapper.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PackageMapper.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PackageMapper.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.packages.core.aptpkgconfig;
+
+import org.eclipse.core.runtime.*;
+
+import org.maemo.esbox.internal.linux.packages.core.Activator;
+import org.maemo.esbox.linux.packages.core.EPackageCategory;
+import org.maemo.esbox.linux.packages.core.IBuildPackageMapping;
+
+import java.util.*;
+
+/**
+ * This class maintains the mappings specified via extension point
+ * @author eswartz
+ *
+ */
+public class PackageMapper {
+
+ private static final String PACKAGE_MAPPING_EXTENSION_ID = Activator.PLUGIN_ID + ".packageMapping";
+
+ private static final String METAPACKAGE_MAPPING = "metapackage_mapping";
+
+ private static final String MAPPING = "mapping";
+
+ private static final String BUILDS = "builds";
+
+ private static final String PLATFORM_PATTERN = "platformPattern";
+
+ private static final String SYSTEM = "system";
+
+ private static final String SYSTEM_RUNTIME = "systemRuntime";
+
+ private static final String SYSTEM_DEBUG = "systemDebug";
+
+ private static final String BUILD = "build";
+
+ private static final String MAPPINGS = "mappings";
+
+ private PackageManagerMappings mappings;
+
+ private static final BuildPackageMapping[] NO_MAPPINGS = new BuildPackageMapping[0];
+
+
+
+ public static class PackageMapping {
+ public String platformPattern;
+ public String buildPackage;
+ public Map<EPackageCategory, String> systemPackages;
+ public boolean isMeta;
+
+ public PackageMapping(String platformPattern, String buildPackage,
+ String systemDevelPackage, String systemRuntimePackage, String systemDebugPackage,
+ boolean isMeta) {
+ this.platformPattern = platformPattern;
+ this.buildPackage = buildPackage;
+ systemPackages = new HashMap<EPackageCategory, String>();
+ if (systemDevelPackage != null)
+ systemPackages.put(EPackageCategory.DEVELOPMENT, systemDevelPackage);
+ if (systemDebugPackage != null)
+ systemPackages.put(EPackageCategory.DEBUG, systemDebugPackage);
+ if (systemRuntimePackage != null)
+ systemPackages.put(EPackageCategory.RUNTIME, systemRuntimePackage);
+ this.isMeta = isMeta;
+ }
+ }
+
+ public static class PackageManagerMappings {
+ private List<PackageMapping> packageMappings;
+
+ public PackageManagerMappings() {
+ packageMappings = new ArrayList<PackageMapping>();
+ }
+
+ protected PackageMapping createPackageMapping(String platformPattern, String build, String system, String systemRuntime, String systemDebug, boolean isMeta) {
+ return new PackageMapping(platformPattern, build, system, systemRuntime, systemDebug, isMeta);
+ }
+
+ public void addPackageMapping(String platformPattern, String build, String system, String systemRuntime, String systemDebug) {
+ PackageMapping mapping = createPackageMapping(platformPattern, build, system, systemRuntime, systemDebug, false);
+ this.packageMappings.add(mapping);
+ }
+
+ public void addMetapackageMapping(String platformPattern, String[] builds, String system, String systemRuntime, String systemDebug) {
+ for (String build : builds) {
+ PackageMapping mapping = createPackageMapping(platformPattern, build, system, systemRuntime, systemDebug, true);
+ this.packageMappings.add(mapping);
+ }
+ }
+
+ /**
+ * Add any matching records to the list.
+ * @param matches
+ * @param platform platform to match, case-insensitive
+ * @param buildPackage
+ * @param isMeta look only for metapackages or normal packages
+ */
+ public void findMatches(List<PackageMapping> matches, String platform,
+ String buildPackage, boolean isMeta) {
+ for (PackageMapping mapping : packageMappings) {
+ if (mapping.isMeta == isMeta
+ && mapping.buildPackage.equals(buildPackage)
+ && (platform == null || platform.matches("(?i)" + mapping.platformPattern))) {
+ matches.add(mapping);
+ }
+ }
+ }
+ }
+
+ public PackageMapper() {
+ mappings = new PackageManagerMappings();
+ initFromExtensions();
+ }
+
+ protected void initFromExtensions() {
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(PACKAGE_MAPPING_EXTENSION_ID).getExtensions();
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for (IConfigurationElement config : configElements) {
+ String platformPattern = config.getAttribute(PLATFORM_PATTERN);
+ if (platformPattern == null || platformPattern.length() == 0)
+ platformPattern = ".*";
+
+ String name = config.getName();
+ if (name.equals(MAPPINGS)) {
+ for (IConfigurationElement me : config.getChildren()) {
+ name = me.getName();
+ if (name.equals(METAPACKAGE_MAPPING)) {
+ mappings.addMetapackageMapping(
+ platformPattern,
+ me.getAttribute(BUILDS).split("\\s+"),
+ me.getAttribute(SYSTEM),
+ me.getAttribute(SYSTEM_RUNTIME),
+ me.getAttribute(SYSTEM_DEBUG));
+ } else if (name.equals(MAPPING)) {
+ mappings.addPackageMapping(
+ platformPattern,
+ me.getAttribute(BUILD),
+ me.getAttribute(SYSTEM),
+ me.getAttribute(SYSTEM_RUNTIME),
+ me.getAttribute(SYSTEM_DEBUG));
+ } else {
+ Activator.getErrorLogger().logError("Unknown config element: " + name, null);
+ }
+ }
+ } else {
+ Activator.getErrorLogger().logError("Unknown config element: " + name, null);
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the mappings for the package manager.
+ * @return {@link PackageManagerMappings} or <code>null</code>
+ */
+ public PackageManagerMappings getPackageManagerMappings() {
+ return mappings;
+ }
+
+ /**
+ * Scan the mappings for the package manager and matching the given platform which reference
+ * the given build package.
+ * @param platform name of platform or <code>null</code> to match all
+ * @param buildPackage build package name
+ * @param fillInMissing if true, fill in runtime/debug with development valu
+ * @param includeMeta if true, search for metapackages in preference to normal packages
+ * @return array of mappings, never <code>null</code>
+ */
+ public IBuildPackageMapping[] getBuildPackageMappings(String platform, String buildPackage, boolean searchMeta, boolean fillInMissing) {
+ PackageManagerMappings mappings = getPackageManagerMappings();
+ if (mappings == null)
+ return NO_MAPPINGS;
+
+ List<PackageMapping> matches = new ArrayList<PackageMapping>();
+ if (searchMeta)
+ mappings.findMatches(matches, platform, buildPackage, true);
+ if (!searchMeta || matches.isEmpty())
+ mappings.findMatches(matches, platform, buildPackage, false);
+
+ IBuildPackageMapping[] bpms = new IBuildPackageMapping[matches.size()];
+ for (int idx = 0; idx < matches.size(); idx++) {
+ bpms[idx] = createBuildPackageMapping(matches.get(idx), fillInMissing);
+ }
+
+ return bpms;
+ }
+
+ protected IBuildPackageMapping createBuildPackageMapping(PackageMapping packageMapping, boolean fillInMissing) {
+ if (fillInMissing) {
+ String devel = packageMapping.systemPackages.get(EPackageCategory.DEVELOPMENT);
+ for (EPackageCategory category : EPackageCategory.values()) {
+ String match = packageMapping.systemPackages.get(category);
+ if (match == null) {
+ packageMapping.systemPackages.put(category, devel);
+ }
+ }
+ }
+ return new BuildPackageMapping(packageMapping.buildPackage, packageMapping.systemPackages);
+ }
+
+ /**
+ * Register a package manager
+ * @param packageManagerMappings
+ */
+ public void addPackageManagerMappings(PackageManagerMappings packageManagerMappings) {
+ mappings.packageMappings.addAll(packageManagerMappings.packageMappings);
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PkgConfigBuildPackage.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PkgConfigBuildPackage.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PkgConfigBuildPackage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.linux.packages.core.aptpkgconfig;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.cpp.IDefine;
+
+import org.maemo.esbox.internal.linux.packages.core.Activator;
+import org.maemo.esbox.linux.packages.core.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A build package scanned from pkg-config
+ * @author eswartz
+ *
+ */
+public class PkgConfigBuildPackage extends BasePackage implements IBuildPackage {
+
+ private ISystemPackage systemPackage;
+ private boolean initialized;
+ private List<IPath> systemIncludes;
+ private List<IPath> userIncludes;
+ private List<IDefine> macros;
+
+ /** Create a stub pkgconfig package, whose version will be detected on demand. */
+ public PkgConfigBuildPackage(IPackageManager manager, String packageName /*, ISystemPackage systemPackage*/) {
+ this(manager, packageName, null);
+ }
+
+ /** Create a pkgconfig package whose version is known. */
+ public PkgConfigBuildPackage(IPackageManager manager, String packageName, String packageVersion /*, ISystemPackage systemPackage*/) {
+ super(manager, packageName, packageVersion);
+ //this.systemPackage = systemPackage;
+ this.initialized = false;
+ }
+
+ private void ensureInitialized() {
+ if (initialized)
+ return;
+
+ synchronized (this) {
+ macros = new ArrayList<IDefine>();
+ systemIncludes = new ArrayList<IPath>();
+ userIncludes = new ArrayList<IPath>();
+
+ try {
+ scanPackage();
+ initialized = true;
+ } catch (Exception e) {
+ Activator.getErrorLogger().logError("Error scanning pkg-config package: " + getName(), e);
+ }
+ }
+ }
+
+ protected void doGetVersion() {
+ ensureInitialized();
+ }
+
+ private void scanPackage() throws Exception {
+
+ setVersion(VERSION_STRING_UNKNOWN);
+
+ PkgConfigScannerEngine engine = new PkgConfigScannerEngine();
+
+ IPkgConfigScanner scanner = new IPkgConfigScanner() {
+
+ public void handleVersion(String version) {
+ setVersion(version);
+ }
+
+ public void handleDefine(IDefine define) {
+ macros.add(define);
+ }
+
+ public void handleInclude(boolean isUserInclude, String path) {
+ if (isUserInclude)
+ userIncludes.add(new Path(path));
+ else
+ systemIncludes.add(new Path(path));
+ }
+ };
+
+ engine.gatherPkgConfigInfo(getPackageManager().getSDKTarget().getProcessLauncherFactory(),
+ null, getName(), true, true,
+ scanner);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IBuildPackage#getMacros()
+ */
+ public IDefine[] getMacros() {
+ ensureInitialized();
+ return (IDefine[]) macros.toArray(new IDefine[macros.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IBuildPackage#getSystemIncludes()
+ */
+ public IPath[] getSystemIncludes() {
+ ensureInitialized();
+ return (IPath[]) systemIncludes.toArray(new IPath[systemIncludes.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IBuildPackage#getSystemPackage()
+ */
+ public ISystemPackage getSystemPackage() {
+ return systemPackage;
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PkgConfigScannerEngine.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PkgConfigScannerEngine.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/internal/linux/packages/core/aptpkgconfig/PkgConfigScannerEngine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.linux.packages.core.aptpkgconfig;
+
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.cpp.DefineFactory;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.linux.packages.core.IPkgConfigScanner;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author eswartz
+ *
+ */
+public class PkgConfigScannerEngine {
+ final static Pattern INCL_PATTERN = Pattern.compile("-I\\s*(\\S+)");
+ final static Pattern DEFINE_PATTERN = Pattern.compile("-D\\s*(([A-Za-z_0-9]+)(=((\"([^\"]+)\")|(\\S+)))?)");
+
+ public PkgConfigScannerEngine() {
+
+ }
+
+ /**
+ * Run pkg-config for the given package, scanning output for well-known
+ * GCC command-line parameters and feeding these to a scanner.
+ * <p>
+ * This is not intended for the more arcane uses of pkg-config (e.g.
+ * checking for package existence or installation status).
+ * @param pkgConfig command for launching pkg-config (e.g. alternate path)
+ * or <code>null</code> for default
+ * @param arguments non-null array of command-line arguments to pkg-config
+ * @param pkgConfigScanner interface that receives all the interpreted
+ * output
+ * @throws ESboxException if errors detected
+ */
+ public void gatherPkgConfigInfo(
+ IProcessLauncherFactory launcherFactory,
+ String pkgConfig,
+ String pkgName,
+ boolean gatherVersion,
+ boolean gatherCFlags,
+ IPkgConfigScanner pkgConfigScanner) throws ESboxException {
+
+ List<String> cmdLine = new ArrayList<String>();
+
+ cmdLine.add(pkgConfig != null ? pkgConfig : "pkg-config");
+ if (gatherVersion)
+ cmdLine.add("--modversion");
+ if (gatherCFlags)
+ cmdLine.add("--cflags");
+
+ cmdLine.add(pkgName);
+
+ ProcessLauncherUtils.Results results = ProcessLauncherUtils.launchAndReadStandardStreams(
+ launcherFactory,
+ cmdLine);
+
+ String[] outputLines = results.getStdoutLines();
+ int lineNum = 0;
+
+ if (gatherVersion) {
+ if (lineNum >= outputLines.length) {
+ throw new ESboxException(MessageFormat.format("Did not get expected number of lines from ''{0}'' (wanted >={1}, got {2})",
+ CommandLineArguments.toCommandLine(cmdLine),
+ lineNum, outputLines.length));
+ }
+ pkgConfigScanner.handleVersion(outputLines[lineNum].trim());
+ lineNum++;
+ }
+
+ if (gatherCFlags) {
+ if (lineNum >= outputLines.length) {
+ throw new ESboxException(MessageFormat.format("Did not get expected number of lines from ''{0}'' (wanted >={1}, got {2})",
+ CommandLineArguments.toCommandLine(cmdLine),
+ lineNum, outputLines.length));
+ }
+
+ String output = outputLines[lineNum++];
+
+ scanPkgConfigCFlagsOutput(output, pkgConfigScanner);
+ }
+
+ if (results.stderr.length() > 0) {
+ throw new ESboxException(
+ MessageFormat.format(
+ "Errors running pkg-config:\n{0}",
+ results.stderr));
+ }
+ }
+
+ /**
+ * Scan pkg-config output for well-known
+ * GCC command-line parameters and feeding these to a scanner.
+ * @param output the textual output
+ * @throws ESboxException if errors detected
+ */
+ public void scanPkgConfigCFlagsOutput(String output,
+ IPkgConfigScanner pkgConfigScanner) throws ESboxException {
+
+ Matcher matcher = INCL_PATTERN.matcher(output);
+ while (matcher.find()) {
+ pkgConfigScanner.handleInclude(false, matcher.group(1));
+ }
+
+ matcher = DEFINE_PATTERN.matcher(output);
+ while (matcher.find()) {
+ pkgConfigScanner.handleDefine(DefineFactory.createSimpleFreeformDefine(matcher.group(1)));
+ }
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/EPackageCategory.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/EPackageCategory.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/EPackageCategory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.core;
+
+/**
+ * This is a package category used in IPackageMapping.
+ * @author eswartz
+ *
+ */
+public enum EPackageCategory {
+ /** The runtime variant of a package, which includes applications and libraries */
+ RUNTIME,
+ /** The development variant of a package, which includes relevant C/C++/etc headers */
+ DEVELOPMENT,
+ /** The debug variant of a package, which includes any free-standing debug symbols */
+ DEBUG
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IAptRepository.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IAptRepository.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IAptRepository.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.core;
+
+/**
+ * This represents a repository of apt packages.
+ * @author eswartz
+ *
+ */
+public interface IAptRepository extends IRepository {
+ /** Get the distribution. May be null for the default from the SDK target. */
+ String getDistribution();
+
+ /** Get the component array. Never null. */
+ String[] getComponents();
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IBuildPackage.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IBuildPackage.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IBuildPackage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.linux.packages.core;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.cpp.IDefine;
+
+/**
+ * This interface encapsulates the data associated with a build package,
+ * which is a package that influences the build process by providing
+ * build-time parameters.
+ * @author eswartz
+ *
+ */
+public interface IBuildPackage extends IPackage {
+ /**
+ * Get the system include paths reported
+ * @return list of paths, never null
+ */
+ IPath[] getSystemIncludes();
+
+ /**
+ * Get the macro definitions reported
+ * @return array of macros, never null
+ */
+ IDefine[] getMacros();
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IBuildPackageMapping.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IBuildPackageMapping.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IBuildPackageMapping.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.core;
+
+/**
+ * This is a mapping of build package to system package.
+ * @author eswartz
+ *
+ */
+public interface IBuildPackageMapping {
+ /**
+ * Get the build package
+ * @return name of build package
+ */
+ String getBuildPackageName();
+
+ /**
+ * Get the candidate package found for the mapping.
+ * @param category which kind of package you want
+ * @return name of a system package or <code>null</code>
+ */
+ String getSystemPackageName(EPackageCategory category);
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IImplicitBuildPackage.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IImplicitBuildPackage.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IImplicitBuildPackage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.linux.packages.core;
+
+/**
+ * This is a package which is implicitly known to an SDK,
+ * like the C library, compiler, etc.
+ * @author eswartz
+ *
+ */
+public interface IImplicitBuildPackage extends IBuildPackage {
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackage.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackage.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.linux.packages.core;
+
+import org.osgi.framework.Version;
+
+/**
+ * This interface encapsulates the data associated with a software package,
+ * i.e. a collection of files installed in an SDK which provide some functionality.
+ * A package has a name and a version.
+ * @author eswartz
+ *
+ */
+public interface IPackage {
+ /** The string used to represent an unknown version. */
+ public final static String VERSION_STRING_UNKNOWN = "<???>"; //$NON-NLS-1$
+
+ /** The version used to represent an unknown version. */
+ public final static Version VERSION_UNKNOWN = new Version(0, 0, 0);
+
+ /**
+ * Get the package manager.
+ * @return package manager, never null
+ */
+ IPackageManager getPackageManager();
+
+ /**
+ * Get the package queried
+ * @return name of package, never null
+ */
+ String getName();
+
+ /**
+ * Get the version of package detected. This may or may not be interpretable
+ * as an OSGI {@link Version}.
+ * @return version string, may be VERSION_STRING_UNKNOWN
+ */
+ String getVersionString();
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackageManager.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackageManager.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackageManager.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.linux.packages.core;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * This interface manages information about packages under a given SDK target. This
+ * assumes that only one version of a package is installed (and that
+ * incompatible differing versions have different names).
+ * <p>
+ * The package manager must be refreshed before use or else it will act as if
+ * empty.
+ *
+ * @author eswartz
+ *
+ */
+public interface IPackageManager {
+ /**
+ * Get the human-readable name for the manager
+ * @return
+ */
+ String getName();
+
+ /**
+ * Get the SDK target which owns a namespace of packages.
+ * @return SDK target, never null
+ */
+ ISDKTarget getSDKTarget();
+
+ /**
+ * Refresh the package manager. This is a long-running operation.
+ * Any references to IBuildPackage instances will be invalid after this operation.
+ * @param progressMonitor a monitor for progress
+ */
+ IStatus refresh(IProgressMonitor progressMonitor);
+
+ /**
+ * Get the information for a given system package. This is a record for
+ * a potentially installed or actually installed package.
+ * @param pkg name of package
+ * @return information, which may be null for missing packages
+ */
+ ISystemPackage getSystemPackage(String pkg);
+
+ /**
+ * Get all the packages known for the SDK.
+ * @return array of system packages, never null
+ */
+ ISystemPackage[] getSystemPackages();
+
+ /**
+ * Get all the build packages known for this SDK.
+ * @return array of build packages, never null
+ */
+ IBuildPackage[] getBuildPackages();
+
+ /**
+ * Get the information for a given build package. This is a record for
+ * an actually installed package.
+ * @param pkg name of package
+ * @return information, which may be <code>null</code> for missing packages
+ */
+ IBuildPackage getBuildPackage(String packageName);
+
+ /**
+ * Initiate a refresh of build packages, which may be necessary when a package
+ * is installed. This may be a long-running operation.
+ * @param progressMonitor
+ * @throws CoreException
+ */
+ void refreshBuildPackages(IProgressMonitor progressMonitor) throws CoreException;
+
+ /**
+ * Retrieve the mappings of the given build packages to system packages which apply to
+ * this package manager.
+ * @param buildPackageNames the array of names of build packages
+ * @param includeMetapackages if true, prefer metapackages providing the given build package over
+ * smaller packages.
+ * @param strict if true, only provide non-<code>null</code> entries for runtime or debug packages
+ * if they're really distinct from the development package
+ * @return array of IBuildPackageMapping, never <code>null</code>;
+ * the size is one per buildPackageName entry; each entry is non-<code>null</code>
+ */
+ IBuildPackageMapping[] getBuildPackageMappings(String[] buildPackageNames, boolean includeMetapackages, boolean strict);
+
+ /**
+ * Check all the packages to see which are not installed.
+ * @param packages the packages to check
+ * @return array of uninstalled packages, never <code>null</code>
+ */
+ ISystemPackage[] getUninstalledPackages(ISystemPackage[] packages);
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackageManagerProvider.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackageManagerProvider.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPackageManagerProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.core;
+
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * Provider for IPackageManager instances.
+ * @author eswartz
+ *
+ */
+public interface IPackageManagerProvider {
+ /**
+ * Create a package manager for the given SDK target.
+ * @param sdkTarget
+ * @return instance or <code>null</code> if target is not supported
+ */
+ IPackageManager createPackageManager(ISDKTarget sdkTarget);
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPkgConfigBuildPackage.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPkgConfigBuildPackage.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPkgConfigBuildPackage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.linux.packages.core;
+
+/**
+ * This is a package detected and queried via pkg-config.
+ * @author eswartz
+ *
+ */
+public interface IPkgConfigBuildPackage extends IBuildPackage {
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPkgConfigScanner.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPkgConfigScanner.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IPkgConfigScanner.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.linux.packages.core;
+
+import org.maemo.esbox.core.cpp.IDefine;
+
+/**
+ * This interface is used by {@link PkgConfigScannerEngine#gatherPkgConfigInfo(IProcessLauncherFactory, String, String[], String, IPkgConfigScanner), String[], IPkgConfigScanner)}
+ * and implemented by a client.
+ * @author eswartz
+ *
+ */
+public interface IPkgConfigScanner {
+ /**
+ * Handle the version.
+ * @param version
+ */
+ public void handleVersion(String version);
+
+ /**
+ * Handle a -I option.
+ * @param path the path after -I
+ */
+ public void handleInclude(boolean isUserInclude, String path);
+
+ /** Handle a -D option.
+ *
+ * @param define the parsed define
+ */
+ public void handleDefine(IDefine define);
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IRepository.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IRepository.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/IRepository.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.core;
+
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+import java.net.URI;
+
+/**
+ * This is an abstraction for the source of a set of packages.
+ * @author eswartz
+ *
+ */
+public interface IRepository {
+ /** Get the owning SDK target. */
+ ISDKTarget getSDKTarget();
+
+ /** Get the repository's name */
+ String getName();
+
+ /** Get the repository's URI */
+ URI getURI();
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/ISystemPackage.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/ISystemPackage.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/ISystemPackage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.linux.packages.core;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * This interface encapsulates the data associated with a system software package,
+ * i.e. a collection of files installed in an SDK target which provide some functionality.
+ * A package has a name and a version and dependencies.
+ * <p>
+ * Under maemo we expect that all the possible packages for an SDK taret are not fully
+ * installed at any given time. System packages may need to be installed at runtime.
+ * @author eswartz
+ *
+ */
+public interface ISystemPackage extends IPackage {
+ /**
+ * Tell if the package is installed on the system.
+ * @return true if installed, false if not
+ */
+ boolean isInstalled();
+
+ /**
+ * Install the package on the system. This is a long-running operation.
+ * @param progressMonitor a monitor for progress
+ * @return IStatus, never <code>null</code>; OK for success
+ */
+ IStatus installSystemPackage(IProgressMonitor progressMonitor);
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/PackageManagerProvider.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/PackageManagerProvider.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/PackageManagerProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.core;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.linux.packages.core.Activator;
+
+import java.util.*;
+
+/**
+ * Entry point to the package manager plugin.
+ *
+ * XXX: this won't work for devices, whose URIs may be the same for different devices, and ISDKTarget may not uniquely correspond with a machine either
+ * @author eswartz
+ *
+ */
+public class PackageManagerProvider {
+
+ private static final String PACKAGE_MANAGER_PROVDER_EXTENSION_ID = Activator.PLUGIN_ID + ".packageManagerProvider";
+ private static final String CLASS = "class";
+ private static PackageManagerProvider instance;
+
+ public static synchronized PackageManagerProvider getInstance() {
+ if (instance == null) {
+ instance = new PackageManagerProvider();
+ }
+ return instance;
+ }
+
+ private Map<String, IPackageManager> packageManagers;
+ private List<IPackageManagerProvider> packageManagerProviders;
+
+ public PackageManagerProvider() {
+ packageManagers = new HashMap<String, IPackageManager>();
+ packageManagerProviders = new ArrayList<IPackageManagerProvider>();
+ initializePackageManagerProviderList();
+ }
+
+ /**
+ * Initialize the list of defined Maemo SDKs. Such SDKs are described
+ * by plug-ins extension point org.maemo.esbox.ui.maemo_sdk
+ */
+ private void initializePackageManagerProviderList() {
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(PACKAGE_MANAGER_PROVDER_EXTENSION_ID).getExtensions();
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+ try {
+ IPackageManagerProvider provider = (IPackageManagerProvider) config.createExecutableExtension(CLASS);
+ packageManagerProviders.add(provider);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Failed to create IPackageManagerProvider", e);
+ }
+
+ }
+ }
+ }
+
+ protected IPackageManager createPackageManagerProviderFor(ISDKTarget sdkTarget) {
+ for (IPackageManagerProvider provider : packageManagerProviders) {
+ IPackageManager manager = provider.createPackageManager(sdkTarget);
+ if (manager != null)
+ return manager;
+ }
+ return null;
+ }
+
+ /**
+ * Get a package manager supporting the given target. Only the first
+ * matching entry is returned.
+ * @param sdkTarget the SDK Target to match
+ * @param monitor monitor for long-running manager initialization
+ * @return a singleton IPackageManager for the given SDK target, or <code>null</code>
+ */
+ public IPackageManager getPackageManagerFor(ISDKTarget sdkTarget, IProgressMonitor monitor) {
+ if (sdkTarget == null)
+ return null;
+ String sdkTargetKey = getSDKTargetKey(sdkTarget);
+ IPackageManager manager = packageManagers.get(sdkTargetKey);
+ if (manager == null) {
+ manager = createPackageManagerProviderFor(sdkTarget);
+ if (manager == null)
+ return null;
+
+ manager.refresh(monitor);
+ packageManagers.put(sdkTargetKey, manager);
+ }
+ return manager;
+ }
+
+ /**
+ * Get a unique key for this SDK target which should survive past
+ * regeneration of an ISDKTarget instance.
+ * @param sdkTarget
+ * @return a String uniquely identifying the sdk target
+ */
+ private String getSDKTargetKey(ISDKTarget sdkTarget) {
+ return sdkTarget.getSDK().getMachine().getURI().toString()
+ + "/" + sdkTarget.getSDK().getName() + "/" + sdkTarget.getName();
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/aptpkgconfig/AptPackageManager.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/aptpkgconfig/AptPackageManager.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/aptpkgconfig/AptPackageManager.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,427 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.linux.packages.core.aptpkgconfig;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.ILocalMachine;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.linux.packages.core.Activator;
+import org.maemo.esbox.internal.linux.packages.core.aptpkgconfig.*;
+import org.maemo.esbox.linux.packages.core.*;
+
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Debian apt-based package manager. In this manager, package names correspond
+ * to the Debian package names.
+ * @author eswartz
+ *
+ */
+public class AptPackageManager extends PackageManagerBase {
+
+ static final Pattern PACKAGE_PATTERN = Pattern.compile("Package:\\s+(.*)"); //$NON-NLS-1$
+ /** The version has a dotted string terminated by a dash and optional repository version info... but can be very complex so don't worry too much about the format */
+ public static final Pattern VERSION_PATTERN = Pattern.compile("Version:\\s+(.*)"); //$NON-NLS-1$
+
+ static final Pattern PKGITEM_PATTERN = Pattern.compile("(\\S+)\\s+(.*)"); //$NON-NLS-1$
+
+ private static final Pattern STATUS_PATTERN = Pattern.compile("Status:\\s+(.*)"); //$NON-NLS-1$
+ private static final String INSTALLED_TOKEN = "installed"; //$NON-NLS-1$
+
+
+ private final ISDKTarget sdkTarget;
+ private PackageMapper packageMapper;
+ private final IProcessLauncherFactory aptProcessLauncherFactory;
+ private final IProcessLauncherFactory pkgconfigProcessLauncherFactory;
+
+ /**
+ *
+ */
+ public AptPackageManager(ISDKTarget sdkTarget, IProcessLauncherFactory aptProcessLauncherFactory,
+ IProcessLauncherFactory pkgconfigProcessLauncherFactory) {
+ super("apt package manager for " + sdkTarget);
+ this.sdkTarget = sdkTarget;
+ this.aptProcessLauncherFactory = aptProcessLauncherFactory;
+ this.pkgconfigProcessLauncherFactory = pkgconfigProcessLauncherFactory;
+ }
+
+ /**
+ * Get a process launcher which can be used for apt-cache, pkg-config, etc.
+ * @return new process launcher factory
+ */
+ public IProcessLauncherFactory getPkgconfigProcessLauncherFactory() {
+ return pkgconfigProcessLauncherFactory;
+ }
+
+ /**
+ * Get a process launcher which can ensure programs can install
+ * programs and/or use "apt" properly.
+ * @return new process launcher factory
+ */
+ public IProcessLauncherFactory getAptProcessLauncherFactory() {
+ return aptProcessLauncherFactory;
+ }
+
+ public ISDKTarget getSDKTarget() {
+ return sdkTarget;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IPackageManager#refresh(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public synchronized IStatus refresh(IProgressMonitor monitor) {
+ return internalRefresh(monitor);
+ }
+
+ protected IStatus internalRefresh(IProgressMonitor monitor) {
+ IStatus status = Status.OK_STATUS;
+ reset();
+
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ monitor.beginTask("", 2);
+ monitor.subTask("Querying apt database...");
+ try {
+ // choose a scanning method for the bandwidth available
+ if (false && getSDKTarget().getSDK().getMachine() instanceof ILocalMachine) {
+ scanSystemPackagesFromNames(new SubProgressMonitor(monitor, 1));
+ } else {
+ scanSystemPackagesFromAvail(new SubProgressMonitor(monitor, 1));
+ }
+ scanBuildPackages(new SubProgressMonitor(monitor, 1));
+ } catch (CoreException e) {
+ status = e.getStatus();
+ } catch (Exception e) {
+ status = Activator.createErrorStatus("Failed to query apt database", e);
+ } finally {
+ monitor.done();
+ }
+ return status;
+ }
+
+ /**
+ * Make stub system packages for all those known to apt-cache.
+ * @param monitor
+ * @throws Exception
+ */
+ private void scanSystemPackagesFromNames(IProgressMonitor monitor) throws Exception {
+ monitor.beginTask("Scanning apt packages...", IProgressMonitor.UNKNOWN);
+ try {
+
+ ProcessLauncherUtils.Results results = ProcessLauncherUtils.launchAndReadStandardStreams(
+ getPkgconfigProcessLauncherFactory(),
+ CommandLineArguments.createFromVarArgs("apt-cache", "pkgnames"));
+
+ String[] pkgLines = results.getStdoutLines();
+ for (String line : pkgLines) {
+ AptSystemPackage pkg = new AptSystemPackage(this, line);
+ addSystemPackage(pkg);
+ }
+
+ } finally {
+ monitor.done();
+ }
+ }
+
+
+ /**
+ * Make system packages for all the packages known to apt-cache. This version
+ * is used when proces launching is slow.
+ * @param monitor
+ * @throws Exception
+ */
+ private void scanSystemPackagesFromAvail(IProgressMonitor monitor) throws Exception {
+ monitor.beginTask("Scanning apt packages", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
+ try {
+ ProcessLauncherUtils.Results results = ProcessLauncherUtils.launchAndReadStandardStreams(
+ getPkgconfigProcessLauncherFactory(),
+ monitor,
+ null /*cwd*/,
+ CommandLineArguments.createFromVarArgs("apt-cache", "dumpavail"),
+ null /*env*/);
+
+ String[] pkgLines = results.getStdoutLines();
+ for (int idx = 0; idx < pkgLines.length; ) {
+ idx = scanPackage(pkgLines, idx);
+ }
+
+ } finally {
+ System.out.println("Number of packages: " + getSystemPackages().length); //$NON-NLS-1$
+ monitor.done();
+ }
+ }
+
+ /**
+ * This version is obsolete but keep it for future cherry-picking
+ * @param monitor
+ * @throws Exception
+ */
+ private int scanPackage(String[] pkgLines, int idx) throws CoreException {
+ AptSystemPackage pkg = null;
+ String line = null;
+ while (idx < pkgLines.length) {
+ line = pkgLines[idx++];
+
+ // end of record
+ if (line.trim().length() == 0) {
+ return idx;
+ }
+
+ Matcher matcher = PACKAGE_PATTERN.matcher(line);
+ if (matcher.matches()) {
+ // see if there is a pkg-config entry for this (TODO)
+ pkg = new AptSystemPackage(this, matcher.group(1));
+ break;
+ }
+ }
+
+ if (pkg == null)
+ return idx;
+
+ // we have a package, so gather info
+ while (idx < pkgLines.length) {
+ line = pkgLines[idx++];
+
+ // end of record
+ if (line.trim().length() == 0)
+ break;
+
+ Matcher matcher = VERSION_PATTERN.matcher(line);
+ if (matcher.matches()) {
+ pkg.setVersion(matcher.group(1));
+ }
+
+ // ignore other lines
+ }
+
+ addSystemPackage(pkg);
+ return idx;
+ }
+
+ /**
+ * Make stub build packages for all those known to pkgconfig.
+ * @param monitor
+ * @throws Exception
+ */
+ private void scanBuildPackages(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("Scanning pkg-config packages...", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
+ try {
+ scanBuildPackageStubs();
+ try {
+ establishBuildPackageVersions();
+ } catch (ESboxException e) {
+ // this is not fatal
+ Activator.getErrorLogger().logError(null, e);
+ }
+ } catch (ESboxException e) {
+ throw new CoreException(Activator.createErrorStatus(null, e));
+ } finally {
+ monitor.done();
+ }
+ }
+/*
+ *
+ IProcessLauncherFactory processLauncherFactory = getProcessLauncherFactory();
+ Properties stdenv = processLauncherFactory.getStandardEnvironment();
+ String extraPathString = stdenv.getProperty("PKG_CONFIG_PATH", //$NON-NLS-1$
+ "/usr/lib/pkgconfig"); //$NON-NLS-1$
+ String[] pkgPaths = extraPathString.split(":"); //$NON-NLS-1$
+
+ for (String pkgPath : pkgPaths) {
+ IFileStore pkgConfigDir = getSDKTarget().getTargetFileSystemAccess().getFileStore(new Path(pkgPath));
+ IFileStore[] pkgFiles = pkgConfigDir.childStores(0, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
+ for (IFileStore pkgFile : pkgFiles) {
+ String name = pkgFile.getName();
+ if (name.endsWith(".pc")) {
+ scanBuildPackage(name.substring(0, name.length() - 3));
+ }
+ }
+ }
+
+ */
+ /**
+ * Report all the known pkg-config packages using 'pkg-config --list-all' and
+ * add stub entries.
+ * @throws ESboxException if anything went wrong
+ */
+ private void scanBuildPackageStubs() throws ESboxException {
+ ProcessLauncherUtils.Results results;
+ results = ProcessLauncherUtils.launchAndReadStandardStreams(
+ getPkgconfigProcessLauncherFactory(),
+ CommandLineArguments.createFromVarArgs("pkg-config", "--list-all"));
+
+ if (results.stderr.length() > 0) {
+ throw new ESboxException("Problem scanning build packages with pkg-config:\n" + results.stderr, null);
+ }
+
+ String[] lines = results.getStdoutLines();
+ for (String line : lines) {
+ if (line.trim().length() > 0) {
+ Matcher matcher = PKGITEM_PATTERN.matcher(line);
+ if (!matcher.matches()) {
+ throw new ESboxException(
+ "Unexpected line when scanning build packages with pkg-config:\n" + line);
+ }
+ IBuildPackage buildPackage = new PkgConfigBuildPackage(this, matcher.group(1), null);
+ addBuildPackage(buildPackage);
+ }
+ }
+ }
+
+ /**
+ * Try to quickly determine all the pkg-config package versions using 'pkg-config --modversion'.
+ * Note, this call will FAIL without reporting ANYTHING if any of the packages is broken.
+ * If that happens, just rely on on-demand querying for versions.
+ * @throws ESboxException if anything went wrong
+ */
+ private void establishBuildPackageVersions() throws ESboxException {
+ ProcessLauncherUtils.Results results;
+
+ IBuildPackage[] buildPackages = getBuildPackages();
+ List<String> pkgNames = new ArrayList<String>(buildPackages.length);
+ for (IBuildPackage buildPackage : buildPackages) {
+ pkgNames.add(buildPackage.getName());
+ }
+
+ // now, find all the versions in one shot
+ List<String> cmdLine = new ArrayList<String>(pkgNames);
+ cmdLine.add(0, "pkg-config");
+ cmdLine.add(1, "--modversion");
+
+ try {
+ results = ProcessLauncherUtils.launchAndReadStandardStreams(
+ getPkgconfigProcessLauncherFactory(),
+ cmdLine);
+ } catch (ESboxException e) {
+ throw new ESboxException("There was a problem scanning the versions of all pkg-config packages at once.\n"
+ +"I will fall back to scanning each individually. Please look into this problem to speed up operations in the future.",
+ e);
+ }
+
+ // the output has one version per line
+ String[] lines = results.getStdoutLines();
+ int pkgIdx = 0;
+ for (String line : lines) {
+ line = line.trim();
+ if (line.length() == 0)
+ continue;
+ if (pkgIdx >= pkgNames.size()) {
+ throw new ESboxException(
+ "Unexpected disparity when matching versions to " + pkgNames.size() + " build packages:\n" + results.stdout);
+ }
+ IBuildPackage buildPackage = new PkgConfigBuildPackage(this, pkgNames.get(pkgIdx), line);
+ addBuildPackage(buildPackage);
+ pkgIdx++;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IPackageManager#refreshBuildPackages(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public synchronized void refreshBuildPackages(IProgressMonitor progressMonitor) throws CoreException {
+ scanBuildPackages(progressMonitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IPackageManager#getBuildPackageMappings(java.lang.String[], boolean)
+ */
+ @SuppressWarnings("unchecked")
+ public IBuildPackageMapping[] getBuildPackageMappings(
+ String[] buildPackageNames, boolean includeMetapackages, boolean strict) {
+ synchronized (this) {
+ if (packageMapper == null) {
+ packageMapper = new PackageMapper();
+ }
+ }
+
+ IBuildPackageMapping[] bpms = new IBuildPackageMapping[buildPackageNames.length];
+
+ for (int idx = 0; idx < buildPackageNames.length; idx++) {
+ String buildPackageName = buildPackageNames[idx];
+
+ IBuildPackageMapping[] mappings = packageMapper.getBuildPackageMappings(
+ sdkTarget.getPlatform().getName(),
+ buildPackageName,
+ includeMetapackages, !strict);
+
+ if (mappings.length == 0) {
+ bpms[idx] = new BuildPackageMapping(buildPackageName, Collections.EMPTY_MAP);
+ } else {
+ // TODO: pick the one that most closely matches this platform -- usually it's the
+ // first one (if the extensions were defined properly) but they may refer
+ // to system packages that are not available (e.g. slightly bumped versions).
+ bpms[idx] = mappings[0];
+ }
+ }
+
+ return bpms;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.packages.IPackageManager#getUninstalledPackages(org.maemo.esbox.core.packages.ISystemPackage[])
+ */
+ public ISystemPackage[] getUninstalledPackages(ISystemPackage[] packages) {
+ List<ISystemPackage> missing = new ArrayList<ISystemPackage>(Arrays.asList(packages));
+ try {
+ // run dpkg -s <package>... to get info. The stdout has a Status: line with 'installed' if so
+ List<String> cmdLine = CommandLineArguments.createFromVarArgs("dpkg", "-s");
+ for (ISystemPackage pkg : packages)
+ cmdLine.add(pkg.getName());
+
+ ProcessLauncherUtils.Results results = ProcessLauncherUtils.launchAndReadStandardStreams(
+ getPkgconfigProcessLauncherFactory(), // not a root command
+ cmdLine);
+
+ ISystemPackage currentPackage = null;
+ String[] lines = results.getStdoutLines();
+ for (String line : lines) {
+ Matcher matcher;
+
+ matcher = PACKAGE_PATTERN.matcher(line);
+ if (matcher.matches()) {
+ currentPackage = null;
+ for (ISystemPackage pkg : packages)
+ if (pkg.getName().equals(matcher.group(1))) {
+ currentPackage = pkg;
+ break;
+ }
+
+ if (currentPackage == null)
+ throw new IllegalStateException("Expected to find package");
+ continue;
+ }
+
+ matcher = STATUS_PATTERN.matcher(line);
+ if (matcher.matches()) {
+ String[] tokens = matcher.group(1).split("\\s+"); //$NON-NLS-1$
+ for (String token : tokens) {
+ if (INSTALLED_TOKEN.equals(token)) {
+ missing.remove(currentPackage);
+ break;
+ }
+ }
+ continue;
+ }
+ }
+ } catch (Exception e) {
+ // debug
+ Activator.getErrorLogger().logError("Failed to check status of packages", e);
+ }
+
+ // anything left over is missing
+ return (ISystemPackage[]) missing.toArray(new ISystemPackage[missing.size()]);
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/debian/DebianPackageInstaller.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/debian/DebianPackageInstaller.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/debian/DebianPackageInstaller.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.core.debian;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineManager;
+
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.internal.linux.packages.core.Activator;
+import org.maemo.esbox.project.core.ProjectScriptLauncher;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * This class handles installing Debian packages, from build, to copy, to installation.
+ * <p>
+ *
+ * @author eswartz
+ *
+ */
+public class DebianPackageInstaller {
+ private boolean isCreatePackage;
+ private boolean isInstallPackage;
+ private File packageLocation;
+ private IProject project;
+ private final IMachine deviceMachine;
+
+ public DebianPackageInstaller(boolean createPackage, boolean installPackage,
+ IProject project, File packageLocation, IMachine sshMachine) {
+ this.isCreatePackage = createPackage;
+ this.isInstallPackage = installPackage;
+ this.project = project;
+ this.packageLocation = packageLocation;
+ this.deviceMachine = sshMachine;
+ }
+
+ /**
+ * Install a debian package to the device.
+ * @param data initialized information about the package
+ * @param monitor
+ * @return status of installation
+ */
+ public IStatus installDebianPackage(IProgressMonitor monitor) {
+ IStatus status = Status.OK_STATUS;
+
+ monitor.beginTask("Deploying Debian package", 4);
+
+ try {
+ if (isCreatePackage) {
+ status = createDebianPackage( new SubProgressMonitor(monitor, 1));
+ if (status.getSeverity() != Status.OK)
+ return status;
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ } else {
+ monitor.worked(1);
+ }
+
+ if (isInstallPackage) {
+ MessageConsole console = CorePlugin.getDefault().getConsole(true, null, "Installing Debian package");
+
+ String targetFolder = CorePlugin.getDefault().getCorePreferenceProvider().getPreferenceValue(ESboxPreferenceConstants.SSH_DEST_FOLDER);
+ IPath targetPath = getAbsoluteTargetPackageFolder(targetFolder);
+
+ status = copyPackage(targetPath, console, new SubProgressMonitor(monitor, 1));
+ if (status.getSeverity() != Status.OK)
+ return status;
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+
+ status = installDebianPackage(targetPath, console, new SubProgressMonitor(monitor, 1));
+ if (status.getSeverity() != Status.OK)
+ return status;
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+
+
+ } else {
+ monitor.worked(2);
+ }
+ } finally {
+ MachineManager.getInstance().releaseMachine(deviceMachine, new SubProgressMonitor(monitor, 1));
+ monitor.done();
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /** Invoke command to build Debian package */
+ private IStatus createDebianPackage(IProgressMonitor monitor) {
+ try {
+ DebianScriptLauncher.getInstance().createDebianPackage(project, monitor);
+ } catch (ESboxException e) {
+ return Activator.createErrorStatus("Failed to create Debian project", e);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /** Copy package to the device and return Status
+ * @param console */
+ private IStatus copyPackage(IPath targetPath, MessageConsole console, IProgressMonitor monitor) {
+
+ IStatus status = downloadFile(packageLocation, targetPath, console, monitor);
+
+
+ return status;
+ }
+
+ /**
+ * Get the absolute destination folder for the copied package. We get an absolute path
+ * since it's likely that the user which copies is not root, and the default destination
+ * folder is relative to that user's home.
+ * @param sshConfiguration
+ * @param targetFolder
+ * @return target-side absolute path
+ */
+ private IPath getAbsoluteTargetPackageFolder(String targetFolder) {
+ IPath path = new Path(targetFolder);
+ if (path.isAbsolute())
+ return path;
+
+ return deviceMachine.getUserHome().append(targetFolder);
+ }
+
+ /**
+ * Download the package file to the SSH file copying location. This is probably relative to
+ * the user's home.
+ */
+ private IStatus downloadFile(File hostFile, IPath targetPath, MessageConsole console, IProgressMonitor monitor) {
+
+ monitor.beginTask("", 2);
+ monitor.subTask("Copying package");
+
+ IFileStore fromStore = EFS.getLocalFileSystem().fromLocalFile(hostFile);
+ IFileStore toStore = deviceMachine.getFileSystemAccess().getFileStore(targetPath).getChild(hostFile.getName());
+
+ try {
+ fromStore.getParent().mkdir(0, new SubProgressMonitor(monitor, 1));
+ fromStore.copy(toStore, EFS.OVERWRITE, new SubProgressMonitor(monitor, 1));
+ } catch (CoreException e) {
+ return e.getStatus();
+ } finally {
+ monitor.done();
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ private IStatus installDebianPackage(IPath targetPath, MessageConsole console, IProgressMonitor monitor) {
+ monitor.beginTask("", 1);
+ monitor.subTask("Installing package; watch device for prompts");
+
+ String packageName = packageLocation.getName();
+ String targetPackageLocation = targetPath.append(packageName).toPortableString();
+
+ List<String> cmdLine = CommandLineArguments.createFromVarArgs("dpkg", "-i", targetPackageLocation);
+
+ IProcessLauncher processLauncher = deviceMachine.getProcessLauncherFactory().createProcessLaunchHandler(
+ null,
+ cmdLine,
+ null);
+
+ Process process;
+ try {
+ process = processLauncher.createProcess();
+ } catch (ESboxException e1) {
+ return Activator.createErrorStatus("Failed to run dpkg", e1);
+ }
+
+ processLauncher.redirectToConsole(console);
+
+ int exit;
+ try {
+ exit = ProjectScriptLauncher.getInstance().waitForProcess(process, monitor);
+ } catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ }
+ if (exit != 0) {
+ return Activator.createErrorStatus("Package installation failed (exit code " + exit + ")", null);
+ }
+ monitor.worked(1);
+ monitor.done();
+
+ return Status.OK_STATUS;
+ }
+}
\ No newline at end of file
Added: trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/debian/DebianScriptLauncher.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/debian/DebianScriptLauncher.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/src/org/maemo/esbox/linux/packages/core/debian/DebianScriptLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.core.debian;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.linux.packages.core.Activator;
+import org.maemo.esbox.project.core.ProjectManager;
+import org.maemo.esbox.project.core.ProjectScriptLauncher;
+
+/**
+ * Class handle all methods that needs some graphical environment.
+ * It invokes graphical thing that are ordered in window - preferences -
+ * Scratchbox preferences.
+ * @author kosola
+ * modified by Raul Fernandes Herbster
+ * modified by eswartz
+ */
+public class DebianScriptLauncher {
+
+ private static DebianScriptLauncher singleton = null;
+
+ /**
+ * Constructor
+ */
+ private DebianScriptLauncher() {
+ }
+
+ public static synchronized DebianScriptLauncher getInstance() {
+ if (singleton == null) {
+ singleton = new DebianScriptLauncher();
+ }
+ return singleton;
+ }
+
+ /**
+ * Create a job which will build a debian package in the project's directory. Waits for completion.
+ * @return IStatus status of build
+ */
+ public void createDebianPackage(final IProject project, IProgressMonitor monitor) throws ESboxException {
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ monitor.subTask("Creating package");
+
+ IPath path = project.getLocation();
+
+ ProjectScriptLauncher.getInstance().verifyFiles(new IPath[] { path.append("debian"),
+ path.append("debian/changelog"),
+ path.append("debian/control"),
+ path.append("debian/rules") });
+
+ ISDKTarget target = ProjectManager.getInstance().getSDKTarget(project);
+
+ IProcessLauncherFactory launcherFactory = target.getProcessLauncherFactory();
+
+ String cmd = "dpkg-buildpackage -rfakeroot -d";
+
+ // launch command inside Scratchbox
+ final IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ launcherFactory, target.convertHostToTargetPath(path),
+ CommandLineArguments.createFromCommandLine(cmd));
+
+ Process sbp = processLauncher.createProcess();
+
+ processLauncher.redirectToConsole(true, null, "Making Debian package [" + project.getName() + "]");
+
+ monitor.worked(1);
+
+ int exit;
+ try {
+ exit = ProjectScriptLauncher.getInstance().waitForProcess(sbp, monitor);
+ if (exit != 0) {
+ throw new ESboxException("Package creation failed; see Console (exit code " + exit + ")");
+ }
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch (CoreException e) {
+ throw new ESboxException(e);
+ }
+ } catch (InterruptedException e1) {
+ throw new ESboxException("Package creation interrupted");
+ }
+
+ monitor.done();
+
+ }
+
+
+ /**
+ * Build a Debian package in the background.
+ * @param project
+ */
+ public void runCreateDebianPackage(final IProject project) {
+ WorkspaceJob job = new WorkspaceJob("Creating Debian package") {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ createDebianPackage(project, monitor);
+ } catch (ESboxException e) {
+ return Activator.createErrorStatus("Failed to create Debian package", e);
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.core/utils/scan-pkgconfig.sh
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.core/utils/scan-pkgconfig.sh (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.core/utils/scan-pkgconfig.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+#!/bin/bash
+for i in /usr/lib/pkgconfig/*.pc; do
+ PKG=`dpkg -S $i|awk -F: '{print $1}'`;
+ #echo $PKG
+ if [ ! -z "$PKG" ] ; then
+ # find the non-dev package
+ NONDEV=`echo $PKG | sed s/-dev//`
+ RUNTIME=`apt-cache depends $PKG | grep $NONDEV | grep -m 1 -e '^ Depends' | awk '{ print $2 }'`
+
+ LINE="build=\"`basename $i .pc`\" system=\"$PKG\""
+ if [ ! -z "$RUNTIME" ]; then
+ LINE="$LINE systemRuntime=\"$RUNTIME\"";
+
+ DBG=`apt-cache search ${RUNTIME}-dbg | awk '{ print $1 }'`
+ if [ ! -z "$DBG" ] ; then
+ LINE="$LINE systemDebug=\"$DBG\"";
+ fi
+ fi
+
+ echo '<mapping '$LINE' />'
+ fi
+done
Property changes on: trunk/linux/org.maemo.esbox.linux.packages.ui
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/.classpath
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/.classpath (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/.project
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/.project (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.linux.packages.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:26:39 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESBox Linux Packages UI Plug-in
+Bundle-SymbolicName: org.maemo.esbox.linux.packages.ui;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.linux.packages.ui.UIActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.eclipse.core.expressions;bundle-version="3.4.0",
+ org.maemo.esbox.linux.packages.core;bundle-version="1.5.0",
+ org.maemo.esbox.ui;bundle-version="1.5.0",
+ org.maemo.esbox.linux.autotools.core;bundle-version="1.5.0",
+ org.maemo.esbox.ssh;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.linux.packages.ui
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/build.properties
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/build.properties (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/plugin.xml
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/plugin.xml (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.maemo.esbox.linux.packages.ui.popupMenu.NavigationContribution"
+ objectClass="org.eclipse.core.resources.IProject">
+ <menu
+ id="org.maemo.esbox.linux.packages.ui.debpopup"
+ label="Debian Package"
+ path="buildGroup">
+ </menu>
+ <action
+ class="org.maemo.esbox.linux.packages.ui.actions.DeployDebianPackageAction"
+ enablesFor="1"
+ id="org.maemo.esbox.linux.packages.ui.action.deploypackage"
+ label="Install Debian Package on Device"
+ menubarPath="org.maemo.esbox.linux.packages.ui.debpopup/content">
+ </action>
+ <action
+ class="org.maemo.esbox.linux.packages.ui.actions.CreateDebianPackageAction"
+ enablesFor="1"
+ id="org.maemo.esbox.linux.packages.ui.action.createdebianpackage"
+ label="Create Debian Package"
+ menubarPath="org.maemo.esbox.linux.packages.ui.debpopup/content">
+ </action>
+ </objectContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:project?after=additions">
+ <command
+ commandId="org.maemo.esbox.linux.packages.ui.validatePackages"
+ mnemonic="V"
+ style="push"
+ tooltip="Validate that the necessary packages are installed to build and run the application.">
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.ui.category.project"
+ description="Ensure that the necessary packages are installed to build and run the application."
+ id="org.maemo.esbox.linux.packages.ui.validatePackages"
+ name="Validate Installed Packages">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.maemo.esbox.linux.packages.ui.actions.ValidatePackagesCommand"
+ commandId="org.maemo.esbox.linux.packages.ui.validatePackages">
+ <enabledWhen>
+ <count
+ value="+">
+ </count>
+ </enabledWhen>
+ </handler>
+ </extension>
+</plugin>
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal/linux/packages/ui/UIActivator.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal/linux/packages/ui/UIActivator.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/internal/linux/packages/ui/UIActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,131 @@
+package org.maemo.esbox.internal.linux.packages.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.linux.packages.ui";
+
+ // The shared instance
+ private static UIActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public UIActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return UIActivator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/DeployDebianPackageWizard.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/DeployDebianPackageWizard.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/DeployDebianPackageWizard.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.wizard.Wizard;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.api.ssh.DeviceSSHLinuxMachine;
+import org.maemo.esbox.internal.linux.packages.ui.UIActivator;
+import org.maemo.esbox.linux.packages.core.debian.DebianPackageInstaller;
+import org.maemo.esbox.ssh.*;
+
+import java.io.File;
+
+public class DeployDebianPackageWizard extends Wizard {
+ private DeployDebianPackageWizardPage deployPage;
+
+ public DeployDebianPackageWizard() {
+ super();
+ setNeedsProgressMonitor(true);
+ setWindowTitle("Install Debian Package On Device");
+ init();
+ }
+
+ public void init() {
+ deployPage = new DeployDebianPackageWizardPage();
+ addPage(deployPage);
+ }
+
+ public boolean canFinish() {
+ return deployPage.canFinish();
+ }
+
+ @Override
+ public boolean performFinish() {
+
+ deployPage.storeProjectPackage();
+
+ final DebianPackageInstaller data = createDebianPackageInstaller();
+
+ Job job = new Job("Deploying Debian package") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IStatus status = data.installDebianPackage(monitor);
+ if (status.getSeverity() == IStatus.ERROR) {
+ if (status.getException() instanceof InterruptedException)
+ return Status.CANCEL_STATUS;
+ UIActivator.getErrorLogger().logAndShowError(
+ null, new CoreException(status));
+ return Status.OK_STATUS;
+ } else {
+ return status;
+ }
+ }
+ };
+
+ job.setUser(true);
+ job.schedule();
+
+ return true;
+ }
+
+ private DebianPackageInstaller createDebianPackageInstaller() {
+ ISSHMachine sshMachine = new DeviceSSHLinuxMachine(
+ "Debian Package Target",
+ createSSHConfiguration(),
+ null);
+ DebianPackageInstaller data = new DebianPackageInstaller(
+ deployPage.isCreatePackage(),
+ deployPage.isInstallPackage(),
+ deployPage.getProject(),
+ new File(deployPage.getPackageLocation()),
+ sshMachine);
+ return data;
+ }
+
+ // XXX: remove SSH dependency from this module
+ protected SSHConfiguration createSSHConfiguration() {
+ ISDKTarget sdkTarget = deployPage.getSDKTarget();
+
+ // only root can install packages
+ String deviceName = deployPage.getTargetAddress();
+ String userName = "root";
+ String connectionTimeoutStr = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SSH_CONNECTION_TIMEOUT);
+ int connectionTimeout = 30;
+ try {
+ connectionTimeout = Integer.valueOf(connectionTimeoutStr);
+ } catch (NumberFormatException e) {
+ }
+
+ SSHConfiguration sshConfiguration = new SSHConfiguration(deviceName, userName, connectionTimeout);
+
+ return sshConfiguration;
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/DeployDebianPackageWizardPage.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/DeployDebianPackageWizardPage.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/DeployDebianPackageWizardPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,326 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.ui;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.PlatformUI;
+import org.maemo.esbox.core.ESboxException;
+
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.linux.packages.ui.UIActivator;
+import org.maemo.esbox.project.core.ProjectManager;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+public class DeployDebianPackageWizardPage extends WizardPage {
+ private static final QualifiedName DEBIAN_PACKAGE_PROPERTY = new QualifiedName(UIActivator.PLUGIN_ID, "debian_package_file");
+
+ private IProject project;
+
+ private Button createDeb, installDeb;
+
+ private Text packageName;
+ private Button browserButton;
+ private FileDialog fileDialog;
+
+ private ISDKTarget sdkTarget;
+
+ private Text targetAddress;
+
+ protected DeployDebianPackageWizardPage() {
+ super("Deploy Debian Package");
+ setTitle("Deploy Debian Package");
+ setDescription("Deploy a Debian package to the device");
+ setPageComplete(false);
+
+ project = (IProject) extractSelection();
+ try {
+ sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
+ } catch (ESboxException e) {
+ UIActivator.getErrorLogger().logAndShowError("Cannot determine scratchbox target", e);
+ return;
+ }
+ }
+
+ public void createControl(Composite parent) {
+
+ Composite composite1 = new Composite(parent, SWT.NONE);
+ composite1.setLayout(new GridLayout(1, false));
+ Composite composite = composite1;
+
+ Composite twoColumnGroup = new Composite(composite, SWT.NONE);
+ twoColumnGroup.setLayout(new GridLayout(2, false));
+ twoColumnGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+
+ createText(twoColumnGroup, "Project Name:");
+
+ /* Separator */
+ //new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ fileDialog = new FileDialog(getShell(),SWT.OPEN);
+ fileDialog.setFilterPath(project.getLocation().toOSString());
+
+ createPackageGroup(twoColumnGroup, "Package Location:");
+
+ /* Separator */
+ //new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ targetAddress = createText(twoColumnGroup, "Device address:");
+ targetAddress.setText("192.168.2.15");
+ targetAddress.setEnabled(true);
+
+ /* Separator */
+ //new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Group checkGroup = new Group(composite, SWT.NONE);
+ checkGroup.setText("");
+ checkGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ checkGroup.setLayout(new GridLayout(1,false));
+
+ createDeb = createButton(checkGroup, "Create Debian package", false);
+ installDeb = createButton(checkGroup, "Install package on device", true);
+
+ /* Separator */
+ //new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ setControl(composite);
+
+ installDeb.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ targetAddress.setEnabled(installDeb.getSelection());
+ }
+ });
+
+ establishDebianPackage();
+ }
+
+ private void createPackageGroup(Composite twoColumnGroup, String label) {
+ createLabel(twoColumnGroup, label);
+
+ Composite packageLocationGroup = new Composite(twoColumnGroup, SWT.NONE);
+ packageLocationGroup.setLayout(new GridLayout(2, false));
+ packageLocationGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ packageName = new Text(packageLocationGroup, SWT.BORDER);
+ packageName.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ setPageComplete(packageName.getText().length() > 0);
+ }
+
+ });
+ packageName.setText("");
+ GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ data.widthHint = 240;
+ packageName.setLayoutData(data);
+
+ browserButton = new Button(packageLocationGroup, SWT.PUSH);
+ browserButton.setText("Browse...");
+ data = new GridData(SWT.LEFT, SWT.CENTER, false, false);
+ data.minimumWidth = 100;
+ browserButton.setLayoutData(data);
+
+ browserButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String currentPath = packageName.getText();
+ if (currentPath.length() > 0) {
+ File current = new File(currentPath);
+ fileDialog.setFilterPath(current.getParent());
+ fileDialog.setFileName(current.getName());
+ }
+ String fileName = fileDialog.open();
+ packageName.setText(fileName);
+ setPageComplete(true);
+ }
+ });
+ }
+
+ private Text createText(Composite twoColumnGroup, String label) {
+ createLabel(twoColumnGroup, label);
+
+ Text text = new Text(twoColumnGroup, SWT.BORDER | SWT.READ_ONLY);
+ text.setText(getProjectName());
+ text.setEditable(false);
+ text.setEnabled(false);
+ text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return text;
+ }
+
+ private void createLabel(Composite twoColumnGroup, String string) {
+ Label label = new Label(twoColumnGroup, SWT.LEFT);
+ label.setText(string);
+ GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
+ gridData.minimumWidth = 100;
+ gridData.widthHint = 100;
+ label.setLayoutData(gridData);
+ }
+
+ private Button createButton(Composite container, String text, boolean enabled) {
+ Button button = new Button(container, SWT.CHECK);
+ button.setText(text);
+ button.setSelection(enabled);
+ GridData gd = new GridData(SWT.LEFT, SWT.CENTER, true, false);
+ button.setLayoutData(gd);
+ return button;
+ }
+
+ /** Establish the debian package to use. */
+ public void establishDebianPackage() {
+ File pkg = getStoredProjectPackage();
+ if (pkg == null) {
+ pkg = guessProjectPackage();
+ }
+ if (pkg != null) {
+ String pkgPath = pkg.getAbsolutePath();
+ packageName.setText(pkgPath);
+ int idx = pkg.getName().length();
+ packageName.setSelection(pkgPath.length() - idx, pkgPath.length());
+ setPageComplete(true);
+ }
+ }
+
+ /**
+ * Get the debian package previously saved with the project.
+ * <p>
+ * NOTE: this is going to be total guesswork until we can parse the
+ * debian package control file.
+ * @return File or null if unknown
+ */
+ public File getStoredProjectPackage() {
+ // see if we know from last time
+ try {
+ String filePath = getProject().getPersistentProperty(DEBIAN_PACKAGE_PROPERTY);
+ if (filePath != null && filePath.length() > 0)
+ return new File(filePath);
+ } catch (CoreException e) {
+ // nope!
+ UIActivator.getErrorLogger().logError(null, e);
+ }
+ return null;
+ }
+
+ public void storeProjectPackage() {
+ try {
+ getProject().setPersistentProperty(DEBIAN_PACKAGE_PROPERTY, getPackageLocation());
+ } catch (CoreException e1) {
+ UIActivator.getErrorLogger().logError(null, e1);
+ }
+ }
+
+
+ /**
+ * guess the debian package associated with the project.
+ * <p>
+ * NOTE: this is going to be total guesswork until we can parse the
+ * debian package control file.
+ * @return File or null if unknown
+ */
+ public File guessProjectPackage() {
+ // filter points to project directory; packages built one level lower
+ File dir = getProject().getLocation().removeLastSegments(1).toFile();
+
+ String[] packages = dir.list(new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".deb");
+ }
+ });
+
+ // see if any matches the project name
+ String pkg = null;
+ for (String pack : packages) {
+ if (pack.startsWith(getProjectName())) {
+ pkg = pack;
+ break;
+ }
+ }
+ if (pkg == null) {
+ String prjPrefix = getProjectName().substring(0, 8);
+
+ // look for one that starts with a reasonable prefix
+ for (String pack : packages) {
+ if (pack.startsWith(prjPrefix)) {
+ pkg = pack;
+ break;
+ }
+ }
+ }
+ if (pkg != null) {
+ return new File(dir, pkg);
+ }
+ return null;
+ }
+
+ private IResource extractSelection() {
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ if(!(selection instanceof IStructuredSelection))
+ return null;
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ Object element = ss.getFirstElement();
+ if(element instanceof IResource)
+ return ((IResource)element).getProject();
+ if(!(element instanceof IAdaptable))
+ return null;
+ IAdaptable adaptable = (IAdaptable)element;
+ Object adapter = adaptable.getAdapter (IResource.class);
+ IResource resource = (IResource)adapter;
+ return resource.getProject();
+ }
+
+ private String getProjectName() {
+ return getProject().getName();
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ public boolean isCreatePackage() {
+ return createDeb.getSelection();
+ }
+
+ public boolean isInstallPackage() {
+ return installDeb.getSelection();
+ }
+
+
+ public boolean canFinish() {
+ return isPageComplete();
+ }
+
+ public String getPackageLocation() {
+ return packageName.getText();
+ }
+
+ public ISDKTarget getSDKTarget() {
+ return sdkTarget;
+ }
+
+ public String getTargetAddress() {
+ return targetAddress.getText();
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/ProjectPackageInstaller.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/ProjectPackageInstaller.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/ProjectPackageInstaller.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.ui;
+
+import com.nokia.cpp.internal.api.utils.core.TextUtils;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.GeneralUtils;
+import org.maemo.esbox.core.machine.IDeviceMachine;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.linux.packages.ui.UIActivator;
+import org.maemo.esbox.linux.packages.core.IPackageManager;
+import org.maemo.esbox.linux.packages.core.ISystemPackage;
+
+import java.text.MessageFormat;
+import java.util.*;
+
+/**
+ * This will check whether a given list of apt packages is available and
+ * prompt the user to install them if needed.
+ * @author eswartz
+ *
+ */
+public class ProjectPackageInstaller {
+
+ /**
+ * Check that the given set of system packages is installed in every package manager.
+ * <p>
+ * This will show UI if any of the packages is missing, and prompt to install;
+ * and also show errors if the packages cannot be installed;
+ * and finally show errors if the packages fail to install.
+ * <p>
+ * The user may choose, at any of these error points, to continue or fail. If he
+ * continues through all errors (i.e. elects to install packages or okays their missing
+ * state), no exception is thrown, otherwise, an exception
+ * is thrown with the details of the missing or non-installable packages.
+ * @param shell in which to show UI
+ * @param packageManagers
+ * @param systemPackageNames
+ * @param monitor for progress tracking
+ * @return information about the installation results
+ * @throws CoreException if user cancels process (does not install) or installation fails (no UI shown)
+ */
+ public static IStatus ensureInstalledPackages(Shell shell,
+ IPackageManager[] packageManagers, String[] packageNames,
+ IProgressMonitor monitor) throws CoreException {
+
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ int totalWork = packageManagers.length * packageNames.length;
+ monitor.beginTask("Validating packages...", totalWork);
+
+ List<String> missingPackages = new ArrayList<String>();
+ List<ISystemPackage> toInstallPackages = new ArrayList<ISystemPackage>();
+
+ Set<String> missingPackageSdkTargetNames = new LinkedHashSet<String>();
+ Set<String> toInstallPackageSdkTargetNames = new LinkedHashSet<String>();
+
+ IStatus cancelStatus = UIActivator.createStatus(IStatus.CANCEL, "The operation was canceled.");
+
+ // find anything missing in any manager
+ for (IPackageManager packageManager : packageManagers) {
+ monitor.subTask("Checking packages in " + getInstallTargetName(packageManager) + "...");
+
+ // gather packages for this manager
+ List<ISystemPackage> mgrPackages = new ArrayList<ISystemPackage>();
+ for (String packageName : packageNames) {
+ ISystemPackage systemPackage = packageManager.getSystemPackage(packageName);
+ if (systemPackage == null) {
+ missingPackages.add(packageName);
+ missingPackageSdkTargetNames.add(getInstallTargetName(packageManager));
+ } else {
+ mgrPackages.add(systemPackage);
+ }
+ }
+
+ // do a bulk installation check
+ ISystemPackage[] uninstalled = packageManager.getUninstalledPackages((ISystemPackage[]) mgrPackages.toArray(new ISystemPackage[mgrPackages.size()]));
+ if (uninstalled.length > 0) {
+ toInstallPackageSdkTargetNames.add(getInstallTargetName(packageManager));
+ for (ISystemPackage pkg : uninstalled) {
+ toInstallPackages.add(pkg);
+ }
+ }
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return cancelStatus;
+ }
+
+ // now report if anything is up
+ if (missingPackages.size() > 0) {
+ String errorMessage = MessageFormat.format(
+ "Some required packages are not available in some build targets ({0}):\n\n{1}\n\nThere is probably a missing repository (see /etc/apt/sources.list)",
+ catenateObjects(missingPackageSdkTargetNames, ","),
+ catenateObjects(missingPackages, "\n"));
+ if (!okCancelError(shell, "Packages missing", errorMessage + "\n\nDo you want to continue?")) {
+ throw new CoreException(UIActivator.createErrorStatus(errorMessage, null));
+ }
+ }
+
+
+ if (toInstallPackages.size() > 0) {
+ String errorMessage = MessageFormat.format(
+ "Some packages need to be installed in in some build targets ({0}) to build or debug this project:\n\n{1}\n\nDo you want to install them now?",
+ catenateObjects(toInstallPackageSdkTargetNames, ","),
+ catenateObjects(toInstallPackages, "\n"));
+ int ret = yesNoCancel(shell, "Packages needed", errorMessage);
+ if (ret == 2) {
+ throw new CoreException(UIActivator.createErrorStatus(errorMessage, null));
+ }
+ if (ret == 1) {
+ return cancelStatus;
+ }
+
+ monitor.worked(totalWork - toInstallPackages.size());
+ try {
+ monitor.setTaskName("Installing packages...");
+ monitor.subTask("");
+
+ installPackages(toInstallPackages, new SubProgressMonitor(monitor, toInstallPackages.size()));
+
+ return UIActivator.createStatus(IStatus.OK, "All the required packages were installed.");
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().showError(e.getStatus().getMessage(), e.getStatus().getException());
+ throw e;
+ }
+ } else {
+ // nothing to do
+ if (missingPackages.size() > 0)
+ return UIActivator.createStatus(IStatus.WARNING,
+ MessageFormat.format("Some unknown packages could not be installed:\n\n\t{0}",
+ TextUtils.catenateStrings(missingPackages.toArray(), "\n\t")));
+ else
+ return UIActivator.createStatus(IStatus.OK, "All known packages are installed.");
+ }
+ }
+
+ /**
+ * Get a name for the target (and device) for the installation
+ * @param packageManager
+ * @return name
+ */
+ private static String getInstallTargetName(IPackageManager packageManager) {
+ ISDKTarget target = packageManager.getSDKTarget();
+ String name = target.getName();
+ if (target.getSDK().getMachine() instanceof IDeviceMachine) {
+ name += " (" + target.getSDK().getMachine().getName() + ")";
+ }
+ return name;
+ }
+
+
+ /**
+ * @param string
+ * @return
+ */
+ private static boolean okCancelError(final Shell shell, final String title, final String message) {
+ if (GeneralUtils.isJUnitRunning())
+ return true;
+ final boolean[] results = { false };
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog dialog = new MessageDialog(shell, title, null, message,
+ MessageDialog.ERROR,
+ new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL },
+ 0);
+ results[0] = (dialog.open() == 0);
+ }
+
+ });
+ return results[0];
+ }
+
+ private static int yesNoCancel(final Shell shell, final String title, final String message) {
+ if (GeneralUtils.isJUnitRunning())
+ return 0;
+
+ final int[] results = { 0 };
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog dialog = new MessageDialog(shell, title, null, message,
+ MessageDialog.QUESTION,
+ new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
+ 0);
+ results[0] = dialog.open();
+ }
+
+ });
+ return results[0];
+ }
+
+ private static String catenateObjects(Collection<?> items, String sep) {
+ StringBuilder builder = new StringBuilder();
+ for (Object item : items) {
+ if (builder.length() > 0)
+ builder.append(sep);
+ builder.append(item.toString());
+ }
+ return builder.toString();
+ }
+
+ /**
+ * Install a list of packages, throwing if it fails
+ * @param packages
+ * @param monitor
+ * @throws CoreException if any packages fail to install (this tries to install everything)
+ */
+ public static void installPackages(List<ISystemPackage> packages, IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("Installing required packages...", packages.size());
+ MultiStatus multiStatus = new MultiStatus(UIActivator.PLUGIN_ID, 0, "Failed to install all packages", null);
+
+ for (ISystemPackage systemPackage : packages) {
+ IStatus status = systemPackage.installSystemPackage(new SubProgressMonitor(monitor, 1));
+ if (monitor.isCanceled()) {
+ return;
+ }
+ if (!status.isOK()) {
+ multiStatus.add(status);
+ }
+ }
+ monitor.done();
+
+ if (multiStatus.isOK())
+ return;
+
+ throw new CoreException(multiStatus);
+
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/CreateDebianPackageAction.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/CreateDebianPackageAction.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/CreateDebianPackageAction.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.ui.actions;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.action.IAction;
+import org.maemo.esbox.linux.packages.core.debian.DebianScriptLauncher;
+import org.maemo.esbox.ui.actions.ESboxAction;
+
+public class CreateDebianPackageAction extends ESboxAction {
+
+ public void run(IAction action) {
+ IProject project = (IProject)extractSelection();
+ DebianScriptLauncher.getInstance().runCreateDebianPackage(project);
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/DeployDebianPackageAction.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/DeployDebianPackageAction.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/DeployDebianPackageAction.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.ui.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.maemo.esbox.linux.packages.ui.DeployDebianPackageWizard;
+
+public class DeployDebianPackageAction implements IObjectActionDelegate {
+
+ private Shell shell;
+
+ public void init() {
+ shell = new Shell();
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+
+ }
+
+ public void run(IAction action) {
+ DeployDebianPackageWizard wizard = new DeployDebianPackageWizard();
+ WizardDialog dlg = new WizardDialog(shell,wizard);
+ dlg.open();
+ }
+
+
+ public void selectionChanged(IAction action, ISelection selection) {
+
+ }
+
+
+}
Added: trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/ValidatePackagesCommand.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/ValidatePackagesCommand.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.packages.ui/src/org/maemo/esbox/linux/packages/ui/actions/ValidatePackagesCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,282 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.packages.ui.actions;
+
+import com.nokia.cpp.internal.api.utils.core.TextUtils;
+
+import org.eclipse.core.commands.*;
+import org.eclipse.core.expressions.EvaluationContext;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.linux.packages.ui.UIActivator;
+import org.maemo.esbox.linux.autotools.core.model.*;
+import org.maemo.esbox.linux.packages.core.*;
+import org.maemo.esbox.linux.packages.ui.ProjectPackageInstaller;
+import org.maemo.esbox.project.core.*;
+
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+import java.util.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ValidatePackagesCommand extends AbstractHandler {
+
+ private Shell shell;
+ private IProject project;
+
+ protected void fail(final String msg, final Object... param) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog.openError(getShell(), "Validation Failure", MessageFormat.format(msg, param));
+ }
+
+ });
+ }
+
+ protected void info(final String msg, final Object... param) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog.openInformation(getShell(), "Validation Information", MessageFormat.format(msg, param));
+ }
+
+ });
+ }
+
+ protected Shell getShell() {
+ return shell;
+ }
+
+ private void setupContext(Object applicationContext) {
+ if (applicationContext instanceof IAdaptable) {
+ shell = (Shell) ((IAdaptable) applicationContext).getAdapter(Shell.class);
+ }
+ if (applicationContext instanceof EvaluationContext) {
+ Object defaultVariable = ((EvaluationContext) applicationContext).getDefaultVariable();
+ if (defaultVariable instanceof List) {
+ List<?> list = (List<?>) defaultVariable;
+ if (list.size() > 0 && list.get(0) instanceof IProject) {
+ project = (IProject) list.get(0);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ setupContext(event.getApplicationContext());
+
+ if (project == null)
+ return null;
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ try {
+ doValidateAndInstall(monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ } catch (InvocationTargetException e) {
+ throw new ExecutionException("Failed to verify or install packages", e.getTargetException());
+ } catch (InterruptedException e) {
+ throw new ExecutionException("Failed to verify or install packages", e);
+ }
+
+ return null;
+ }
+
+ /**
+ * @param monitor
+ * @throws CoreException
+ */
+ protected void doValidateAndInstall(IProgressMonitor monitor)
+ throws CoreException {
+ monitor.beginTask("Validating packages...", IProgressMonitor.UNKNOWN);
+
+ SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
+ subMonitor.beginTask("", IProgressMonitor.UNKNOWN);
+ subMonitor.subTask("Reading configure.ac... ");
+
+ // get the active build target, so we can get the package manager
+ IESboxProjectHandle handle = ProjectManager.getInstance().getProjectHandle(project);
+ if (handle == null) {
+ fail("This command only works with up-to-date autotools-based C/C++ ESbox projects");
+ return;
+ }
+
+ IESboxBuildConfiguration current = handle.getCurrentConfiguration();
+ if (current == null) {
+ fail("The project appears to be misconfigured; ensure it has an active configuration");
+ return;
+ }
+
+ // XXX: ASSUME that the packages are the same no matter what the SDK target is, and just parse the active configuration
+
+ // open the configure.ac model
+ IAutoconfModel model = null;
+ IPath path = project.getLocation().append("configure.ac");
+ try {
+ model = AutoconfWorkspaceModelProvider.getInstance().getSharedModel(path);
+ if (model == null) {
+ fail("This command only works with autotools projects; did not find ''configure.ac'' in the project directory");
+ return;
+ }
+ } catch (CoreException e) {
+ fail("Could not load 'configure.ac' from ''{0}''", path.toOSString());
+ UIActivator.getErrorLogger().logError("Failed to load model", e);
+ }
+
+
+ subMonitor.worked(1);
+
+
+ final IPackageManager[] managers = getPackageManagers(subMonitor,
+ handle);
+ if (subMonitor.isCanceled())
+ return;
+
+ Set<String> systemPackages = new LinkedHashSet<String>();
+ Set<String> unknownBuildPackages = new LinkedHashSet<String>();
+
+ gatherSystemPackages(subMonitor, model, managers, systemPackages, unknownBuildPackages);
+
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return;
+
+ IStatus installStatus = ProjectPackageInstaller.ensureInstalledPackages(shell, managers,
+ (String[]) systemPackages.toArray(new String[systemPackages.size()]),
+ new SubProgressMonitor(monitor, 1));
+
+ if (installStatus.getSeverity() != IStatus.CANCEL) {
+ String message = installStatus.getMessage();
+ if (unknownBuildPackages.size() > 0) {
+ if (installStatus.isOK())
+ message = "";
+ else
+ message += "\n\n";
+
+ message += MessageFormat.format(
+ "One or more build packages is not recognized, so the required system package is unknown:\n\n\t{0}",
+ TextUtils.catenateStrings(
+ unknownBuildPackages.toArray(), "\n\t"));
+
+ fail(message);
+ } else if (!installStatus.isOK()) {
+ fail(message);
+ } else {
+ info(message);
+ }
+ }
+
+ monitor.done();
+ }
+
+ /**
+ * @param subMonitor
+ * @param handle
+ * @return
+ */
+ private IPackageManager[] getPackageManagers(SubProgressMonitor subMonitor,
+ IESboxProjectHandle handle) {
+ IESboxBuildConfiguration[] buildConfigurations = handle.getBuildConfigurations();
+ List<IPackageManager> managerList = new ArrayList<IPackageManager>();
+ for (IESboxBuildConfiguration buildConfiguration : buildConfigurations) {
+ ISDKTarget target = buildConfiguration.getSDKTarget();
+ if (target != null) {
+ subMonitor.subTask("Gathering package information for " + target.getName() + "...");
+ IPackageManager manager = PackageManagerProvider.getInstance().getPackageManagerFor(
+ target, new SubProgressMonitor(subMonitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
+ if (manager != null) {
+ managerList.add(manager);
+ }
+ }
+ if (subMonitor.isCanceled())
+ break;
+ }
+
+ final IPackageManager[] managers = (IPackageManager[]) managerList.toArray(new IPackageManager[managerList.size()]);
+ return managers;
+ }
+
+ /**
+ * @param subMonitor
+ * @param model
+ * @param managers
+ * @return
+ */
+ private void gatherSystemPackages(SubProgressMonitor subMonitor,
+ IAutoconfModel model, final IPackageManager[] managers,
+ Set<String> systemPackages, Set<String> unknownBuildPackages) {
+ // gather all the build packages referenced
+ subMonitor.subTask("Gathering required packages... ");
+ Set<String> buildPackages = new HashSet<String>();
+ try {
+ IAutoconfPackageCheck[] packageChecks = model.getPackageChecks();
+ for (IAutoconfPackageCheck packageCheck : packageChecks) {
+ IAutoconfPackageCheckModule[] modules = packageCheck.getModules();
+ for (IAutoconfPackageCheckModule module : modules) {
+ String buildPackage = module.getModuleName();
+ buildPackages.add(buildPackage);
+ }
+ }
+ subMonitor.worked(1);
+ } finally {
+ AutoconfWorkspaceModelProvider.getInstance().releaseSharedModel(model);
+ }
+
+ // see what system packages we need (go through every target and get a unified list --
+ // likely this logic needs some smoothing, but it helps compensate when one target's
+ // package manager is broken for whatever reason)
+ //
+ for (IPackageManager manager : managers) {
+ IBuildPackageMapping[] buildPackageMappings = manager.getBuildPackageMappings(
+ (String[]) buildPackages.toArray(new String[buildPackages.size()]),
+ false,
+ true);
+
+ for (IBuildPackageMapping mapping : buildPackageMappings) {
+ String devel = mapping.getSystemPackageName(EPackageCategory.DEVELOPMENT);
+ if (devel != null)
+ systemPackages.add(devel);
+ String runTime = mapping.getSystemPackageName(EPackageCategory.RUNTIME);
+ if (runTime != null)
+ systemPackages.add(runTime);
+
+ if (devel == null && runTime == null)
+ unknownBuildPackages.add(mapping.getBuildPackageName());
+ }
+ subMonitor.worked(1);
+ }
+
+ subMonitor.done();
+ }
+
+}
Property changes on: trunk/linux/org.maemo.esbox.linux.tests
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/linux/org.maemo.esbox.linux.tests/.classpath
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/.classpath (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/linux/org.maemo.esbox.linux.tests/.project
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/.project (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.linux.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/linux/org.maemo.esbox.linux.tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:58:15 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/linux/org.maemo.esbox.linux.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/META-INF/MANIFEST.MF (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Linux Feature Tests Plug-in
+Bundle-SymbolicName: org.maemo.esbox.linux.tests
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.linux.tests.noexport.TestActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.linux.autotools.core;bundle-version="1.5.0",
+ org.maemo.esbox.linux.packages.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.junit4;bundle-version="4.3.1",
+ org.maemo.esbox.core.tests;bundle-version="1.5.0",
+ org.maemo.esbox.maemosdk.core;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: trunk/linux/org.maemo.esbox.linux.tests/build.properties
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/build.properties (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ data/
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/.cproject
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/.cproject (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/.cproject 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="org.eclipse.cdt.core.default.config.1203508225">
+<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.1203508225" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.pathentry">
+<pathentry kind="src" path=""/>
+<pathentry kind="src" path="src"/>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+</storageModule>
+</cproject>
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/.project
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/.project (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>maemopadproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.maemo.esbox.cpp.project.core.ESboxCppNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/Makefile.am
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/Makefile.am (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+#
+# This file is part of maemopad
+#
+# Copyright (C) 2005 Nokia Corporation.
+#
+# This software is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+
+EXTRA_DIST = \
+ autogen.sh \
+ intltool-extract.in \
+ intltool-merge.in \
+ intltool-update.in \
+ debian/changelog \
+ debian/control \
+ debian/copyright \
+ debian/rules \
+ debian/maemopad.links
+
+SUBDIRS = src data po
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/aclocal.m4
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/aclocal.m4 (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/aclocal.m4 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7822 @@
+# generated automatically by aclocal 1.7.9 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# This macro actually does too much some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 10
+
+AC_PREREQ([2.54])
+
+# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
+# the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+ AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG(AMTAR, tar)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.7.9])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright 2001, 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# -*- Autoconf -*-
+
+
+# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# AM_AUX_DIR_EXPAND
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+# Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])
+
+AC_DEFUN([AM_AUX_DIR_EXPAND], [
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# AM_PROG_INSTALL_STRIP
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# -*- Autoconf -*-
+# Copyright (C) 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# serial 5 -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ : > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored.
+ if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking Speeds up one-time builds
+ --enable-dependency-tracking Do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+#serial 2
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
+ # Extract the definition of DEP_FILES from the Makefile without
+ # running `make'.
+ DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n -e '/^U = / s///p' < "$mf"`
+ test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
+ # We invoke sed twice because it is the simplest approach to
+ # changing $(DEPDIR) to its actual value in the expansion.
+ for file in `sed -n -e '
+ /^DEP_FILES = .*\\\\$/ {
+ s/^DEP_FILES = //
+ :loop
+ s/\\\\$//
+ p
+ n
+ /\\\\$/ b loop
+ p
+ }
+ /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 5
+
+AC_PREREQ(2.52)
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.])
+fi])])
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
+
+# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AC_PREREQ([2.52])
+
+# serial 6
+
+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 47 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+ [],
+ [m4_define([AC_PROVIDE_IFELSE],
+ [m4_ifdef([AC_PROVIDE_$1],
+ [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+ AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [AC_LIBTOOL_CXX],
+ [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+ ])])
+dnl And a similar setup for Fortran 77 support
+ AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [AC_LIBTOOL_F77],
+ [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [ifdef([AC_PROG_GCJ],
+ [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([A][M_PROG_GCJ],
+ [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([LT_AC_PROG_GCJ],
+ [define([LT_AC_PROG_GCJ],
+ defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+ ;;
+ *)
+ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ AC_PATH_MAGIC
+ fi
+ ;;
+esac
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+ [AC_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+ [AC_HELP_STRING([--with-pic],
+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+ [pic_mode="$withval"],
+ [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+ case $cc_temp in
+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+AC_DEFUN([_LT_LINKER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_LINKER_BOILERPLATE
+
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+ [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+ [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+ ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X[$]1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+[$]*
+EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+ echo_test_string=`eval $cmd` &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+ then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+ else
+ # Try using printf.
+ echo='printf %s\n'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "[$]0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+ ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AC_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_PUSH(C)
+ AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_POP])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+ ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$3"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp
+ $SED '/^$/d' conftest.err >conftest.er2
+ if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ fi
+ $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ ifelse([$5], , :, [$5])
+else
+ ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $3"
+ printf "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&AS_MESSAGE_LOG_FD
+ $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp
+ $SED '/^$/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ else
+ $2=yes
+ fi
+ fi
+ $rm conftest*
+ LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+ ifelse([$4], , :, [$4])
+else
+ ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ *)
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+ = "XX$teststring") >/dev/null 2>&1 &&
+ new_result=`expr "X$teststring" : ".*" 2>&1` &&
+ lt_cv_sys_max_cmd_len=$new_result &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on massive
+ # amounts of additional arguments before passing them to the linker.
+ # It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ ;;
+ esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+ AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+ AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# --------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+ [$4]
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+
+ exit (status);
+}]
+EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_unknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# -------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ])
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+ [AC_CHECK_FUNC([dlopen],
+ [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB([svld], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+ [AC_CHECK_LIB([dld], [dld_link],
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ AC_CACHE_CHECK([whether a program can dlopen itself],
+ lt_cv_dlopen_self, [dnl
+ _LT_AC_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+ ])
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ LDFLAGS="$LDFLAGS $link_static_flag"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_AC_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+ lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
+ ])
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp
+ $SED '/^$/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w . 2>&AS_MESSAGE_LOG_FD
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ AC_MSG_CHECKING([if we can lock with hard links])
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ AC_MSG_RESULT([$hard_links])
+ if test "$hard_links" = no; then
+ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+ test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_AC_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[[01]] | aix4.[[01]].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[[45]]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+ if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+ else
+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+ fi
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+kfreebsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[[123]]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ *) # from 3.2 on
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+knetbsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[[89]] | openbsd2.[[89]].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+sco3.2v5*)
+ version_type=osf
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_ARG_WITH([tags],
+ [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+ [include additional configurations @<:@automatic@:>@])],
+ [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+ if test ! -f "${ofile}"; then
+ AC_MSG_WARN([output file `$ofile' does not exist])
+ fi
+
+ if test -z "$LTCC"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+ if test -z "$LTCC"; then
+ AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+ else
+ AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+ fi
+ fi
+
+ # Extract list of available tagged configurations in $ofile.
+ # Note that this assumes the entire list is on one line.
+ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for tagname in $tagnames; do
+ IFS="$lt_save_ifs"
+ # Check whether tagname contains only valid characters
+ case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+ "") ;;
+ *) AC_MSG_ERROR([invalid tag name: $tagname])
+ ;;
+ esac
+
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+ then
+ AC_MSG_ERROR([tag name \"$tagname\" already exists])
+ fi
+
+ # Update the list of available tags.
+ if test -n "$tagname"; then
+ echo appending configuration tag \"$tagname\" to $ofile
+
+ case $tagname in
+ CXX)
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_LIBTOOL_LANG_CXX_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ F77)
+ if test -n "$F77" && test "X$F77" != "Xno"; then
+ AC_LIBTOOL_LANG_F77_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ GCJ)
+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+ AC_LIBTOOL_LANG_GCJ_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ RC)
+ AC_LIBTOOL_LANG_RC_CONFIG
+ ;;
+
+ *)
+ AC_MSG_ERROR([Unsupported tag name: $tagname])
+ ;;
+ esac
+
+ # Append the new tag name to the list of available tags.
+ if test -n "$tagname" ; then
+ available_tags="$available_tags $tagname"
+ fi
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ # Now substitute the updated list of available tags.
+ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+ mv "${ofile}T" "$ofile"
+ chmod +x "$ofile"
+ else
+ rm -f "${ofile}T"
+ AC_MSG_ERROR([unable to update list of available tagged configurations.])
+ fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 DLLs
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+ [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+#- set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+ [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+ [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+ [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] | ?:[\\/]*])
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="ifelse([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+ [AC_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by $CC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+ lt_cv_ld_reload_flag,
+ [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[[45]]*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | kfreebsd*-gnu | dragonfly*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+nto-qnx*)
+ lt_cv_deplibs_check_method=unknown
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/${ac_tool_prefix}nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, cos, LIBM="-lm")
+ ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments. Note that
+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
+# it is assumed to be `libltdl'. LIBLTDL will be prefixed with
+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+# (note the single quotes!). If your package is not flat and you're not
+# using automake, define top_builddir and top_srcdir appropriately in
+# the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case $enable_ltdl_convenience in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments. Note that
+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
+# and an installed libltdl is not found, it is assumed to be `libltdl'.
+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and top_srcdir
+# appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, lt_dlinit,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ LTDLINCL=
+ fi
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+# _LT_AC_PROG_CXXCPP
+# ---------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+ [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+ [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+ [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# --------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+#
+# Check for any special shared library compilation flags.
+#
+_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)=
+if test "$GCC" = no; then
+ case $host_os in
+ sco3.2v5*)
+ _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf'
+ ;;
+ esac
+fi
+if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then
+ AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries])
+ if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then :
+ else
+ AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure])
+ _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no
+ fi
+fi
+
+
+#
+# Check to make sure the static flag actually works.
+#
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works],
+ _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+ $_LT_AC_TAGVAR(lt_prog_compiler_static, $1),
+ [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+# Report which librarie types wil actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+ unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+ unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ AC_PROG_LD
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+ grep 'no-whole-archive' > /dev/null; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_AC_TAGVAR(archive_cmds, $1)=''
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GXX" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ else
+ # We have old collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # -bexpall does not export symbols beginning with underscore (_)
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' '
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GXX" = yes ; then
+ lt_int_apple_cc_single_mod=no
+ output_verbose_link_cmd='echo'
+ if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+ lt_int_apple_cc_single_mod=yes
+ fi
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ fi
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ freebsd[[12]]*)
+ # C++ shared libraries reported to be fairly broken before switch to ELF
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ freebsd-elf*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+ gnu*)
+ ;;
+ hpux9*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ ;;
+ *)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ *)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ ia64*|hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+ fi
+ fi
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+ linux*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc*)
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC*)
+ # Portland Group C++ compiler
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ esac
+ ;;
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ openbsd*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd='echo'
+ ;;
+ osf3*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+ $rm $lib.exp'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ sco*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The C++ compiler is used as linker so we must use $wl
+ # flag to pass the commands to the underlying system
+ # linker. We must also pass each convience library through
+ # to the system linker between allextract/defaultextract.
+ # The C++ compiler will combine linker options so we
+ # cannot just pass the convience library names through
+ # without $wl.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | grep -v '^2\.7' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ fi
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ fi
+ ;;
+ esac
+ ;;
+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library. It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ # The `*' in the case matches for architectures that use `case' in
+ # $output_verbose_cmd can trigger glob expansion during the loop
+ # eval without this substitution.
+ output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+ for p in `eval $output_verbose_link_cmd`; do
+ case $p in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" \
+ || test $p = "-R"; then
+ prev=$p
+ continue
+ else
+ prev=
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ case $p in
+ -L* | -R*)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+ _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+ fi
+ fi
+ ;;
+
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+ _LT_AC_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+ _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+ifelse([$1],[CXX],
+[case $host_os in
+solaris*)
+ case $cc_basename in
+ CC*)
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun'
+ ;;
+ esac
+esac
+])
+
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code=" subroutine t\n return\n end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code=" program t\n end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars. Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ _LT_AC_TAGVAR(compiler, $1) \
+ _LT_AC_TAGVAR(CC, $1) \
+ _LT_AC_TAGVAR(LD, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+ _LT_AC_TAGVAR(old_archive_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+ _LT_AC_TAGVAR(predep_objects, $1) \
+ _LT_AC_TAGVAR(postdep_objects, $1) \
+ _LT_AC_TAGVAR(predeps, $1) \
+ _LT_AC_TAGVAR(postdeps, $1) \
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+ _LT_AC_TAGVAR(archive_cmds, $1) \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(postinstall_cmds, $1) \
+ _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+ _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+ _LT_AC_TAGVAR(no_undefined_flag, $1) \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+ _LT_AC_TAGVAR(hardcode_automatic, $1) \
+ _LT_AC_TAGVAR(module_cmds, $1) \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+ _LT_AC_TAGVAR(exclude_expsyms, $1) \
+ _LT_AC_TAGVAR(include_expsyms, $1); do
+
+ case $var in
+ _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(module_cmds, $1) | \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\[$]0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+ ;;
+ esac
+
+ifelse([$1], [],
+ [cfgfile="${ofile}T"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ $rm -f "$cfgfile"
+ AC_MSG_NOTICE([creating $ofile])],
+ [cfgfile="$ofile"])
+
+ cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+ case $host_os in
+ aix3*)
+ cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" || \
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+])
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ lt_cv_prog_compiler_rtti_exceptions,
+ [-fno-rtti -fno-exceptions], [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDEGRST]]'
+ fi
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ ;;
+linux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDGIRSTW]]'
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris* | sysv5*)
+ symcode='[[BDRT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if grep ' nm_test_var$' "$nlist" >/dev/null; then
+ if grep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+ cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+ cat <<\EOF >> conftest.$ac_ext
+ {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+ cat conftest.$ac_ext >&5
+ fi
+ rm -f conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ AC_MSG_RESULT(failed)
+else
+ AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | os2* | pw32*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix4* | aix5*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ esac
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+ if test "$host_cpu" != ia64; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ fi
+ ;;
+ aCC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux*)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ icpc* | ecpc*)
+ # Intel C++
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgCC*)
+ # Portland Group C++ compiler.
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ sco*)
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ unixware*)
+ ;;
+ vxworks*)
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+],
+[
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ enable_shared=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC (with -KPIC) is the default.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ newsos6)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ linux*)
+ case $cc_basename in
+ icc* | ecc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ ccc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All Alpha code is PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ esac
+ ;;
+
+ osf3* | osf4* | osf5*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All OSF/1 code is PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ sco3.2v5*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn'
+ ;;
+
+ solaris*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ unicos*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+
+ uts4*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+ _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+ [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+ "" | " "*) ;;
+ *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ esac],
+ [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ case $host_os in
+ aix4* | aix5*)
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw*)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ *)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+],[
+ runpath_var=
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)=
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+ _LT_AC_TAGVAR(module_cmds, $1)=
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ _LT_AC_TAGVAR(include_expsyms, $1)=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ extract_expsyms_cmds=
+ # Just being paranoid about ensuring that cc_basename is set.
+ _LT_CC_BASENAME([$compiler])
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>/dev/null` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ fi
+ ;;
+
+ amigaos*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+ # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ linux*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test $supports_anon_versioning = yes; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ $echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris* | sysv5*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ sunos4*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+
+ if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
+ runpath_var=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ if test "$GCC" = yes && test -z "$link_static_flag"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_AC_TAGVAR(archive_cmds, $1)=''
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ else
+ # We have old collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # -bexpall does not export symbols beginning with underscore (_)
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' '
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ # see comment about different semantics on the GNU ld section
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ bsdi[[45]]*)
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ freebsd1*)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+
+ hpux10* | hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ *)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ newsos6)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ openbsd*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+
+ os2*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ else
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ sco3.2v5*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ;;
+
+ solaris*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ else
+ wlarc=''
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine linker options so we
+ # cannot just pass the convience library names through
+ # without $wl, iff we do not link with $LD.
+ # Luckily, gcc supports the same syntax we need for Sun Studio.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ case $wlarc in
+ '')
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+ *)
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+ esac ;;
+ esac
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ ;;
+ motorola)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4.3*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ fi
+ ;;
+
+ sysv4.2uw2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ hardcode_runpath_var=yes
+ runpath_var=LD_RUN_PATH
+ ;;
+
+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text'
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ runpath_var='LD_RUN_PATH'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv5*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+ ;;
+
+ uts4*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+ # Assume -lc should be added
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $_LT_AC_TAGVAR(archive_cmds, $1) in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+ $rm conftest*
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+ then
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+ ;;
+ esac
+ fi
+ ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD], [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_SED. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+])
+SED=$lt_cv_path_SED
+AC_MSG_RESULT([$SED])
+])
+
+
+dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml])
+# serial 35 IT_PROG_INTLTOOL
+AC_DEFUN([IT_PROG_INTLTOOL],
+[AC_PREREQ([2.50])dnl
+
+case "$am__api_version" in
+ 1.[01234])
+ AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool])
+ ;;
+ *)
+ ;;
+esac
+
+if test -n "$1"; then
+ AC_MSG_CHECKING(for intltool >= $1)
+
+ INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
+ INTLTOOL_APPLIED_VERSION=`awk -F\" '/\\$VERSION / { print $ 2; }' ${ac_aux_dir}/intltool-update.in`
+ [INTLTOOL_APPLIED_VERSION_AS_INT=`awk -F\" '/\\$VERSION / { split($ 2, VERSION, "."); print VERSION[1] * 1000 + VERSION[2] * 100 + VERSION[3];}' ${ac_aux_dir}/intltool-update.in`
+ ]
+ AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found])
+ test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
+ AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.])
+fi
+
+ INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< [$]@'
+ INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< [$]@'
+ INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+ INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+
+AC_SUBST(INTLTOOL_DESKTOP_RULE)
+AC_SUBST(INTLTOOL_DIRECTORY_RULE)
+AC_SUBST(INTLTOOL_KEYS_RULE)
+AC_SUBST(INTLTOOL_PROP_RULE)
+AC_SUBST(INTLTOOL_OAF_RULE)
+AC_SUBST(INTLTOOL_PONG_RULE)
+AC_SUBST(INTLTOOL_SERVER_RULE)
+AC_SUBST(INTLTOOL_SHEET_RULE)
+AC_SUBST(INTLTOOL_SOUNDLIST_RULE)
+AC_SUBST(INTLTOOL_UI_RULE)
+AC_SUBST(INTLTOOL_XAM_RULE)
+AC_SUBST(INTLTOOL_KBD_RULE)
+AC_SUBST(INTLTOOL_XML_RULE)
+AC_SUBST(INTLTOOL_XML_NOMERGE_RULE)
+AC_SUBST(INTLTOOL_CAVES_RULE)
+AC_SUBST(INTLTOOL_SCHEMAS_RULE)
+AC_SUBST(INTLTOOL_THEME_RULE)
+AC_SUBST(INTLTOOL_SERVICE_RULE)
+
+# Use the tools built into the package, not the ones that are installed.
+AC_SUBST(INTLTOOL_EXTRACT, '$(top_builddir)/intltool-extract')
+AC_SUBST(INTLTOOL_MERGE, '$(top_builddir)/intltool-merge')
+AC_SUBST(INTLTOOL_UPDATE, '$(top_builddir)/intltool-update')
+
+AC_PATH_PROG(INTLTOOL_PERL, perl)
+if test -z "$INTLTOOL_PERL"; then
+ AC_MSG_ERROR([perl not found; required for intltool])
+fi
+if test -z "`$INTLTOOL_PERL -v | fgrep '5.' 2> /dev/null`"; then
+ AC_MSG_ERROR([perl 5.x required for intltool])
+fi
+if test "x$2" != "xno-xml"; then
+ AC_MSG_CHECKING([for XML::Parser])
+ if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then
+ AC_MSG_RESULT([ok])
+ else
+ AC_MSG_ERROR([XML::Parser perl module is required for intltool])
+ fi
+fi
+
+AC_PATH_PROG(INTLTOOL_ICONV, iconv, iconv)
+AC_PATH_PROG(INTLTOOL_MSGFMT, msgfmt, msgfmt)
+AC_PATH_PROG(INTLTOOL_MSGMERGE, msgmerge, msgmerge)
+AC_PATH_PROG(INTLTOOL_XGETTEXT, xgettext, xgettext)
+
+# Substitute ALL_LINGUAS so we can use it in po/Makefile
+AC_SUBST(ALL_LINGUAS)
+
+# Set DATADIRNAME correctly if it is not set yet
+# (copied from glib-gettext.m4)
+if test -z "$DATADIRNAME"; then
+ AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr],
+ [DATADIRNAME=share],
+ [case $host in
+ *-*-solaris*)
+ dnl On Solaris, if bind_textdomain_codeset is in libc,
+ dnl GNU format message catalog is always supported,
+ dnl since both are added to the libc all together.
+ dnl Hence, we'd like to go with DATADIRNAME=share
+ dnl in this case.
+ AC_CHECK_FUNC(bind_textdomain_codeset,
+ [DATADIRNAME=share], [DATADIRNAME=lib])
+ ;;
+ *)
+ [DATADIRNAME=lib]
+ ;;
+ esac])
+fi
+AC_SUBST(DATADIRNAME)
+
+IT_PO_SUBDIR([po])
+
+dnl The following is very similar to
+dnl
+dnl AC_CONFIG_FILES([intltool-extract intltool-merge intltool-update])
+dnl
+dnl with the following slight differences:
+dnl - the *.in files are in ac_aux_dir,
+dnl - if the file haven't changed upon reconfigure, it's not touched,
+dnl - the evaluation of the third parameter enables a hack which computes
+dnl the actual value of $libdir,
+dnl - the user sees "executing intltool commands", instead of
+dnl "creating intltool-extract" and such.
+dnl
+dnl Nothing crucial here, and we could use AC_CONFIG_FILES, if there were
+dnl a reason for it.
+
+AC_CONFIG_COMMANDS([intltool], [
+
+for file in intltool-extract intltool-merge intltool-update; do
+ sed -e "s|@INTLTOOL_EXTRACT@|`pwd`/intltool-extract|g" \
+ -e "s|@INTLTOOL_LIBDIR@|${INTLTOOL_LIBDIR}|g" \
+ -e "s|@INTLTOOL_ICONV@|${INTLTOOL_ICONV}|g" \
+ -e "s|@INTLTOOL_MSGFMT@|${INTLTOOL_MSGFMT}|g" \
+ -e "s|@INTLTOOL_MSGMERGE@|${INTLTOOL_MSGMERGE}|g" \
+ -e "s|@INTLTOOL_XGETTEXT@|${INTLTOOL_XGETTEXT}|g" \
+ -e "s|@INTLTOOL_PERL@|${INTLTOOL_PERL}|g" \
+ < ${ac_aux_dir}/${file}.in > ${file}.out
+ if cmp -s ${file} ${file}.out 2>/dev/null; then
+ rm -f ${file}.out
+ else
+ mv -f ${file}.out ${file}
+ fi
+ chmod ugo+x ${file}
+ chmod u+w ${file}
+done
+
+],
+[INTLTOOL_PERL='${INTLTOOL_PERL}' ac_aux_dir='${ac_aux_dir}'
+prefix="$prefix" exec_prefix="$exec_prefix" INTLTOOL_LIBDIR="$libdir"
+INTLTOOL_EXTRACT='${INTLTOOL_EXTRACT}' INTLTOOL_ICONV='${INTLTOOL_ICONV}'
+INTLTOOL_MSGFMT='${INTLTOOL_MSGFMT}' INTLTOOL_MSGMERGE='${INTLTOOL_MSGMERGE}'
+INTLTOOL_XGETTEXT='${INTLTOOL_XGETTEXT}'])
+
+])
+
+
+# IT_PO_SUBDIR(DIRNAME)
+# ---------------------
+# All po subdirs have to be declared with this macro; the subdir "po" is
+# declared by IT_PROG_INTLTOOL.
+#
+AC_DEFUN([IT_PO_SUBDIR],
+[AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS.
+dnl
+dnl The following CONFIG_COMMANDS should be exetuted at the very end
+dnl of config.status.
+AC_CONFIG_COMMANDS_PRE([
+ AC_CONFIG_COMMANDS([$1/stamp-it], [
+ rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp"
+ >"$1/stamp-it.tmp"
+ [sed '/^#/d
+ s/^[[].*] *//
+ /^[ ]*$/d
+ '"s|^| $ac_top_srcdir/|" \
+ "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES"
+ ]
+ if test ! -f "$1/Makefile"; then
+ AC_MSG_ERROR([$1/Makefile is not ready.])
+ fi
+ mv "$1/Makefile" "$1/Makefile.tmp"
+ [sed '/^POTFILES =/,/[^\\]$/ {
+ /^POTFILES =/!d
+ r $1/POTFILES
+ }
+ ' "$1/Makefile.tmp" >"$1/Makefile"]
+ rm -f "$1/Makefile.tmp"
+ mv "$1/stamp-it.tmp" "$1/stamp-it"
+ ])
+])dnl
+])
+
+
+# deprecated macros
+AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL])
+# A hint is needed for aclocal from Automake <= 1.9.4:
+# AC_DEFUN([AC_PROG_INTLTOOL], ...)
+
+
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+#
+# Copyright © 2004 Scott James Remnant <scott at netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$PKG_CONFIG"; then
+ if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ else
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+ [pkg_failed=yes])
+ fi
+else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+ [AC_MSG_RESULT([no])
+ $4])
+elif test $pkg_failed = untried; then
+ ifelse([$4], , [AC_MSG_FAILURE(dnl
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
+ [$4])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES
+
+# Copyright (C) 1995-2002 Free Software Foundation, Inc.
+# Copyright (C) 2001-2003,2004 Red Hat, Inc.
+#
+# This file is free software, distributed under the terms of the GNU
+# General Public License. As a special exception to the GNU General
+# Public License, this file may be distributed as part of a program
+# that contains a configuration script generated by Autoconf, under
+# the same distribution terms as the rest of that program.
+#
+# This file can be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+#
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper at cygnus.com>, 1995, 1996
+#
+# Modified to never use included libintl.
+# Owen Taylor <otaylor at redhat.com>, 12/15/1998
+#
+# Major rework to remove unused code
+# Owen Taylor <otaylor at redhat.com>, 12/11/2002
+#
+# Added better handling of ALL_LINGUAS from GNU gettext version
+# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
+#
+# Modified to require ngettext
+# Matthias Clasen <mclasen at redhat.com> 08/06/2004
+#
+# We need this here as well, since someone might use autoconf-2.5x
+# to configure GLib then an older version to configure a package
+# using AM_GLIB_GNU_GETTEXT
+AC_PREREQ(2.53)
+
+dnl
+dnl We go to great lengths to make sure that aclocal won't
+dnl try to pull in the installed version of these macros
+dnl when running aclocal in the glib directory.
+dnl
+m4_copy([AC_DEFUN],[glib_DEFUN])
+m4_copy([AC_REQUIRE],[glib_REQUIRE])
+dnl
+dnl At the end, if we're not within glib, we'll define the public
+dnl definitions in terms of our private definitions.
+dnl
+
+# GLIB_LC_MESSAGES
+#--------------------
+glib_DEFUN([GLIB_LC_MESSAGES],
+ [AC_CHECK_HEADERS([locale.h])
+ if test $ac_cv_header_locale_h = yes; then
+ AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
+ [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+ am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
+ if test $am_cv_val_LC_MESSAGES = yes; then
+ AC_DEFINE(HAVE_LC_MESSAGES, 1,
+ [Define if your <locale.h> file defines LC_MESSAGES.])
+ fi
+ fi])
+
+# GLIB_PATH_PROG_WITH_TEST
+#----------------------------
+dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
+[# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL(ac_cv_path_$1,
+[case "[$]$1" in
+ /*)
+ ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in ifelse([$5], , $PATH, [$5]); do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if [$3]; then
+ ac_cv_path_$1="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+ ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
+ AC_MSG_RESULT([$]$1)
+else
+ AC_MSG_RESULT(no)
+fi
+AC_SUBST($1)dnl
+])
+
+# GLIB_WITH_NLS
+#-----------------
+glib_DEFUN([GLIB_WITH_NLS],
+ dnl NLS is obligatory
+ [AC_REQUIRE([AC_CANONICAL_HOST])dnl
+ USE_NLS=yes
+ AC_SUBST(USE_NLS)
+
+ gt_cv_have_gettext=no
+
+ CATOBJEXT=NONE
+ XGETTEXT=:
+ INTLLIBS=
+
+ AC_CHECK_HEADER(libintl.h,
+ [gt_cv_func_dgettext_libintl="no"
+ libintl_extra_libs=""
+
+ #
+ # First check in libc
+ #
+ AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
+ [AC_TRY_LINK([
+#include <libintl.h>
+],
+ [return !ngettext ("","", 1)],
+ gt_cv_func_ngettext_libc=yes,
+ gt_cv_func_ngettext_libc=no)
+ ])
+
+ if test "$gt_cv_func_ngettext_libc" = "yes" ; then
+ AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
+ [AC_TRY_LINK([
+#include <libintl.h>
+],
+ [return !dgettext ("","")],
+ gt_cv_func_dgettext_libc=yes,
+ gt_cv_func_dgettext_libc=no)
+ ])
+ fi
+
+ if test "$gt_cv_func_ngettext_libc" = "yes" ; then
+ AC_CHECK_FUNCS(bind_textdomain_codeset)
+ fi
+
+ #
+ # If we don't have everything we want, check in libintl
+ #
+ if test "$gt_cv_func_dgettext_libc" != "yes" \
+ || test "$gt_cv_func_ngettext_libc" != "yes" \
+ || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
+
+ AC_CHECK_LIB(intl, bindtextdomain,
+ [AC_CHECK_LIB(intl, ngettext,
+ [AC_CHECK_LIB(intl, dgettext,
+ gt_cv_func_dgettext_libintl=yes)])])
+
+ if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
+ AC_MSG_CHECKING([if -liconv is needed to use gettext])
+ AC_MSG_RESULT([])
+ AC_CHECK_LIB(intl, ngettext,
+ [AC_CHECK_LIB(intl, dcgettext,
+ [gt_cv_func_dgettext_libintl=yes
+ libintl_extra_libs=-liconv],
+ :,-liconv)],
+ :,-liconv)
+ fi
+
+ #
+ # If we found libintl, then check in it for bind_textdomain_codeset();
+ # we'll prefer libc if neither have bind_textdomain_codeset(),
+ # and both have dgettext and ngettext
+ #
+ if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
+ glib_save_LIBS="$LIBS"
+ LIBS="$LIBS -lintl $libintl_extra_libs"
+ unset ac_cv_func_bind_textdomain_codeset
+ AC_CHECK_FUNCS(bind_textdomain_codeset)
+ LIBS="$glib_save_LIBS"
+
+ if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
+ gt_cv_func_dgettext_libc=no
+ else
+ if test "$gt_cv_func_dgettext_libc" = "yes" \
+ && test "$gt_cv_func_ngettext_libc" = "yes"; then
+ gt_cv_func_dgettext_libintl=no
+ fi
+ fi
+ fi
+ fi
+
+ if test "$gt_cv_func_dgettext_libc" = "yes" \
+ || test "$gt_cv_func_dgettext_libintl" = "yes"; then
+ gt_cv_have_gettext=yes
+ fi
+
+ if test "$gt_cv_func_dgettext_libintl" = "yes"; then
+ INTLLIBS="-lintl $libintl_extra_libs"
+ fi
+
+ if test "$gt_cv_have_gettext" = "yes"; then
+ AC_DEFINE(HAVE_GETTEXT,1,
+ [Define if the GNU gettext() function is already present or preinstalled.])
+ GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
+ if test "$MSGFMT" != "no"; then
+ glib_save_LIBS="$LIBS"
+ LIBS="$LIBS $INTLLIBS"
+ AC_CHECK_FUNCS(dcgettext)
+ MSGFMT_OPTS=
+ AC_MSG_CHECKING([if msgfmt accepts -c])
+ GLIB_RUN_PROG([msgfmt -c -o /dev/null],[
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Project-Id-Version: test 1.0\n"
+"PO-Revision-Date: 2007-02-15 12:01+0100\n"
+"Last-Translator: test <foo at bar.xx>\n"
+"Language-Team: C <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Transfer-Encoding: 8bit\n"
+], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
+ AC_SUBST(MSGFMT_OPTS)
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+ GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+ AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr],
+ [CATOBJEXT=.gmo
+ DATADIRNAME=share],
+ [case $host in
+ *-*-solaris*)
+ dnl On Solaris, if bind_textdomain_codeset is in libc,
+ dnl GNU format message catalog is always supported,
+ dnl since both are added to the libc all together.
+ dnl Hence, we'd like to go with DATADIRNAME=share and
+ dnl and CATOBJEXT=.gmo in this case.
+ AC_CHECK_FUNC(bind_textdomain_codeset,
+ [CATOBJEXT=.gmo
+ DATADIRNAME=share],
+ [CATOBJEXT=.mo
+ DATADIRNAME=lib])
+ ;;
+ *)
+ CATOBJEXT=.mo
+ DATADIRNAME=lib
+ ;;
+ esac])
+ LIBS="$glib_save_LIBS"
+ INSTOBJEXT=.mo
+ else
+ gt_cv_have_gettext=no
+ fi
+ fi
+ ])
+
+ if test "$gt_cv_have_gettext" = "yes" ; then
+ AC_DEFINE(ENABLE_NLS, 1,
+ [always defined to indicate that i18n is enabled])
+ fi
+
+ dnl Test whether we really found GNU xgettext.
+ if test "$XGETTEXT" != ":"; then
+ dnl If it is not GNU xgettext we define it as : so that the
+ dnl Makefiles still can work.
+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ : ;
+ else
+ AC_MSG_RESULT(
+ [found xgettext program is not GNU xgettext; ignore it])
+ XGETTEXT=":"
+ fi
+ fi
+
+ # We need to process the po/ directory.
+ POSUB=po
+
+ AC_OUTPUT_COMMANDS(
+ [case "$CONFIG_FILES" in *po/Makefile.in*)
+ sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
+ esac])
+
+ dnl These rules are solely for the distribution goal. While doing this
+ dnl we only have to keep exactly one list of the available catalogs
+ dnl in configure.in.
+ for lang in $ALL_LINGUAS; do
+ GMOFILES="$GMOFILES $lang.gmo"
+ POFILES="$POFILES $lang.po"
+ done
+
+ dnl Make all variables we use known to autoconf.
+ AC_SUBST(CATALOGS)
+ AC_SUBST(CATOBJEXT)
+ AC_SUBST(DATADIRNAME)
+ AC_SUBST(GMOFILES)
+ AC_SUBST(INSTOBJEXT)
+ AC_SUBST(INTLLIBS)
+ AC_SUBST(PO_IN_DATADIR_TRUE)
+ AC_SUBST(PO_IN_DATADIR_FALSE)
+ AC_SUBST(POFILES)
+ AC_SUBST(POSUB)
+ ])
+
+# AM_GLIB_GNU_GETTEXT
+# -------------------
+# Do checks necessary for use of gettext. If a suitable implementation
+# of gettext is found in either in libintl or in the C library,
+# it will set INTLLIBS to the libraries needed for use of gettext
+# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
+# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
+# on various variables needed by the Makefile.in.in installed by
+# glib-gettextize.
+dnl
+glib_DEFUN([GLIB_GNU_GETTEXT],
+ [AC_REQUIRE([AC_PROG_CC])dnl
+ AC_REQUIRE([AC_HEADER_STDC])dnl
+
+ GLIB_LC_MESSAGES
+ GLIB_WITH_NLS
+
+ if test "$gt_cv_have_gettext" = "yes"; then
+ if test "x$ALL_LINGUAS" = "x"; then
+ LINGUAS=
+ else
+ AC_MSG_CHECKING(for catalogs to be installed)
+ NEW_LINGUAS=
+ for presentlang in $ALL_LINGUAS; do
+ useit=no
+ if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
+ desiredlanguages="$LINGUAS"
+ else
+ desiredlanguages="$ALL_LINGUAS"
+ fi
+ for desiredlang in $desiredlanguages; do
+ # Use the presentlang catalog if desiredlang is
+ # a. equal to presentlang, or
+ # b. a variant of presentlang (because in this case,
+ # presentlang can be used as a fallback for messages
+ # which are not translated in the desiredlang catalog).
+ case "$desiredlang" in
+ "$presentlang"*) useit=yes;;
+ esac
+ done
+ if test $useit = yes; then
+ NEW_LINGUAS="$NEW_LINGUAS $presentlang"
+ fi
+ done
+ LINGUAS=$NEW_LINGUAS
+ AC_MSG_RESULT($LINGUAS)
+ fi
+
+ dnl Construct list of names of catalog files to be constructed.
+ if test -n "$LINGUAS"; then
+ for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+ fi
+ fi
+
+ dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
+ dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
+ dnl Try to locate is.
+ MKINSTALLDIRS=
+ if test -n "$ac_aux_dir"; then
+ MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+ fi
+ if test -z "$MKINSTALLDIRS"; then
+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+ fi
+ AC_SUBST(MKINSTALLDIRS)
+
+ dnl Generate list of files to be processed by xgettext which will
+ dnl be included in po/Makefile.
+ test -d po || mkdir po
+ if test "x$srcdir" != "x."; then
+ if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+ posrcprefix="$srcdir/"
+ else
+ posrcprefix="../$srcdir/"
+ fi
+ else
+ posrcprefix="../"
+ fi
+ rm -f po/POTFILES
+ sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+ < $srcdir/po/POTFILES.in > po/POTFILES
+ ])
+
+# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
+# -------------------------------
+# Define VARIABLE to the location where catalog files will
+# be installed by po/Makefile.
+glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
+[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
+glib_save_prefix="$prefix"
+glib_save_exec_prefix="$exec_prefix"
+glib_save_datarootdir="$datarootdir"
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+test "x$exec_prefix" = xNONE && exec_prefix=$prefix
+datarootdir=`eval echo "${datarootdir}"`
+if test "x$CATOBJEXT" = "x.mo" ; then
+ localedir=`eval echo "${libdir}/locale"`
+else
+ localedir=`eval echo "${datadir}/locale"`
+fi
+prefix="$glib_save_prefix"
+exec_prefix="$glib_save_exec_prefix"
+datarootdir="$glib_save_datarootdir"
+AC_DEFINE_UNQUOTED($1, "$localedir",
+ [Define the location where the catalogs will be installed])
+])
+
+dnl
+dnl Now the definitions that aclocal will find
+dnl
+ifdef(glib_configure_in,[],[
+AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
+AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
+])dnl
+
+# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL])
+#
+# Create a temporary file with TEST-FILE as its contents and pass the
+# file name to PROGRAM. Perform ACTION-IF-PASS if PROGRAM exits with
+# 0 and perform ACTION-IF-FAIL for any other exit status.
+AC_DEFUN([GLIB_RUN_PROG],
+[cat >conftest.foo <<_ACEOF
+$2
+_ACEOF
+if AC_RUN_LOG([$1 conftest.foo]); then
+ m4_ifval([$3], [$3], [:])
+m4_ifvaln([$4], [else $4])dnl
+echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD
+sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD
+fi])
+
+
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/autogen.sh
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/autogen.sh (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -x
+glib-gettextize --copy --force
+libtoolize --automake --copy --force
+intltoolize --automake --copy --force
+aclocal-1.7
+autoconf --force
+autoheader --force
+automake-1.7 --add-missing --copy --force-missing --foreign
+./configure --enable-maintainer-mode
\ No newline at end of file
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,98 @@
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(maemopad, `date +%Y%m%d`)
+AM_CONFIG_HEADER(config.h)
+
+AC_CANONICAL_HOST
+
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+AC_PROG_INTLTOOL([0.23])
+AC_HEADER_STDC
+
+# Option to enable debugging
+AC_ARG_ENABLE(debug,
+ [AC_HELP_STRING([ --enable-debug],[Debugging (default=no)])],
+ [with_debug=yes], [with_debug=no])
+
+if test "x$with_debug" == "xyes" ; then
+ CFLAGS="$CFLAGS -ggdb -O0 -DDEBUG -Wall -ansi -pedantic"
+else
+ CFLAGS="$CFLAGS -O2 -Wall -ansi -pedantic"
+fi
+
+# Hildon library dependsncies
+PKG_CHECK_MODULES(HILDON, hildon-1 >= 0.9.50 hildon-fm-2 hildon-help)
+AC_SUBST(HILDON_LIBS)
+AC_SUBST(HILDON_CFLAGS)
+
+# Only used for the .service file path
+PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.60)
+
+# OSSO application framework dependencies
+PKG_CHECK_MODULES(OSSO, osso-af-settings >= 0.8.5 libosso >= 0.9.17 gnome-vfs-2.0 >= 2.8.4.11 gnome-vfs-module-2.0 >= 2.8.4.11)
+AC_SUBST(OSSO_LIBS)
+AC_SUBST(OSSO_CFLAGS)
+
+# Localisation
+GETTEXT_PACKAGE=$PACKAGE
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "${GETTEXT_PACKAGE}", [Name of gettext package])
+ALL_LINGUAS="en_GB"
+AM_GLIB_GNU_GETTEXT
+
+# To make application visible in maemo Task Navigator it needs a Desktop
+# file for the application.
+# D-BUS service file is needed to be able to launch the maemo application
+# and connect it to D-BUS services.
+# The following line defines install directories for these files.
+desktopentrydir=`$PKG_CONFIG osso-af-settings --variable=desktopentrydir`
+serviceentrydir=`$PKG_CONFIG osso-af-settings --variable=dbusservicedir`
+
+# Application locale install directory
+localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
+
+# Application pixmaps install directory
+pixmapdir=`$PKG_CONFIG osso-af-settings --variable=hildonpixmapdir`
+
+# Application icon install directories
+icon_26x26dir=$datadir/icons/hicolor/26x26/hildon
+icon_34x34dir=$datadir/icons/hicolor/34x34/hildon
+icon_40x40dir=$datadir/icons/hicolor/40x40/hildon
+icon_50x50dir=$datadir/icons/hicolor/50x50/hildon
+icon_scalabledir=$datadir/icons/hicolor/scalable/hildon
+
+# Help file install directory
+helpfile_engbdir=$datadir/osso-help/en_GB
+
+# Hildon control panel plugin install directories
+pluginlibdir=`$PKG_CONFIG hildon-control-panel --variable=plugindir`
+plugindesktopentrydir=`$PKG_CONFIG hildon-control-panel --variable=plugindesktopentrydir`
+
+# Define as variables in Makefiles
+AC_SUBST(desktopentrydir)
+AC_SUBST(serviceentrydir)
+AC_SUBST(localedir)
+AC_SUBST(pixmapdir)
+AC_SUBST(icon_26x26dir)
+AC_SUBST(icon_34x34dir)
+AC_SUBST(icon_40x40dir)
+AC_SUBST(icon_50x50dir)
+AC_SUBST(icon_scalabledir)
+AC_SUBST(pluginlibdir)
+AC_SUBST(plugindesktopentrydir)
+AC_SUBST(helpfile_engbdir)
+
+AC_DEFINE_UNQUOTED([LOCALEDIR], "${localedir}", [Runtime locale catalog files path])
+AC_DEFINE_UNQUOTED([PIXMAPDIR], "${pixmapdir}", [Runtime pixmap files path])
+
+# Produce output files
+AC_OUTPUT(
+ Makefile \
+ src/Makefile \
+ data/Makefile \
+ po/Makefile.in \
+ po/Makefile
+)
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.badpkgmacros
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.badpkgmacros (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.badpkgmacros 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,20 @@
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(maemopad, `date +%Y%m%d`)
+AM_CONFIG_HEADER(config.h)
+
+
+# Hildon library dependsncies
+PKG_CHECK_MODULES()
+
+# Only used for the .service file path
+PKG_CHECK_EXISTS()
+
+
+# Produce output files
+AC_OUTPUT(
+ Makefile \
+ src/Makefile \
+ data/Makefile \
+ po/Makefile.in \
+ po/Makefile
+)
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.check
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.check (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.check 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(maemopad, `date +%Y%m%d`)
+AM_CONFIG_HEADER(config.h)
+
+
+# Hildon library dependsncies
+PKG_CHECK_EXISTS(hildon-1 >= 0.9.50 hildon-fm-2 hildon-help)
+
+# Only used for the .service file path
+PKG_CHECK_EXISTS(dbus-glib-1 >= 0.60)
+
+# OSSO application framework dependencies
+PKG_CHECK_EXISTS(osso-af-settings >= 0.8.5 libosso >= 0.9.17 gnome-vfs-2.0 >= 2.8.4.11 gnome-vfs-module-2.0 >= 2.8.4.11)
+
+# Produce output files
+AC_OUTPUT(
+ Makefile \
+ src/Makefile \
+ data/Makefile \
+ po/Makefile.in \
+ po/Makefile
+)
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.newstyle
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.newstyle (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.newstyle 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,101 @@
+AC_INIT(MaemoPad Example, `date +%Y%m%d`, [maemo-integration at maemo.org], maemopad)
+AC_CONFIG_SRCDIR(Makefile.am)
+AM_INIT_AUTOMAKE
+AM_CONFIG_HEADER(config.h)
+
+AC_CANONICAL_HOST
+
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+AC_PROG_INTLTOOL([0.23])
+AC_HEADER_STDC
+
+# Option to enable debugging
+AC_ARG_ENABLE(debug,
+ [AC_HELP_STRING([ --enable-debug],[Debugging (default=no)])],
+ [with_debug=yes], [with_debug=no])
+
+if test "x$with_debug" == "xyes" ; then
+ CFLAGS="$CFLAGS -ggdb -O0 -DDEBUG -Wall -ansi -pedantic"
+else
+ CFLAGS="$CFLAGS -O2 -Wall -ansi -pedantic"
+fi
+
+# Hildon library dependsncies
+PKG_CHECK_MODULES(HILDON, hildon-1 >= 0.9.50 hildon-fm-2 hildon-help)
+AC_SUBST(HILDON_LIBS)
+AC_SUBST(HILDON_CFLAGS)
+
+# Only used for the .service file path
+PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.60)
+
+# OSSO application framework dependencies
+PKG_CHECK_MODULES(OSSO, osso-af-settings >= 0.8.5 libosso >= 0.9.17 gnome-vfs-2.0 >= 2.8.4.11 gnome-vfs-module-2.0 >= 2.8.4.11)
+AC_SUBST(OSSO_LIBS)
+AC_SUBST(OSSO_CFLAGS)
+
+# Localisation
+GETTEXT_PACKAGE=$PACKAGE
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "${GETTEXT_PACKAGE}", [Name of gettext package])
+ALL_LINGUAS="en_GB"
+AM_GLIB_GNU_GETTEXT
+
+# To make application visible in maemo Task Navigator it needs a Desktop
+# file for the application.
+# D-BUS service file is needed to be able to launch the maemo application
+# and connect it to D-BUS services.
+# The following line defines install directories for these files.
+desktopentrydir=`$PKG_CONFIG osso-af-settings --variable=desktopentrydir`
+serviceentrydir=`$PKG_CONFIG osso-af-settings --variable=dbusservicedir`
+
+# Application locale install directory
+localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
+
+# Application pixmaps install directory
+pixmapdir=`$PKG_CONFIG osso-af-settings --variable=hildonpixmapdir`
+
+# Application icon install directories
+icon_26x26dir=$datadir/icons/hicolor/26x26/hildon
+icon_34x34dir=$datadir/icons/hicolor/34x34/hildon
+icon_40x40dir=$datadir/icons/hicolor/40x40/hildon
+icon_50x50dir=$datadir/icons/hicolor/50x50/hildon
+icon_scalabledir=$datadir/icons/hicolor/scalable/hildon
+
+# Help file install directory
+helpfile_engbdir=$datadir/osso-help/en_GB
+
+# Hildon control panel plugin install directories
+pluginlibdir=`$PKG_CONFIG hildon-control-panel --variable=plugindir`
+plugindesktopentrydir=`$PKG_CONFIG hildon-control-panel --variable=plugindesktopentrydir`
+
+# Define as variables in Makefiles
+AC_SUBST(desktopentrydir)
+AC_SUBST(serviceentrydir)
+AC_SUBST(localedir)
+AC_SUBST(pixmapdir)
+AC_SUBST(icon_26x26dir)
+AC_SUBST(icon_34x34dir)
+AC_SUBST(icon_40x40dir)
+AC_SUBST(icon_50x50dir)
+AC_SUBST(icon_scalabledir)
+AC_SUBST(pluginlibdir)
+AC_SUBST(plugindesktopentrydir)
+AC_SUBST(helpfile_engbdir)
+
+AC_DEFINE_UNQUOTED([LOCALEDIR], "${localedir}", [Runtime locale catalog files path])
+AC_DEFINE_UNQUOTED([PIXMAPDIR], "${pixmapdir}", [Runtime pixmap files path])
+
+# Produce output files
+AC_CONFIG_FILES(
+ [Makefile \
+ src/Makefile \
+ data/Makefile \
+ po/Makefile.in \
+ po/Makefile]
+ )
+
+AC_OUTPUT
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.noautomake
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.noautomake (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/configure.ac.noautomake 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+AC_INIT(maemopad, 1.0)
+
+# Produce output files
+AC_CONFIG_FILES(
+ Makefile \
+ src/Makefile \
+ data/Makefile \
+ po/Makefile.in \
+ po/Makefile
+ )
+
+AC_OUTPUT
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/data/Makefile.am
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/data/Makefile.am (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/data/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+#
+# This file is part of maemopad
+#
+# Copyright (C) 2005 Nokia Corporation.
+#
+# This software is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+
+serviceentry_DATA = com.nokia.maemopad.service
+
+desktopentry_DATA = maemopad.desktop
+
+icon_26x26_DATA = icons/26x26/maemopad.png
+icon_40x40_DATA = icons/40x40/maemopad.png
+icon_scalable_DATA = icons/scalable/maemopad.png
+
+helpfile_engb_DATA = help/en_GB/MaemoPad.xml
+
+EXTRA_DIST = $(serviceentry_DATA) $(desktopentry_DATA) $(icon_26x26_DATA) $(icon_40x40_DATA) $(icon_scalable_DATA) $(helpfile_engb_DATA)
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/Makefile.am
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/Makefile.am (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+# This file is part of maemopad
+#
+# Copyright (C) 2005 Nokia Corporation.
+#
+# This software is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+
+bin_PROGRAMS = maemopad
+
+maemopad_LDADD = $(HILDON_LIBS) $(OSSO_LIBS)
+
+maemopad_CFLAGS= $(HILDON_CFLAGS) $(OSSO_CFLAGS)
+
+maemopad_SOURCES = \
+ main.c \
+ appdata.h \
+ ui/interface.h \
+ ui/interface.c \
+ ui/callbacks.h \
+ ui/callbacks.c
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/appdata.h
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/appdata.h (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/appdata.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,38 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef MAEMOPAD_APPDATA_H
+#define MAEMOPAD_APPDATA_H
+
+#include <libosso.h>
+
+typedef struct _AppData AppData;
+
+struct _AppData
+{
+ HildonProgram *program; /* handle to application */
+ HildonWindow *window; /* handle to app's window */
+ osso_context_t *osso; /* handle to osso */
+};
+
+#endif
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/main.c
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/main.c (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/main.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,104 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <ui/interface.h>
+#include <appdata.h>
+
+#include <gtk/gtkmain.h>
+
+#include <hildon/hildon-program.h>
+
+#include <libintl.h>
+#include <locale.h>
+#include <libosso.h>
+
+#define _(String) gettext(String)
+
+#include <config.h>
+
+/*
+ * create our application specific data
+ * This consists of allocating some space
+ * for the AppData structure, and also
+ * creating the list store that will act
+ * as a model for the contact list.
+ * The other elements of the AppData structure
+ * are implicitly set by the call to g_new0
+ * which zeroes the memory of the AppData, thereby
+ * setting create_new to FALSE, and iter to NULL.
+ *
+ */
+
+static AppData *create_data ()
+{
+ AppData *result = g_new0( AppData, 1 );
+
+ result->osso = osso_initialize ( PACKAGE, VERSION, TRUE, NULL );
+ g_assert ( result->osso );
+ return result;
+}
+
+/* Here we clean up all the data that we allocated */
+static void destroy_data ( AppData *data )
+{
+ g_free ( data );
+}
+
+int main( int argc, char* argv[] )
+{
+ AppData* data;
+ HildonProgram* program;
+ MainView* main_view;
+
+ /* Initialise the locale stuff */
+ setlocale ( LC_ALL, "" );
+ bindtextdomain ( GETTEXT_PACKAGE, LOCALEDIR );
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+ textdomain ( GETTEXT_PACKAGE );
+
+ /* Init the gtk - must be called before any hildon stuff */
+ gtk_init( &argc, &argv );
+
+ /* Create the hildon application and setup the title */
+ program = HILDON_PROGRAM ( hildon_program_get_instance () );
+ g_set_application_name ( _("MaemoPad") );
+
+ /* Create the data and views for our application */
+ data = create_data ();
+ data->program = program;
+ main_view = interface_main_view_new ( data );
+ hildon_program_add_window( data->program, data->window );
+
+ gtk_signal_connect( G_OBJECT(data->window), "delete_event", gtk_main_quit, NULL );
+
+ /* Begin the main app */
+ gtk_widget_show ( GTK_WIDGET ( program ) );
+ gtk_main();
+
+ /* Clean up */
+ interface_main_view_destroy ( main_view );
+ destroy_data ( data );
+
+ return 0;
+}
+
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/callbacks.c
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/callbacks.c (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/callbacks.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,303 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <ui/callbacks.h>
+#include <ui/interface.h>
+#include <gtk/gtk.h>
+#include <libintl.h>
+/* strlen needed from string.h */
+#include <string.h>
+/* Gnome VFS for file i/o */
+#include <libgnomevfs/gnome-vfs.h>
+
+/* Privates: */
+void read_file_to_buffer ( MainView* mainview );
+void write_buffer_to_file ( MainView* mainview );
+
+/* cut */
+void callback_edit_cut( GtkAction * action, gpointer data )
+{
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* do cut */
+ gtk_text_buffer_cut_clipboard(GTK_TEXT_BUFFER(mainview->buffer), mainview->clipboard, TRUE);
+}
+
+/* copy */
+void callback_edit_copy( GtkAction * action, gpointer data )
+{
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* do copy */
+ gtk_text_buffer_copy_clipboard (GTK_TEXT_BUFFER(mainview->buffer), mainview->clipboard);
+}
+
+/* paste */
+void callback_edit_paste( GtkAction * action, gpointer data )
+{
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* do paste */
+ gtk_text_buffer_paste_clipboard (GTK_TEXT_BUFFER (mainview->buffer), mainview->clipboard, NULL, TRUE);
+}
+
+/* new */
+void callback_file_new(GtkAction * action, gpointer data)
+{
+ gint answer;
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* save changes note if file is edited */
+ if( mainview->file_edited ) {
+ answer = interface_save_changes_note( mainview );
+ if( answer == CONFRESP_YES ) {
+ if( mainview->file_name == NULL ) {
+ mainview->file_name = interface_file_chooser ( mainview, GTK_FILE_CHOOSER_ACTION_SAVE );
+ }
+ write_buffer_to_file ( mainview );
+ }
+ }
+ /* clear buffer, filename and free buffer text */
+ gtk_text_buffer_set_text ( GTK_TEXT_BUFFER (mainview->buffer), "", -1 );
+ mainview->file_name = NULL;
+ mainview->file_edited = FALSE;
+}
+
+/* open */
+void callback_file_open(GtkAction * action, gpointer data)
+{
+ gint answer;
+ gchar* filename = NULL;
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* save changes note if file is edited */
+ if( mainview->file_edited ) {
+ answer = interface_save_changes_note( mainview );
+ if( answer == CONFRESP_YES ) {
+ /* check is we had a new file */
+ if( mainview->file_name == NULL ) {
+ mainview->file_name = interface_file_chooser ( mainview, GTK_FILE_CHOOSER_ACTION_SAVE );
+ }
+ write_buffer_to_file ( mainview );
+ }
+ }
+
+ /* open new file */
+ filename = interface_file_chooser ( mainview, GTK_FILE_CHOOSER_ACTION_OPEN );
+
+ /* if we got a file name from chooser -> open file */
+ if( filename != NULL ) {
+ mainview->file_name = filename;
+ read_file_to_buffer ( mainview );
+ mainview->file_edited = FALSE;
+ }
+}
+
+/* save */
+void callback_file_save(GtkAction * action, gpointer data)
+{
+ gchar* filename = NULL;
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* check is we had a new file */
+ if( mainview->file_name != NULL ) {
+ write_buffer_to_file ( mainview );
+ } else {
+ filename = interface_file_chooser ( mainview, GTK_FILE_CHOOSER_ACTION_SAVE );
+ /* if we got a file name from chooser -> save file */
+ if( filename != NULL ) {
+ mainview->file_name = filename;
+ write_buffer_to_file ( mainview );
+ mainview->file_edited = FALSE;
+ }
+ }
+}
+
+/* save as... */
+void callback_file_saveas(GtkAction * action, gpointer data)
+{
+ gchar* filename = NULL;
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ filename = interface_file_chooser ( mainview, GTK_FILE_CHOOSER_ACTION_SAVE );
+
+ /* if we got a file name from chooser -> save file */
+ if( filename != NULL ) {
+ mainview->file_name = filename;
+ write_buffer_to_file ( mainview );
+ mainview->file_edited = FALSE;
+ }
+}
+
+/* font */
+void callback_font( GtkAction * action, gpointer data )
+{
+ PangoFontDescription* new_font = NULL;
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ new_font = interface_font_chooser( mainview );
+
+ /* if we got a new font from chooser -> change font */
+ if( new_font != NULL ) {
+ mainview->font_desc = new_font;
+ gtk_widget_modify_font ( mainview->textview, mainview->font_desc );
+ }
+}
+
+/* fullscreen */
+void callback_fullscreen( GtkAction * action, gpointer data )
+{
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* toggle fullscreen on<->off */
+ mainview->fullscreen = !mainview->fullscreen;
+
+ if (mainview->fullscreen) {
+ gtk_window_fullscreen(GTK_WINDOW(mainview->data->window));
+ } else {
+ gtk_window_unfullscreen(GTK_WINDOW(mainview->data->window));
+ }
+}
+
+/* help */
+void callback_help( GtkAction * action, gpointer data )
+{
+ osso_return_t retval;
+
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ retval = hildon_help_show(
+ mainview->data->osso, /* osso_context */
+ HELP_TOPIC_ID, /* topic id */
+ HILDON_HELP_SHOW_DIALOG);
+}
+
+/* buffer edited */
+void callback_buffer_modified ( GtkAction * action, gpointer data )
+{
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* change state */
+ mainview->file_edited = TRUE;
+}
+
+/* Privates */
+
+/* read file */
+void read_file_to_buffer ( MainView* mainview )
+{
+ GnomeVFSResult vfs_result;
+ GnomeVFSHandle *handle = NULL;
+ GnomeVFSFileSize in_bytes;
+ GnomeVFSFileInfo finfo;
+ gchar *temp_buffer = NULL;
+ g_assert( mainview != NULL );
+
+ /* try to get file info */
+ vfs_result = gnome_vfs_get_file_info(mainview->file_name, &finfo, GNOME_VFS_FILE_INFO_DEFAULT);
+ if ( vfs_result != GNOME_VFS_OK ) {
+ interface_error( MAEMOPAD_ERROR_OPEN_FAILED, mainview );
+ return;
+ }
+ /* try to create handle to file */
+ vfs_result = gnome_vfs_open(&handle, mainview->file_name, GNOME_VFS_OPEN_READ);
+ if ( vfs_result != GNOME_VFS_OK ) {
+ interface_error( MAEMOPAD_ERROR_OPEN_FAILED, mainview );
+ return;
+ }
+
+ /* allocate memory for temp_buffer */
+ temp_buffer = g_malloc(finfo.size + 1);
+ memset(temp_buffer, 0, finfo.size + 1);
+
+ /* read from file to buffer */
+ gnome_vfs_read(handle, temp_buffer, finfo.size, &in_bytes);
+
+ /* set text to screen */
+ gtk_text_buffer_set_text( GTK_TEXT_BUFFER (mainview->buffer), temp_buffer, -1);
+
+ /* free temp, close file and return */
+ g_free(temp_buffer);
+ gnome_vfs_close(handle);
+}
+
+
+
+/* write to file */
+void write_buffer_to_file ( MainView* mainview )
+{
+ GnomeVFSResult vfs_result;
+ GnomeVFSHandle *handle = NULL;
+ GnomeVFSFileSize out_bytes;
+ gchar *temp_buffer = NULL;
+ GtkTextIter start, end;
+ g_assert( mainview != NULL );
+
+ /* try to create handle to file */
+ vfs_result = gnome_vfs_create(&handle, mainview->file_name, GNOME_VFS_OPEN_WRITE, 0, 0600);
+ if ( vfs_result != GNOME_VFS_OK ) {
+ interface_error( MAEMOPAD_ERROR_SAVE_FAILED, mainview );
+ return;
+ }
+
+ /* find start and end of text */
+ gtk_text_buffer_get_bounds( GTK_TEXT_BUFFER (mainview->buffer), &start, &end);
+
+ /* copy all text from screen to temp_buffer */
+ temp_buffer = gtk_text_buffer_get_slice( GTK_TEXT_BUFFER (mainview->buffer), &start, &end, TRUE);
+
+ /* write text to file */
+ gnome_vfs_write(handle, temp_buffer, strlen(temp_buffer), &out_bytes);
+
+ /* free temp, close file and return */
+ g_free(temp_buffer);
+ gnome_vfs_close(handle);
+}
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/callbacks.h
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/callbacks.h (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/callbacks.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,53 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef CALLBACKS_H
+#define CALLBACKS_H
+
+#include <ui/interface.h>
+#include <gtk/gtk.h>
+#include <appdata.h>
+#include <hildon/hildon-help.h>
+
+#define HELP_TOPIC_ID "Example_MaemoPad_Content"
+
+/* edit-> cut/copy/paste */
+void callback_edit_cut ( GtkAction * action, gpointer data );
+void callback_edit_copy ( GtkAction * action, gpointer data );
+void callback_edit_paste ( GtkAction * action, gpointer data );
+/* file-> new/open/save */
+void callback_file_new ( GtkAction * action, gpointer data );
+void callback_file_open ( GtkAction * action, gpointer data );
+void callback_file_save ( GtkAction * action, gpointer data );
+void callback_file_saveas ( GtkAction * action, gpointer data );
+/* font */
+void callback_font ( GtkAction * action, gpointer data );
+/* fullscreen */
+void callback_fullscreen ( GtkAction * action, gpointer data );
+/* help */
+void callback_help ( GtkAction * action, gpointer data );
+
+/* buffer modified */
+void callback_buffer_modified ( GtkAction * action, gpointer data );
+
+#endif
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/interface.c
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/interface.c (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/interface.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,376 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <ui/interface.h>
+#include <ui/callbacks.h>
+#include <gtk/gtk.h>
+#include <libintl.h>
+
+#include <hildon/hildon-file-chooser-dialog.h>
+#include <hildon/hildon-note.h>
+#include <hildon/hildon-font-selection-dialog.h>
+
+
+/* Privates: */
+
+static void create_menu( MainView *main );
+static void create_toolbar( MainView *main );
+void create_textarea( MainView *main );
+
+/* Creates and initialises a main_view */
+MainView* interface_main_view_new( AppData *data )
+{
+ /* Zero memory with g_new0 */
+ MainView* result = g_new0( MainView, 1 );
+ /* Create GTK vbox which will be our text area */
+ GtkWidget *main_vbox = gtk_vbox_new( FALSE, 0 );
+ result->clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_set_can_store(result->clipboard, NULL, 0);
+
+ /* Initialize interface data */
+ result->file_edited = FALSE;
+ /* Store handle to app's data to view's data */
+ result->data = data;
+ /* Store handle to hildon_window to app's data */
+ result->data->window = HILDON_WINDOW(hildon_window_new());
+ /* Create all our necessary parts */
+ create_textarea( result );
+ create_toolbar( result );
+ create_menu( result );
+ /* Put GTK vbox to app's view */
+ gtk_container_add( GTK_CONTAINER( result->data->window ), main_vbox );
+ /* Put scrolledwindow to GTK vbox and show it */
+ gtk_box_pack_start( GTK_BOX( main_vbox ), result->scrolledwindow, TRUE, TRUE, 0 );
+ gtk_widget_show( main_vbox );
+ /* Focus on textarea */
+ gtk_widget_grab_focus( GTK_WIDGET(result->textview ));
+ /* Initialize our textview's file (no file opened yet) */
+ result->file_edited=FALSE;
+ result->file_name=NULL;
+ /* Return with new mainview handle */
+ return result;
+}
+
+/* clean up the allocated memory */
+void interface_main_view_destroy( MainView *main )
+{
+ g_free( main );
+}
+
+/* File chooser */
+gchar* interface_file_chooser(MainView * mainview, GtkFileChooserAction action)
+{
+ GtkWidget *dialog;
+ gchar* filename = NULL;
+
+ dialog = hildon_file_chooser_dialog_new( GTK_WINDOW(mainview->data->program), action);
+ gtk_widget_show_all (GTK_WIDGET(dialog));
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
+ {
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+ }
+ gtk_widget_destroy (dialog);
+ return filename;
+}
+
+/* Font chooser */
+PangoFontDescription* interface_font_chooser( MainView * main )
+{
+ HildonFontSelectionDialog *dialog = NULL;
+
+ PangoFontDescription *font = NULL;
+ gint size;
+ gboolean bold, italic;
+ gchar *family = NULL;
+
+ font = pango_font_description_new();
+
+ /* create dialog */
+ dialog = HILDON_FONT_SELECTION_DIALOG ( hildon_font_selection_dialog_new( NULL, NULL ) );
+
+ gtk_widget_show_all (GTK_WIDGET(dialog));
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
+ {
+ g_object_get(G_OBJECT(dialog),
+ "family", &family,
+ "size", &size,
+ "bold", &bold,
+ "italic", &italic,
+ NULL);
+ pango_font_description_set_family(font, family);
+ pango_font_description_set_size(font, size * PANGO_SCALE);
+ if (bold) {
+ pango_font_description_set_weight(font, PANGO_WEIGHT_BOLD);
+ } else {
+ pango_font_description_set_weight(font, PANGO_WEIGHT_NORMAL);
+ }
+ if (italic) {
+ pango_font_description_set_style(font, PANGO_STYLE_ITALIC);
+ } else {
+ pango_font_description_set_style(font, PANGO_STYLE_NORMAL);
+ }
+ }
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+
+ return font;
+}
+
+/* Save changes note */
+gint interface_save_changes_note(MainView * main)
+{
+ HildonNote *hn = NULL;
+ gint response = FALSE;
+
+ g_assert(main != NULL && main->data->program != NULL);
+
+ hn = HILDON_NOTE(hildon_note_new_confirmation_add_buttons
+ (GTK_WINDOW(main->data->program),
+ _("maemopad_save_changes_made"),
+ _("maemopad_yes"), CONFRESP_YES,
+ _("maemopad_no"), CONFRESP_NO,
+ NULL, NULL));
+ response = gtk_dialog_run(GTK_DIALOG(hn));
+ gtk_widget_destroy(GTK_WIDGET(hn));
+ return response;
+}
+
+/* Error note */
+void interface_error( MaemopadError me, MainView *main )
+{
+ GtkWidget *dialog = NULL;
+ gchar *msg = NULL;
+
+ switch (me) {
+
+ case MAEMOPAD_ERROR_INVALID_URI:
+ msg = g_strdup( _("maemopad_invalid_uri") );
+ break;
+
+ case MAEMOPAD_ERROR_SAVE_FAILED:
+ msg = g_strdup( _("maemopad_save_failed") );
+ break;
+
+ case MAEMOPAD_ERROR_OPEN_FAILED:
+ msg = g_strdup( _("maemopad_open_failed") );
+ break;
+
+ case MAEMOPAD_NO_ERROR:
+ return;
+
+ default:
+ g_assert_not_reached();
+ }
+
+ dialog = hildon_note_new_information( GTK_WINDOW( main->data->program ), msg );
+
+ gtk_dialog_run( GTK_DIALOG( dialog ) );
+ gtk_widget_destroy( dialog );
+ g_free( msg );
+}
+
+/* Privates */
+
+/* Create the menu items needed for the drop down menu */
+static void create_menu( MainView *main )
+{
+ /* Create needed handles */
+ GtkMenu *main_menu;
+ GtkWidget *file_menu, *edit_menu;
+ GtkWidget *separator = NULL;
+ GtkWidget *help = NULL, *close = NULL;
+
+ /* Create main menu and new menus for submenus in our drop down menu */
+ main_menu = GTK_MENU( gtk_menu_new () );
+ file_menu = gtk_menu_new ();
+ edit_menu = gtk_menu_new ();
+
+ /* Create the menu items */
+ main->file_item = gtk_menu_item_new_with_label ( _("File") );
+ main->new_item = gtk_menu_item_new_with_label ( _("New") );
+ main->open_item = gtk_menu_item_new_with_label ( _("Open") );
+ main->save_item = gtk_menu_item_new_with_label ( _("Save") );
+ main->saveas_item = gtk_menu_item_new_with_label ( _("Save As...") );
+ main->edit_item = gtk_menu_item_new_with_label ( _("Edit") );
+ main->cut_item = gtk_menu_item_new_with_label ( _("Cut") );
+ main->copy_item = gtk_menu_item_new_with_label ( _("Copy") );
+ main->paste_item = gtk_menu_item_new_with_label ( _("Paste") );
+ main->font_item = gtk_menu_item_new_with_label ( _("Font") );
+ main->fullscreen_item = gtk_menu_item_new_with_label ( _("Full Screen") );
+ separator = gtk_separator_menu_item_new();
+ help = gtk_menu_item_new_with_label( _("Help") );
+ close = gtk_menu_item_new_with_label( _("Close") );
+
+ /* Add menu items to right menus */
+ gtk_menu_append( main_menu, main->file_item );
+ gtk_menu_append( file_menu, main->new_item );
+ gtk_menu_append( file_menu, main->open_item );
+ gtk_menu_append( file_menu, main->save_item );
+ gtk_menu_append( file_menu, main->saveas_item );
+ gtk_menu_append( main_menu, main->edit_item );
+ gtk_menu_append( edit_menu, main->cut_item );
+ gtk_menu_append( edit_menu, main->copy_item );
+ gtk_menu_append( edit_menu, main->paste_item );
+ gtk_menu_append( main_menu, main->font_item );
+ gtk_menu_append( main_menu, main->fullscreen_item );
+ gtk_menu_append( main_menu, separator );
+ gtk_menu_append( main_menu, help );
+ gtk_menu_append( main_menu, close );
+
+ /* Add submenus to the right items */
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM (main->file_item), file_menu );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM (main->edit_item), edit_menu );
+
+ /* Attach the callback functions to the activate signal */
+ g_signal_connect( G_OBJECT( main->new_item ), "activate",
+ G_CALLBACK ( callback_file_new), main );
+ g_signal_connect( G_OBJECT( main->open_item ), "activate",
+ G_CALLBACK ( callback_file_open), main );
+ g_signal_connect( G_OBJECT( main->save_item ), "activate",
+ G_CALLBACK ( callback_file_save), main );
+ g_signal_connect( G_OBJECT( main->saveas_item ), "activate",
+ G_CALLBACK ( callback_file_saveas), main );
+ g_signal_connect( G_OBJECT( main->cut_item ), "activate",
+ G_CALLBACK ( callback_edit_cut), main );
+ g_signal_connect( G_OBJECT( main->copy_item ), "activate",
+ G_CALLBACK( callback_edit_copy ), main );
+ g_signal_connect( G_OBJECT( main->paste_item ), "activate",
+ G_CALLBACK( callback_edit_paste ), main );
+ g_signal_connect( G_OBJECT( main->font_item ), "activate",
+ G_CALLBACK ( callback_font ), main );
+ g_signal_connect( G_OBJECT( main->fullscreen_item ), "activate",
+ G_CALLBACK ( callback_fullscreen ), main );
+ g_signal_connect( G_OBJECT( help ), "activate",
+ G_CALLBACK ( callback_help ), main );
+ g_signal_connect( G_OBJECT( close ), "activate", gtk_main_quit, NULL );
+
+ /* Add menu to HildonWindow */
+ hildon_window_set_menu(main->data->window, main_menu);
+
+ /* We need to show menu items */
+ gtk_widget_show_all( GTK_WIDGET( main_menu ) );
+}
+
+
+/* Create toolbar to mainview */
+static void create_toolbar ( MainView *main )
+{
+ /* Create new GTK toolbar */
+ main->toolbar = gtk_toolbar_new ();
+
+ /* Set toolbar properties */
+ gtk_toolbar_set_orientation( GTK_TOOLBAR(main->toolbar), GTK_ORIENTATION_HORIZONTAL);
+ gtk_toolbar_set_style( GTK_TOOLBAR(main->toolbar), GTK_TOOLBAR_BOTH_HORIZ);
+
+ /* Make menus and buttons to toolbar: */
+ /* Create toolitems using defined items from stock */
+ main->new_tb = gtk_tool_button_new_from_stock(GTK_STOCK_NEW);
+ main->open_tb = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN);
+ main->save_tb = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE);
+ main->saveas_tb = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE_AS);
+ main->separator_tb1 = gtk_separator_tool_item_new();
+ main->cut_tb = gtk_tool_button_new_from_stock(GTK_STOCK_CUT);
+ main->copy_tb = gtk_tool_button_new_from_stock(GTK_STOCK_COPY);
+ main->paste_tb = gtk_tool_button_new_from_stock(GTK_STOCK_PASTE);
+ main->separator_tb2 = gtk_separator_tool_item_new();
+ main->font_tb = gtk_tool_button_new_from_stock( GTK_STOCK_SELECT_FONT );
+ main->fullscreen_tb = gtk_tool_button_new_from_stock( GTK_STOCK_ZOOM_FIT );
+
+ /* Insert items to toolbar */
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->new_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->open_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->save_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->saveas_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->separator_tb1, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->cut_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->copy_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->paste_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->separator_tb2, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->font_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->fullscreen_tb, -1);
+
+ /* Connect signals to buttons */
+ g_signal_connect(G_OBJECT(main->new_tb), "clicked",
+ G_CALLBACK(callback_file_new), main);
+ g_signal_connect(G_OBJECT(main->open_tb), "clicked",
+ G_CALLBACK(callback_file_open), main);
+ g_signal_connect(G_OBJECT(main->save_tb), "clicked",
+ G_CALLBACK(callback_file_save), main);
+ g_signal_connect(G_OBJECT(main->saveas_tb), "clicked",
+ G_CALLBACK(callback_file_saveas), main);
+ g_signal_connect(G_OBJECT(main->cut_tb), "clicked",
+ G_CALLBACK(callback_edit_cut), main);
+ g_signal_connect(G_OBJECT(main->copy_tb), "clicked",
+ G_CALLBACK(callback_edit_copy), main);
+ g_signal_connect(G_OBJECT(main->paste_tb), "clicked",
+ G_CALLBACK(callback_edit_paste), main);
+ g_signal_connect(G_OBJECT(main->font_tb), "clicked",
+ G_CALLBACK(callback_font), main);
+ g_signal_connect(G_OBJECT(main->fullscreen_tb), "clicked",
+ G_CALLBACK(callback_fullscreen), main);
+
+ /* Add toolbar to the HildonWindow */
+ hildon_window_add_toolbar(main->data->window, GTK_TOOLBAR(main->toolbar));
+
+ /* Show toolbar */
+ gtk_widget_show_all (GTK_WIDGET(main->toolbar));
+ gtk_widget_show_all (GTK_WIDGET(main->data->window) );
+}
+
+/* Create the text area */
+void create_textarea( MainView *main )
+{
+ /* Scrolled window */
+ main->scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_show(main->scrolledwindow);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(main->scrolledwindow),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ /* Text view */
+ main->textview = gtk_text_view_new ();
+
+ /* Some text view settings */
+ gtk_text_view_set_editable ( GTK_TEXT_VIEW (main->textview), TRUE );
+ gtk_text_view_set_left_margin (GTK_TEXT_VIEW (main->textview), 10 );
+ gtk_text_view_set_right_margin (GTK_TEXT_VIEW (main->textview), 10 );
+
+ /* Get handle */
+ main->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (main->textview));
+
+ /* Enable Rich Text Support */
+ gtk_text_buffer_set_can_paste_rich_text ( main->buffer, TRUE );
+ gtk_text_buffer_set_rich_text_format ( main->buffer, "RTF" );
+
+ /* Put textview under scrolledwindow and show it*/
+ gtk_container_add(GTK_CONTAINER(main->scrolledwindow), main->textview);
+ gtk_widget_show(main->textview);
+
+ /* Change default font throughout the widget */
+ main->font_desc = pango_font_description_from_string ("Monospace Regular 22");
+ gtk_widget_modify_font (main->textview, main->font_desc);
+
+ /* Connect signals */
+ g_signal_connect (G_OBJECT (main->buffer), "modified-changed",
+ G_CALLBACK(callback_buffer_modified), main);
+ g_signal_connect (G_OBJECT (main->buffer), "changed",
+ G_CALLBACK(callback_buffer_modified), main);
+}
Added: trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/interface.h
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/interface.h (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/data/autotools/maemopadproject/src/ui/interface.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,107 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef INTERFACE_H
+#define INTERFACE_H
+
+#include <gtk/gtk.h>
+#include <hildon/hildon-program.h>
+#include <appdata.h>
+
+#define _(String) gettext(String)
+
+/* confirmation responses */
+#define CONFRESP_YES 1
+#define CONFRESP_NO 2
+#define CONFRESP_OK 3
+#define CONFRESP_CANCEL 4
+#define CONFRESP_ERROR 5
+
+#define MAIN_VIEW_NAME "MainView"
+
+typedef enum {
+ MAEMOPAD_NO_ERROR = 0,
+ MAEMOPAD_ERROR_INVALID_URI,
+ MAEMOPAD_ERROR_SAVE_FAILED,
+ MAEMOPAD_ERROR_OPEN_FAILED
+} MaemopadError;
+
+/* Struct to include view's information */
+typedef struct _MainView MainView;
+struct _MainView
+{
+ /* Handle to app's data */
+ AppData *data;
+
+ /* Fullscreen mode is on (TRUE) or off (FALSE) */
+ gboolean fullscreen;
+
+ /* Items for menu */
+ GtkWidget *file_item;
+ GtkWidget *new_item;
+ GtkWidget *open_item;
+ GtkWidget *save_item;
+ GtkWidget *saveas_item;
+ GtkWidget *edit_item;
+ GtkWidget *cut_item;
+ GtkWidget *copy_item;
+ GtkWidget *paste_item;
+ GtkWidget *font_item;
+ GtkWidget *fullscreen_item;
+
+ /* Toolbar */
+ GtkWidget* toolbar;
+ GtkWidget* iconw;
+ GtkToolItem* new_tb;
+ GtkToolItem* open_tb;
+ GtkToolItem* save_tb;
+ GtkToolItem* saveas_tb;
+ GtkToolItem* separator_tb1;
+ GtkToolItem* cut_tb;
+ GtkToolItem* copy_tb;
+ GtkToolItem* paste_tb;
+ GtkToolItem* separator_tb2;
+ GtkToolItem* font_tb;
+ GtkToolItem* fullscreen_tb;
+
+ /* Textview related */
+ GtkWidget* scrolledwindow; /* textview is under this widget */
+ GtkWidget* textview; /* widget that shows the text */
+ GtkTextBuffer* buffer; /* buffer that contains the text */
+ GtkClipboard* clipboard; /* clipboard for copy/paste */
+
+ PangoFontDescription* font_desc; /* font used in textview */
+
+ gboolean file_edited; /* tells is our file on view edited */
+ gchar* file_name; /* directory/file under editing */
+};
+
+/* Publics: */
+MainView* interface_main_view_new( AppData* data );
+void interface_main_view_destroy( MainView* main );
+char* interface_file_chooser( MainView* main, GtkFileChooserAction action );
+PangoFontDescription* interface_font_chooser( MainView * main );
+gint interface_save_changes_note( MainView* main );
+void interface_error( MaemopadError me, MainView *main );
+
+#endif
Added: trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal/linux/tests/noexport/TestActivator.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal/linux/tests/noexport/TestActivator.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/internal/linux/tests/noexport/TestActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,118 @@
+package org.maemo.esbox.internal.linux.tests.noexport;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TestActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.linux.tests";
+
+ // The shared instance
+ private static TestActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public TestActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static TestActivator getDefault() {
+ return plugin;
+ }
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return TestActivator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/ManualTestPackageManager.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/ManualTestPackageManager.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/ManualTestPackageManager.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.tests;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.junit.Ignore;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.core.sdk.SDKFactory;
+import org.maemo.esbox.linux.packages.core.*;
+
+import junit.framework.TestCase;
+
+/**
+ * Run this test MANUALLY to validate the package manager. This must be run in a workspace
+ * with the maemosdk plugins and with some SDK target supporting gtk.
+ * <p>
+ * It is expected to run tests in order.
+ * <p>
+ * Please remove the package 'libgtk2.0-dev' and ensure 'libgtk2.0' is installed before running this.
+ * @author eswartz
+ *
+ */
+ at Ignore("This is a manual test. REMOVE this annotation when running manually.")
+public class ManualTestPackageManager extends TestCase {
+ private static final String SDK_TARGET = "CHINOOK_ARMEL";
+
+ private static final String BASE_PACKAGE = "libgtk2.0-0";
+ private static final String TEST_PACKAGE = "libgtk2.0-dev";
+ private IPackageManager thePackageManager;
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ for (ISDKTarget sdkTarget : SDKFactory.getInstance().getAllSDKTargets()) {
+ if (!sdkTarget.getName().equals(SDK_TARGET))
+ continue;
+ IPackageManager packageManager = PackageManagerProvider.getInstance().getPackageManagerFor(sdkTarget, null);
+ if (packageManager.getSystemPackage(TEST_PACKAGE) != null
+ && packageManager.getSystemPackage(BASE_PACKAGE) != null) {
+ System.out.println("\n\n====== USING " + packageManager.getSDKTarget() + " ======\n\n");
+ thePackageManager = packageManager;
+ break;
+ }
+ }
+ assertNotNull("Could not find a target " + SDK_TARGET + " purporting to provide " + BASE_PACKAGE + " and " + TEST_PACKAGE,
+ thePackageManager);
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testPackageInstalled() throws Exception {
+ ISystemPackage pkg = thePackageManager.getSystemPackage(BASE_PACKAGE);
+ assertTrue(pkg.isInstalled());
+ assertTrue(pkg.isInstalled());
+ pkg = thePackageManager.getSystemPackage(TEST_PACKAGE);
+ assertFalse(pkg.isInstalled());
+ assertFalse(pkg.isInstalled());
+ }
+
+ public void testInstallPackage() throws Exception {
+ // no-op should work
+ ISystemPackage pkg = thePackageManager.getSystemPackage(BASE_PACKAGE);
+ IStatus status = pkg.installSystemPackage(new NullProgressMonitor());
+ assertTrue(status.toString(), status.isOK());
+
+ // actual work should work
+ pkg = thePackageManager.getSystemPackage(TEST_PACKAGE);
+ status = pkg.installSystemPackage(new NullProgressMonitor());
+ assertTrue(status.toString(), status.isOK());
+
+ }
+
+ public void testPackagesWereInstalled() throws Exception {
+ ISystemPackage pkg = thePackageManager.getSystemPackage(BASE_PACKAGE);
+ assertTrue(pkg.isInstalled());
+ assertTrue(pkg.isInstalled());
+ pkg = thePackageManager.getSystemPackage(TEST_PACKAGE);
+ assertTrue(pkg.isInstalled());
+ assertTrue(pkg.isInstalled());
+
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestAutoconfModel.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestAutoconfModel.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestAutoconfModel.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,414 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import com.nokia.cpp.internal.api.utils.core.*;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.IDocument;
+import org.junit.Test;
+import org.maemo.esbox.core.model.DocumentFactory;
+import org.maemo.esbox.core.model.IModelLoadResults;
+import org.maemo.esbox.core.tests.TestUtils;
+import org.maemo.esbox.internal.linux.tests.noexport.TestActivator;
+import org.maemo.esbox.linux.autotools.core.model.*;
+
+import java.io.File;
+import java.util.regex.Pattern;
+
+/**
+ * @author eswartz
+ *
+ */
+public class TestAutoconfModel {
+
+ private IMessage[] messages;
+
+ @Test
+ public void testCreate() {
+ IPath stockPath = new Path("/home/devel/sources/project/configure.ac");
+ IDocument document = DocumentFactory.createDocument("");
+ IAutoconfOwnedModel model = new AutoconfModelFactory().createModel(
+ stockPath,
+ document);
+ assertNotNull(model);
+ assertEquals(stockPath, model.getPath());
+ assertNull(model.getModelProvider());
+ assertEquals(document, model.getDocument());
+
+ IModelLoadResults results = model.parse();
+ assertNotNull(results);
+ assertNotNull(results.getMessages());
+ assertEquals(0, results.getMessages().length);
+ }
+
+ protected IAutoconfModel readAndParseModel(String dataAutotoolsPath, boolean expectErrors) throws Exception {
+ File file = new File(TestUtils.projectRelativeFile(TestActivator.PLUGIN_ID, "data/autotools"), dataAutotoolsPath);
+ char[] chars = FileUtils.readFileContents(file, null);
+ IPath path = new Path(file.getAbsolutePath());
+ IDocument document = DocumentFactory.createDocument(new String(chars));
+ IAutoconfOwnedModel model = new AutoconfModelFactory().createModel(
+ path,
+ document);
+ IModelLoadResults loadResults = model.parse();
+ messages = loadResults.getMessages();
+ if (!expectErrors) {
+ assertEquals(0, messages.length);
+ } else
+ assertTrue("Expected messages", messages.length > 0);
+ return model;
+ }
+
+ protected IAutoconfModel readAndParseModel(String dataAutotoolsPath) throws Exception {
+ return readAndParseModel(dataAutotoolsPath, false);
+ }
+
+ /**
+ * @param call
+ */
+ private void validateMacroCall(IAutoconfModelMacroCall call) {
+ assertNotNull(call);
+ assertNotNull(call.getName());
+ String[] arguments = call.getArguments();
+ assertNotNull(arguments);
+ for (int i = 0; i < arguments.length; i++)
+ assertNotNull(arguments[i]);
+ }
+
+ @Test
+ public void testMacros1() throws Exception {
+ IAutoconfModel model = readAndParseModel("maemopadproject/configure.ac");
+ IAutoconfModelMacroCall[] calls = model.getMacroCalls();
+ assertNotNull(calls);
+ assertEquals(37, calls.length);
+
+ for (IAutoconfModelMacroCall call : calls) {
+ validateMacroCall(call);
+ }
+ }
+
+ @Test
+ public void testMacros2() throws Exception {
+ IAutoconfModel model = readAndParseModel("maemopadproject/configure.ac");
+ IAutoconfModelMacroCall[] calls = model.getMacroCalls(
+ Pattern.compile("AC_.*"));
+ assertNotNull(calls);
+ assertEquals(31, calls.length);
+
+ for (IAutoconfModelMacroCall call : calls) {
+ validateMacroCall(call);
+ }
+
+ calls = model.getMacroCalls(
+ Pattern.compile("AC_OUTPUT"));
+ assertNotNull(calls);
+ assertEquals(1, calls.length);
+
+ // the space-separated entities are not "arguments" until it's interpreted,
+ // so we still get a single-argument catenated-looking argument
+ assertEquals("AC_OUTPUT", calls[0].getName());
+ String[] files = calls[0].getArguments();
+ assertEquals(1, files.length);
+
+ assertEquals("Makefile \\\n" +
+ " src/Makefile \\\n" +
+ " data/Makefile \\\n" +
+ " po/Makefile.in \\\n" +
+ " po/Makefile\n",
+ TextUtils.canonicalizeNewlines(files[0]));
+ }
+
+ @Test
+ public void testConfigurationFiles() throws Exception {
+ IAutoconfModel model = readAndParseModel("maemopadproject/configure.ac");
+ IAutoconfConfigurationFile[] confFiles = model.getConfigurationFiles();
+ validateExpectedMaemopadConfigurationFiles(confFiles);
+
+ model = readAndParseModel("maemopadproject/configure.ac.newstyle");
+ confFiles = model.getConfigurationFiles();
+ validateExpectedMaemopadConfigurationFiles(confFiles);
+
+ model = readAndParseModel("maemopadproject/configure.ac.noautomake");
+ confFiles = model.getConfigurationFiles();
+ validateExpectedMaemopadConfigurationFiles(confFiles);
+ }
+
+ /**
+ * Standard entries for the configure.ac* variants in this test.
+ */
+ private void validateExpectedMaemopadConfigurationFiles(IAutoconfConfigurationFile[] confFiles) {
+ assertEquals(5, confFiles.length);
+ validateSingleInputConfigurationFile(confFiles[0],
+ "Makefile.in", "Makefile");
+ validateSingleInputConfigurationFile(confFiles[1],
+ "src/Makefile.in", "src/Makefile");
+ validateSingleInputConfigurationFile(confFiles[2],
+ "data/Makefile.in", "data/Makefile");
+ validateSingleInputConfigurationFile(confFiles[3],
+ "po/Makefile.in.in", "po/Makefile.in");
+ validateSingleInputConfigurationFile(confFiles[4],
+ "po/Makefile.in", "po/Makefile");
+ }
+
+ /**
+ * @param autoconfConfigurationFile
+ * @param string
+ * @param string2
+ */
+ private void validateSingleInputConfigurationFile(
+ IAutoconfConfigurationFile confFile,
+ String input, String output) {
+ assertEquals(1, confFile.getInputs().length);
+ assertEquals(new Path(input), confFile.getInputs()[0]);
+ assertEquals(new Path(output), confFile.getOutput());
+ }
+
+ @Test
+ public void testAutomakeFiles() throws Exception {
+ IAutoconfModel model = readAndParseModel("maemopadproject/configure.ac");
+ assertTrue(model.usesAutomake());
+ IAutoconfConfigurationFile[] confFiles = model.getConfigurationFiles();
+ validateExpectedMaemopadAutomakeConfigurationFiles(model, confFiles);
+
+ model = readAndParseModel("maemopadproject/configure.ac.newstyle");
+ assertTrue(model.usesAutomake());
+ confFiles = model.getConfigurationFiles();
+ validateExpectedMaemopadAutomakeConfigurationFiles(model, confFiles);
+
+ model = readAndParseModel("maemopadproject/configure.ac.noautomake");
+ assertFalse(model.usesAutomake());
+ confFiles = model.getConfigurationFiles();
+ validateExpectedMaemopadAutomakeConfigurationFiles(model, confFiles);
+ }
+
+ /**
+ * Standard entries for the configure.ac* variants in this test.
+ * Make sure we find the *.am files.
+ */
+ private void validateExpectedMaemopadAutomakeConfigurationFiles(
+ IAutoconfModel model, IAutoconfConfigurationFile[] confFiles) {
+ assertEquals(5, confFiles.length);
+ validateSingleInputAutomakeConfigurationFile(model, confFiles[0],
+ "Makefile.am");
+ validateSingleInputAutomakeConfigurationFile(model, confFiles[1],
+ "src/Makefile.am");
+ validateSingleInputAutomakeConfigurationFile(model, confFiles[2],
+ "data/Makefile.am");
+ validateSingleInputAutomakeConfigurationFile(model, confFiles[3],
+ null);
+ validateSingleInputAutomakeConfigurationFile(model, confFiles[4],
+ null);
+ }
+
+ /**
+ * Validate that the utility locating *.am files works as expected.
+ * @param model
+ * @param confFile
+ * @param input
+ */
+ private void validateSingleInputAutomakeConfigurationFile(
+ IAutoconfModel model,
+ IAutoconfConfigurationFile confFile,
+ String input) {
+ IPath automakeInput = AutoconfAutomakeBridge.getAutomakeInput(model, confFile);
+ if (input == null)
+ assertNull(automakeInput);
+ else
+ assertEquals(new Path(input), automakeInput);
+ }
+
+ @Test
+ public void testMetadata() throws Exception {
+ IAutoconfModel model = readAndParseModel("maemopadproject/configure.ac");
+ assertEquals("maemopad", model.getPackage());
+ assertEquals("`date +%Y%m%d`", model.getVersion());
+ assertEquals("maemopad", model.getTarballName());
+ assertNull(model.getBugReportAddress());
+
+ model = readAndParseModel("maemopadproject/configure.ac.newstyle");
+ assertEquals("MaemoPad Example", model.getPackage());
+ assertEquals("`date +%Y%m%d`", model.getVersion());
+ assertEquals("maemo-integration at maemo.org", model.getBugReportAddress());
+ assertEquals("maemopad", model.getTarballName());
+
+ model = readAndParseModel("maemopadproject/configure.ac.noautomake");
+ assertEquals("maemopad", model.getPackage());
+ assertEquals("1.0", model.getVersion());
+ // it's not specified but not an error
+ assertEquals("", model.getBugReportAddress());
+ assertEquals("maemopad", model.getTarballName());
+ }
+
+ @Test
+ public void testPackageCheckModules() throws Exception {
+ IAutoconfModel model = readAndParseModel("maemopadproject/configure.ac");
+
+ validateExpectedMaemopadPackages(model, true);
+
+ }
+
+ @Test
+ public void testPackageCheckExists() throws Exception {
+ IAutoconfModel model = readAndParseModel("maemopadproject/configure.ac.check");
+
+ validateExpectedMaemopadPackages(model, false);
+
+ }
+ /**
+ * @param model
+ */
+ private void validateExpectedMaemopadPackages(IAutoconfModel model, boolean expectVariables) {
+ IAutoconfPackageCheck[] checks = model.getPackageChecks();
+ assertNotNull(checks);
+ assertEquals(3, checks.length);
+
+ IAutoconfPackageCheck check;
+ IAutoconfPackageCheckModule[] modules;
+ IAutoconfPackageCheckModule module;
+
+ check = checks[0];
+ if (expectVariables)
+ assertEquals("HILDON", check.getVariableBase());
+ else
+ assertNull(check.getVariableBase());
+ modules = check.getModules();
+ assertNotNull(modules);
+ assertEquals(3, modules.length);
+ module = modules[0];
+ assertEquals("hildon-1", module.getModuleName());
+ assertEquals(EAutoconfPackageCheckOperator.GREATER_OR_EQUAL, module.getOperator());
+ assertEquals("0.9.50", module.getVersion());
+
+ module = modules[1];
+ assertEquals("hildon-fm-2", module.getModuleName());
+ assertNull(module.getOperator());
+ assertNull(module.getVersion());
+
+ module = modules[2];
+ assertEquals("hildon-help", module.getModuleName());
+ assertNull(module.getOperator());
+ assertNull(module.getVersion());
+
+ check = checks[1];
+ if (expectVariables)
+ assertEquals("DBUS", check.getVariableBase());
+ else
+ assertNull(check.getVariableBase());
+ modules = check.getModules();
+ assertNotNull(modules);
+ assertEquals(1, modules.length);
+ module = modules[0];
+ assertEquals("dbus-glib-1", module.getModuleName());
+ assertEquals(EAutoconfPackageCheckOperator.GREATER_OR_EQUAL, module.getOperator());
+ assertEquals("0.60", module.getVersion());
+
+ check = checks[2];
+ if (expectVariables)
+ assertEquals("OSSO", check.getVariableBase());
+ else
+ assertNull(check.getVariableBase());
+ modules = check.getModules();
+ assertNotNull(modules);
+ assertEquals(4, modules.length);
+ module = modules[0];
+ assertEquals("osso-af-settings", module.getModuleName());
+ assertEquals(EAutoconfPackageCheckOperator.GREATER_OR_EQUAL, module.getOperator());
+ assertEquals("0.8.5", module.getVersion());
+
+ module = modules[1];
+ assertEquals("libosso", module.getModuleName());
+ assertEquals(EAutoconfPackageCheckOperator.GREATER_OR_EQUAL, module.getOperator());
+ assertEquals("0.9.17", module.getVersion());
+
+ module = modules[2];
+ assertEquals("gnome-vfs-2.0", module.getModuleName());
+ assertEquals(EAutoconfPackageCheckOperator.GREATER_OR_EQUAL, module.getOperator());
+ assertEquals("2.8.4.11", module.getVersion());
+
+ module = modules[3];
+ assertEquals("gnome-vfs-module-2.0", module.getModuleName());
+ assertEquals(EAutoconfPackageCheckOperator.GREATER_OR_EQUAL, module.getOperator());
+ assertEquals("2.8.4.11", module.getVersion());
+ }
+
+ @Test
+ public void testAutoconfVersionOperators() throws Exception {
+ String[] ops = { ">=", "<" ,"<=", ">", "!=", "=", "(any)" };
+ for (String op : ops) {
+ assertNotNull(EAutoconfPackageCheckOperator.fromToken(op));
+ }
+ }
+
+ @Test
+ public void testAutoconfVersionComparison() throws Exception {
+ Object[] tests =
+ {
+ "0", "0", 0,
+ "0", "1", -1,
+ "0.0", "0.1", -1,
+ "2.0", "1.2", 1,
+ "2.0.0.0", "0.9.9", 1,
+ "#$*^#@-0.1", "0.0", 1,
+ "0000100", "99", 1,
+ "2.3", "2.2a-ubuntu-1", 1,
+ "~~~2.3", "2.2a-ubuntu-1", 1,
+ "2.3a", "2.34", -1,
+ "2.34a", "2.3", 1,
+ "2", "2&&&&", -1,
+ "", "0", -1,
+ "", "", 0,
+ "2.2a-ubuntu-1", "2.2a-ubuntu-2", -1,
+ "2.2a-ubuntu-1", "2.2a-debian-2", 1,
+ };
+
+ for (int idx = 0; idx < tests.length; idx += 3) {
+ int ret = AutotoolsPackageManagerBridge.compareVersions(
+ tests[idx].toString(), tests[idx+1].toString());
+ assertEquals(tests[idx] + " ?= " + tests[idx+1], tests[idx+2], (Integer)ret);
+ ret = AutotoolsPackageManagerBridge.compareVersions(
+ tests[idx+1].toString(), tests[idx].toString());
+ assertEquals(tests[idx+1] + " ?= " + tests[idx], -(Integer)tests[idx+2], (Integer)ret);
+ }
+
+ // non-ordered cases: different types are always -1
+ int ret = AutotoolsPackageManagerBridge.compareVersions("2.3", "2.y");
+ assertEquals(-1, ret);
+ ret = AutotoolsPackageManagerBridge.compareVersions("2.y", "2.3");
+ assertEquals(-1, ret);
+ }
+
+ @Test
+ public void testBrokenPackageMacros() throws Exception {
+ /*IAutoconfModel model =*/ readAndParseModel(
+ "maemopadproject/configure.ac.badpkgmacros", true);
+
+ assertEquals(2, messages.length);
+ IMessage msg = messages[0];
+ assertEquals(IMessage.ERROR, msg.getSeverity());
+ assertEquals(7, msg.getLineNumber());
+ assertEquals(1, msg.getColumnNumber());
+ assertEquals("AutoconfModel.BadPkgCheckModulesError", msg.getMessageKey());
+
+ msg = messages[1];
+ assertEquals(IMessage.ERROR, msg.getSeverity());
+ assertEquals(10, msg.getLineNumber());
+ assertEquals(1, msg.getColumnNumber());
+ assertEquals("AutoconfModel.BadPkgCheckExistsError", msg.getMessageKey());
+
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestBuildPackageMapper.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestBuildPackageMapper.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestBuildPackageMapper.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,264 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.maemo.esbox.internal.linux.packages.core.aptpkgconfig.PackageMapper;
+import org.maemo.esbox.internal.linux.packages.core.aptpkgconfig.PackageMapper.PackageManagerMappings;
+import org.maemo.esbox.internal.linux.packages.core.aptpkgconfig.PackageMapper.PackageMapping;
+import org.maemo.esbox.linux.packages.core.EPackageCategory;
+import org.maemo.esbox.linux.packages.core.IBuildPackageMapping;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test the implementation of the class that manages package mappings (white-box).
+ * @author eswartz
+ *
+ */
+public class TestBuildPackageMapper {
+ private static PackageMapper testMapper;
+
+ @BeforeClass
+ public static void makeStockPackageManagerMappings() throws Exception {
+ // this also incidentally parses extension points,
+ // but we're not using anything built-in
+ testMapper = new PackageMapper();
+
+ PackageManagerMappings testPackageManagerMappings = new PackageManagerMappings();
+ testPackageManagerMappings.addPackageMapping("diablo",
+ "diablo-stuff-1",
+ "libdiablostuff-dev", "libdiablostuff", null);
+
+ testPackageManagerMappings.addPackageMapping(".*",
+ "gtk-2.0",
+ "libgtk2.0-dev", "libgtk2.0", "libgtk2.0-dbg");
+
+ testPackageManagerMappings.addMetapackageMapping("chinook|diablo",
+ new String[] { "gtk-2.0", "glib-2.0" },
+ "maemo-c-env", "maemo-c-device-env", "maemo-c-device-env");
+ testPackageManagerMappings.addMetapackageMapping("diablo",
+ new String[] { "diablo-stuff-1" },
+ "maemo-special-env", null, null);
+
+ testPackageManagerMappings.addPackageMapping(".*",
+ "common-lib",
+ "libcommon1", null, null);
+ testPackageManagerMappings.addPackageMapping(".*",
+ "common-lib",
+ "libcommon2", null, null);
+
+ testMapper.addPackageManagerMappings(testPackageManagerMappings);
+ }
+
+ @Test
+ public void testBasic() throws Exception {
+ PackageManagerMappings mappings = testMapper.getPackageManagerMappings();
+ assertNotNull(mappings);
+ }
+
+ @Test
+ public void testFindNormalPackages() throws Exception {
+ PackageManagerMappings mappings = testMapper.getPackageManagerMappings();
+ List<PackageMapping> matches = new ArrayList<PackageMapping>();
+ mappings.findMatches(matches, "goofy", "unknown", false);
+ assertTrue(matches.isEmpty());
+
+ // platform .* should match
+ matches.clear();
+ mappings.findMatches(matches, "goofy", "gtk-2.0", false);
+ assertEquals(1, matches.size());
+ PackageMapping packageMapping = matches.get(0);
+ assertEquals("libgtk2.0-dev", packageMapping.systemPackages.get(EPackageCategory.DEVELOPMENT));
+ assertEquals("libgtk2.0", packageMapping.systemPackages.get(EPackageCategory.RUNTIME));
+ assertEquals("libgtk2.0-dbg", packageMapping.systemPackages.get(EPackageCategory.DEBUG));
+
+ // platform diablo should match
+ matches.clear();
+ mappings.findMatches(matches, "diablo", "gtk-2.0", false);
+ assertEquals(1, matches.size());
+ packageMapping = matches.get(0);
+ assertEquals("libgtk2.0-dev", packageMapping.systemPackages.get(EPackageCategory.DEVELOPMENT));
+ assertEquals("libgtk2.0", packageMapping.systemPackages.get(EPackageCategory.RUNTIME));
+ assertEquals("libgtk2.0-dbg", packageMapping.systemPackages.get(EPackageCategory.DEBUG));
+
+ // platform diablo should match
+ matches.clear();
+ mappings.findMatches(matches, "diablo", "diablo-stuff-1", false);
+ assertEquals(1, matches.size());
+ packageMapping = matches.get(0);
+ assertEquals("libdiablostuff-dev", packageMapping.systemPackages.get(EPackageCategory.DEVELOPMENT));
+ assertEquals("libdiablostuff", packageMapping.systemPackages.get(EPackageCategory.RUNTIME));
+ assertNull(packageMapping.systemPackages.get(EPackageCategory.DEBUG));
+
+ // no platform should match
+ matches.clear();
+ mappings.findMatches(matches, "chinook", "diablo-stuff-1", false);
+ assertEquals(0, matches.size());
+
+ }
+
+ @Test
+ public void testFindMetaPackages() throws Exception {
+ PackageManagerMappings mappings = testMapper.getPackageManagerMappings();
+ List<PackageMapping> matches = new ArrayList<PackageMapping>();
+ mappings.findMatches(matches, "goofy", "unknown", true);
+ assertTrue(matches.isEmpty());
+
+ // no platform should match (diablo only)
+ matches.clear();
+ mappings.findMatches(matches, "goofy", "glib-2.0", true);
+ assertEquals(0, matches.size());
+
+ // platform diablo should match
+ matches.clear();
+ mappings.findMatches(matches, "diablo", "gtk-2.0", true);
+ assertEquals(1, matches.size());
+ PackageMapping packageMapping = matches.get(0);
+ assertEquals("maemo-c-env", packageMapping.systemPackages.get(EPackageCategory.DEVELOPMENT));
+ assertEquals("maemo-c-device-env", packageMapping.systemPackages.get(EPackageCategory.RUNTIME));
+ assertEquals("maemo-c-device-env", packageMapping.systemPackages.get(EPackageCategory.DEBUG));
+
+ // platform diablo should match
+ matches.clear();
+ mappings.findMatches(matches, "diablo", "diablo-stuff-1", true);
+ assertEquals(1, matches.size());
+ packageMapping = matches.get(0);
+ assertEquals("maemo-special-env", packageMapping.systemPackages.get(EPackageCategory.DEVELOPMENT));
+ assertNull(packageMapping.systemPackages.get(EPackageCategory.RUNTIME));
+ assertNull(packageMapping.systemPackages.get(EPackageCategory.DEBUG));
+
+ // no platform should match
+ matches.clear();
+ mappings.findMatches(matches, "chinook", "diablo-stuff-1", true);
+ assertEquals(0, matches.size());
+
+ }
+
+ @Test
+ public void testBuildPackageMappingsStrict() throws Exception {
+ IBuildPackageMapping[] matches;
+ IBuildPackageMapping packageMapping;
+ matches = testMapper.getBuildPackageMappings("goofy", "gtk-2.0", true, false);
+ assertEquals(1, matches.length);
+ packageMapping = matches[0];
+
+ assertEquals("gtk-2.0", packageMapping.getBuildPackageName());
+ assertEquals("libgtk2.0-dev", packageMapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals("libgtk2.0", packageMapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals("libgtk2.0-dbg", packageMapping.getSystemPackageName(EPackageCategory.DEBUG));
+
+ // here, we have a metapackage
+ matches = testMapper.getBuildPackageMappings("diablo", "gtk-2.0", true, false);
+ assertEquals(1, matches.length);
+ packageMapping = matches[0];
+
+ assertEquals("gtk-2.0", packageMapping.getBuildPackageName());
+ assertEquals("maemo-c-env", packageMapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals("maemo-c-device-env", packageMapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals("maemo-c-device-env", packageMapping.getSystemPackageName(EPackageCategory.DEBUG));
+
+ // no package or metapackage
+ matches = testMapper.getBuildPackageMappings("chinook", "diablo-stuff-1", true, false);
+ assertEquals(0, matches.length);
+
+ // here, we have a metapackage
+ matches = testMapper.getBuildPackageMappings("diablo", "diablo-stuff-1", true, false);
+ assertEquals(1, matches.length);
+ packageMapping = matches[0];
+
+ assertEquals("diablo-stuff-1", packageMapping.getBuildPackageName());
+ assertEquals("maemo-special-env", packageMapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals(null, packageMapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals(null, packageMapping.getSystemPackageName(EPackageCategory.DEBUG));
+
+ // here, we have a normal package
+ matches = testMapper.getBuildPackageMappings("chinook", "common-lib", true, false);
+ assertEquals(2, matches.length);
+ packageMapping = matches[0];
+
+ assertEquals("common-lib", packageMapping.getBuildPackageName());
+ assertEquals("libcommon1", packageMapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals(null, packageMapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals(null, packageMapping.getSystemPackageName(EPackageCategory.DEBUG));
+
+ packageMapping = matches[1];
+ assertEquals("common-lib", packageMapping.getBuildPackageName());
+ assertEquals("libcommon2", packageMapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals(null, packageMapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals(null, packageMapping.getSystemPackageName(EPackageCategory.DEBUG));
+
+ }
+
+ @Test
+ public void testBuildPackageMappingsLoose() throws Exception {
+ IBuildPackageMapping[] matches;
+ IBuildPackageMapping packageMapping;
+ matches = testMapper.getBuildPackageMappings("goofy", "gtk-2.0", true, true);
+ assertEquals(1, matches.length);
+ packageMapping = matches[0];
+
+ assertEquals("gtk-2.0", packageMapping.getBuildPackageName());
+ assertEquals("libgtk2.0-dev", packageMapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals("libgtk2.0", packageMapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals("libgtk2.0-dbg", packageMapping.getSystemPackageName(EPackageCategory.DEBUG));
+
+ // here, we have a metapackage
+ matches = testMapper.getBuildPackageMappings("diablo", "gtk-2.0", true, true);
+ assertEquals(1, matches.length);
+ packageMapping = matches[0];
+
+ assertEquals("gtk-2.0", packageMapping.getBuildPackageName());
+ assertEquals("maemo-c-env", packageMapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals("maemo-c-device-env", packageMapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals("maemo-c-device-env", packageMapping.getSystemPackageName(EPackageCategory.DEBUG));
+
+ // no package or metapackage
+ matches = testMapper.getBuildPackageMappings("chinook", "diablo-stuff-1", true, true);
+ assertEquals(0, matches.length);
+
+ // here, we have a metapackage
+ matches = testMapper.getBuildPackageMappings("diablo", "diablo-stuff-1", true, true);
+ assertEquals(1, matches.length);
+ packageMapping = matches[0];
+
+ assertEquals("diablo-stuff-1", packageMapping.getBuildPackageName());
+ assertEquals("maemo-special-env", packageMapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals("maemo-special-env", packageMapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals("maemo-special-env", packageMapping.getSystemPackageName(EPackageCategory.DEBUG));
+
+ // here, we have a normal package
+ matches = testMapper.getBuildPackageMappings("chinook", "common-lib", true, true);
+ assertEquals(2, matches.length);
+ packageMapping = matches[0];
+
+ assertEquals("common-lib", packageMapping.getBuildPackageName());
+ assertEquals("libcommon1", packageMapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals("libcommon1", packageMapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals("libcommon1", packageMapping.getSystemPackageName(EPackageCategory.DEBUG));
+
+ packageMapping = matches[1];
+ assertEquals("common-lib", packageMapping.getBuildPackageName());
+ assertEquals("libcommon2", packageMapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals("libcommon2", packageMapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals("libcommon2", packageMapping.getSystemPackageName(EPackageCategory.DEBUG));
+
+ }
+
+}
Added: trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestBuildPackageMapping.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestBuildPackageMapping.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestBuildPackageMapping.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.linux.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.core.sdk.SDKFactory;
+import org.maemo.esbox.linux.packages.core.*;
+
+/**
+ * Test the IPackageManager interface to package mapping (black-box).
+ * This requires a CHINOOK or DIABLO (scratchbox) SDK to be available.
+ * @author eswartz
+ *
+ */
+public class TestBuildPackageMapping {
+ private static IPackageManager pkgMgr;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ for (ISDKTarget sdkTarget : SDKFactory.getInstance().getAllSDKTargets()) {
+ if (sdkTarget.getName().matches("CHINOOK_ARMEL|DIABLO_ARMEL")) {
+ System.out.println("\n\n====== USING " + sdkTarget + " ======\n\n");
+ IPackageManager packageManager = PackageManagerProvider.getInstance().getPackageManagerFor(sdkTarget, null);
+ pkgMgr = packageManager;
+ break;
+ }
+ }
+
+ assertNotNull("Could not find a package manager for a known CHINOOK or DIABLO SDK",
+ pkgMgr);
+ }
+
+ @Test
+ public void testBasic() throws Exception {
+ if (pkgMgr == null) return;
+
+ IBuildPackageMapping[] buildPackageMappings;
+ buildPackageMappings = pkgMgr.getBuildPackageMappings(new String[0], false, false);
+ assertEquals(0, buildPackageMappings.length);
+ }
+
+ @Test
+ public void testMissingPackageLookup() throws Exception {
+ if (pkgMgr == null) return;
+ IBuildPackageMapping[] buildPackageMappings = pkgMgr.getBuildPackageMappings(new String[] { "gtk-2.0" }, false, false);
+ assertEquals(1, buildPackageMappings.length);
+ IBuildPackageMapping mapping = buildPackageMappings[0];
+ assertEquals("gtk-2.0", mapping.getBuildPackageName());
+ assertNull(mapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertNull(mapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertNull(mapping.getSystemPackageName(EPackageCategory.DEBUG));
+ }
+
+ @Test
+ public void testPackageLookup() throws Exception {
+ if (pkgMgr == null) return;
+ IBuildPackageMapping[] buildPackageMappings = pkgMgr.getBuildPackageMappings(new String[] { "gtk+-2.0" }, false, false);
+ assertEquals(1, buildPackageMappings.length);
+ IBuildPackageMapping mapping = buildPackageMappings[0];
+ assertEquals("gtk+-2.0", mapping.getBuildPackageName());
+ assertEquals("libgtk2.0-dev", mapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals("libgtk2.0-0", mapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals("libgtk2.0-0-dbg", mapping.getSystemPackageName(EPackageCategory.DEBUG));
+ }
+
+ @Test
+ public void testPackageWithMetaLookup() throws Exception {
+ if (pkgMgr == null) return;
+ IBuildPackageMapping[] buildPackageMappings = pkgMgr.getBuildPackageMappings(new String[] { "gtkmm-2.4", "glibmm-2.4" }, false, false);
+ assertEquals(2, buildPackageMappings.length);
+ IBuildPackageMapping mapping = buildPackageMappings[0];
+ assertEquals("gtkmm-2.4", mapping.getBuildPackageName());
+ assertEquals("libgtkmm-2.4-dev", mapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertTrue(mapping.getSystemPackageName(EPackageCategory.RUNTIME).matches("libgtkmm-2.4.*"));
+ assertTrue(mapping.getSystemPackageName(EPackageCategory.DEBUG).matches("libgtkmm-2.4.*-dbg"));
+
+ mapping = buildPackageMappings[1];
+ assertEquals("glibmm-2.4", mapping.getBuildPackageName());
+ assertEquals("libglibmm-2.4-dev", mapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertTrue(mapping.getSystemPackageName(EPackageCategory.RUNTIME).matches("libglibmm-2.4.*"));
+ assertTrue(mapping.getSystemPackageName(EPackageCategory.DEBUG).matches("libglibmm-2.4.*-dbg"));
+ }
+
+ @Test
+ public void testNoMetapackageLookup() throws Exception {
+ if (pkgMgr == null) return;
+ IBuildPackageMapping[] buildPackageMappings = pkgMgr.getBuildPackageMappings(new String[] { "gtk+-2.0" }, true, false);
+ assertEquals(1, buildPackageMappings.length);
+ IBuildPackageMapping mapping = buildPackageMappings[0];
+ assertEquals("gtk+-2.0", mapping.getBuildPackageName());
+ assertEquals("libgtk2.0-dev", mapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals("libgtk2.0-0", mapping.getSystemPackageName(EPackageCategory.RUNTIME));
+ assertEquals("libgtk2.0-0-dbg", mapping.getSystemPackageName(EPackageCategory.DEBUG));
+
+ }
+ @Test
+ public void testMetapackageLookup() throws Exception {
+ if (pkgMgr == null) return;
+ IBuildPackageMapping[] buildPackageMappings = pkgMgr.getBuildPackageMappings(new String[] { "gtkmm-2.4", "glibmm-2.4" }, true, false);
+ assertEquals(2, buildPackageMappings.length);
+ IBuildPackageMapping mapping = buildPackageMappings[0];
+ assertEquals("gtkmm-2.4", mapping.getBuildPackageName());
+ assertEquals("maemo-cplusplus-env", mapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals("maemo-cplusplus-device-env", mapping.getSystemPackageName(EPackageCategory.DEBUG));
+ assertEquals("maemo-cplusplus-device-env", mapping.getSystemPackageName(EPackageCategory.RUNTIME));
+
+ mapping = buildPackageMappings[1];
+ assertEquals("glibmm-2.4", mapping.getBuildPackageName());
+ assertEquals("maemo-cplusplus-env", mapping.getSystemPackageName(EPackageCategory.DEVELOPMENT));
+ assertEquals("maemo-cplusplus-device-env", mapping.getSystemPackageName(EPackageCategory.DEBUG));
+ assertEquals("maemo-cplusplus-device-env", mapping.getSystemPackageName(EPackageCategory.RUNTIME));
+
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestPkgConfigScanner.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestPkgConfigScanner.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestPkgConfigScanner.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.linux.tests;
+
+import org.junit.Test;
+import org.maemo.esbox.core.cpp.IDefine;
+import org.maemo.esbox.internal.linux.packages.core.aptpkgconfig.PkgConfigScannerEngine;
+import org.maemo.esbox.linux.packages.core.IPkgConfigScanner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+
+/**
+ * @author eswartz
+ *
+ */
+public class TestPkgConfigScanner extends TestCase {
+
+ class MyScanner implements IPkgConfigScanner {
+
+ public List<IDefine> macros = new ArrayList<IDefine>();
+ public List<String> includes = new ArrayList<String>();
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IPkgConfigScanner#handleVersion(java.lang.String)
+ */
+ public void handleVersion(String version) {
+ fail("Did not request version");
+ }
+
+ public void handleDefine(IDefine define) {
+ macros.add(define);
+ }
+
+ public void handleInclude(boolean isUserInclude, String path) {
+ includes.add(path);
+ }
+
+ }
+ @Test
+ public void testCase1() throws Exception {
+ String output = "-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include " +
+ "-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 " +
+ "-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include " +
+ "-I/usr/include/freetype2 -I/usr/include/libpng12 -lgtk-x11-2.0 " +
+ "-lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 " +
+ "-lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 \n" +
+ "";
+ MyScanner scanner = new MyScanner();
+ PkgConfigScannerEngine engine = new PkgConfigScannerEngine();
+ engine.scanPkgConfigCFlagsOutput(output, scanner);
+ assertTrue(scanner.macros.isEmpty());
+ assertEquals(9, scanner.includes.size());
+ assertEquals("/usr/include/gtk-2.0", scanner.includes.get(0));
+ assertEquals("/usr/lib/gtk-2.0/include", scanner.includes.get(1));
+ assertEquals("/usr/include/atk-1.0", scanner.includes.get(2));
+ assertEquals("/usr/include/cairo", scanner.includes.get(3));
+ assertEquals("/usr/include/pango-1.0", scanner.includes.get(4));
+ assertEquals("/usr/include/glib-2.0", scanner.includes.get(5));
+ assertEquals("/usr/lib/glib-2.0/include", scanner.includes.get(6));
+ assertEquals("/usr/include/freetype2", scanner.includes.get(7));
+ assertEquals("/usr/include/libpng12", scanner.includes.get(8));
+ }
+ @Test
+ public void testCase2() throws Exception {
+ String output = "-I /usr/include/gtk-2.0 -I /usr/lib/gtk-2.0/include " +
+ "-Dmacro -D otherMacro=3 -D anotherMacro=\"my string\" " +
+ "-I/last"+
+ "";
+ MyScanner scanner = new MyScanner();
+ PkgConfigScannerEngine engine = new PkgConfigScannerEngine();
+ engine.scanPkgConfigCFlagsOutput(output, scanner);
+ assertEquals(3, scanner.includes.size());
+ assertEquals("/usr/include/gtk-2.0", scanner.includes.get(0));
+ assertEquals("/usr/lib/gtk-2.0/include", scanner.includes.get(1));
+ assertEquals("/last", scanner.includes.get(2));
+
+ assertEquals(3, scanner.macros.size());
+ IDefine define = scanner.macros.get(0);
+ assertEquals("macro", define.getName());
+ assertNull(define.getArgumentNames());
+ assertEquals("1", define.getExpansion());
+
+ define = scanner.macros.get(1);
+ assertEquals("otherMacro", define.getName());
+ assertNull(define.getArgumentNames());
+ assertEquals("3", define.getExpansion());
+
+ define = scanner.macros.get(2);
+ assertEquals("anotherMacro", define.getName());
+ assertNull(define.getArgumentNames());
+ assertEquals("\"my string\"", define.getExpansion());
+
+
+ }
+}
Added: trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestScratchboxPackageProvider.java
===================================================================
--- trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestScratchboxPackageProvider.java (rev 0)
+++ trunk/linux/org.maemo.esbox.linux.tests/src/org/maemo/esbox/linux/tests/TestScratchboxPackageProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.linux.tests;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.core.ErrorLogger.Listener;
+import org.maemo.esbox.core.cpp.IDefine;
+
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.core.tests.core.BaseTest;
+import org.maemo.esbox.linux.packages.core.*;
+
+import java.util.List;
+
+/**
+ * If SB1 is installed, make sure its SDKs and targets
+ * are properly detected, and that it launches processes
+ * in the expected way
+ * @author eswartz
+ *
+ */
+public class TestScratchboxPackageProvider extends BaseTest {
+ private Listener logListener;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ SDKFactory factory = SDKFactory.getInstance();
+
+ List<ISDKProvider> providers = factory.getSDKProviders();
+ assertNotNull(providers);
+
+
+ logListener = new ErrorLogger.Listener() {
+
+ public void statusLogged(IStatus status) {
+ System.out.println(status);
+ }
+
+ };
+ ErrorLogger.addListener(logListener);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ ErrorLogger.removeListener(logListener);
+ super.tearDown();
+
+ }
+
+ public void testSDKTargetPackages() throws Exception {
+ int count = 3;
+ for (ISDKTarget sdkTarget : SDKFactory.getInstance().getAllSDKTargets()) {
+ IPackageManager packageManager = PackageManagerProvider.getInstance().getPackageManagerFor(sdkTarget, null);
+ _testSDKTargetPackages(packageManager);
+ if (--count == 0)
+ break;
+ }
+ }
+
+ private void _testSDKTargetPackages(IPackageManager packageManager) throws Exception {
+
+ ISystemPackage[] systemPackages = packageManager.getSystemPackages();
+ assertNotNull(systemPackages);
+ assertTrue(systemPackages.length > 100);
+
+ for (ISystemPackage systemPackage : systemPackages) {
+ validateSystemPackage(packageManager, systemPackage);
+ }
+
+ IBuildPackage[] buildPackages = packageManager.getBuildPackages();
+ assertNotNull(buildPackages);
+ assertTrue(buildPackages.length > 10);
+
+ boolean checkInfo = true;
+ int count = 1;
+ for (IBuildPackage buildPackage : buildPackages) {
+ validateBuildPackage(packageManager, buildPackage, checkInfo);
+ if (--count <= 0)
+ checkInfo = false;
+ }
+
+ // MANUAL TEST of package installation in another test
+ }
+
+ /**
+ * @param packageManager
+ * @param buildPackage
+ */
+ private void validateBuildPackage(IPackageManager packageManager,
+ IBuildPackage buildPackage, boolean checkInfo) {
+ assertNotNull(buildPackage);
+ assertNotNull(buildPackage.getName());
+
+ // this checks validity as well as lack of duplication
+ assertSame(buildPackage, packageManager.getBuildPackage(buildPackage.getName()));
+
+ // check some well-known packages to be sure we pick up the parseable stuff
+ if (buildPackage.getName().equals("gtk+-2.0")) {
+ assertTrue(buildPackage.getVersionString().startsWith("2."));
+ IPath[] systemIncludes = buildPackage.getSystemIncludes();
+ assertNotNull(systemIncludes);
+ assertTrue(systemIncludes.length > 2);
+ } else if (buildPackage.getName().equals("hildon-1")) {
+ IPath[] systemIncludes = buildPackage.getSystemIncludes();
+ assertNotNull(systemIncludes);
+ assertTrue(systemIncludes.length > 2);
+ IDefine[] defines = buildPackage.getMacros();
+ assertTrue(defines.length > 0);
+ } else if (buildPackage.getName().equals("xtrans")) {
+ IDefine[] defines = buildPackage.getMacros();
+ assertTrue(defines.length > 1);
+ } else if (checkInfo) {
+ // this takes more time on a non-local connection
+ assertNotNull(buildPackage.getVersionString());
+ assertNotNull(buildPackage.getMacros());
+ assertNotNull(buildPackage.getSystemIncludes());
+ }
+ }
+
+ /**
+ * @param systemPackage
+ */
+ private void validateSystemPackage(IPackageManager packageManager, ISystemPackage systemPackage) throws Exception {
+ assertNotNull(systemPackage);
+ assertNotNull(systemPackage.getName());
+ assertNotNull(systemPackage.getVersionString());
+ assertSame(packageManager, systemPackage.getPackageManager());
+
+ // this checks validity as well as lack of duplication
+ assertSame(systemPackage, packageManager.getSystemPackage(systemPackage.getName()));
+ }
+
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk-feature
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/maemosdk/org.maemo.esbox.maemosdk-feature/.project
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk-feature/.project (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk-feature/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.maemosdk-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk-feature/build.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk-feature/build.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk-feature/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+bin.includes = feature.xml,\
+ license.html,\
+ licenses/,\
+ TODO.txt
Added: trunk/maemosdk/org.maemo.esbox.maemosdk-feature/feature.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk-feature/feature.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk-feature/feature.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.maemo.esbox.maemosdk"
+ label="ESbox Maemo SDK Support Feature"
+ version="1.5.0.qualifier"
+ provider-name="INdT / Nokia">
+
+ <description>
+ This feature provides support for maemo SDKs using scratchbox.
+Installations of scratchbox 1 and scratchbox 2 are supported.
+
+This provides project templates for Maemo C/C++ or Python projects
+as well, though it does not require those languages' features to be installed.
+ </description>
+
+ <copyright>
+ Copyright (c) 2007-2008 INdT, (c) 2007-2008 Nokia. All rights
+reserved.
+ </copyright>
+
+ <license url="http://www.eclipse.org/legal/epl-v10.html">
+ For legal terms, see the Eclipse Public License.
+ </license>
+
+ <url>
+ <update label="Update Site for ESbox project" url="http://esbox.garage.maemo.org/update"/>
+ </url>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.maemo.esbox.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.maemosdk.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.analysis" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.expressions" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.linux.packages.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.project.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.launch" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.device.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.ui" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui.ide" version="3.4.0" match="greaterOrEqual"/>
+ </requires>
+
+ <plugin
+ id="org.maemo.esbox.maemosdk.analysis"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.maemosdk.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.maemosdk.cpp.templates"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.maemo.esbox.maemosdk.python.templates"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.maemo.esbox.maemosdk.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk-feature/license.html
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk-feature/license.html (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk-feature/license.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+<html>
+<head>
+<title>ESbox License</title>
+</head>
+
+<body>
+<h2>ESbox Software User Agreement</h2>
+<p>16<sup>th</sup> April, 2008</p>
+
+<h3>ESbox</h3>
+
+<p>ESbox is licensed under the terms of the <a href="licenses/epl-v10.html">Eclipse Public License v1.0</a>.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>ESbox has a set of open source templates to help the development of applications. Such templates are distributed
+under <a href="licenses/COPYING.LESSER">LGPL license.</a></p>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THIS CONTENT.</p>
+
+</body>
+</html>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/COPYING.LESSER
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/COPYING.LESSER (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/epl-v10.html
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/epl-v10.html (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk-feature/licenses/epl-v10.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ at font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+ at page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.analysis
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.classpath
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.classpath (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.project
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.project (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.maemosdk.analysis</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 25 14:23:13 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/META-INF/MANIFEST.MF
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/META-INF/MANIFEST.MF (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Maemo SDK Analysis Support Plug-in
+Bundle-SymbolicName: org.maemo.esbox.maemosdk.analysis;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.maemosdk.analysis.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.maemosdk.core;bundle-version="1.5.0",
+ org.maemo.esbox.maemosdk.core;bundle-version="1.5.0",
+ org.maemo.esbox.analysis;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/build.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/build.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/plugin.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/plugin.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.maemo.esbox.core.sdk.ISDKTarget"
+ class="org.maemo.esbox.internal.maemosdk.analysis.adapters.AnalysisAdapterFactory">
+ <adapter
+ type="org.maemo.esbox.analysis.adapters.IValgrindSupportAdapter">
+ </adapter>
+ <adapter
+ type="org.maemo.esbox.analysis.adapters.IOProfileSupportAdapter">
+ </adapter>
+ </factory>
+ </extension>
+
+</plugin>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/Activator.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/Activator.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.analysis;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.maemosdk.analysis";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/AnalysisAdapterFactory.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/AnalysisAdapterFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/AnalysisAdapterFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.analysis.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.maemo.esbox.analysis.adapters.IOProfileSupportAdapter;
+import org.maemo.esbox.analysis.adapters.IValgrindSupportAdapter;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+/**
+ * This factory is used to provide the valgrind and oprofile adapters for ISDKTarget.
+ * It is registered via extension point.
+ * @author eswartz
+ *
+ */
+public class AnalysisAdapterFactory implements IAdapterFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IScratchboxSDKTarget) {
+ ISDKTarget sdkTarget = (ISDKTarget) adaptableObject;
+ if (adapterType.equals(IValgrindSupportAdapter.class)) {
+ return new ValgrindSupportAdapter(sdkTarget);
+ }
+ if (adapterType.equals(IOProfileSupportAdapter.class)) {
+ return new OProfileSupportAdapter(sdkTarget);
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[] {
+ IValgrindSupportAdapter.class,
+ IOProfileSupportAdapter.class
+ };
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/OProfileSupportAdapter.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/OProfileSupportAdapter.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/OProfileSupportAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.analysis.adapters;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.analysis.adapters.IOProfileSupportAdapter;
+import org.maemo.esbox.core.machine.IDeviceMachine;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * @author eswartz
+ *
+ */
+public class OProfileSupportAdapter implements IOProfileSupportAdapter {
+
+ public OProfileSupportAdapter(ISDKTarget sdkTarget) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.analysis.adapters.IOProfileSupport#validateSupport()
+ */
+ public String validateSupport(IMachine machine) {
+ if (!(machine instanceof IDeviceMachine))
+ return "OProfile is only supported on devices.";
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.analysis.adapters.IOProfileSupport#preLaunchCheck(org.eclipse.swt.widgets.Shell)
+ */
+ public boolean preLaunchCheck(Shell shell) throws CoreException {
+ // TODO: validate the installed packages, etc.
+ return true;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/ValgrindSupportAdapter.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/ValgrindSupportAdapter.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.analysis/src/org/maemo/esbox/internal/maemosdk/analysis/adapters/ValgrindSupportAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.analysis.adapters;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.analysis.adapters.IValgrindSupportAdapter;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ValgrindSupportAdapter implements IValgrindSupportAdapter {
+
+ private final ISDKTarget sdkTarget;
+ /**
+ * @param sdkTarget
+ */
+ public ValgrindSupportAdapter(ISDKTarget sdkTarget) {
+ this.sdkTarget = sdkTarget;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.analysis.adapters.IValgrindSupport#validateSupport()
+ */
+ public String validateSupport(IMachine machine) {
+ if (sdkTarget.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_X86)) {
+ return null;
+ }
+ return "valgrind is only supported on x86 targets.";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.analysis.adapters.IValgrindSupport#preLaunchCheck(org.eclipse.swt.widgets.Shell)
+ */
+ public boolean preLaunchCheck(Shell shell) throws CoreException {
+ // TODO: verify that the correct packages are installed, ask to install, etc...
+ return true;
+ }
+
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.core
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/.classpath
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/.classpath (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/.project
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/.project (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.maemosdk.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:34:08 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Scratchbox Core Plug-in
+Bundle-SymbolicName: org.maemo.esbox.maemosdk.core;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.maemosdk.core.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.eclipse.core.expressions;bundle-version="3.4.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.maemo.esbox.device.core;bundle-version="1.5.0",
+ org.maemo.esbox.linux.packages.core;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.core.maemosdk,
+ org.maemo.esbox.core.maemosdk.platform,
+ org.maemo.esbox.internal.maemosdk.core.command;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.internal.maemosdk.core.command.scratchbox;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.internal.maemosdk.core.sdk,
+ org.maemo.esbox.internal.maemosdk.core.sdk.providers;x-friends:="org.maemo.esbox.maemosdk.tests",
+ org.maemo.esbox.maemosdk.core,
+ org.maemo.esbox.maemosdk.core.execEnv,
+ org.maemo.esbox.maemosdk.core.scratchbox,
+ org.maemo.esbox.maemosdk.core.sdk
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/build.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/build.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ conf/,\
+ schema/
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/conf/run.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/conf/run.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/conf/run.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+#/*******************************************************************************
+# * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia.
+# * All rights reserved. This program and the accompanying materials
+# * are made available under the terms of the Eclipse Public License v1.0
+# * which accompanies this distribution, and is available at
+# * http://www.eclipse.org/legal/epl-v10.html
+# *
+# * Contributors:
+# * Raul Herbster (raul at embedded.ufcg.edu.br) (UFCG) - initial API and implementation
+# * Ed Swartz (Nokia)
+# *******************************************************************************/
+
+__version=0.5
+__release=1.2
+__location=$1
+__export_list=$2
+shift
+shift
+__command="$@"
+
+if [ ! -d $__location ] ; then
+ echo "E: Directory $__location not found"
+ exit 1
+fi
+
+cd $__location
+
+# gather exports
+IFS=,; for __export in $__export_list; do
+ export $__export
+done
+IFS=" "
+
+
+# Run command
+$__command
+
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/plugin.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/plugin.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="platform" name="Platform" schema="schema/platform.exsd"/>
+ <extension-point id="maemo_sdk" name="Maemo SDK" schema="schema/maemo_sdk.exsd"/>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester namespace="org.maemo.esbox.maemosdk"
+ properties="isRemoteTarget,isEmulatorTarget,isX86Target,isARMELTarget"
+ type="org.eclipse.core.runtime.IAdaptable"
+ class="org.maemo.esbox.maemosdk.core.ScratchboxPropertyTester"
+ id="org.maemo.esbox.scratchbox.PropertyTester">
+ </propertyTester>
+
+ </extension>
+
+ <extension
+ point="org.maemo.esbox.core.sdk_provider">
+ <sdk_provider
+ class="org.maemo.esbox.internal.maemosdk.core.sdk.providers.Scratchbox1SDKProvider">
+ </sdk_provider>
+ <sdk_provider
+ class="org.maemo.esbox.internal.maemosdk.core.sdk.providers.Scratchbox2SDKProvider">
+ </sdk_provider>
+ </extension>
+
+ <extension
+ id="org.maemo.esbox.core.execution_environments"
+ name="name"
+ point="org.maemo.esbox.core.execution_environment">
+ <execution_environment
+ id="org.maemo.esbox.maemosdk.core.execution_environment.x11"
+ class="org.maemo.esbox.maemosdk.core.execEnv.X11ExecutionEnvironment">
+ </execution_environment>
+ <execution_environment
+ id="org.maemo.esbox.maemosdk.core.execution_environment.gtk"
+ class="org.maemo.esbox.maemosdk.core.execEnv.GTKExecutionEnvironment">
+ </execution_environment>
+ <execution_environment
+ id="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ class="org.maemo.esbox.maemosdk.core.execEnv.MaemoExecutionEnvironment">
+ </execution_environment>
+ </extension>
+ <extension
+ point="org.maemo.esbox.maemosdk.core.platform">
+ <platform
+ id="org.maemo.esbox.core.platform.armel"
+ name="ARMEL">
+ </platform>
+ <platform
+ id="org.maemo.esbox.core.platform.x86"
+ name="X86">
+ </platform>
+ </extension>
+ <extension
+ point="org.maemo.esbox.maemosdk.core.maemo_sdk">
+ <maemo_sdk
+ name="Gregale"
+ version="2.2">
+ </maemo_sdk>
+ <maemo_sdk
+ name="Bora"
+ version="3.2">
+ </maemo_sdk>
+ <maemo_sdk
+ name="Chinook"
+ version="4.0">
+ </maemo_sdk>
+ <maemo_sdk
+ name="Diablo"
+ version="4.1">
+ </maemo_sdk>
+ <maemo_sdk
+ name="Fremantle"
+ version="5.0">
+ </maemo_sdk>
+ </extension>
+
+ <extension
+ point="org.maemo.esbox.linux.packages.core.packageMapping">
+
+ <!-- these platforms contain convenient metapackages -->
+ <mappings
+ platformPattern="chinook|diablo|fremantle">
+ <metapackage_mapping
+ builds="hildonmm hildon-fmmm hildon-notifymm libnotify-mm pangomm-1.4 gconfmm-2.6 gdkmm-2.4 glibmm-2.4 glibmm-2.4 cairomm-1.0 gtkmm-2.4 atkmm-1.6"
+ system="maemo-cplusplus-env"
+ systemDebug="maemo-cplusplus-device-env"
+ systemRuntime="maemo-cplusplus-device-env"/>
+ </mappings>
+
+ <!-- generic upstream packages, automatically generated by utils/scan-pkgconfig.sh -->
+ <mappings
+ platformPattern="diablo">
+
+ <mapping build="fontcacheproto" system="x11proto-fontcache-dev" />
+ <mapping build="gnome-python-2.0" system="python2.5-gnome-dev" systemRuntime="python2.5-gnome" />
+ <mapping build="gtkembedmoz" system="libgtkmozembed-dev" systemRuntime="libgtkmozembed" />
+ <mapping build="libcrypto" system="libssl-dev" systemRuntime="libssl0.9.8" />
+ <mapping build="libmodest-dbus-client-1.0" system="libmodest-dbus-client-dev" systemRuntime="libmodest-dbus-client" systemDebug="libmodest-dbus-client-dbg" />
+ <mapping build="libssl" system="libssl-dev" systemRuntime="libssl0.9.8" />
+ <mapping build="microb-engine" system="microb-engine-dev" systemRuntime="microb-engine" />
+ <mapping build="microb-engine-js" system="microb-engine-dev" systemRuntime="microb-engine" />
+ <mapping build="microb-engine-nspr" system="libnspr4-dev" systemRuntime="libnspr4" />
+ <mapping build="microb-engine-nss" system="libnss3-dev" systemRuntime="libnss3" />
+ <mapping build="microb-engine-plugin" system="microb-engine-dev" systemRuntime="microb-engine" />
+ <mapping build="microb-engine-xpcom" system="microb-engine-dev" systemRuntime="microb-engine" />
+ <mapping build="openssl" system="libssl-dev" systemRuntime="libssl0.9.8" />
+ <mapping build="osso-ic" system="icd2-osso-ic-dev" />
+ <mapping build="osso-systemui-dbus" system="osso-systemui-dbus-dev" />
+ <mapping build="wpeditor" system="wpeditor-dev" systemRuntime="wpeditor0" />
+
+ </mappings>
+
+ <mappings
+ platformPattern="chinook">
+
+ <mapping build="libossoemailinterface" system="libosso-email-interface-dev" systemRuntime="libosso-email-interface" />
+ <mapping build="openssl" system="libssl-dev" systemRuntime="libssl0.9.7" />
+
+ </mappings>
+
+ <mappings
+ platformPattern=".*">
+
+ <mapping build="alsa" system="libasound2-dev" systemRuntime="libasound2" systemDebug="libasound2-dbg" />
+ <mapping build="atk" system="libatk1.0-dev" systemRuntime="libatk1.0-0" systemDebug="libatk1.0-0-dbg" />
+ <mapping build="atkmm-1.6" system="libgtkmm-2.4-dev" systemRuntime="libgtkmm-2.4-1c2a" systemDebug="libgtkmm-2.4-1c2a-dbg" />
+ <mapping build="audiofile" system="libaudiofile-dev" systemRuntime="libaudiofile0" />
+ <mapping build="bigreqsproto" system="x11proto-bigreqs-dev" />
+ <mapping build="bluez" system="libbluetooth2-dev" systemRuntime="libbluetooth2" systemDebug="libbluetooth2-dbg" />
+ <mapping build="cairo" system="libcairo2-dev" systemRuntime="libcairo2" systemDebug="libcairo2-dbg" />
+ <mapping build="cairo-ft" system="libcairo2-dev" systemRuntime="libcairo2" systemDebug="libcairo2-dbg" />
+ <mapping build="cairo-pdf" system="libcairo2-dev" systemRuntime="libcairo2" systemDebug="libcairo2-dbg" />
+ <mapping build="cairo-png" system="libcairo2-dev" systemRuntime="libcairo2" systemDebug="libcairo2-dbg" />
+ <mapping build="cairo-ps" system="libcairo2-dev" systemRuntime="libcairo2" systemDebug="libcairo2-dbg" />
+ <mapping build="cairo-svg" system="libcairo2-dev" systemRuntime="libcairo2" systemDebug="libcairo2-dbg" />
+ <mapping build="cairo-xlib" system="libcairo2-dev" systemRuntime="libcairo2" systemDebug="libcairo2-dbg" />
+ <mapping build="cairo-xlib-xrender" system="libcairo2-dev" systemRuntime="libcairo2" systemDebug="libcairo2-dbg" />
+ <mapping build="cairomm-1.0" system="libcairomm-1.0-dev" systemRuntime="libcairomm-1.0-1" systemDebug="libcairomm-1.0-1-dbg" />
+ <mapping build="clinkc" system="clinkc-dev" systemRuntime="clinkc0" />
+ <mapping build="clinkcav" system="clinkc-av-dev" systemRuntime="clinkc-av0" />
+ <mapping build="compositeproto" system="x11proto-composite-dev" />
+ <mapping build="conbtdialogs" system="conbtdialogs-dev" />
+ <mapping build="conic" system="libconic0-dev" systemRuntime="libconic0" systemDebug="libconic0-dbg" />
+ <mapping build="cst" system="libcst-dev" systemRuntime="libcst" />
+ <mapping build="damageproto" system="x11proto-damage-dev" />
+ <mapping build="dbus-1" system="libdbus-1-dev" systemRuntime="libdbus-1-3" systemDebug="libdbus-1-3-dbg" />
+ <mapping build="dbus-glib-1" system="libdbus-glib-1-dev" systemRuntime="libdbus-glib-1-2" systemDebug="libdbus-glib-1-2-dbg" />
+ <mapping build="dbus-python" system="python2.5-dbus" />
+ <mapping build="esound" system="libesd0-dev" systemRuntime="libesd0" />
+ <mapping build="evolution-data-server-1.2" system="evolution-data-server-dev" />
+ <mapping build="farsight-0.1" system="libfarsight-0.1-dev" systemRuntime="libfarsight-0.1-2" systemDebug="libfarsight-0.1-2-dbg" />
+ <mapping build="fixesproto" system="x11proto-fixes-dev" />
+ <mapping build="fontconfig" system="libfontconfig1-dev" systemRuntime="libfontconfig1" systemDebug="libfontconfig1-dbg" />
+ <mapping build="fontenc" system="libfontenc-dev" systemRuntime="libfontenc1" systemDebug="libfontenc1-dbg" />
+ <mapping build="fontsproto" system="x11proto-fonts-dev" />
+ <mapping build="freetype2" system="libfreetype6-dev" systemRuntime="libfreetype6" systemDebug="libfreetype6-dbg" />
+ <mapping build="gconf-2.0" system="libgconf2-dev" systemRuntime="libgconf2-6" systemDebug="libgconf2-6-dbg" />
+ <mapping build="gconfmm-2.6" system="libgconfmm-2.6-dev" systemRuntime="libgconfmm-2.6-1c2" systemDebug="libgconfmm-2.6-1c2-dbg" />
+ <mapping build="gdk-2.0" system="libgtk2.0-dev" systemRuntime="libgtk2.0-0" systemDebug="libgtk2.0-0-dbg" />
+ <mapping build="gdk-pixbuf-2.0" system="libgtk2.0-dev" systemRuntime="libgtk2.0-0" systemDebug="libgtk2.0-0-dbg" />
+ <mapping build="gdk-pixbuf-xlib-2.0" system="libgtk2.0-dev" systemRuntime="libgtk2.0-0" systemDebug="libgtk2.0-0-dbg" />
+ <mapping build="gdk-x11-2.0" system="libgtk2.0-dev" systemRuntime="libgtk2.0-0" systemDebug="libgtk2.0-0-dbg" />
+ <mapping build="gdkmm-2.4" system="libgtkmm-2.4-dev" systemRuntime="libgtkmm-2.4-1c2a" systemDebug="libgtkmm-2.4-1c2a-dbg" />
+ <mapping build="glib-2.0" system="libglib2.0-dev" systemRuntime="libglib2.0-0" systemDebug="libglib2.0-0-dbg" />
+ <mapping build="glibmm-2.4" system="libglibmm-2.4-dev" systemRuntime="libglibmm-2.4-1c2a" systemDebug="libglibmm-2.4-1c2a-dbg" />
+ <mapping build="gmodule-2.0" system="libglib2.0-dev" systemRuntime="libglib2.0-0" systemDebug="libglib2.0-0-dbg" />
+ <mapping build="gmodule-export-2.0" system="libglib2.0-dev" systemRuntime="libglib2.0-0" systemDebug="libglib2.0-0-dbg" />
+ <mapping build="gmodule-no-export-2.0" system="libglib2.0-dev" systemRuntime="libglib2.0-0" systemDebug="libglib2.0-0-dbg" />
+ <mapping build="gnome-vfs-2.0" system="libosso-gnomevfs2-dev" systemRuntime="libosso-gnomevfs2-common" systemDebug="libosso-gnomevfs2-common-dbg" />
+ <mapping build="gnome-vfs-module-2.0" system="libosso-gnomevfs2-dev" systemRuntime="libosso-gnomevfs2-common" systemDebug="libosso-gnomevfs2-common-dbg" />
+ <mapping build="gobject-2.0" system="libglib2.0-dev" systemRuntime="libglib2.0-0" systemDebug="libglib2.0-0-dbg" />
+ <mapping build="gst-python-0.10" system="python2.5-gstreamer-dev" systemRuntime="python2.5-gstreamer" />
+ <mapping build="gstreamer-0.10" system="libgstreamer0.10-dev" systemRuntime="libgstreamer0.10-0" systemDebug="libgstreamer0.10-0-dbg" />
+ <mapping build="gstreamer-base-0.10" system="libgstreamer0.10-dev" systemRuntime="libgstreamer0.10-0" systemDebug="libgstreamer0.10-0-dbg" />
+ <mapping build="gstreamer-controller-0.10" system="libgstreamer0.10-dev" systemRuntime="libgstreamer0.10-0" systemDebug="libgstreamer0.10-0-dbg" />
+ <mapping build="gstreamer-dataprotocol-0.10" system="libgstreamer0.10-dev" systemRuntime="libgstreamer0.10-0" systemDebug="libgstreamer0.10-0-dbg" />
+ <mapping build="gstreamer-net-0.10" system="libgstreamer0.10-dev" systemRuntime="libgstreamer0.10-0" systemDebug="libgstreamer0.10-0-dbg" />
+ <mapping build="gstreamer-plugins-base-0.10" system="libgstreamer-plugins-base0.10-dev" systemRuntime="libgstreamer-plugins-base0.10-0" systemDebug="libgstreamer-plugins-base0.10-0-dbg" />
+ <mapping build="gthread-2.0" system="libglib2.0-dev" systemRuntime="libglib2.0-0" systemDebug="libglib2.0-0-dbg" />
+ <mapping build="gtk+-2.0" system="libgtk2.0-dev" systemRuntime="libgtk2.0-0" systemDebug="libgtk2.0-0-dbg" />
+ <mapping build="gtk+-unix-print-2.0" system="libgtk2.0-dev" systemRuntime="libgtk2.0-0" systemDebug="libgtk2.0-0-dbg" />
+ <mapping build="gtk+-x11-2.0" system="libgtk2.0-dev" systemRuntime="libgtk2.0-0" systemDebug="libgtk2.0-0-dbg" />
+ <mapping build="gtkfilesystemmemory" system="osso-memory-backend" />
+ <mapping build="gtkfilesystemmemorypublic" system="osso-memory-backend" />
+ <mapping build="gtkmm-2.4" system="libgtkmm-2.4-dev" systemRuntime="libgtkmm-2.4-1c2a" systemDebug="libgtkmm-2.4-1c2a-dbg" />
+ <mapping build="gwconnect" system="osso-gwconnect-dev" />
+ <mapping build="hal" system="libhal-dev" systemRuntime="libhal1" />
+ <mapping build="hal-storage" system="libhal-storage-dev" systemRuntime="libhal-storage1" />
+ <mapping build="hildon-1" system="libhildon1-dev" systemRuntime="libhildon1" systemDebug="libhildon1-dbg" />
+ <mapping build="hildon-control-panel" system="hildon-control-panel-dev" />
+ <mapping build="hildon-desktop" system="hildon-desktop-dev" />
+ <mapping build="hildon-fm-2" system="libhildonfm2-dev" systemRuntime="libhildonfm2" systemDebug="libhildonfm2-dbg" />
+ <mapping build="hildon-fmmm" system="libhildon-fmmm-dev" systemRuntime="libhildon-fmmm" systemDebug="libhildon-fmmm-dbg" />
+ <mapping build="hildon-help" system="libhildonhelp-dev" systemRuntime="libhildonhelp0" systemDebug="libhildonhelp0-dbg" />
+ <mapping build="hildon-input-method-framework-3.0" system="hildon-input-method-framework-dev" systemRuntime="hildon-input-method-framework" systemDebug="hildon-input-method-framework-dbg" />
+ <mapping build="hildon-input-method-ui-3.0" system="libhildon-im-ui-dev" systemRuntime="libhildon-im-ui3" systemDebug="libhildon-im-ui3-dbg" />
+ <mapping build="hildon-notify" system="libhildonnotify-dev" systemRuntime="libhildonnotify0" />
+ <mapping build="hildon-notifymm" system="libhildonnotifymm-dev" systemRuntime="libhildonnotifymm" systemDebug="libhildonnotifymm-dbg" />
+ <mapping build="hildon-thumbnail" system="libhildon-thumbnail-dev" systemRuntime="libhildon-thumbnail0" systemDebug="libhildon-thumbnail0-dbg" />
+ <mapping build="hildonmm" system="libhildonmm-dev" systemRuntime="libhildonmm" systemDebug="libhildonmm-dbg" />
+ <mapping build="ice" system="libice-dev" systemRuntime="libice6" systemDebug="libice6-dbg" />
+ <mapping build="id3lib" system="libid3-3.8.3-dev" systemRuntime="libid3-3.8.3" />
+ <mapping build="inputproto" system="x11proto-input-dev" />
+ <mapping build="jinglebase-0.3" system="libjingle-dev" systemRuntime="libjinglebase0" systemDebug="libjinglebase0-dbg" />
+ <mapping build="jinglep2p-0.3" system="libjingle-dev" systemRuntime="libjinglebase0" systemDebug="libjinglebase0-dbg" />
+ <mapping build="kbproto" system="x11proto-kb-dev" />
+ <mapping build="libalarm" system="libalarm-dev" systemRuntime="libalarm0" systemDebug="libalarm0-dbg" />
+ <mapping build="libcurl" system="libcurl3-openssl-dev" />
+ <mapping build="libebook-1.2" system="libebook-dev" systemRuntime="libebook" systemDebug="libebook-dbg" />
+ <mapping build="libedata-book-1.2" system="libedata-book-dev" systemRuntime="libedata-book" systemDebug="libedata-book-dbg" />
+ <mapping build="libedataserver-1.2" system="libedataserver-dev" systemRuntime="libedataserver" systemDebug="libedataserver-dbg" />
+ <mapping build="libgalago" system="libgalago-dev" systemRuntime="libgalago3" systemDebug="libgalago3-dbg" />
+ <mapping build="libglade-2.0" system="libglade2-dev" systemRuntime="libglade2-0" />
+ <mapping build="libgtkhtml-3.8" system="gtkhtml-dev" systemRuntime="gtkhtml0" systemDebug="gtkhtml0-dbg" />
+ <mapping build="libgwobex" system="libgwobex-dev" systemRuntime="libgwobex0" systemDebug="libgwobex0-dbg" />
+ <mapping build="libhildondesktop" system="libhildondesktop-dev" systemRuntime="libhildondesktop0" systemDebug="libhildondesktop0-dbg" />
+ <mapping build="libhildonmime" system="libhildonmime-dev" systemRuntime="libhildonmime0" systemDebug="libhildonmime0-dbg" />
+ <mapping build="libhildonwm" system="libhildonwm-dev" />
+ <mapping build="libmb" system="libmatchbox-dev" systemRuntime="libmatchbox1" systemDebug="libmatchbox1-dbg" />
+ <mapping build="libmissioncontrol" system="libmissioncontrol-dev" systemRuntime="libmissioncontrol-client0" systemDebug="libmissioncontrol-client0-dbg" />
+ <mapping build="libnotify" system="libnotify-dev" systemRuntime="libnotify1" />
+ <mapping build="libnotifymm-1.0" system="libnotifymm-dev" systemRuntime="libnotifymm" systemDebug="libnotifymm-dbg" />
+ <mapping build="liboil-0.3" system="liboil0.3-dev" systemRuntime="liboil0.3" />
+ <mapping build="libosso" system="libosso-dev" systemRuntime="libosso1" systemDebug="libosso1-dbg" />
+ <mapping build="libpng" system="libpng12-dev" systemRuntime="libpng12-0" systemDebug="libpng12-0-dbg" />
+ <mapping build="libpng12" system="libpng12-dev" systemRuntime="libpng12-0" systemDebug="libpng12-0-dbg" />
+ <mapping build="libtelepathy" system="libtelepathy-dev" systemRuntime="libtelepathy2" systemDebug="libtelepathy2-dbg" />
+ <mapping build="libusb" system="libusb-dev" systemRuntime="libusb-0.1-4" />
+ <mapping build="libvolume_id" system="libvolume-id-dev" systemRuntime="libvolume-id0" />
+ <mapping build="libxml++-2.6" system="libxml++2.6-dev" systemRuntime="libxml++2.6c2a" />
+ <mapping build="libxml-2.0" system="libxml2-dev" systemRuntime="libxml2" systemDebug="libxml2-dbg" />
+ <mapping build="loudmouth-1.0" system="libloudmouth1-dev" systemRuntime="libloudmouth1-0" systemDebug="libloudmouth1-0-dbg" />
+ <mapping build="maemo-launcher-app" system="maemo-launcher-dev" />
+ <mapping build="maemo-launcher-booster" system="maemo-launcher-dev" />
+ <mapping build="maemo-version" system="maemo-version-dev" />
+ <mapping build="mce" system="mce-dev" />
+ <mapping build="mission-control" system="libmissioncontrol-dev" systemRuntime="libmissioncontrol-client0" systemDebug="libmissioncontrol-client0-dbg" />
+ <mapping build="obex-vfs-utils" system="osso-gnomevfs-extra-dev" systemRuntime="osso-gnomevfs-extra" systemDebug="osso-gnomevfs-extra-dbg" />
+ <mapping build="openobex" system="libopenobex1-dev" systemRuntime="libopenobex1" systemDebug="libopenobex1-dbg" />
+ <mapping build="osso-af-settings" system="osso-af-settings" />
+ <mapping build="osso-gpsd" system="osso-gpsd-dev" systemRuntime="osso-gpsd" systemDebug="osso-gpsd-dbg" />
+ <mapping build="pango" system="libpango1.0-dev" systemRuntime="libpango1.0-0" systemDebug="libpango1.0-0-dbg" />
+ <mapping build="pangocairo" system="libpango1.0-dev" systemRuntime="libpango1.0-0" systemDebug="libpango1.0-0-dbg" />
+ <mapping build="pangoft2" system="libpango1.0-dev" systemRuntime="libpango1.0-0" systemDebug="libpango1.0-0-dbg" />
+ <mapping build="pangomm-1.4" system="libgtkmm-2.4-dev" systemRuntime="libgtkmm-2.4-1c2a" systemDebug="libgtkmm-2.4-1c2a-dbg" />
+ <mapping build="pangox" system="libpango1.0-dev" systemRuntime="libpango1.0-0" systemDebug="libpango1.0-0-dbg" />
+ <mapping build="pangoxft" system="libpango1.0-dev" systemRuntime="libpango1.0-0" systemDebug="libpango1.0-0-dbg" />
+ <mapping build="pycairo" system="python2.5-cairo" />
+ <mapping build="pygobject-2.0" system="python2.5-gobject-dev" systemRuntime="python2.5-gobject" />
+ <mapping build="pygtk-2.0" system="python2.5-gtk2-dev" systemRuntime="python2.5-gtk2" />
+ <mapping build="randrproto" system="x11proto-randr-dev" />
+ <mapping build="recordproto" system="x11proto-record-dev" />
+ <mapping build="renderproto" system="x11proto-render-dev" />
+ <mapping build="resourceproto" system="x11proto-resource-dev" />
+ <mapping build="scrnsaverproto" system="x11proto-scrnsaver-dev" />
+ <mapping build="scw-1.0" system="libscw-dev" systemRuntime="libscw" systemDebug="libscw-dbg" />
+ <mapping build="shared-mime-info" system="shared-mime-info" />
+ <mapping build="sigc++-2.0" system="libsigc++-2.0-dev" systemRuntime="libsigc++-2.0-0c2a" />
+ <mapping build="sm" system="libsm-dev" systemRuntime="libsm6" systemDebug="libsm6-dbg" />
+ <mapping build="sofia-sip-ua" system="libsofia-sip-ua-dev" systemRuntime="libsofia-sip-ua0" systemDebug="libsofia-sip-ua0-dbg" />
+ <mapping build="sofia-sip-ua-glib" system="libsofia-sip-ua-glib-dev" systemRuntime="libsofia-sip-ua-glib3" systemDebug="libsofia-sip-ua-glib3-dbg" />
+ <mapping build="sofia-tools" system="libsofia-tools-dev" systemRuntime="libsofia-tools0" systemDebug="libsofia-tools0-dbg" />
+ <mapping build="sqlite3" system="libsqlite3-dev" systemRuntime="libsqlite3-0" />
+ <mapping build="tablet-bookmark-interface" system="tablet-browser-interface-dev" />
+ <mapping build="tablet-browser-interface" system="tablet-browser-interface-dev" />
+ <mapping build="telepathy-glib" system="libtelepathy-glib-dev" systemRuntime="libtelepathy-glib0" systemDebug="libtelepathy-glib0-dbg" />
+ <mapping build="trapproto" system="x11proto-trap-dev" />
+ <mapping build="videoproto" system="x11proto-video-dev" />
+ <mapping build="x11" system="libx11-dev" systemRuntime="libx11-6" systemDebug="libx11-6-dbg" />
+ <mapping build="xau" system="libxau-dev" systemRuntime="libxau6" systemDebug="libxau6-dbg" />
+ <mapping build="xaw7" system="libxaw7-dev" systemRuntime="libxaw7" systemDebug="libxaw7-dbg" />
+ <mapping build="xcmiscproto" system="x11proto-xcmisc-dev" />
+ <mapping build="xcomposite" system="libxcomposite-dev" systemRuntime="libxcomposite1" systemDebug="libxcomposite1-dbg" />
+ <mapping build="xcursor" system="libxcursor-dev" systemRuntime="libxcursor1" systemDebug="libxcursor1-dbg" />
+ <mapping build="xdamage" system="libxdamage-dev" systemRuntime="libxdamage1" systemDebug="libxdamage1-dbg" />
+ <mapping build="xdmcp" system="libxdmcp-dev" systemRuntime="libxdmcp6" systemDebug="libxdmcp6-dbg" />
+ <mapping build="xext" system="libxext-dev" systemRuntime="libxext6" systemDebug="libxext6-dbg" />
+ <mapping build="xextproto" system="x11proto-xext-dev" />
+ <mapping build="xf86bigfontproto" system="x11proto-xf86bigfont-dev" />
+ <mapping build="xfixes" system="libxfixes-dev" systemRuntime="libxfixes3" systemDebug="libxfixes3-dbg" />
+ <mapping build="xfont" system="libxfont-dev" systemRuntime="libxfont1" systemDebug="libxfont1-dbg" />
+ <mapping build="xft" system="libxft-dev" systemRuntime="libxft2" systemDebug="libxft2-dbg" />
+ <mapping build="xi" system="libxi-dev" systemRuntime="libxi6" systemDebug="libxi6-dbg" />
+ <mapping build="xineramaproto" system="x11proto-xinerama-dev" />
+ <mapping build="xkbfile" system="libxkbfile-dev" systemRuntime="libxkbfile1" systemDebug="libxkbfile1-dbg" />
+ <mapping build="xmu" system="libxmu-dev" systemRuntime="libxmu6" systemDebug="libxmu6-dbg" />
+ <mapping build="xmuu" system="libxmuu-dev" systemRuntime="libxmuu1" systemDebug="libxmuu1-dbg" />
+ <mapping build="xpm" system="libxpm-dev" systemRuntime="libxpm4" systemDebug="libxpm4-dbg" />
+ <mapping build="xproto" system="x11proto-core-dev" />
+ <mapping build="xrandr" system="libxrandr-dev" systemRuntime="libxrandr2" systemDebug="libxrandr2-dbg" />
+ <mapping build="xrender" system="libxrender-dev" systemRuntime="libxrender1" systemDebug="libxrender1-dbg" />
+ <mapping build="xres" system="libxres-dev" systemRuntime="libxres1" systemDebug="libxres1-dbg" />
+ <mapping build="xsp" system="libxsp-dev" systemRuntime="libxsp0" systemDebug="libxsp0-dbg" />
+ <mapping build="xspproto" system="x11proto-xsp-dev" />
+ <mapping build="xt" system="libxt-dev" systemRuntime="libxt6" systemDebug="libxt6-dbg" />
+ <mapping build="xtrans" system="xtrans-dev" />
+ <mapping build="xtst" system="libxtst-dev" systemRuntime="libxtst6" systemDebug="libxtst6-dbg" />
+ <mapping build="xv" system="libxv-dev" systemRuntime="libxv1" systemDebug="libxv1-dbg" />
+
+ </mappings>
+
+ </extension>
+ <extension
+ point="org.maemo.esbox.linux.packages.core.packageManagerProvider">
+ <packageManagerProvider
+ class="org.maemo.esbox.maemosdk.core.ScratchboxPackageManagerProvider">
+ </packageManagerProvider>
+ </extension>
+ <extension
+ point="org.maemo.esbox.project.core.oldStyleProjectPropertiesProvider">
+ <projectPropertiesProvider
+ class="org.maemo.esbox.maemosdk.core.OldStyleWorkspaceProjectPropertiesProvider">
+ </projectPropertiesProvider>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.maemo.esbox.core.sdk.ISDKTarget"
+ class="org.maemo.esbox.internal.maemosdk.core.adapters.MaemoRunStandaloneSupportAdapterFactory">
+ <adapter
+ type="org.maemo.esbox.launch.adapters.IRunStandaloneAdapter">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.maemo.esbox.core.sdk.ISDKTarget"
+ class="org.maemo.esbox.internal.maemosdk.core.adapters.MaemoGdbServerSupportAdapterFactory">
+ <adapter
+ type="org.maemo.esbox.launch.adapters.IGdbServerSupportAdapter">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.maemo.esbox.core.sdk.ISDKTarget"
+ class="org.maemo.esbox.internal.maemosdk.core.adapters.MaemoSbrshAutoconfigurationAdapterFactory">
+ <adapter
+ type="org.maemo.esbox.device.core.adapters.ISbrshAutoconfigurationAdapter">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.maemo.esbox.core.sdk.ISDKTarget"
+ class="org.maemo.esbox.internal.maemosdk.core.adapters.MaemoDefaultExecutionEnvironmentFactory">
+ <adapter
+ type="org.maemo.esbox.core.adapters.IDefaultExecutionEnvironmentAdapter">
+ </adapter>
+ </factory>
+ </extension>
+
+
+</plugin>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/schema/maemo_sdk.exsd
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/schema/maemo_sdk.exsd (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/schema/maemo_sdk.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,109 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.maemo.esbox.core" id="platform" name="Platform"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="maemo_sdk" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="maemo_sdk">
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="version" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/schema/platform.exsd
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/schema/platform.exsd (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/schema/platform.exsd 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,109 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.maemo.esbox.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.maemo.esbox.core" id="platform" name="Platform"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="platform" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="platform">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/MaemoSDKEngine.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/MaemoSDKEngine.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/MaemoSDKEngine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.maemosdk;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+
+/**
+ * Engine to manipulate information about Maemo SDK.
+ */
+public class MaemoSDKEngine {
+
+ public static String MAEMOSDK_EXTENSION_ID = Activator.PLUGIN_ID + ".maemo_sdk";
+ public static String MAEMOSDK_VERSION = "version";
+ public static String MAEMOSDK_NAME = "name";
+ private static MaemoSDKEngine singleton = null;
+
+ /* singleton instance */
+ private List<MaemoSDKInfo> maemoSDKSList;
+
+ /**
+ * Private constructor.
+ */
+ private MaemoSDKEngine() {
+ maemoSDKSList = new ArrayList<MaemoSDKInfo>();
+ initializeMaemoSDKList();
+ }
+
+ /**
+ * Return the singleton instance of this engine.
+ * @return the singleton instance of this engine.
+ */
+ public static synchronized MaemoSDKEngine getInstance() {
+ if (singleton == null)
+ singleton = new MaemoSDKEngine();
+ return singleton;
+ }
+
+ /**
+ * Initialize the list of defined Maemo SDKs. Such SDKs are described
+ * by plug-ins extension point org.maemo.esbox.ui.maemo_sdk
+ */
+ private void initializeMaemoSDKList() {
+ String maemoSDKVersion = null;
+ String maemoSDKName = null;
+
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(MAEMOSDK_EXTENSION_ID).getExtensions();
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+ maemoSDKVersion = config.getAttribute(MAEMOSDK_VERSION);
+ maemoSDKName = config.getAttribute(MAEMOSDK_NAME);
+
+ maemoSDKSList.add(new MaemoSDKInfo(maemoSDKVersion,maemoSDKName));
+ }
+ }
+ }
+
+ /**
+ * Return the list of subscribed Maemo SDKs.
+ * @return the list of subscribed Maemo SDKs.
+ */
+ public List<MaemoSDKInfo> getMaemoSDKS() {
+ return maemoSDKSList;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/MaemoSDKInfo.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/MaemoSDKInfo.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/MaemoSDKInfo.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.maemosdk;
+
+
+/**
+ * Class that contains information about an Maemo SDK.
+ */
+public class MaemoSDKInfo {
+
+ private String version;
+ private String name;
+
+ /**
+ * Constructor.
+ * @param version the version of Maemo.
+ * @param name the name of SDK version.
+ */
+ public MaemoSDKInfo(String version, String name) {
+ this.version = version;
+ this.name = name;
+ }
+
+ /**
+ * Return the version of Maemo SDK.
+ * @return the version of Maemo SDK.
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * The name of Maemo SDK.
+ * @return the name of Maemo SDK.
+ */
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((version == null) ? 0 : version.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final MaemoSDKInfo other = (MaemoSDKInfo) obj;
+ if (version == null) {
+ if (other.version != null)
+ return false;
+ } else if (!version.equals(other.version))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return getVersion() + " (" + getName() + ")";
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/platform/PlatformEngine.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/platform/PlatformEngine.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/platform/PlatformEngine.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.maemosdk.platform;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+
+/**
+ * Engine to manipulate information about platforms supported by Maemo.
+ */
+public class PlatformEngine {
+
+ public static String PLATFORMS_EXTENSION_ID = Activator.PLUGIN_ID + ".platform";
+ public static String PLATFORM_ID = "id";
+ public static String PLATFORM_NAME = "name";
+
+ /* singleton instance */
+ private static PlatformEngine singleton = null;
+
+ private List<PlatformInfo> platformList;
+
+ /**
+ * Private constructor.
+ */
+ private PlatformEngine() {
+ platformList = new ArrayList<PlatformInfo>();
+ initializePlatformInfoList();
+ }
+
+ /**
+ * Return the singleton instance of this engine.
+ * @return the singleton instance of this engine.
+ */
+ public static synchronized PlatformEngine getInstance() {
+ if (singleton == null)
+ singleton = new PlatformEngine();
+ return singleton;
+ }
+
+ /**
+ * Return the list of subscribed platforms supported by Maemo.
+ * @return the list of subscribed platforms supported by Maemo.
+ */
+ public List<PlatformInfo> getPlatforms() {
+ return platformList;
+ }
+
+ /**
+ * Initialize the list of defined Maemo SDKs. Such SDKs are described
+ * by plug-ins extension point org.maemo.esbox.ui.platform
+ **/
+ private void initializePlatformInfoList() {
+ String platformId = null;
+ String platformName = null;
+
+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(PLATFORMS_EXTENSION_ID).getExtensions();
+ for(int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for(int j=0; j<configElements.length; j++) {
+ IConfigurationElement config = configElements[j];
+ platformId = config.getAttribute(PLATFORM_ID);
+ platformName = config.getAttribute(PLATFORM_NAME);
+
+ platformList.add(new PlatformInfo(platformId,platformName));
+ }
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/platform/PlatformInfo.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/platform/PlatformInfo.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/core/maemosdk/platform/PlatformInfo.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.core.maemosdk.platform;
+
+
+/**
+ * Contains information about platforms supported by Maemo.
+ */
+public class PlatformInfo {
+
+ private String id;
+
+ private String name;
+
+ /**
+ * Constructor
+ * @param id the id of platform.
+ * @param name the name of platform.
+ */
+ public PlatformInfo(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ /**
+ * Return the id of platform.
+ * @return the id of platform.
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Return the name of platform.
+ * @return the name of platoform.
+ */
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final PlatformInfo other = (PlatformInfo) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/Activator.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/Activator.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,119 @@
+package org.maemo.esbox.internal.maemosdk.core;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.maemosdk.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoDefaultExecutionEnvironmentAdapter.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoDefaultExecutionEnvironmentAdapter.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoDefaultExecutionEnvironmentAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.core.adapters;
+
+import org.eclipse.core.resources.IProject;
+import org.maemo.esbox.core.adapters.IDefaultExecutionEnvironmentAdapter;
+import org.maemo.esbox.core.execEnv.ExecutionEnvironmentFactory;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.maemosdk.core.execEnv.MaemoExecutionEnvironment;
+
+/**
+ * Implementation of default execution environment adapter
+ * @author eswartz
+ *
+ */
+public class MaemoDefaultExecutionEnvironmentAdapter implements IDefaultExecutionEnvironmentAdapter {
+ final ISDKTarget sdkTarget;
+
+ public MaemoDefaultExecutionEnvironmentAdapter(ISDKTarget sdkTarget) {
+ this.sdkTarget = sdkTarget;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.adapters.IDefaultExecutionEnvironmentAdapter#getDefaultExecutionEnvironment(org.eclipse.core.resources.IProject)
+ */
+ public IExecutionEnvironment getDefaultExecutionEnvironment(IProject project) {
+ // TODO: more intelligent check
+ return ExecutionEnvironmentFactory.getInstance().findExecutionEnvironment(MaemoExecutionEnvironment.ID);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoDefaultExecutionEnvironmentFactory.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoDefaultExecutionEnvironmentFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoDefaultExecutionEnvironmentFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.core.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.maemo.esbox.core.adapters.IDefaultExecutionEnvironmentAdapter;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * This factory ties "default execution environment" support into an SDK target
+ * @author eswartz
+ *
+ */
+public class MaemoDefaultExecutionEnvironmentFactory implements IAdapterFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adapterType.equals(IDefaultExecutionEnvironmentAdapter.class)) {
+ if (adaptableObject instanceof ISDKTarget) {
+ ISDKTarget sdkTarget = (ISDKTarget) adaptableObject;
+ return new MaemoDefaultExecutionEnvironmentAdapter(sdkTarget);
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[] { IDefaultExecutionEnvironmentAdapter.class };
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoGdbServerSupportAdapter.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoGdbServerSupportAdapter.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoGdbServerSupportAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.core.adapters;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.launch.adapters.IGdbServerSupportAdapter;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+import java.text.MessageFormat;
+
+/**
+ * Maemo implementation, which takes care of sb1 vs. sb2 differences
+ * @author eswartz
+ *
+ */
+public class MaemoGdbServerSupportAdapter implements IGdbServerSupportAdapter {
+
+ private final ISDKTarget sdkTarget;
+
+ public MaemoGdbServerSupportAdapter(ISDKTarget sdkTarget) {
+ this.sdkTarget = sdkTarget;
+ }
+
+ public String getGDBServerCommandPattern() {
+
+ String architecture = IScratchboxSDKTarget.ARCHITECTURE_UNKNOWN;
+
+ if (sdkTarget.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL)) {
+ architecture = IScratchboxSDKTarget.ARCHITECTURE_ARMEL;
+ }
+ else {
+ architecture = IScratchboxSDKTarget.ARCHITECTURE_X86;
+ }
+ try {
+ String commandPattern = ScratchboxFacade.getInstance().getGdbQemuCommandPattern(sdkTarget, architecture);
+ return commandPattern;
+ } catch (ESboxException e) {
+ String msg = MessageFormat.format(
+ "Cannot determine gdb server command pattern for ''{0}''",
+ sdkTarget.getName());
+ Activator.getErrorLogger().logError( msg, e);
+ return "<<unknown gdb server command pattern>>";
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoGdbServerSupportAdapterFactory.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoGdbServerSupportAdapterFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoGdbServerSupportAdapterFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.core.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.launch.adapters.IGdbServerSupportAdapter;
+
+/**
+ * @author eswartz
+ *
+ */
+public class MaemoGdbServerSupportAdapterFactory implements IAdapterFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof ISDKTarget) {
+ if (adapterType.equals(IGdbServerSupportAdapter.class)) {
+ return new MaemoGdbServerSupportAdapter((ISDKTarget) adaptableObject);
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[] { IGdbServerSupportAdapter.class };
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoRunStandaloneAdapter.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoRunStandaloneAdapter.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoRunStandaloneAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.core.adapters;
+
+import org.maemo.esbox.core.process.ProcessLauncherParameters;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.launch.adapters.IRunStandaloneAdapter;
+
+/**
+ * Implementation of "run standalone" support for maemo SDKs.
+ * @author eswartz
+ *
+ */
+public class MaemoRunStandaloneAdapter implements IRunStandaloneAdapter {
+
+
+ /**
+ *
+ */
+ public MaemoRunStandaloneAdapter(ISDKTarget sdkTarget) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.adapters.IRunStandaloneSupport#getDefault()
+ */
+ public boolean getDefault() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.adapters.IRunStandaloneSupport#getLabelText()
+ */
+ public String getLabelText() {
+ return "Run with \"run-standalone.sh\" script";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.adapters.IRunStandaloneSupport#getTooltipText()
+ */
+ public String getTooltipText() {
+ return "When enabled, the application is launched with the appropriate environment so that it will behave as if it were installed.";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.adapters.IRunStandaloneSupport#updateLaunch(org.maemo.esbox.core.process.ProcessLauncherParameters, boolean)
+ */
+ public void updateLaunch(ProcessLauncherParameters parameters,
+ boolean isRunStandalone) {
+ if (isRunStandalone) {
+ parameters.getCommandLine().add(0, "run-standalone.sh");
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoRunStandaloneSupportAdapterFactory.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoRunStandaloneSupportAdapterFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoRunStandaloneSupportAdapterFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.core.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.launch.adapters.IRunStandaloneAdapter;
+
+/**
+ * This factory ties "run standalone" support into an SDK target
+ * @author eswartz
+ *
+ */
+public class MaemoRunStandaloneSupportAdapterFactory implements IAdapterFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adapterType.equals(IRunStandaloneAdapter.class)) {
+ if (adaptableObject instanceof ISDKTarget) {
+ ISDKTarget sdkTarget = (ISDKTarget) adaptableObject;
+ if (sdkTarget.getPlatform().getName().toLowerCase().matches("gregale|bora|chinook|diablo|fremantle")) {
+ return new MaemoRunStandaloneAdapter(sdkTarget);
+ }
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[] { IRunStandaloneAdapter.class };
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoSbrshAutoconfigurationAdapter.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoSbrshAutoconfigurationAdapter.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoSbrshAutoconfigurationAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.core.adapters;
+
+import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.device.core.adapters.ISbrshAutoconfigurationAdapter;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+/**
+ * Implementation of SBRSH autoconfiguration support for maemo SDKs.
+ * @author eswartz
+ *
+ */
+public class MaemoSbrshAutoconfigurationAdapter implements ISbrshAutoconfigurationAdapter {
+ private final ISDKTarget sdkTarget;
+
+ public MaemoSbrshAutoconfigurationAdapter(ISDKTarget sdkTarget) {
+ this.sdkTarget = sdkTarget;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.device.core.adapters.ISbrshAutoconfigurationAdapter#getDefaultConfigurationTemplate()
+ */
+ public String getDefaultConfigurationTemplate() {
+ String sbrshHeader =
+ "AutoTarget ${TARGET}:${TARGET_PORT} \n";
+ String rootstrapLine =
+ "\t ssh ${USER}@${HOST}:${ROOTSTRAP_PATH} / rw,nonempty,allow_other,port=${HOST_PORT}\n";
+ String stdMounts =
+ "\t ssh ${USER}@${HOST}:${HOST_PROJECT_PATH} ${TARGET_PROJECT_PATH} rw,nonempty,allow_other,port=${HOST_PORT}\n" +
+ "\t bind /tmp /tmp \n" +
+ "\t bind /dev /dev \n" +
+ "\t bind /dev/pts /dev/pts \n" +
+ "\t bind /proc /proc \n" +
+ "\t bind /sys /sys \n" +
+ "\t bind /var /var \n"
+ ;
+
+ if (sdkTarget instanceof IScratchboxSDKTarget) {
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("ROOTSTRAP_PATH", ((IScratchboxSDKTarget) sdkTarget).getRootstrapPath().toPortableString());
+ rootstrapLine = substitutor.substitute(rootstrapLine);
+ } else {
+ rootstrapLine = "";
+ }
+
+ return sbrshHeader + rootstrapLine + stdMounts;
+ }
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoSbrshAutoconfigurationAdapterFactory.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoSbrshAutoconfigurationAdapterFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/adapters/MaemoSbrshAutoconfigurationAdapterFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.core.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.device.core.adapters.ISbrshAutoconfigurationAdapter;
+import org.maemo.esbox.launch.adapters.IRunStandaloneAdapter;
+
+/**
+ * This factory ties "run standalone" support into an SDK target
+ * @author eswartz
+ *
+ */
+public class MaemoSbrshAutoconfigurationAdapterFactory implements IAdapterFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adapterType.equals(ISbrshAutoconfigurationAdapter.class)) {
+ if (adaptableObject instanceof ISDKTarget) {
+ ISDKTarget sdkTarget = (ISDKTarget) adaptableObject;
+ if (sdkTarget.getPlatform().getName().toLowerCase().matches("gregale|bora|chinook|diablo|fremantle")) {
+ return new MaemoSbrshAutoconfigurationAdapter(sdkTarget);
+ }
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[] { IRunStandaloneAdapter.class };
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command;
+
+
+import org.maemo.esbox.core.ESboxException;
+
+import java.util.List;
+
+/**
+ * ICommand type corresponds to a general command to be executed inside
+ * Scratchbox.
+ */
+public interface ICommand {
+
+ /**
+ * Execute the command.
+ * @param param
+ * the parameters used for the command.
+ * @return the result of command.
+ * @throws ESboxException TODO
+ */
+ public Object performCommand(List<String> params) throws ESboxException;
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommandAbstractor.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommandAbstractor.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/ICommandAbstractor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command;
+
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+
+/**
+ * This interface is used to abstract the way an ICommand is constructed
+ * and launched, and the means by which it gets the values to substitute into
+ * commands. It may, for instance, either be run in the context of an ISDKTarget,
+ * ISDK, or run natively. Similarly, it may be controlled entirely by unit tests.
+ *
+ * @author eswartz
+ *
+ */
+public interface ICommandAbstractor {
+
+ /**
+ * Read a preference for the implicit category of the abstractor.
+ * @param key the key to search
+ * @return preference value or "" if undefined
+ */
+ String getPreferenceValue(ESboxPreferenceConstants key);
+
+ /**
+ * Get the factory for creating process launchers to run programs in the context of the SDK.
+ * @return the process launcher factory, never <code>null</code>
+ */
+ IProcessLauncherFactory getProcessLauncherFactory();
+
+ /**
+ * Get the file system access for the filesystem used by the command
+ * @return IFilesystemAccess, never <code>null</code>
+ */
+ IFileSystemAccess getFileSystemAccess();
+}
\ No newline at end of file
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateMaemoRootstrapSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateMaemoRootstrapSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateMaemoRootstrapSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.core.*;
+
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.*;
+
+/**
+ * Creates a new rootstrap for a target, if it does not exist.
+ * This command wraps the callback to service:
+ * <p>
+ * maemo-rootstrap [--force] install <target>
+ *
+ */
+public class CreateMaemoRootstrapSb2Command extends MaemoRootstrapSb2Command {
+
+ private ISDK sdk;
+ private IProgressMonitor monitor;
+
+ public CreateMaemoRootstrapSb2Command(ISDK sdk, ICommandAbstractor commandAbstractor, IProgressMonitor monitor) {
+ super(commandAbstractor);
+ this.sdk = sdk;
+ this.monitor = monitor;
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return param.size() == 3;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Boolean performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetName = param.get(0);
+ String useHostToolsFlag = param.get(1);
+ String forceFlag = param.get(2);
+
+ List<String> params = new ArrayList<String>();
+ if (useHostToolsFlag.equals(Boolean.TRUE.toString())) {
+ params.add(commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_MAEMO_ROOTSTRAP_HOST_TOOLS_OPT));
+ }
+ if (forceFlag.equals(Boolean.TRUE.toString())) {
+ params.add(commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_MAEMO_ROOTSTRAP_FORCE_OPT));
+ }
+ params.add(commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_MAEMO_ROOTSTRAP_INSTALL_ACT));
+ params.add(targetName);
+
+ Properties env = commandAbstractor.getProcessLauncherFactory().getStandardEnvironment();
+ env = ProcessLauncherUtils.defineProxyVariables(env);
+
+ setMonitorAndConsole(
+ monitor,
+ CorePlugin.getDefault().getConsole(true, null, "Installing rootstrap " + targetName));
+ doPerformCommand(params, env, 0);
+
+ sdk.refresh();
+
+ return true;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+
+import java.util.List;
+
+/**
+ * Creates a new target, if it does not exist.
+ * This command wraps the callback to service sb-conf setup [<TARGET>]
+ * [--compiler=<COMPILER>]
+ * [--devkits=<LIST>]
+ * [--cputransp=<METHOD>]
+ * [--force]
+ *
+ */
+public class CreateTargetCommand extends ScratchboxCommand {
+
+
+ private ISDK sdk;
+
+ public CreateTargetCommand(ISDK sdk, ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ this.sdk = sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetName = param.get(0);
+ String compilerName = param.get(1);
+ String devkitsNames = param.get(2);
+ String cputranspName = param.get(3);
+
+ String setupTargetAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SETUP_ACT);
+
+ String[] setupActionOptionsReplaced = this.replaceActions(targetName,
+ compilerName, devkitsNames, cputranspName);
+ String setupTargetCommand = this.replaceScratchboxConfigCommand(
+ setupTargetAction, setupActionOptionsReplaced);
+
+ Process process = createProcess(setupTargetCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ sdk.refresh();
+
+ return true;
+ }
+
+ /**
+ * Replace the options of action SETUP. The options of SETUP action are
+ * different from the other ones, so this method replaces the variables
+ * properly.
+ *
+ * @param targetName
+ * the name of the target.
+ *
+ * @param compiler
+ * the compiler name of the target.
+ * @param devkits
+ * the devkits of the target.
+ * @param cputransp
+ * the cputransp method of the target.
+ * @return an array of String with the options already modified with the
+ * options.
+ */
+ protected String[] replaceActions(String targetName, String compiler,
+ String devkits, String cputransp) {
+ String[] setupActions = new String[4];
+ setupActions[0] = targetName;
+ setupActions[1] = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SETUP_OPT_COMPILER);
+ setupActions[2] = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SETUP_OPT_DEVKITS);
+ setupActions[3] = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SETUP_OPT_CPUTRANSP);
+
+ setupActions[1] = setupActions[1].replaceAll("\\$\\{COMPILER\\}",
+ compiler);
+ setupActions[2] = setupActions[2].replaceAll("\\$\\{LIST\\}", devkits);
+ setupActions[3] = setupActions[3].replaceAll("\\$\\{METHOD\\}",
+ cputransp);
+
+ return setupActions;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 4;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/CreateTargetSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+
+import java.util.List;
+
+/**
+ * Creates a new target, if it does not exist.
+ * This command wraps the callback to service:
+ * <p>
+ * sb2-init {flags} [targetname] [compiler]
+ *
+ */
+public class CreateTargetSb2Command extends ScratchboxCommand {
+
+
+ private ISDK sdk;
+
+ public CreateTargetSb2Command(ISDK sdk, ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 2);
+ this.sdk = sdk;
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return param.size() >= 3;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetName = param.get(0);
+ String compilerName = param.get(1);
+ String cpuTransp = param.get(2);
+
+ // remaining arguments are flags
+ String pattern = commandAbstractor.getPreferenceValue(ESboxPreferenceConstants.SB2_INIT_COMMAND);
+
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("TARGET", targetName);
+ substitutor.define("COMPILER", compilerName);
+
+ String options = "";
+ if (cpuTransp != null && cpuTransp.length() > 0) {
+ options += "-c " + cpuTransp;
+ }
+ substitutor.define("OPTIONS", options);
+
+ pattern = substitutor.substitute(pattern);
+
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine(pattern);
+
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ commandAbstractor.getProcessLauncherFactory(),
+ null,
+ cmdLine);
+
+ Process process = processLauncher.createProcess();
+
+ processLauncher.redirectToConsole(true, null, "Installing scratchbox2 target " + targetName);
+
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ Activator.getErrorLogger().logError("Target installation aborted", e);
+ }
+
+ sdk.refresh();
+
+ return true;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 3;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+
+import java.util.List;
+
+/**
+ * Get the current Scratchbox 1 target.
+ * This command wraps the callback to service sb-conf current
+ */
+public class GetCurrentTargetCommand extends ScratchboxCommand {
+
+ private final IScratchboxSDK sdk;
+
+ public GetCurrentTargetCommand(ICommandAbstractor commandAbstractor, IScratchboxSDK sdk) {
+ super(commandAbstractor, 1);
+ this.sdk = sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public String performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ if (sdk.getCachedCurrentTarget() != null)
+ return sdk.getCachedCurrentTarget();
+
+ String currentTargetAction = commandAbstractor.getPreferenceValue(ESboxPreferenceConstants.SB1_CURRENT_ACT);
+ String currentTargetCommand = this
+ .replaceScratchboxConfigCommand(currentTargetAction);
+
+ Process process = createProcess(currentTargetCommand, null);
+
+ String currentTarget = getInputFromProcessAndWait(process, true, 0);
+
+ sdk.setCachedCurrentTarget(currentTarget);
+ return currentTarget;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetCurrentTargetSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.io.*;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Get the current Scratchgox 2 target.
+ * There is no command to do this, so read $HOME/.scratchbox2/config
+ */
+public class GetCurrentTargetSb2Command extends ScratchboxCommand {
+
+ public GetCurrentTargetSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 2);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public String performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ IFileStore config = commandAbstractor.getFileSystemAccess().getFileStore(
+ new Path("home").append(commandAbstractor.getPreferenceValue(ESboxPreferenceConstants.USER))
+ .append(".scratchbox2")
+ .append("config"));
+
+ InputStream is = null;
+ try {
+ is = config.openInputStream(EFS.NONE, null);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+ Pattern varPattern = Pattern.compile("\\s*DEFAULT_TARGET\\s*=\\s*(\\S+)\\s*");
+ String line;
+ while ((line = reader.readLine()) != null) {
+ Matcher matcher = varPattern.matcher(line.trim());
+ if (matcher.matches()) {
+ return matcher.group(1);
+ }
+ }
+
+ return null;
+ } catch (IOException e) {
+ throw new ScratchboxException("Cannot read target from " + config + ": " + e.getMessage());
+ } catch (CoreException e) {
+ throw new ScratchboxException("Cannot read target from " + config + ": " + e.getMessage());
+ } finally {
+ Policy.close(is);
+ }
+
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetGdbQemuCommandPatternCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetGdbQemuCommandPatternCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetGdbQemuCommandPatternCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.eclipse.core.runtime.IStatus;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+import org.osgi.framework.Version;
+
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Get the command pattern for launching qemu with the debugger
+ * @author eswartz
+ *
+ */
+public class GetGdbQemuCommandPatternCommand extends ScratchboxCommand {
+
+ private ISDKTarget sdkTarget;
+
+ public GetGdbQemuCommandPatternCommand(ISDKTarget sdkTarget, ICommandAbstractor commandAbstractor, int sboxVersion) {
+ super(commandAbstractor, sboxVersion);
+ this.sdkTarget = sdkTarget;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public String performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String commandPattern = null;
+
+ String architecture = param.get(0);
+
+ if (architecture.equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL))
+ {
+ if (sdkTarget instanceof IScratchbox1SDKTarget) {
+ // scratchbox often misconfigures the softlinks, so explicitly launch the qemu configured for the target
+ String qemu = getConfiguredQemu();
+ if (qemu == null) {
+ // fallback
+ Activator.getErrorLogger().log(IStatus.WARNING,
+ "Target " + sdkTarget + " does not seem to use qemu, so assuming qemu-arm for debugging", null);
+ qemu = "qemu-arm";
+ }
+
+ // get the version
+ Version version = null;
+ Pattern versionPattern = Pattern.compile("qemu-.*((\\d+)\\.(\\d+)\\.(\\d+))-.*");
+ Matcher matcher = versionPattern.matcher(qemu);
+ if (matcher.matches()) {
+ version = new Version(matcher.group(1));
+ }
+
+ // For ARM emulator debug, use "qemu-arm" command.
+ commandPattern = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SB1_GDB_REMOTE_QEMU);
+
+ if (version != null && version.compareTo(new Version(0, 8, 0)) < 0) {
+ // hide ${PORT}, which doesn't exist in 0.7.x
+ commandPattern = commandPattern.replace("${PORT}", "");
+ //Activator.getErrorLogger().log(IStatus.WARNING,
+ // "The version of qemu-arm in use (" + version + ") is too old -- debugging may not work. Check your softlinks in /scratchbox/devkits/cputransp/bin/.", null);
+ }
+
+ commandPattern = commandPattern.replace("${QEMU}", qemu);
+
+ } else if (sdkTarget instanceof IScratchbox2SDKTarget) {
+ // we think this always uses a new enough version, so keep ${PORT}
+ commandPattern = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SB2_GDB_REMOTE_QEMU);
+ } else {
+ throw new ScratchboxException("unknown scratchbox version");
+ }
+ }
+ else {
+ // The others, just standard "gdbserver" command.
+ commandPattern = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SBOX_GDB_REMOTE);
+ }
+
+ return commandPattern;
+ }
+
+ /**
+ * Find what qemu is configured for this target.
+ * @return qemu name, or <code>null</code> if not using qemu
+ */
+ private String getConfiguredQemu() throws ESboxException {
+
+ // we use sb-select show <target> to find out if qemu is even used for this target.
+ String showAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SHOW_ACT);
+ String showInfoCommandString = this
+ .replaceScratchboxConfigCommand(showAction,
+ new String[] { sdkTarget.getName() });
+
+ Process process = createProcess(showInfoCommandString, null);
+
+ List<String> lines = getLineInputFromProcessAndWait(process, true, 0);
+
+ // see if this is the line describing CPU transparency
+ Pattern namePattern = Pattern.compile(".*/(qemu-\\S+).*");
+ for (String line : lines) {
+ Matcher matcher = namePattern.matcher(line);
+ if (matcher.matches()) {
+ return matcher.group(1);
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetMaemoRootstrapLocationCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetMaemoRootstrapLocationCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetMaemoRootstrapLocationCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox2SDKTarget;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author eswartz
+ *
+ */
+public class GetMaemoRootstrapLocationCommand extends MaemoRootstrapSb2Command {
+
+ private IScratchbox2SDKTarget sdkTarget;
+
+ public GetMaemoRootstrapLocationCommand(
+ ICommandAbstractor commandAbstractor, IScratchbox2SDKTarget sdkTarget) {
+ super(commandAbstractor);
+ this.sdkTarget = sdkTarget;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return param.size() == 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.command.ICommand#performCommand(java.util.List)
+ */
+ public Object performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ List<String> rsCommands = new ArrayList<String>(2);
+
+ String pathAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_MAEMO_ROOTSTRAP_PATH_ACT);
+
+ rsCommands.add(pathAction);
+ rsCommands.add(sdkTarget.getName());
+
+ List<String> results = doPerformCommand(rsCommands, null, 0);
+ if (results.size() == 0)
+ throw new ScratchboxException("Could not detect rootstrap location for " + sdkTarget + "\ngot:\n"
+ + catenateLines(results));
+
+ // ignore bogus report of deleted rootstrap
+ IPath root = new Path(results.get(0).trim());
+ IFileStore store = sdkTarget.getMachineFileSystemAccess().getFileStore(root);
+ if (store.fetchInfo().exists())
+ return root;
+ else
+ throw new ScratchboxException("Rootstrap location for " + sdkTarget + " does not exist: " + store);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetVesionScratchboxCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetVesionScratchboxCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/GetVesionScratchboxCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.List;
+
+/**
+ * Get the version of Scratchbox installed.
+ * This command wraps the callback to service sb-conf version.
+ *
+ */
+public class GetVesionScratchboxCommand extends ScratchboxCommand {
+
+ public GetVesionScratchboxCommand(ICommandAbstractor commandAbstractor, int version) {
+ super(commandAbstractor, version);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.ScratchboxCommand#getParametersSize()
+ */
+ public int getParametersSize() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.util.List)
+ */
+ public String performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String sboxVersionAction;
+ if (sboxVersion == 1)
+ sboxVersionAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_VERSION_ACT);
+ else
+ sboxVersionAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_VERSION_ACT);
+
+ String currentSboxVersionCommand = this
+ .replaceScratchboxConfigCommand(sboxVersionAction);
+
+ Process process = createProcess(currentSboxVersionCommand, null);
+
+ String currentVersion = getInputFromProcessAndWait(process, false, 0);
+
+ return currentVersion;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/KillallCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/KillallCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/KillallCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.List;
+
+/**
+ * Kill all Scratchbox sessions.
+ * This command wraps the callback to service sb-conf killall [-signal=<SIGNAL>]
+ *
+ */
+public class KillallCommand extends ScratchboxCommand {
+
+ public KillallCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String signalValue = "";
+ if (param.size() > 0)
+ signalValue = param.get(0);
+
+ String killallAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_KILLALL_ACT);
+ String signalOption = this.replaceSignal(signalValue);
+ String killallCommand = this.replaceScratchboxConfigCommand(
+ killallAction, new String[] { signalOption });
+
+ Process process = createProcess(killallCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ return true;
+ }
+
+ /**
+ * Replace the value of SIGNAL option of killall action.
+ *
+ * @param signalValue
+ * the value of the signal to be replaced.
+ * @return the signal option of killall action replaced with the given
+ * signal value.
+ */
+ private String replaceSignal(String signalValue) {
+ if (signalValue.equals(""))
+ return "";
+ String killallSignalOption = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_KILLALL_OPT_SIGNAL);
+
+ String signalReplaced = killallSignalOption.replaceAll(
+ "\\$\\{SIGNAL\\}", signalValue);
+
+ return signalReplaced;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ // TODO Auto-generated method stub
+ return getParametersSize() <= 1;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListAvailableMaemoRootstrapsSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListAvailableMaemoRootstrapsSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListAvailableMaemoRootstrapsSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.*;
+
+/**
+ * List the maemo rootstraps available for installation.
+ */
+public class ListAvailableMaemoRootstrapsSb2Command extends MaemoRootstrapSb2Command {
+
+ private static final int LIST_TIMEOUT = 10000;
+
+ public ListAvailableMaemoRootstrapsSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return param.size() == 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public List<MaemoRootstrap> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String availableAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_MAEMO_ROOTSTRAP_AVAILABLE_ACT);
+
+ // ensure the proxy is established
+ Properties proxyEnv = commandAbstractor.getProcessLauncherFactory().getStandardEnvironment();
+ proxyEnv = ProcessLauncherUtils.defineProxyVariables(proxyEnv);
+
+ List<String> available = doPerformCommand(
+ Collections.singletonList(availableAction), proxyEnv, LIST_TIMEOUT);
+
+ // this output has a few header lines
+ List<MaemoRootstrap> targetsAvailable = new ArrayList<MaemoRootstrap>();
+
+ boolean gotHeader = false;
+ for (String line : available) {
+ if (line.contains("Nickname,")) {
+ gotHeader = true;
+ continue;
+ }
+ if (line.trim().length() == 0) {
+ continue;
+ }
+ if (!gotHeader) {
+ continue;
+ }
+
+ String[] tokens = line.split(",\\s*");
+ if (tokens.length == 3) {
+ targetsAvailable.add(new MaemoRootstrap(tokens[0], tokens[1], tokens[2]));
+ }
+
+ }
+ return targetsAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.List;
+
+/**
+ * List the installed compilers.
+ * This command wraps the callback to service sb-conf list --compilers
+ *
+ */
+public class ListCompilersCommand extends ScratchboxCommand {
+
+ public ListCompilersCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_LIST_ACT);
+ String compilersOptions = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_LIST_OPT_COMPILERS);
+ String listCompilersCommand = this.replaceScratchboxConfigCommand(
+ listAction, new String[] { compilersOptions });
+
+ Process process = createProcess(listCompilersCommand, null);
+
+ List<String> compilersAvailable = getLineInputFromProcessAndWait(process, true, 0);
+
+ return compilersAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCompilersSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * List the installed compilers.
+ * There's no known command for this, but we can look in specific places.
+ *
+ */
+public class ListCompilersSb2Command extends ScratchboxCommand {
+
+ public ListCompilersSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 2);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ List<String> compilersAvailable = new ArrayList<String>();
+
+ try {
+ IFileStore baseToolDir = commandAbstractor.getFileSystemAccess().getFileStore(new Path("/opt/maemo/tools"));
+ IFileStore[] kids = baseToolDir.childStores(EFS.NONE, null);
+ for (IFileStore baseDir : kids) {
+ IFileStore dir = baseDir.getChild("bin");
+ if (dir.fetchInfo().isDirectory()) {
+ IFileStore[] files = dir.childStores(EFS.NONE, null);
+ for (IFileStore file : files) {
+ if (file.getName().endsWith("-gcc")) {
+ compilersAvailable.add(file.toURI().getPath());
+ break;
+ }
+ }
+ }
+ }
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Error scanning compilers", e);
+ }
+ return compilersAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.List;
+
+/**
+ * List the installed cpu-transparency.
+ * This command wraps the callback to service sb-conf list --cputransps
+ *
+ */
+public class ListCputranspCommand extends ScratchboxCommand {
+
+ public ListCputranspCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_LIST_ACT);
+ String cputranpOption = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_LIST_OPT_CPU);
+ String listCputranspsCommandString = this
+ .replaceScratchboxConfigCommand(listAction,
+ new String[] { cputranpOption });
+
+ Process process = createProcess(listCputranspsCommandString, null);
+
+ List<String> cputranspsAvailable = getLineInputFromProcessAndWait(process, true, 0);
+
+ return cputranspsAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListCputranspSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.*;
+
+/**
+ * List the installed compilers.
+ * There's no known command for this, but we can look in specific places.
+ *
+ */
+public class ListCputranspSb2Command extends ScratchboxCommand {
+
+ public ListCputranspSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 2);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ List<String> cputranspAvailable = new ArrayList<String>();
+
+ Set<String> expected = new HashSet<String>();
+ expected.add("sb2-qemu-arm");
+ expected.add("sbrsh");
+
+ Properties properties = commandAbstractor.getProcessLauncherFactory().getStandardEnvironment();
+ String pathenv = (String) properties.get("PATH");
+ if (pathenv == null) {
+ pathenv = "/usr/bin:/bin"; // XXX
+ }
+ if (pathenv != null) {
+ String[] paths = pathenv.split(":");
+ for (String exp : expected) {
+ for (String path : paths) {
+ IFileStore bin = commandAbstractor.getFileSystemAccess().getFileStore(new Path(path).append(exp));
+ if (bin.fetchInfo().exists()) {
+ cputranspAvailable.add(bin.toURI().getPath());
+ break;
+ }
+ }
+ }
+ }
+
+ return cputranspAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListDevkitsCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListDevkitsCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListDevkitsCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.List;
+
+/**
+ * List the installed devkits.
+ * This command wraps the callback to service sb-conf list --devkits
+ *
+ */
+public class ListDevkitsCommand extends ScratchboxCommand {
+
+ public ListDevkitsCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_LIST_ACT);
+ String devkitsOption = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_LIST_OPT_DEVKITS);
+ String listDevkitsCommandString = this.replaceScratchboxConfigCommand(
+ listAction, new String[] { devkitsOption });
+
+ Process process = createProcess(listDevkitsCommandString, null);
+
+ List<String> devkitsAvailable = getLineInputFromProcessAndWait(process, true, 0);
+
+ return devkitsAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListInstalledMaemoRootstrapsSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListInstalledMaemoRootstrapsSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListInstalledMaemoRootstrapsSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * List the maemo rootstraps installed
+ */
+public class ListInstalledMaemoRootstrapsSb2Command extends MaemoRootstrapSb2Command {
+
+ public ListInstalledMaemoRootstrapsSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor);
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return param.size() == 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String availableAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_MAEMO_ROOTSTRAP_LIST_ACT);
+
+ List<String> installed = doPerformCommand(
+ Collections.singletonList(availableAction), null, 0);
+
+ return installed;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListSessionsCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListSessionsCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListSessionsCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * List the current Scratchbox sessions.
+ * This command wraps the callback to service sb-conf list --sessions
+ *
+ */
+public class ListSessionsCommand extends ScratchboxCommand {
+
+ public ListSessionsCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_LIST_ACT);
+ String sessionsOption = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_LIST_OPT_SESSIONS);
+ String listSessionsCommandString = this.replaceScratchboxConfigCommand(
+ listAction, new String[] { sessionsOption });
+
+ Process process = createProcess(listSessionsCommandString, null);
+
+ List<String> sessionLines = getLineInputFromProcessAndWait(process, true, 0);
+
+ List<String> sessionsAvailable = new ArrayList<String>();
+
+ // remove prefix text
+ for (String line : sessionLines) {
+ int idx = line.indexOf(':');
+ if (idx >= 0) {
+ String[] pids = line.substring(idx+1).split("\\s+");
+ for (String pid : pids) {
+ pid = pid.trim();
+ if (pid.length() > 0)
+ sessionsAvailable.add(pid);
+ }
+ }
+ }
+
+
+ return sessionsAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListTargetsCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListTargetsCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ListTargetsCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.List;
+
+/**
+ * List the installed targets.
+ * This command wraps the callback to service (sb1) sb-conf list --targets
+ * or sb2-config -l (sb2)
+ *
+ */
+public class ListTargetsCommand extends ScratchboxCommand {
+
+ public ListTargetsCommand(ICommandAbstractor commandAbstractor, int sboxVersion) {
+ super(commandAbstractor, sboxVersion);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public List<String> performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction;
+ String targetsOption;
+ if (sboxVersion == 1) {
+ listAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_LIST_ACT);
+ targetsOption = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_LIST_OPT_TARGETS);
+ } else {
+ listAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_LIST_ACT);
+ targetsOption = "";
+ }
+ String listTargetsCommandString = this.replaceScratchboxConfigCommand(
+ listAction, new String[] { targetsOption });
+
+ Process process = createProcess(listTargetsCommandString, null);
+
+ List<String> targetsAvailable = getLineInputFromProcessAndWait(process, true, 0);
+
+ return targetsAvailable;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.*;
+
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ *
+ */
+public class MaemoCommand extends ScratchboxCommand {
+
+ private ISDKTarget sdkTarget;
+
+ public MaemoCommand(ICommandAbstractor commandAbstractor, ISDKTarget sdkTarget) {
+ super(commandAbstractor, 1);
+ this.sdkTarget = sdkTarget;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.internal.core.command.scratchbox.ScratchboxCommand#getParametersSize()
+ */
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+ /*
+ * private Properties getVariablesSet() {
+ StorableEnvironment env = ESboxEnvironmentVariableManager.fUserSupplier.getWorkspaceEnvironmentCopy();
+ ESboxStorableEnvironment esboxEnv = new ESboxStorableEnvironment(env.getVariables(),env.isReadOnly());
+ IEnvironmentVariable[] variable = esboxEnv.getVariables();
+
+ Properties properties = new Properties();
+ for (int i = 0; i < variable.length; i++) {
+ IEnvironmentVariable environmentVariable = variable[i];
+ properties.put(environmentVariable.getName(), environmentVariable.getValue());
+ }
+
+ return properties;
+ }
+ */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.internal.core.command.ICommand#performCommand(java.util.List)
+ */
+ public Object performCommand(List<String> params) throws ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String maemoCommand = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.MAEMO_COMMAND);
+ maemoCommand = this.replaceActions(maemoCommand,params.get(0));
+
+ IProcessLauncherFactory processLauncherFactory = commandAbstractor.getProcessLauncherFactory();
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, null,
+ Collections.singletonList(maemoCommand), null);
+
+ Process process = processLauncher.createProcess();
+
+ // XXX: see why this hangs
+ // read the first line to check for error
+ InputParser inputParser = new InputParser(process.getInputStream());
+ inputParser.run();
+
+ // spit the consumed output to the console
+ MessageConsole console = CorePlugin.getDefault().getConsole(
+ true, sdkTarget, "Running Maemo command (" + params.get(0) + ")");
+ try {
+ console.newOutputStream().write(inputParser.data().getBytes());
+ } catch (IOException e) {
+ }
+
+ // emit everything else to the console
+ processLauncher.redirectToConsole(console);
+
+ // wait for it to finish
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+
+ }
+
+ return true;
+ }
+
+ public Object startMaemoCommand(ISDKTarget sdkTarget) throws ESboxException {
+ if (sdkTarget == null) {
+ throw new ScratchboxException("No SDK target specified");
+ }
+
+ List<String> params = getParamList(ESboxPreferenceConstants.MAEMO_START_ACTION);
+
+ Object result = performCommand(params);
+ return result;
+ }
+
+ public Object stopMaemoCommand(ISDKTarget sdkTarget) throws ESboxException {
+ if (sdkTarget == null) {
+ throw new ScratchboxException("No SDK target specified");
+ }
+
+ List<String> params = getParamList(ESboxPreferenceConstants.MAEMO_STOP_ACTION);
+
+ Object result = performCommand(params);
+
+ return result;
+ }
+
+ public Object restartMaemoCommand(ISDKTarget sdkTarget) throws ESboxException {
+ if (sdkTarget == null) {
+ throw new ScratchboxException("No SDK target specified");
+ }
+
+ List<String> params = getParamList(ESboxPreferenceConstants.MAEMO_RESTART_ACTION);
+ return performCommand(params);
+ }
+
+ private List<String> getParamList(ESboxPreferenceConstants key) {
+ List<String> params = new ArrayList<String>();
+ params.add(commandAbstractor.getPreferenceValue(key));
+ return params;
+ }
+
+ private String replaceActions(String command, String action) {
+ return command.replaceAll("\\$\\{ACTIONS\\}", action);
+ }
+
+ /**
+ * Examine the output to ensure the first line is not an error.
+ */
+ public class InputParser implements Runnable {
+
+ boolean firstLine = true;
+ private InputStream input;
+ private StringBuilder data;
+
+ public InputParser(InputStream input) {
+ this.input = input;
+ this.data = new StringBuilder();
+ }
+
+ public void run() {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(input));
+ try {
+ String line = "";
+ if( (line = reader.readLine()) != null ) {
+ // get the rest of the buffered content
+ data.append(line);
+ while (reader.ready())
+ data.append((char)reader.read());
+
+ if (line.startsWith("ERROR"))
+ throw new ScratchboxInvalidOperationException(line);
+ }
+ } catch (Exception e) {
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+ errorLogger.logAndShowError("Error launching maemo", e);
+ }
+ }
+
+ public String data() {
+ return data.toString();
+ }
+
+ }
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoRootstrapSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoRootstrapSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/MaemoRootstrapSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.CommandLineArguments;
+import org.maemo.esbox.core.process.ShellTemplateSubstitutor;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.*;
+
+/**
+ * Base class for maemo rootstrap command.
+ */
+public abstract class MaemoRootstrapSb2Command extends ScratchboxCommand {
+
+ public MaemoRootstrapSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 2);
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return true;
+ }
+
+ /**
+ * Override if stderr output is allowed.
+ * @return false
+ */
+ protected boolean allowErrors() {
+ return false;
+
+ }
+
+ /**
+ * Perform the command with the given params as command line arguments,
+ * with an optional timeout (triggering ScratchboxException if reached)
+ * @param params command line parameters to maemo-rootstrap
+ * @param env any environment needed or <code>null</code>
+ * @param timeout if not 0, timeout in milliseconds
+ * @return lines from stdout
+ * @throws ScratchboxException if command execution fails or if timeout reached
+ */
+ @SuppressWarnings("unchecked")
+ protected List<String> doPerformCommand(List<String> params, Properties env, long timeout)
+ throws ESboxException {
+ String rootstrapCommand = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_MAEMO_ROOTSTRAP_COMMAND);
+
+ String options = CommandLineArguments.toCommandLine(params);
+
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("OPTIONS", options);
+
+ rootstrapCommand = substitutor.substitute(rootstrapCommand);
+
+ if (console == null) {
+ Process process = createProcess(rootstrapCommand, env);
+ List<String> results = getLineInputFromProcessAndWait(process, allowErrors(), timeout);
+ return results;
+ } else {
+ runAndWaitForProcess("Running " + rootstrapCommand, rootstrapCommand, env, timeout);
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveMaemoRootstrapSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveMaemoRootstrapSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveMaemoRootstrapSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.maemo.esbox.core.*;
+
+import org.maemo.esbox.core.process.ProcessLauncherUtils;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.*;
+
+/**
+ * Remove a maemo rootstrap. Parameters are target name and force boolean flag.
+ */
+public class RemoveMaemoRootstrapSb2Command extends MaemoRootstrapSb2Command {
+
+ private final IProgressMonitor monitor;
+
+ public RemoveMaemoRootstrapSb2Command(ICommandAbstractor commandAbstractor, IProgressMonitor monitor) {
+ super(commandAbstractor);
+ this.monitor = monitor;
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return param.size() == 2;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Boolean performCommand(List<String> param)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetName = param.get(0);
+ String forceFlag = param.get(1);
+
+ String action = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_MAEMO_ROOTSTRAP_REMOVE_ACT);
+
+ List<String> commands = new ArrayList<String>();
+
+ if (forceFlag.equals(Boolean.TRUE.toString())) {
+ String force = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_MAEMO_ROOTSTRAP_FORCE_OPT);
+ commands.add(force);
+ }
+ commands.add(action);
+ commands.add(targetName);
+
+ Properties env = commandAbstractor.getProcessLauncherFactory().getStandardEnvironment();
+ env = ProcessLauncherUtils.defineProxyVariables(env);
+
+ setMonitorAndConsole(
+ monitor,
+ CorePlugin.getDefault().getConsole(true, null, "Removing rootstrap " + targetName));
+
+ doPerformCommand(commands, env, 0);
+
+ return Boolean.TRUE;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Remove a Scratchbox target.
+ * This command wraps the callback to service sb-conf remove [<TARGET>]
+ *
+ */
+public class RemoveTargetCommand extends ScratchboxCommand {
+
+ private ISDK sdk;
+
+ public RemoveTargetCommand(ISDK sdk, ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ this.sdk = sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetToRemove = param.get(0);
+ if (!targetExist(targetToRemove))
+ throw new ScratchboxInvalidParameterException("Target "
+ + targetToRemove + " does not exist.");
+
+ String removeTargetAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_REMOVE_ACT);
+ String forceRemoveTargetOption = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_REMOVE_OPT_FORCE);
+ String removeTargetCommand = this.replaceScratchboxConfigCommand(
+ removeTargetAction, new String[] { targetToRemove,
+ forceRemoveTargetOption });
+
+ Process process = createProcess(removeTargetCommand, null);
+
+ getInputFromProcessAndWait(process, true, 0);
+
+ sdk.refresh();
+
+ return true;
+ }
+
+ /**
+ * Verify if a target exists.
+ * @param targetToRemove
+ * the target to verify.
+ *
+ * @return true, if the target exists in Scratchbox; false, otherwise.
+ * @throws ScratchboxException
+ * if some problem occurrs while requesting Scratchbox services.
+ */
+ private boolean targetExist(String targetToRemove)
+ throws ESboxException {
+ List<String> targetsAvailable = new ListTargetsCommand(commandAbstractor, sboxVersion)
+ .performCommand(new ArrayList<String>());
+ return targetsAvailable.contains(targetToRemove);
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RemoveTargetSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox2SDK;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Remove a Scratchbox 2 target.
+ * There's no known command for this, but we can manually fix up the system.
+ *
+ */
+public class RemoveTargetSb2Command extends ScratchboxCommand {
+
+ private IScratchbox2SDK sdk;
+
+ public RemoveTargetSb2Command(ISDK sdk, ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 2);
+ this.sdk = (IScratchbox2SDK) sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetToRemove = param.get(0);
+ if (!targetExist(targetToRemove))
+ throw new ScratchboxInvalidParameterException("Target "
+ + targetToRemove + " does not exist.");
+
+ IFileStore sb2Dir = commandAbstractor.getFileSystemAccess().getFileStore(
+ sdk.getScratchbox2ConfigDirectory());
+ IFileStore targetDir = sb2Dir.getChild(targetToRemove);
+
+ if (!targetDir.fetchInfo().exists()) {
+ throw new ScratchboxInvalidParameterException("Target "
+ + targetToRemove + " does not exist at the expected location: " + targetDir);
+ }
+
+ try {
+ targetDir.delete(EFS.NONE, null);
+ } catch (CoreException e) {
+ throw new ScratchboxException("Failed to delete rootstrap", e);
+ } finally {
+ sdk.refresh();
+ }
+
+ return true;
+ }
+
+ /**
+ * Verify if a target exists.
+ * @param targetToRemove
+ * the target to verify.
+ *
+ * @return true, if the target exists in Scratchbox; false, otherwise.
+ * @throws ScratchboxException
+ * if some problem occurrs while requesting Scratchbox services.
+ */
+ private boolean targetExist(String targetToRemove)
+ throws ESboxException {
+ List<String> targetsAvailable = new ListTargetsCommand(commandAbstractor, sboxVersion)
+ .performCommand(new ArrayList<String>());
+ return targetsAvailable.contains(targetToRemove);
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ResetTargetCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ResetTargetCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ResetTargetCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.List;
+
+/**
+ * Reset a Scratchbox target.
+ * This command wraps the callback to service sb-conf reset [<TARGET>]
+ *
+ */
+public class ResetTargetCommand extends ScratchboxCommand {
+
+ public ResetTargetCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.util.List)
+ */
+ public Object performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String resetTargetAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_RESET_ACT);
+ String resetTargetCommand = this.replaceScratchboxConfigCommand(
+ resetTargetAction, new String[] {});
+
+ Process process = createProcess(resetTargetCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ return true;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RootstrapCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RootstrapCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/RootstrapCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.List;
+
+/**
+ * This command wraps the callback to service sb-conf rootstrap [<TARGET>] <FILE>|<URL>
+ */
+public class RootstrapCommand extends ScratchboxCommand {
+
+ public RootstrapCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String fileOrURL = param.get(0);
+
+ String rootstrapAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_ROOTSTRAP_ACT);
+ String rootstrapCommand = this.replaceScratchboxConfigCommand(
+ rootstrapAction, new String[] { fileOrURL });
+
+ Process process = createProcess(rootstrapCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ return true;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,571 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommand;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.io.*;
+import java.security.InvalidParameterException;
+import java.util.*;
+
+/**
+ * Implements some common methods for Scratchbox commands.
+ * <p>
+ * <b>NOTE:</b> this base class should only be used for basic scratchbox utility
+ * command launching. It is not recommended to use this class's
+ * string-substitution method to create general command lines, since this
+ * ignores details like shell escaping and quoting, which should be
+ * constructed with the List<String> class and alternate IProcessLauncherFactory
+ * methods.
+ */
+public abstract class ScratchboxCommand implements ICommand {
+
+ public static final String ERROR_TOKEN = "ERROR:"; //$NON-NLS-1$
+
+ public static final String WARNING_TOKEN = "sb-conf:"; //$NON-NLS-1$
+
+ protected ICommandAbstractor commandAbstractor;
+
+ protected int sboxVersion;
+
+ protected MessageConsole console;
+
+ private IProgressMonitor monitor;
+
+ public ScratchboxCommand(ICommandAbstractor commandAbstractor, int sboxVersion) {
+ this.commandAbstractor = commandAbstractor;
+ this.sboxVersion = sboxVersion;
+ }
+
+ /**
+ * Replace the actions and options of the Scratchbox configure command. This
+ * is an utility method to be used by all the subclasses of
+ * IScratchboxCommand.
+ *
+ * @param sboxCommand
+ * The Scratchbox command.
+ * @param action
+ * The action to be replace.
+ * @return The result command with the replacement of action made.
+ */
+ public String replaceScratchboxConfigCommand(String action) {
+ return this.replaceScratchboxConfigCommand(action, null);
+ }
+
+ /**
+ * Replace the actions and options of the Scratchbox configure command. This
+ * is an utility method to be used by all the subclasses of
+ * IScratchboxCommand.
+ *
+ * @param action
+ * The action to be replace.
+ * @param options
+ * The options to be replace. If the value of options is null, it
+ * is supposed to not consider any option.
+ * @return The result command with all the replacements (actions and
+ * options) made.
+ *
+ * @throws InvalidParameterException
+ * if parameters action or command is null.
+ */
+ public String replaceScratchboxConfigCommand(String action, String[] options)
+ throws InvalidParameterException {
+ String sboxCommand;
+
+ if (sboxVersion == 1)
+ sboxCommand = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SBOX_COMMAND);
+ else
+ sboxCommand = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB2_CONFIG_COMMAND);
+
+ return replaceScratchboxCommand(sboxCommand, action, options);
+ }
+
+ /**
+ * Replace the actions and options of the sbrsh configure command.
+ *
+ * @param action
+ * The action to be replace.
+ * @return The result command with the replacement of action made.
+ */
+ public String replaceScratchboxSbrshConfigCommand(String action) {
+ return this.replaceScratchboxSbrshConfigCommand(action, null);
+ }
+
+ /**
+ * Replace the actions and options of the sbrsh configure command.
+ *
+ * @param action
+ * The action to be replace.
+ * @param options
+ * The options to be replace. If the value of options is null, it
+ * is supposed to not consider any option.
+ * @return The result command with all the replacements (actions and
+ * options) made.
+ *
+ * @throws InvalidParameterException
+ * if parameters action or command is null.
+ */
+ public String replaceScratchboxSbrshConfigCommand(String action,
+ String[] options) throws InvalidParameterException {
+ String sbrshConfigCommand = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SBRSH_CONFIG_COMMAND);
+
+ return replaceScratchboxCommand(sbrshConfigCommand, action, options);
+ }
+
+ /**
+ * Replace the actions and options of a given Scratchbox command.
+ *
+ * @param command
+ * The command with actions and options to be replaced.
+ * @param action
+ * The action to be replaced.
+ * @param options
+ * The options to be replace. If the value of options is null, it
+ * is supposed to not consider any option.
+ * @return The result command with all the replacements (actions and
+ * options) made.
+ * @throws InvalidParameterException
+ * if parameters action or command is null.
+ */
+ protected String replaceScratchboxCommand(String command, String action,
+ String[] options) throws InvalidParameterException {
+ if (command == null || action == null)
+ throw new InvalidParameterException("The parameters cannot be null");
+
+ String resultCommand;
+ String optionsToReplace = "";
+ String separator = "";
+
+ if (options != null) {
+ for (int i = 0; i < options.length; i++) {
+ optionsToReplace += separator + options[i];
+ separator = " ";
+ }
+ }
+
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("ACTIONS", action);
+ substitutor.define("OPTIONS", optionsToReplace);
+
+ resultCommand = substitutor.substitute(command);
+
+ return resultCommand;
+ }
+
+ /**
+ * For long-running process, provide a progress monitor and
+ * the console to which to report results of an executing command.
+ * If not set, or set to <code>null</code>, there will be no console output.
+ * @param monitor
+ * @param console
+ */
+ protected void setMonitorAndConsole(IProgressMonitor monitor, MessageConsole console) {
+ this.monitor = monitor;
+ this.console = console;
+ }
+
+
+ /**
+ * Create a process from the given process launch handler factory and
+ * the given command line.
+ * @param launcherFactory the factory for creating IProcessLauncherFactory
+ * @param commandLine the command line string
+ * @throws ScratchboxException failure to launch process
+ */
+ public Process createProcess(List<String> cmdLine) throws ESboxException {
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ commandAbstractor.getProcessLauncherFactory(),
+ null,
+ cmdLine);
+ Process process = processLauncher.createProcess();
+ if (console != null) {
+ new PrintStream(console.newMessageStream()).println(CommandLineArguments.toCommandLine(cmdLine));
+ processLauncher.redirectToConsole(console);
+ }
+ return process;
+ }
+
+ /**
+ * Create a process from the given process launch handler factory and
+ * the given command line.
+ * @param launcherFactory the factory for creating IProcessLauncherFactory
+ * @param commandLine the command line string
+ * @throws ScratchboxException failure to launch process
+ */
+ public Process createProcess(String commandline) throws ESboxException {
+ return createProcess(commandline, null);
+ }
+
+ /**
+ * Create a process from the given process launch handler factory and
+ * the given command line.
+ * @param commandLine the command line string
+ * @param env prperties
+ * @throws ScratchboxException failure to launch process
+ */
+ public Process createProcess(String commandline, Properties env) throws ESboxException {
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine(commandline);
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ commandAbstractor.getProcessLauncherFactory(),
+ null,
+ cmdLine,
+ env);
+ Process process = processLauncher.createProcess();
+ if (console != null) {
+ new PrintStream(console.newMessageStream()).println(commandline);
+ processLauncher.redirectToConsole(console);
+ }
+ return process;
+ }
+
+ /**
+ * Eat the stdout and stderr results from the process and wait for it
+ * to finish. Optionally check whether stderr is empty.
+ * <p>
+ * This is done here instead of in the commands because CDT's Spawner will
+ * destroy the streams when #waitFor() is called, while other Process
+ * implementations don't do this, and we don't want a dependency on the
+ * ordering repeated in the command implementations.
+ * @return stdout results, as a string
+ */
+ protected String getInputFromProcessAndWait(Process process, boolean allowError) throws ScratchboxException {
+ return getInputFromProcessAndWait(process, allowError, 0);
+ }
+
+ protected IStatus runAndWaitForProcess(String jobName, final String commandline,
+ Properties env, long timeout) throws ESboxException {
+ final IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ commandAbstractor.getProcessLauncherFactory(),
+ null,
+ CommandLineArguments.createFromCommandLine(commandline),
+ env);
+ processLauncher.usePTY(true);
+
+ final Process process = processLauncher.createProcess();
+ new PrintStream(console.newMessageStream()).println(commandline);
+
+ Job job = new Job(jobName) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("", 2);
+ monitor.subTask("Running " + commandline);
+ try {
+ processLauncher.redirectToConsole(console);
+ try {
+ process.waitFor();
+ monitor.worked(1);
+ int exit = process.exitValue();
+ if (exit != 0) {
+ return Activator.createErrorStatus("Process failed with exit value " + exit, null);
+ }
+ } catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ }
+ } finally {
+ monitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ try {
+ long deadline = System.currentTimeMillis() + timeout;
+ while (job.getResult() == null) {
+ Thread.sleep(500);
+ if (monitor.isCanceled() || (timeout != 0 && System.currentTimeMillis() >= deadline)) {
+ process.destroy();
+ job.cancel();
+ return Status.CANCEL_STATUS;
+ }
+ }
+ return job.getResult();
+ } catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ }
+ }
+
+ /**
+ * Wait for the process to finish with a certain timeout.
+ * @param timeout if not zero, timeout in milliseconds before throwing exception
+ * @return exit code
+ */
+ protected int waitForProcess(final Process process, final long timeout) throws ScratchboxException {
+ final Exception[] excs = { null };
+ Runnable runnable = new Runnable() {
+
+ public void run() {
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ excs[0] = e;
+ }
+ }
+
+ };
+
+ if (timeout == 0) {
+ runnable.run();
+ } else {
+ Thread thread = new Thread(runnable);
+ thread.start();
+ try {
+ thread.join(timeout);
+ if (thread.isAlive()) {
+ thread.interrupt();
+ excs[0] = new InterruptedException();
+ }
+ } catch (InterruptedException e) {
+ excs[0] = e;
+ }
+ }
+
+ if (excs[0] instanceof InterruptedException) {
+ throw new ScratchboxException("Command interrupted after " + timeout + " milliseconds");
+ } else if (excs[0] instanceof ScratchboxException) {
+ throw (ScratchboxException) excs[0];
+ } else if (excs[0] != null) {
+ throw new ScratchboxException(excs[0]);
+ }
+
+ return process.exitValue();
+ }
+
+ /**
+ * Eat the stdout and stderr results from the process and wait for it
+ * to finish. Optionally check whether stderr is empty.
+ * <p>
+ * This is done here instead of in the commands because CDT's Spawner will
+ * destroy the streams when #waitFor() is called, while other Process
+ * implementations don't do this, and we don't want a dependency on the
+ * ordering repeated in the command implementations.
+ * @param timeout if not zero, timeout in milliseconds before throwing exception
+ * @return stdout results, as a string
+ */
+ protected String getInputFromProcessAndWait(final Process process, final boolean allowError, final long timeout) throws ScratchboxException {
+ final String[] inputs = { null };
+ final Exception[] excs = { null };
+ Runnable runnable = new Runnable() {
+
+ public void run() {
+ try {
+ inputs[0] = getInputFromProcess(process);
+
+ if (!allowError) {
+ String error = getErrorInputFromProcess(process);
+ if (error.length() > 0) {
+ excs[0] = new ScratchboxInvalidOperationException(error);
+ return;
+ }
+ }
+ } catch (IOException e) {
+ excs[0] = e;
+ return;
+ } catch (ScratchboxException e) {
+ excs[0] = e;
+ return;
+ }
+
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ excs[0] = e;
+ }
+ }
+
+ };
+
+ if (timeout == 0) {
+ runnable.run();
+ } else {
+ Thread thread = new Thread(runnable);
+ thread.start();
+ try {
+ thread.join(timeout);
+ if (thread.isAlive()) {
+ thread.interrupt();
+ process.destroy();
+ excs[0] = new InterruptedException();
+ }
+ } catch (InterruptedException e) {
+ excs[0] = e;
+ }
+ }
+
+ if (excs[0] instanceof InterruptedException) {
+ throw new ScratchboxException("Command interrupted after " + timeout + " milliseconds");
+ } else if (excs[0] instanceof ScratchboxException) {
+ throw (ScratchboxException) excs[0];
+ } else if (excs[0] != null) {
+ throw new ScratchboxException(excs[0]);
+ }
+
+ return inputs[0];
+ }
+
+ /**
+ * Eat the stdout and stderr results from the process and wait for it
+ * to finish. Return a
+ * <p>
+ * This is done here instead of in the commands because CDT's Spawner will
+ * destroy the streams when #waitFor() is called, while other Process
+ * implementations don't do this, and we don't want a dependency on the
+ * ordering repeated in the command implementations.
+ * @return stdout results, as an array of lines
+ */
+ protected List<String> getLineInputFromProcessAndWait(Process process, boolean allowError) throws ScratchboxException {
+ return getLineInputFromProcessAndWait(process, allowError, 0);
+ }
+
+ /**
+ * Eat the stdout and stderr results from the process and wait for it
+ * to finish. Return a
+ * <p>
+ * This is done here instead of in the commands because CDT's Spawner will
+ * destroy the streams when #waitFor() is called, while other Process
+ * implementations don't do this, and we don't want a dependency on the
+ * ordering repeated in the command implementations.
+ * @param timeout if non-zero, timeout in milliseconds
+ * @return stdout results, as an array of lines
+ */
+ protected List<String> getLineInputFromProcessAndWait(Process process, boolean allowError, long timeout) throws ScratchboxException {
+ String input = getInputFromProcessAndWait(process, allowError, timeout);
+ return processLines(input);
+ }
+
+ /**
+ * Return the input stream of the process as a string. All lines generated
+ * by the process are concatenated.
+ *
+ * @param process
+ * the process.
+ * @return the input stream of the process.
+ * @throws IOException
+ * if any I/O problem occurrs.
+ */
+ private String getInputFromProcess(Process process) throws IOException, ScratchboxException {
+ return getInputStream(process.getInputStream());
+ }
+
+ /**
+ * Return the error input stream of the process as a string. All lines
+ * generated by the process are concatenated.
+ *
+ * @param process
+ * the process.
+ * @return the input stream of the process.
+ * @throws IOException
+ * if any I/O problem occurrs.
+ * @throws ScratchboxException
+ */
+ private String getErrorInputFromProcess(Process process) throws IOException, ScratchboxException {
+ return getInputStream(process.getErrorStream());
+ }
+
+ /**
+ * Return an input stream as a string. All lines generated by the process
+ * are concatenated.
+ *
+ * @param processInputStream
+ * the input stream to be read.
+ * @return the input stream of the process.
+ * @throws IOException
+ * if any I/O problem occurrs.
+ * @throws ScratchboxException
+ */
+ private String getInputStream(InputStream processInputStream)
+ throws IOException, ScratchboxException {
+ BufferedReader in = new BufferedReader(new InputStreamReader(
+ processInputStream));
+
+ String line;
+ String result = "";
+ String separator = "";
+
+ while ((line = in.readLine()) != null) {
+ checkError(line,ERROR_TOKEN);
+ checkError(line,WARNING_TOKEN);
+ result += separator + line;
+ separator = System.getProperty("line.separator");
+ }
+
+ return result;
+ }
+
+ private void checkError(String inputString, String errorPattern) throws ScratchboxException {
+ if (inputString.startsWith(errorPattern)) {
+ int index = inputString.indexOf(errorPattern);
+ throw new ScratchboxException(inputString.substring(index + errorPattern.length()));
+ }
+ }
+
+ /**
+ * Get a string with a set of lines an return a list with the lines
+ * separated.
+ *
+ * @param stringWithLines
+ * a string with lines.
+ * @return a list with the lines separated.
+ */
+ private List<String> processLines(String stringWithLines) {
+ List<String> lines = new ArrayList<String>();
+ final String FILE_SEPARATOR = System.getProperty("line.separator");
+
+ StringTokenizer tokens = new StringTokenizer(stringWithLines,
+ FILE_SEPARATOR);
+ while (tokens.hasMoreElements()) {
+ lines.add(tokens.nextToken());
+ }
+
+ return lines;
+ }
+
+ /**
+ * Return the correct size of performCommand parameters list.
+ *
+ * @return the correct size of performCommand parameters list.
+ */
+ public abstract int getParametersSize();
+
+ /**
+ * Verify if the parameter list has the correct size.
+ *
+ * @param param
+ * the list of parameters to be verified.
+ * @return true, if the list contains the correct number of parameters;
+ * false, otherwise.
+ */
+ protected boolean checkParameters(List<String> param) {
+ return getParametersSize() == param.size();
+ }
+
+
+ protected String catenateLines(List<String> lines) {
+ StringBuilder builder = new StringBuilder();
+ for (String line : lines) {
+ builder.append(line);
+ builder.append('\n');
+ }
+ return builder.toString();
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidOperationException.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidOperationException.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidOperationException.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * This exception is thrown whenever the user try to remove the current
+ * Scratchbox target.
+ *
+ */
+public class ScratchboxInvalidOperationException extends ScratchboxException {
+
+ /**
+ * Serial version number of exception.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * the message associated with the exception.
+ */
+ public ScratchboxInvalidOperationException(String message) {
+ super(message);
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidParameterException.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidParameterException.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ScratchboxInvalidParameterException.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * This exception is thrown whenever an invalid parameter is passed to a command.
+ */
+public class ScratchboxInvalidParameterException extends ScratchboxException {
+
+ /**
+ * Serial version number of exception.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * the message associated with the exception.
+ */
+ public ScratchboxInvalidParameterException(String message) {
+ super(message);
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SelectTargetCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SelectTargetCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SelectTargetCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+
+import java.util.List;
+
+/**
+ * Select a Scratchbox target.
+ * This command wraps the callback to service sb-conf select [<TARGET>]
+ *
+ */
+public class SelectTargetCommand extends ScratchboxCommand {
+
+ private final IScratchboxSDK sdk;
+
+ public SelectTargetCommand(ICommandAbstractor commandAbstractor, IScratchboxSDK sdk) {
+ super(commandAbstractor, 1);
+ this.sdk = sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.lang.Object)
+ */
+ public Object performCommand(List<String> param) throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(param))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetToSelect = param.get(0);
+
+ String selectTargetAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SELECT_ACT);
+ String selectTargetCommand = this.replaceScratchboxConfigCommand(
+ selectTargetAction, new String[] { targetToSelect });
+
+ Process process = createProcess(selectTargetCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ sdk.setCachedCurrentTarget(targetToSelect);
+
+ return true;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 1;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowPathMappingSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowPathMappingSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowPathMappingSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.io.ByteArrayOutputStream;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Invoke 'sb2-show path' on a list of paths and return the mappings, or <code>null</code>
+ * for unmapped entries
+ * @author eswartz
+ *
+ */
+public class ShowPathMappingSb2Command extends ScratchboxCommand {
+ public ShowPathMappingSb2Command(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 2);
+ }
+
+ @Override
+ protected boolean checkParameters(List<String> param) {
+ return true;
+ }
+
+ public Map<IPath, IPath> performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ List<String> cmdLine = CommandLineArguments.createFromVarArgs(
+ commandAbstractor.getPreferenceValue(ESboxPreferenceConstants.SB2_SB2_SHOW_COMMAND),
+ commandAbstractor.getPreferenceValue(ESboxPreferenceConstants.SB2_SB2_SHOW_PATH_ACTION));
+ cmdLine.addAll(params);
+
+ IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(
+ commandAbstractor.getProcessLauncherFactory(),
+ null, cmdLine);
+
+ /*Process process =*/ launcher.createProcess();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ launcher.waitAndRead(out, err);
+
+ if (err.size() != 0)
+ throw new ScratchboxException("Cannot resolve scratchbox2 path mappings:\n"+ err);
+
+ String resolveInfo = out.toString().trim();
+ String[] lines = resolveInfo.split("\r\n|\r|\n");
+
+ Map<IPath, IPath> result = new HashMap<IPath, IPath>(lines.length);
+
+ Pattern sb2ShowPattern = Pattern.compile(
+ commandAbstractor.getPreferenceValue(ESboxPreferenceConstants.SB2_SB2_SHOW_PATH_OUTPUT_PATTERN));
+
+ for (String line : lines) {
+ Matcher matcher = sb2ShowPattern.matcher(line);
+ if (matcher.matches()) {
+ String toPath = matcher.group(2);
+ // workaround buggy output
+ if (toPath.startsWith("//"))
+ toPath = toPath.substring(1);
+ result.put(new Path(matcher.group(1)), new Path(toPath));
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowTargetCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowTargetCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/ShowTargetCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxTarget;
+
+import java.util.*;
+
+/**
+ * Show the settings of a Scratchbox target.
+ * This command wraps the callback to service sb-conf show [<TARGET>]
+ *
+ */
+public class ShowTargetCommand extends ScratchboxCommand {
+
+ public ShowTargetCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.internal.command.ICommand#performCommand(java.util.List)
+ */
+ public ScratchboxTarget performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String listAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SHOW_ACT);
+ String showTargetCommandString = this.replaceScratchboxConfigCommand(
+ listAction, new String[] { params.get(0) });
+
+ Process process = createProcess(showTargetCommandString, null);
+
+ ScratchboxTarget target = null;
+ List<String> targetInfo = getLineInputFromProcessAndWait(process, false, 0);
+ target = createTarget(params.get(0), targetInfo);
+
+ return target;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.scratchbox.internal.command.ScratchboxCommand#getParametersSize()
+ */
+ @Override
+ public int getParametersSize() {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+
+ private ScratchboxTarget createTarget(String targetName,
+ List<String> targetInfo) {
+ ScratchboxTarget target = new ScratchboxTarget();
+
+ target.setName(targetName);
+
+ String compilerField = targetInfo.get(0);
+ String compiler = compilerField.substring(
+ compilerField.indexOf(":") + 1).trim();
+ target.setCompiler(compiler);
+
+ String devkitsField = targetInfo.get(1);
+ devkitsField = devkitsField.substring(devkitsField.indexOf(":") + 1);
+ StringTokenizer tokens = new StringTokenizer(devkitsField);
+ List<String> devkits = new ArrayList<String>();
+ while (tokens.hasMoreTokens()) {
+ devkits.add(tokens.nextToken());
+ }
+ target.setDevkits(devkits);
+
+ String cputranspField = targetInfo.get(2);
+ String cpuTransp = cputranspField.substring(
+ cputranspField.indexOf(":") + 1).trim();
+ target.setCputransp(cpuTransp);
+
+ return target;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SimpleCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SimpleCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/SimpleCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox;
+
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.ProcessLauncherCreator;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.List;
+
+/**
+ * Execute a simple command inside Scratchbox.
+ *
+ */
+public class SimpleCommand extends ScratchboxCommand {
+
+ public SimpleCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.internal.command.ICommand#performCommand(java.util.List)
+ */
+ public List<String> performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+
+ if (params.size() == 0)
+ throw new ScratchboxInvalidParameterException("empty parameter list");
+
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(commandAbstractor.getProcessLauncherFactory(), null,
+ params);
+ Process process = processLauncher.createProcess();
+
+ List<String> commandResult = getLineInputFromProcessAndWait(process, true, 0);
+
+ return commandResult;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.scratchbox.internal.command.ScratchboxCommand#getParametersSize()
+ */
+ @Override
+ public int getParametersSize() {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/AddSbrshCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/AddSbrshCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/AddSbrshCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * This command wraps the callback to service sbrsh-conf add <TARGET-HOSTNAME> [[<USERNAME>@]<IP-ADDRESS>]
+ *
+ */
+public class AddSbrshCommand extends ScratchboxCommand {
+
+ public AddSbrshCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.ScratchboxCommand#getParametersSize()
+ */
+ @Override
+ public int getParametersSize() {
+ // TODO Auto-generated method stub
+ return 3;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.util.List)
+ */
+ public Object performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetDeviceAddr = params.get(0);
+ String username = params.get(1);
+ String ipAddress = params.get(2);
+
+ String localHostName = username + "@" + ipAddress;
+
+ String addAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.ADD_ACT);
+ String addCommand = this.replaceScratchboxSbrshConfigCommand(addAction,
+ new String[] { targetDeviceAddr, localHostName });
+
+ Process process = createProcess(addCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ return true;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/ConfigureSbrshCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/ConfigureSbrshCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/ConfigureSbrshCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * This command wraps the callback to service sbrsh-conf configure [<TARGET-NAME>]
+ * <TARGET-HOSTNAME>[:<TARGET-PORT>]
+ *
+ */
+public class ConfigureSbrshCommand extends ScratchboxCommand {
+
+ public ConfigureSbrshCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.ScratchboxCommand#getParametersSize()
+ */
+ @Override
+ public int getParametersSize() {
+ // TODO Auto-generated method stub
+ return 3;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.util.List)
+ */
+ public Object performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetName = params.get(0);
+ String targetHostname = params.get(1);
+ String nfsServerAddr = params.get(2);
+
+ String configureAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.CONFIGURE_ACT);
+ String nfsOption = this.replaceAction(nfsServerAddr);
+
+ String configureCommand = this.replaceScratchboxSbrshConfigCommand(
+ configureAction, new String[] { targetName, targetHostname,
+ nfsOption });
+
+ Process process = createProcess(configureCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ return true;
+ }
+
+ /**
+ *
+ * @param nfsServerAddr
+ * @return
+ */
+ protected String replaceAction(String nfsServerAddr) {
+ String nfsOption = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.NFS_SERVER_HOSTNAME);
+ nfsOption = nfsOption.replaceAll("\\$\\{HOSTNAME\\}", nfsServerAddr);
+
+ return nfsOption;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/MountTargetSbrshCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/MountTargetSbrshCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/MountTargetSbrshCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * This command wraps the callback to service sbrsh-conf mount [<TARGET-NAME>]
+ *
+ */
+public class MountTargetSbrshCommand extends ScratchboxCommand {
+
+ public MountTargetSbrshCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.ScratchboxCommand#getParametersSize()
+ */
+ @Override
+ public int getParametersSize() {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.util.List)
+ */
+ public Object performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetName = params.get(0);
+
+ String mountAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.MOUNT_ACT);
+ String mountCommand = this.replaceScratchboxSbrshConfigCommand(
+ mountAction, new String[] { targetName });
+
+ Process process = createProcess(mountCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ return true;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/UnmountTargetSbrshCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/UnmountTargetSbrshCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/command/scratchbox/sbrsh/UnmountTargetSbrshCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh;
+
+import java.util.List;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidParameterException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * This command wraps the callback to service sbrsh-conf unmount [<TARGET-NAME>]
+ *
+ */
+public class UnmountTargetSbrshCommand extends ScratchboxCommand {
+
+ public UnmountTargetSbrshCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.ScratchboxCommand#getParametersSize()
+ */
+ @Override
+ public int getParametersSize() {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see embedded.core.scratchbox.command.IScratchboxCommand#performCommand(java.util.List)
+ */
+ public Object performCommand(List<String> params)
+ throws ScratchboxException, ESboxException {
+ if (!this.checkParameters(params))
+ throw new ScratchboxInvalidParameterException(
+ "Invalid number of parameters");
+
+ String targetName = params.get(0);
+
+ String unmountAction = commandAbstractor.getPreferenceValue(
+ ESboxPreferenceConstants.UNMOUNT_ACT);
+ String unmountCommand = this.replaceScratchboxSbrshConfigCommand(
+ unmountAction, new String[] { targetName });
+
+ Process process = createProcess(unmountCommand, null);
+
+ getInputFromProcessAndWait(process, false, 0);
+
+ return true;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/BaseScratchboxSDKTarget.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/BaseScratchboxSDKTarget.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/BaseScratchboxSDKTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.api.core.sdk.BaseSDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.adapters.MaemoRunStandaloneSupportAdapterFactory;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+/**
+ * Common base for (maemo) scratchbox SDK targets
+ * @author eswartz
+ *
+ */
+public abstract class BaseScratchboxSDKTarget extends BaseSDKTarget implements IScratchboxSDKTarget {
+
+ public BaseScratchboxSDKTarget(ISDK sdk, ISDKPlatform platform,
+ String architecture, String target) {
+ super(sdk, platform, architecture, target);
+
+ Platform.getAdapterManager().registerAdapters(new MaemoRunStandaloneSupportAdapterFactory(), ISDKTarget.class);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/IScratchboxSDKPlatformArchitectureProvider.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/IScratchboxSDKPlatformArchitectureProvider.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/IScratchboxSDKPlatformArchitectureProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.sdk.ISDKPlatform;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+
+/**
+ * Helper interface to identify the platform and architecture
+ * @author eswartz
+ *
+ */
+public interface IScratchboxSDKPlatformArchitectureProvider {
+ /**
+ * Identify the platform for the target
+ *
+ * @param sdk the SDK
+ * @param target the target name
+ */
+ ISDKPlatform getPlatform(IScratchboxSDK sdk, IPath sdkTargetRoot, String target);
+
+ /**
+ * Identify the architecture for the target
+ *
+ * @param sdk the SDK
+ * @param target the target name
+ */
+ String getArchitecture(IScratchboxSDK sdk, IPath sdkTargetRoot, String target);
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1FileSystemMapping.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1FileSystemMapping.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1FileSystemMapping.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,66 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import com.nokia.cpp.internal.api.utils.core.Pair;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.internal.api.core.machine.FileSystemMapping;
+
+import java.util.List;
+
+/**
+ * Represent the mappings from the machine to a Scratchbox 1 target running on the machine.
+ * This represents the direct mappings with all softlinks resolved (so, not "/scratchbox/users/user/usr"
+ * but "/scratchbox/users/user/targets/CHINOOK_ARMEL/usr")
+ * @author eswartz
+ *
+ */
+public class Scratchbox1FileSystemMapping extends FileSystemMapping {
+
+ /**
+ * Construct with default Linux path canonicalizers and add mappings for paths
+ * known to be mapped.
+ * @param targetRoot
+ * @param target
+ */
+ public Scratchbox1FileSystemMapping(IPath scratchboxBase, String target, String user) {
+
+ super(FileSystemMapping.getMachineCanonicalizer(true), FileSystemMapping.getMachineCanonicalizer(true));
+
+ List<Pair<IPath, IPath>> mappings = getHostToTargetRootMappings();
+ mappings.clear();
+
+ // directories that are the same for all targets
+ String[] topLevelDirs = {
+ "dev", "home", "host_usr", "proc", "scratchbox", "sys", "targets"
+ };
+
+ IPath sharedBase = scratchboxBase;
+ map(mappings, sharedBase, new Path("/"));
+ for (String topLevelDir : topLevelDirs) {
+ map(mappings, sharedBase.append(topLevelDir), new Path(topLevelDir).makeAbsolute());
+ }
+
+ // directories that depend on the current target
+ String[] topLevelLinks = {
+ "bin", "boot", "cdrom", "etc", "floppy", "initrd",
+ "lib", "media", "mnt", "opt", "root", "sbin", "srv", "usr", "var"
+ };
+
+ IPath perTargetBase = scratchboxBase.append("targets").append(target);
+ for (String topLevelDir : topLevelLinks) {
+ map(mappings, perTargetBase.append(topLevelDir), new Path(topLevelDir).makeAbsolute());
+ }
+
+ setHostToTargetRootMappings(mappings);
+ }
+
+ private void map(List<Pair<IPath, IPath>> mappings, IPath from, IPath to) {
+ mappings.add(new Pair<IPath, IPath>(from, to));
+ }
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1ProcessLauncher.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1ProcessLauncher.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1ProcessLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.provider.FileInfo;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxTargetSwitcher;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.*;
+
+/**
+ * For SB 1, we need to use a "run.sh" wrapper script. The
+ * login program does not conserve variables set outside
+ * unless "-k" is passed, but we don't want to use that anyway,
+ * in order to have a clean SB environment.
+ * @author eswartz
+ *
+ */
+public class Scratchbox1ProcessLauncher extends BaseProcessLauncher implements
+ IProcessLauncher {
+
+ private ISDKTarget sdkTarget;
+ private List<String> originalArguments;
+
+ public Scratchbox1ProcessLauncher(
+ ISDKTarget sdkTarget,
+ IPath workingDirectory,
+ List<String> cmdLine, Properties environment) {
+ // in SB 1, the working directory, executable, args, and environment
+ // are encoded in a single command to a wrapper script
+ super(encodeArgumentArray(sdkTarget, workingDirectory,
+ cmdLine,
+ environment),
+ null,
+ null,
+ sdkTarget);
+ if (sdkTarget == null)
+ throw new IllegalArgumentException();
+ this.sdkTarget = sdkTarget;
+ this.originalArguments = cmdLine;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoPrefix()
+ */
+ @Override
+ protected String getLaunchInfoPrefix() {
+ return sdkTarget + " ";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoStandardEnvironment()
+ */
+ @Override
+ protected Map<String, String> getLaunchInfoStandardEnvironment() {
+ return sdkTarget.getSDK().getMachine().getStandardEnvironment();
+ }
+
+ @Override
+ public String getCommandLineString() {
+ return CommandLineArguments.toCommandLine(originalArguments);
+ }
+
+ private static List<String> encodeArgumentArray(ISDKTarget sdkTarget,
+ IPath workingDirectory,
+ List<String> cmdLine,
+ Properties environment) {
+
+ // get the location where the launcher script will be copied on the target
+ String runScriptLocation = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.RUN_SCRIPT_LOC);
+
+ // encode working directory inside scratchbox
+ if (workingDirectory == null) {
+ workingDirectory = new Path("/");
+ }
+
+ // get complete environment to play with
+ Properties fullEnv = new Properties();
+ if (environment != null) {
+ fullEnv.putAll(environment);
+ }
+
+ // sort environment variables, since no longer done in run.sh
+ List<String> envArgs = EnvironmentProperties.createEnvpList(fullEnv, true);
+
+ // ensure SOMETHING is exported, or else run.sh fails
+ if (envArgs.isEmpty()) {
+ envArgs.add("_DUMMY="); //$NON-NLS-1$
+ }
+
+ // Encode the launch command by replacing the arguments
+ // representing template arguments with the actual values.
+ //
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+
+ substitutor.define("RUN_SCRIPT_DIRECTORY", runScriptLocation);
+ substitutor.define("DIRECTORY", workingDirectory.toPortableString());
+
+ String exportsString = CommandLineArguments.toString(envArgs, ",", false); //$NON-NLS-1$
+
+ substitutor.define("EXPORTS", exportsString);
+ substitutor.define("COMMAND", cmdLine.get(0));
+ substitutor.define("ARGS", CommandLineArguments.toCommandLine(cmdLine.subList(1, cmdLine.size())));
+
+ // get the Scratchbox invocation pattern
+ String commandPattern = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SB1_LOGIN_COMMAND);
+
+ // replace variables
+ commandPattern = substitutor.substitute(commandPattern);
+
+ List<String> commandArgs = CommandLineArguments.createFromCommandLine(commandPattern);
+ return commandArgs;
+ }
+
+
+ @Override
+ protected void setupForLaunch() throws ESboxException {
+ // first, be sure we're running under the current target
+ ScratchboxTargetSwitcher.ensureCurrentTarget(sdkTarget);
+
+ IFileStore runScriptLocation = sdkTarget.getMachineFileSystemAccess().getFileStore(new Path(
+ sdkTarget.getPreferenceValue(ESboxPreferenceConstants.RUN_SCRIPT_LOC)));
+ IFileStore runScript = runScriptLocation.getChild("run.sh");
+
+ if (!runScript.fetchInfo().exists()) {
+ try {
+ runScriptLocation.mkdir(EFS.NONE, null);
+
+ OutputStream os = null;
+ InputStream is = null;
+ try {
+ os = runScript.openOutputStream(EFS.OVERWRITE, null);
+ is = Activator.getPluginRelativeInputStream("./conf/run.sh");
+ byte[] content = new byte[8192];
+ int len;
+ while ((len = is.read(content)) > 0) {
+ os.write(content, 0, len);
+ }
+ } finally {
+ Policy.close(os);
+ Policy.close(is);
+ }
+
+ FileInfo info = new FileInfo();
+ info.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, true);
+ runScript.putInfo(info, EFS.NONE, null);
+
+ } catch (Exception e) {
+ throw (ScratchboxException) new ScratchboxException("Cannot copy run script to " + runScript).initCause(e);
+ }
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#doCreateProcess()
+ */
+ @Override
+ protected Process doCreateProcess() throws Exception {
+ return sdkTarget.getSDK().getMachine().createProcess(
+ getLaunchCurrentWorkingDirectory(), getLaunchCommandArguments(),
+ getLaunchEnvironment(), isUsePTY());
+ }
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1ProcessLauncherFactory.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1ProcessLauncherFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1ProcessLauncherFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.api.core.BaseProcessLauncherFactory;
+
+import java.util.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public class Scratchbox1ProcessLauncherFactory extends
+ BaseProcessLauncherFactory {
+
+ protected ISDKTarget sdkTarget;
+ private Properties standardEnv;
+ private final boolean runAsRoot;
+
+ public Scratchbox1ProcessLauncherFactory(ISDKTarget sdkTarget, boolean runAsRoot) {
+ super(false);
+ this.sdkTarget = sdkTarget;
+ this.runAsRoot = runAsRoot;
+ }
+
+ /**
+ * The standard environment *should* include the host environment if the Esbox
+ * environment setting is 'Append', but we don't want to pass these to sb1,
+ * ever.
+ */
+ protected Properties readStandardEnvironment() {
+ if (standardEnv == null) {
+ standardEnv = new Properties();
+
+ // don't use system environment; sb1 wants its own isolated context
+ mergeOrSetUserVariables(sdkTarget.getSDK().getMachine().getEnvironmentVariablePrefix(),
+ standardEnv, null);
+ }
+ return standardEnv;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncherFactory#createProcessLaunchHandler(org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath, org.maemo.esbox.core.List<String>, java.util.Properties)
+ */
+ protected IProcessLauncher doCreateProcessLaunchHandler(
+ IPath workingDirectory, List<String> cmdLine,
+ Properties environment) {
+
+ if (runAsRoot) {
+ cmdLine = new ArrayList<String>(cmdLine);
+ cmdLine.add(0, "fakeroot");
+ }
+ return new Scratchbox1ProcessLauncher(
+ sdkTarget,
+ workingDirectory, cmdLine,
+ environment != null ? environment : readStandardEnvironment());
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1SDK.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1SDK.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1SDK.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox1SDK;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * SDK for a Scratchbox 1.x environment
+ * @author eswartz
+ *
+ */
+public class Scratchbox1SDK extends ScratchboxSDK implements IScratchbox1SDK {
+
+ private IPath sdkRoot;
+ private IPreferenceProvider prefProvider;
+ private final IScratchboxSDKPlatformArchitectureProvider platformArchitectureProvider;
+
+ /**
+ * @param version
+ * @param name
+ */
+ public Scratchbox1SDK(
+ IMachine machine,
+ IScratchboxSDKPlatformArchitectureProvider platformArchitectureProvider,
+ String version,
+ IPreferenceProvider prefProvider) {
+ super(machine, version, NAME);
+ this.sdkRoot = null;
+ this.platformArchitectureProvider = platformArchitectureProvider;
+ this.prefProvider = prefProvider;
+ }
+
+ public void refresh() {
+ // populate targets
+ super.refresh();
+ try {
+ List<String> targetNames = getTargets();
+ List<ISDKTarget> newTargets = new ArrayList<ISDKTarget>();
+ for (String target : targetNames) {
+ IPath sb1TargetRoot = getSDKRoot().append("targets").append(target); //$NON-NLS-1$
+ ISDKTarget sdkTarget = new Scratchbox1SDKTarget(
+ this,
+ platformArchitectureProvider.getPlatform(this, sb1TargetRoot, target),
+ platformArchitectureProvider.getArchitecture(this, sb1TargetRoot, target),
+ target,
+ sb1TargetRoot);
+ newTargets.add(sdkTarget);
+ }
+ this.targets = newTargets;
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logError("Could not refresh targets", e);
+ }
+ }
+
+ public synchronized IPath getSDKRoot() {
+ if (sdkRoot == null) {
+ String userPath = prefProvider.getPreferenceValue(ESboxPreferenceConstants.SB1_SBOX_SANDBOX);
+ sdkRoot = new Path(userPath);
+
+ /*
+ // ensure this is canonical
+ try {
+ sdkRoot = new Path(sdkRoot.toFile().getCanonicalPath());
+ } catch (IOException e) {
+ Activator.getErrorLogger().logError("Cannot canonicalize scratchbox installation path", e);
+ }
+ */
+ }
+ return sdkRoot;
+ }
+
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return prefProvider.getPreferenceValue(key);
+ }
+
+
+ /**
+ * Return the list of available targets in Scratchbox.
+ *
+ * @return a list with the available targets in Scratchbox.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ private List<String> getTargets() throws ESboxException {
+ return ScratchboxFacade.getInstance().getTargets(this);
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1SDKTarget.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1SDKTarget.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox1SDKTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.ISDKPlatform;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox1SDKTarget;
+
+/**
+ * SDK target for a Scratchbox 1.x environment
+ *
+ * @author eswartz
+ *
+ */
+public class Scratchbox1SDKTarget extends BaseScratchboxSDKTarget implements IScratchbox1SDKTarget {
+
+ private IPath targetRoot;
+
+ /**
+ * @param version
+ * @param name
+ */
+ public Scratchbox1SDKTarget(Scratchbox1SDK sdk,
+ ISDKPlatform platform,
+ String architecture, String target,
+ IPath targetRoot) {
+ super(sdk, platform, architecture, target);
+ this.targetRoot = targetRoot;
+ init(new Scratchbox1FileSystemMapping(sdk.getSDKRoot(), target,
+ sdk.getPreferenceValue(ESboxPreferenceConstants.USER))
+ //,new AptPackageManager(this)
+ );
+ }
+
+ public IPath getSDKTargetRoot() {
+ return targetRoot;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.ISDKTarget#createProcessLauncher()
+ */
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return new Scratchbox1ProcessLauncherFactory(this, false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.scratchbox.sdk.IScratchboxSDKTarget#getProcessLauncherFactoryForInstall()
+ */
+ public IProcessLauncherFactory getProcessLauncherFactoryForInstall() {
+ return new Scratchbox1ProcessLauncherFactory(this, true);
+ }
+
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return getSDK().getPreferenceValue(key);
+ }
+
+ public IPath getRootstrapPath() {
+ // Rootstrap path is just the TargetRoot like this:
+ // /scratchbox/users/maemo/targets/CHINOOK_ARMEL
+ return getSDKTargetRoot();
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2FileSystemMapping.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2FileSystemMapping.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2FileSystemMapping.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,77 @@
+/**
+ * (c) 2008 Nokia
+ */
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import com.nokia.cpp.internal.api.utils.core.Pair;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.api.core.machine.FileSystemMapping;
+import org.maemo.esbox.internal.api.core.machine.IFileSystemMappingImpl;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox2SDKTarget;
+
+import java.util.*;
+
+/**
+ * Represent the mappings from the machine to a Scratchbox 2 target running on the machine.
+ * This represents the direct mappings with all softlinks resolved.
+ * @author eswartz
+ *
+ */
+public class Scratchbox2FileSystemMapping extends FileSystemMapping implements
+ IFileSystemMappingImpl {
+ /**
+ * Construct with default path canonicalizers and add mappings for paths
+ * known to be mapped.
+ * @param targetRoot
+ * @param target
+ */
+ public Scratchbox2FileSystemMapping(IScratchbox2SDKTarget sdkTarget, IPath scratchboxBase, String target, String user) {
+
+ super(FileSystemMapping.getMachineCanonicalizer(true), FileSystemMapping.getMachineCanonicalizer(true));
+
+ List<Pair<IPath, IPath>> mappings = getHostToTargetRootMappings();
+ mappings.clear();
+
+ // directories we're interested in
+ String[] topLevelDirs = {
+ "/dev", "/home", "/proc", "/sys", "/targets",
+ "/bin", "/boot", "/cdrom", "/etc", "/floppy", "/initrd",
+ "/lib", "/media", "/mnt", "/opt", "/root", "/sbin", "/srv", "/usr", "/var",
+
+ // things get messier, so be more specific
+ "/var/cache/apt", "/usr/include", "/usr/lib", "/usr/local/include", "/usr/local/lib",
+ "/usr/X11R6", "/usr/local", "/home/user",
+ };
+
+ List<IPath> topLevelPaths = new ArrayList<IPath>();
+ topLevelPaths.add(new Path("/"));
+ for (String topLevelDir : topLevelDirs) {
+ topLevelPaths.add(new Path(topLevelDir));
+ }
+
+ Map<IPath, IPath> pathMapping = null;
+ try {
+ pathMapping = ScratchboxFacade.getInstance().getSb2PathMapping(
+ sdkTarget, topLevelPaths);
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logError("Unable to map Scratchbox 2 paths", e);
+ return;
+ }
+
+ for (Map.Entry<IPath, IPath> entry : pathMapping.entrySet()) {
+ map(mappings, entry.getValue(), entry.getKey());
+ }
+
+ setHostToTargetRootMappings(mappings);
+ }
+
+ private void map(List<Pair<IPath, IPath>> mappings, IPath from, IPath to) {
+ mappings.add(new Pair<IPath, IPath>(from, to));
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2ProcessLauncher.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2ProcessLauncher.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2ProcessLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+import java.util.*;
+
+/**
+ * For SB 2, launching is easy and follows the same pattern as a normal
+ * program invocation.
+ * @author eswartz
+ *
+ */
+public class Scratchbox2ProcessLauncher extends BaseProcessLauncher implements
+ IProcessLauncher {
+
+ private ISDKTarget sdkTarget;
+
+ public Scratchbox2ProcessLauncher(
+ ISDKTarget sdkTarget,
+ IPath workingDirectory,
+ List<String> cmdLine,
+ Properties environment,
+ ESboxPreferenceConstants modeKey, boolean runAsRoot) {
+ super(encodeArgumentArray(sdkTarget, cmdLine, modeKey), environment, workingDirectory,
+ sdkTarget);
+ if (runAsRoot) {
+ getLaunchCommandArguments().add(0, "sudo");
+ }
+ if (sdkTarget == null)
+ throw new IllegalArgumentException();
+ this.sdkTarget = sdkTarget;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoPrefix()
+ */
+ @Override
+ protected String getLaunchInfoPrefix() {
+ return sdkTarget + " ";
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#getLaunchInfoStandardEnvironment()
+ */
+ @Override
+ protected Map<String, String> getLaunchInfoStandardEnvironment() {
+ return sdkTarget.getSDK().getMachine().getStandardEnvironment();
+ }
+
+ private static List<String> encodeArgumentArray(
+ ISDKTarget sdkTarget,
+ List<String> cmdLine,
+ ESboxPreferenceConstants modeKey) {
+
+ // Encode the launch command by replacing the arguments
+ // representing template arguments with the actual values.
+ //
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+
+ substitutor.define("TARGET", sdkTarget.getName());
+ substitutor.define("COMMAND", cmdLine.get(0));
+ substitutor.define("ARGS", CommandLineArguments.toCommandLine(cmdLine.subList(1, cmdLine.size())));
+
+ String level = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SB2_LOG_LEVEL);
+ if (level.length() > 0) {
+ substitutor.define("LOG_OPTION", "-L " + level);
+ } else {
+ substitutor.define("LOG_OPTION", "");
+ }
+
+ String mapMode = sdkTarget.getPreferenceValue(modeKey);
+ substitutor.define("MAPPING_MODE", mapMode);
+
+ // get the Scratchbox invocation pattern
+ String commandPattern = sdkTarget.getPreferenceValue(ESboxPreferenceConstants.SB2_EXEC_COMMAND);
+
+ // replace variables
+ commandPattern = substitutor.substitute(commandPattern);
+
+ List<String> commandArgs = CommandLineArguments.createFromCommandLine(commandPattern);
+ return commandArgs;
+ }
+
+ @Override
+ protected void setupForLaunch() throws ScratchboxException {
+ // nothing
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.BaseProcessLauncher#doCreateProcess()
+ */
+ @Override
+ protected Process doCreateProcess() throws Exception {
+ return sdkTarget.getSDK().getMachine().createProcess(
+ getLaunchCurrentWorkingDirectory(), getLaunchCommandArguments(),
+ getLaunchEnvironment(), isUsePTY());
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2ProcessLauncherFactory.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2ProcessLauncherFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2ProcessLauncherFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.EnvironmentProperties;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.api.core.BaseProcessLauncherFactory;
+
+import java.util.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public class Scratchbox2ProcessLauncherFactory extends
+ BaseProcessLauncherFactory {
+
+ protected ISDKTarget sdkTarget;
+ private Properties standardEnv;
+ private ESboxPreferenceConstants mappingModeKey;
+ private final boolean runAsRoot;
+
+ /**
+ * Create a factory and specify whether it is creating commands in build
+ * mode (sb2 -m maemo) or installation mode (sb2 -e)
+ * @param sdkTarget
+ * @param isBuildMode true: build mode, false: installation mode
+ */
+ public Scratchbox2ProcessLauncherFactory(ISDKTarget sdkTarget, ESboxPreferenceConstants mappingModeKey, boolean runAsRoot) {
+ super(false);
+ if (sdkTarget == null)
+ throw new IllegalArgumentException();
+ this.sdkTarget = sdkTarget;
+ this.mappingModeKey = mappingModeKey;
+ this.runAsRoot = runAsRoot;
+ }
+
+ protected Properties readStandardEnvironment() {
+ if (standardEnv == null) {
+ standardEnv = new Properties();
+
+ Map<String, String> env = sdkTarget.getSDK().getMachine().getStandardEnvironment();
+ mergeOrSetUserVariables(sdkTarget.getSDK().getMachine().getEnvironmentVariablePrefix(),
+ standardEnv, env);
+ }
+ return standardEnv;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncherFactory#createProcessLaunchHandler(org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath, org.maemo.esbox.core.List<String>, java.util.Properties)
+ */
+ protected IProcessLauncher doCreateProcessLaunchHandler(
+ IPath workingDirectory, List<String> cmdLine,
+ Properties environment) {
+
+ return new Scratchbox2ProcessLauncher(
+ sdkTarget,
+ workingDirectory, cmdLine,
+ augmentEnvironment(environment),
+ mappingModeKey,
+ runAsRoot);
+ }
+
+ /**
+ * sbox2 depends on some variables always existing, so avoid attempts
+ * to run without them.
+ * @param environment
+ * @return possibly modified environment
+ */
+ private Properties augmentEnvironment(Properties environment) {
+ // if no env, then default is used anyway
+ if (environment == null)
+ return null; //readStandardEnvironment();
+
+ if (environment.containsKey("HOME") && environment.containsKey("SBOX_DIR"))
+ return environment;
+
+ Properties augmented = EnvironmentProperties.copyProperties(environment);
+
+ // avoid spurious nil dereferences
+ Object homeDir = getStandardEnvironment().get("HOME");
+ if (homeDir != null)
+ augmented.put("HOME", homeDir);
+ else
+ augmented.put("HOME", "/home/" + sdkTarget.getPreferenceValue(ESboxPreferenceConstants.USER));
+ Object sboxDir = getStandardEnvironment().get("SBOX_DIR");
+ if (sboxDir != null)
+ augmented.put("SBOX_DIR", sboxDir.toString());
+ else
+ augmented.put("SBOX_DIR", "");
+
+ return augmented;
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2SDK.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2SDK.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2SDK.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox2SDK;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * SDK target for a Scratchbox 2 environment
+ * @author eswartz
+ *
+ */
+public class Scratchbox2SDK extends ScratchboxSDK implements IScratchbox2SDK {
+
+ private static final IPath ROOT_PATH = new Path("/");
+ private IPreferenceProvider prefProvider;
+ private final IScratchboxSDKPlatformArchitectureProvider platformArchitectureProvider;
+
+ /**
+ * @param version
+ * @param name
+ */
+ public Scratchbox2SDK(
+ IMachine machine,
+ IScratchboxSDKPlatformArchitectureProvider platformArchitectureProvider,
+ String version, IPreferenceProvider prefProvider) {
+ super(machine, version, NAME);
+ this.platformArchitectureProvider = platformArchitectureProvider;
+ this.prefProvider = prefProvider;
+ }
+
+ public void refresh() {
+ // populate targets
+ super.refresh();
+
+ List<String> targetNames;
+ try {
+ targetNames = getTargets();
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logError("Could not refresh targets", e);
+ return;
+ }
+ List<ISDKTarget> newTargets = new ArrayList<ISDKTarget>();
+ for (String target : targetNames) {
+ // ignore this one, left behind by errant rootstrap installations
+ if (target.equals("libtool_build"))
+ continue;
+ IPath config = getScratchbox2ConfigDirectory();
+ IPath sb2BasePath = config.append(target);
+ Scratchbox2SDKTarget sdkTarget = new Scratchbox2SDKTarget(this,
+ platformArchitectureProvider.getPlatform(this, sb2BasePath, target),
+ platformArchitectureProvider.getArchitecture(this, sb2BasePath, target),
+ target,
+ sb2BasePath);
+ newTargets.add(sdkTarget);
+
+ try {
+ IPath sb2RootstrapPath = ScratchboxFacade.getInstance().getMaemoRootstrapPath(sdkTarget);
+ sdkTarget.setRootstrapPath(sb2RootstrapPath);
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logError(null, e);
+ }
+
+ }
+ this.targets = newTargets;
+ }
+
+ public IPath getSDKRoot() {
+ return ROOT_PATH;
+ }
+
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return prefProvider.getPreferenceValue(key);
+ }
+
+
+ /**
+ * Return the list of available targets in Scratchbox.
+ *
+ * @return a list with the available targets in Scratchbox.
+ * @throws ScratchboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ private List<String> getTargets() throws ESboxException {
+ return ScratchboxFacade.getInstance().getTargets(this);
+ }
+
+ public IPath getScratchbox2ConfigDirectory() {
+ String userName = prefProvider.getPreferenceValue(ESboxPreferenceConstants.USER);
+ if (userName.length() == 0)
+ userName = "ubuntu";
+ return new Path("home").append(userName).append(".scratchbox2").makeAbsolute();
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2SDKTarget.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2SDKTarget.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/Scratchbox2SDKTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.ISDKPlatform;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox2SDKTarget;
+
+/**
+ * SDK target for a Scratchbox 2 environment
+ *
+ * @author eswartz
+ *
+ */
+public class Scratchbox2SDKTarget extends BaseScratchboxSDKTarget implements IScratchbox2SDKTarget {
+ private IPath targetRoot;
+ private IPath rootstrapRoot;
+
+ /**
+ * @param version
+ * @param name
+ */
+ public Scratchbox2SDKTarget(Scratchbox2SDK scratchbox2SDK,
+ ISDKPlatform platform,
+ String architecture, String target,
+ IPath targetRoot) {
+ super(scratchbox2SDK, platform, architecture, target);
+ if (targetRoot == null)
+ throw new IllegalArgumentException();
+ this.targetRoot = targetRoot;
+ init(new Scratchbox2FileSystemMapping(this, targetRoot, target,
+ scratchbox2SDK.getPreferenceValue(ESboxPreferenceConstants.USER))
+ //,new AptPackageManager(this)
+ );
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKTarget#getSDKTargetRoot()
+ */
+ public IPath getSDKTargetRoot() {
+ return targetRoot;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.maemo.esbox.core.ISDKTarget#createProcessLauncher()
+ */
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ // default is build mode
+ return new Scratchbox2ProcessLauncherFactory(this, ESboxPreferenceConstants.SB2_MAPPING_MODE, false);
+ }
+
+ public IProcessLauncherFactory getProcessLauncherFactoryForInstall() {
+ // install mode needs to be a different mapping and also run as root
+ return new Scratchbox2ProcessLauncherFactory(this, ESboxPreferenceConstants.SB2_INSTALL_MAPPING_MODE, true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.IPreferenceProvider#getPreferenceValue(org.maemo.esbox.core.ESboxPreferenceConstants)
+ */
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return getSDK().getPreferenceValue(key);
+ }
+
+ public IPath getRootstrapPath() {
+ return rootstrapRoot;
+ }
+
+ /** Not API! The targets should be refreshed from ISDK#refresh() */
+ void setRootstrapPath(IPath rootstrapPath) {
+ this.rootstrapRoot = rootstrapPath;
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/ScratchboxSDK.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/ScratchboxSDK.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/ScratchboxSDK.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk;
+
+import org.maemo.esbox.core.machine.ILocalMachine;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.internal.api.core.sdk.BaseSDK;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+
+/**
+ * SDK for a Scratchbox environment
+ * @author eswartz
+ *
+ */
+public abstract class ScratchboxSDK extends BaseSDK implements IScratchboxSDK {
+
+ public ScratchboxSDK(IMachine machine, String version, String name) {
+ super(machine, version, name);
+ }
+
+ private String cachedCurrentTarget;
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDK#refresh()
+ */
+ public void refresh() {
+ cachedCurrentTarget = null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.scratchbox.sdk.IScratchboxSDK#getCachedCurrentTarget()
+ */
+ public String getCachedCurrentTarget() {
+ // not (too) expensive to re-check, so don't invoke a process
+ if (getMachine() instanceof ILocalMachine)
+ return null;
+ return cachedCurrentTarget;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.scratchbox.sdk.IScratchboxSDK#setCachedCurrentTarget(java.lang.String)
+ */
+ public void setCachedCurrentTarget(String currentTarget) {
+ cachedCurrentTarget = currentTarget;
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/providers/Scratchbox1SDKProvider.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/providers/Scratchbox1SDKProvider.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/providers/Scratchbox1SDKProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk.providers;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineRegistry;
+import org.maemo.esbox.core.maemosdk.MaemoSDKEngine;
+import org.maemo.esbox.core.maemosdk.MaemoSDKInfo;
+
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.api.core.sdk.BaseSDKPlatform;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.internal.maemosdk.core.sdk.IScratchboxSDKPlatformArchitectureProvider;
+import org.maemo.esbox.internal.maemosdk.core.sdk.Scratchbox1SDK;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This implementation of the SDK provider searches for SB1
+ * targets using the 'sb-conf list --targets' command.
+ * If any aspect of SB1 communication fails, we assume SB1
+ * is not installed.
+ * @author eswartz
+ *
+ */
+public class Scratchbox1SDKProvider implements ISDKProvider, IScratchboxSDKPlatformArchitectureProvider {
+
+ // only 1.0.x+ supported right now
+ private static final String SCRATCHBOX_VERSION_PATTERN = "1\\.\\d+\\..*"; //$NON-NLS-1$
+
+ /**
+ *
+ */
+ public Scratchbox1SDKProvider() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKProvider#createSDKs()
+ */
+ public List<ISDK> createSDKs() throws ESboxException {
+ ErrorLogger logger = Activator.getErrorLogger();
+
+ List<ISDK> sdks = new ArrayList<ISDK>();
+ for (IMachine machine : MachineRegistry.getInstance().getBuildMachines()) {
+ try {
+ IPreferenceProvider prefProvider = null;
+ if (Activator.getDefault() != null) {
+ prefProvider = new PreferenceProvider(machine, CorePlugin.getDefault().getPreferenceStore());
+ } else {
+ prefProvider = new PreferenceProvider(null, new Preferences());
+ }
+ Scratchbox1SDK sdk = getMachineSDKs(prefProvider, machine);
+ if (sdk != null) {
+ sdks.add(sdk);
+ sdk.refresh();
+ }
+ } catch (ScratchboxException e) {
+ logger.log(IStatus.INFO, "Problem scanning Scratchbox 1 installation", e);
+ }
+ }
+
+ ScratchboxFacade.getInstance().saveCachedData();
+
+ return sdks;
+ }
+
+ /**
+ * @param prefProvider
+ * @return
+ * @throws ScratchboxException
+ */
+ private Scratchbox1SDK getMachineSDKs(IPreferenceProvider prefProvider,
+ IMachine machine)
+ throws ESboxException {
+ ErrorLogger logger = Activator.getErrorLogger();
+
+ // make sure the machine is running first
+ if (!machine.isAlive()) {
+ return null;
+ }
+
+ // only support one Scratchbox 1.x installation
+ String version = ScratchboxFacade.getInstance().getCurrentSbox1Version(machine);
+ if (version == null) {
+ // no scratchbox?
+ return null;
+ }
+
+ if (!version.matches(SCRATCHBOX_VERSION_PATTERN)) {
+ logger.logError(
+ MessageFormat.format(
+ "Only Scratchbox 1.x is supported (detected {0}); disabling Scratchbox 1 support",
+ version),
+ null);
+ return null;
+ }
+
+ Scratchbox1SDK sdk = new Scratchbox1SDK(
+ machine,
+ this,
+ version,
+ prefProvider);
+
+ return sdk;
+ }
+
+ public ISDKPlatform getPlatform(IScratchboxSDK sdk, IPath sdkTargetRoot, String target) {
+ // convention says this is the part of the target before the underscore,
+ // usually the name of the platform directly, except for aberrant 'SDK' cases
+ int idx = target.lastIndexOf('_');
+ String platformName = ISDKPlatform.NAME_UNKNOWN;
+ String version = ISDKPlatform.VERSION_UNKNOWN;
+ if (idx >= 1) {
+ String platform = target.substring(0, idx);
+ // the 'SDK' one is a hard nut to crack
+ if (!platform.equalsIgnoreCase("SDK")) {
+ platformName = platform.substring(0, 1).toUpperCase()
+ + platform.substring(1).toLowerCase();
+
+ List<MaemoSDKInfo> maemoSDKS = MaemoSDKEngine.getInstance().getMaemoSDKS();
+ for (MaemoSDKInfo info : maemoSDKS) {
+ if (info.getName().equalsIgnoreCase(platformName)) {
+ version = info.getVersion();
+ break;
+ }
+ }
+ } else {
+ // TODO: look at key files or versions to determine the
+ // platform from the SDK target contents
+ }
+ }
+ return new BaseSDKPlatform(platformName, version);
+ }
+
+ public String getArchitecture(IScratchboxSDK sdk, IPath sdkTargetRoot, String target) {
+ // convention says this is the part of the target after the underscore
+ int idx = target.lastIndexOf('_');
+ if (idx > 0)
+ return target.substring(idx + 1).toUpperCase();
+ else
+ return IScratchboxSDKTarget.ARCHITECTURE_UNKNOWN;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/providers/Scratchbox2SDKProvider.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/providers/Scratchbox2SDKProvider.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/maemosdk/core/sdk/providers/Scratchbox2SDKProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.maemosdk.core.sdk.providers;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineRegistry;
+
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.api.core.sdk.BaseSDKPlatform;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.internal.maemosdk.core.sdk.IScratchboxSDKPlatformArchitectureProvider;
+import org.maemo.esbox.internal.maemosdk.core.sdk.Scratchbox2SDK;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * This implementation of the SDK provider searches for SB2
+ * targets using the 'sb2-config -l' command.
+ * If any aspect of SB2 communication fails, we assume SB2
+ * is not installed.
+ * @author eswartz
+ *
+ */
+public class Scratchbox2SDKProvider implements ISDKProvider, IScratchboxSDKPlatformArchitectureProvider {
+
+ // this may need to be bumped once an official release is made
+ private static final String SCRATCHBOX_VERSION_PATTERN = "1\\.99\\..*"; //$NON-NLS-1$
+
+ /**
+ *
+ */
+ public Scratchbox2SDKProvider() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.sdk.ISDKProvider#createSDKs()
+ */
+ public List<ISDK> createSDKs() throws ESboxException {
+ ErrorLogger logger = Activator.getErrorLogger();
+
+
+ List<ISDK> sdks = new ArrayList<ISDK>();
+ for (IMachine machine : MachineRegistry.getInstance().getBuildMachines()) {
+ // will never find sbox on host (right?!)
+ if (machine.getOS().equals(Platform.OS_WIN32))
+ continue;
+
+ try {
+ IPreferenceProvider prefProvider = null;
+ if (Activator.getDefault() != null) {
+ prefProvider = new PreferenceProvider(machine, CorePlugin.getDefault().getPreferenceStore());
+ } else {
+ prefProvider = new PreferenceProvider(null, new Preferences());
+ }
+ Scratchbox2SDK sdk = getMachineSDK(prefProvider, machine);
+ if (sdk != null) {
+ sdks.add(sdk);
+ sdk.refresh();
+ }
+ } catch (ScratchboxException e) {
+ logger.log(IStatus.INFO, "Problem scanning Scratchbox 2 installation", e);
+ }
+ }
+
+ ScratchboxFacade.getInstance().saveCachedData();
+
+ return sdks;
+ }
+
+ /**
+ * @param logger
+ * @param prefProvider
+ * @param sdks
+ * @return
+ * @throws ScratchboxException
+ */
+ private Scratchbox2SDK getMachineSDK(
+ IPreferenceProvider prefProvider,
+ IMachine machine)
+ throws ESboxException {
+ ErrorLogger logger = Activator.getErrorLogger();
+
+ // make sure the machine is running first
+ if (!machine.isAlive()) {
+ return null;
+ }
+
+ // only support one Scratchbox 2 installation
+ String version = ScratchboxFacade.getInstance().getCurrentSbox2Version(machine);
+ if (version == null) {
+ // no scratchbox?
+ return null;
+ }
+
+ if (!version.matches(SCRATCHBOX_VERSION_PATTERN)) {
+ logger.logError(
+ MessageFormat.format(
+ "Only Scratchbox 2 version 1.99.x is supported (detected {0}); disabling Scratchbox 2 support",
+ version),
+ null);
+ return null;
+ }
+
+ Scratchbox2SDK sdk = new Scratchbox2SDK(
+ machine,
+ this,
+ version,
+ prefProvider);
+
+ return sdk;
+ }
+
+ private static Pattern TARGET_PLATFORM_VERSION_ARCHITECTURE_PATTERN =
+ Pattern.compile("([a-zA-Z_]+)(\\d+)_([a-zA-Z]+)");
+
+ public ISDKPlatform getPlatform(IScratchboxSDK sdk, IPath sdkTargetRoot, String target) {
+ // convention says this is the part of the target before the underscore,
+ // minus a version.
+ Matcher matcher = TARGET_PLATFORM_VERSION_ARCHITECTURE_PATTERN.matcher(target);
+ if (matcher.matches()) {
+ String name = matcher.group(1);
+ String platformName = name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
+ String versionInfo = matcher.group(2);
+ String version = ISDKPlatform.VERSION_UNKNOWN;
+ if (versionInfo.length() == 2)
+ version = versionInfo.substring(0, 1) + "." + versionInfo.substring(1, 2);
+ return new BaseSDKPlatform(platformName, version);
+ } else {
+ return new BaseSDKPlatform(ISDKPlatform.NAME_UNKNOWN, ISDKPlatform.VERSION_UNKNOWN);
+ }
+ }
+
+ public String getArchitecture(IScratchboxSDK sdk, IPath sdkTargetRoot, String target) {
+ // convention says this is the part of the target after the underscore
+ Matcher matcher = TARGET_PLATFORM_VERSION_ARCHITECTURE_PATTERN.matcher(target);
+ if (matcher.matches()) {
+ return matcher.group(3).toUpperCase();
+ } else {
+ return IScratchboxSDKTarget.ARCHITECTURE_UNKNOWN;
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/OldStyleProjectProperties.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/OldStyleProjectProperties.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/OldStyleProjectProperties.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.execEnv.*;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+import org.maemo.esbox.project.core.IProjectProperties;
+
+import java.text.MessageFormat;
+
+/**
+ * This class retrieves the old-style C/C++ or Python project properties stored in workspace metadata.
+ * @author eswartz
+ *
+ */
+public class OldStyleProjectProperties implements
+ IProjectProperties {
+ private static final String TARGET_NAME_ID = "org.indt.esbox.project.targetName";
+
+ private static final String SCRATCHBOX_VERSION_ID = "org.indt.esbox.project.scratchboxVersion";
+
+ private static final String EXECUTION_ENVIRONMENT_ID = "org.indt.esbox.project.execEnv";
+
+ static final QualifiedName targetNameProperty = new QualifiedName(TARGET_NAME_ID,"Scratchbox Target");
+
+ static final QualifiedName scratchboxVersionProperty = new QualifiedName(SCRATCHBOX_VERSION_ID,"Scratchbox Version");
+
+ static final QualifiedName executionEnvironmentProperty = new QualifiedName(EXECUTION_ENVIRONMENT_ID,"Execution Environment");
+
+ private IProject project;
+
+ public OldStyleProjectProperties(IProject project) {
+ this.project = project;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IPropertyAccess#read(java.lang.String)
+ */
+ private String readProperty(QualifiedName property) {
+ try {
+ return project.getPersistentProperty(property);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Could not read project property", e);
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IProjectProperties#getExecutionEnvironment()
+ */
+ public IExecutionEnvironment getExecutionEnvironment() {
+ IExecutionEnvironment execEnv = null;
+ String execEnvId = readProperty(executionEnvironmentProperty);
+ if (execEnvId == null) {
+ // XXX: this is compatibility behavior
+ //execEnvId = "org.maemo.esbox.maemosdk.core.execution_environment.maemo";
+ }
+ execEnv = ExecutionEnvironmentFactory.getInstance().findExecutionEnvironment(execEnvId);
+ if (execEnv == null) {
+ execEnv = new UnknownExecutionEnvironment();
+ }
+ return execEnv;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IProjectProperties#getExecutionEnvironmentId()
+ */
+ public String getExecutionEnvironmentId() {
+ return readProperty(executionEnvironmentProperty);
+ }
+
+ /**
+ * Get the SDK target (SDK + target name) for the project's configured SDK
+ * @return SDK target, never <code>null</code>
+ * @throws ESboxException if no target known
+ */
+ public ISDKTarget getSDKTarget() throws ESboxException {
+ if (!project.isOpen())
+ throw new ESboxException(
+ MessageFormat.format("Project ''{0}'' is not open",
+ project.getName()));
+
+ ISDK sdk = getSDK();
+ String targetName = getTargetName();
+
+ ISDKTarget target = sdk.findSDKTarget(targetName);
+ if (target == null) {
+ throw new ESboxException(
+ MessageFormat.format("Project ''{0}'' references an unavailable target ''{1}''",
+ project.getName(),
+ targetName));
+ }
+
+ return target;
+ }
+
+ /**
+ * Get the SDK for the project
+ * @return SDK, never <code>null</code>
+ * @throws ESboxException if no SDK known
+ */
+ public ISDK getSDK() throws ESboxException {
+ ISDK sdk = null;
+
+ String version = getScratchboxVersion(project);
+ if (version == null) {
+ // old projects
+ version = "1";
+ }
+ if (version.equals("1")) {
+ sdk = ScratchboxSDKFacade.getInstance().getScratchbox1SDK();
+ } else if (version.equals("2")) {
+ sdk = ScratchboxSDKFacade.getInstance().getScratchbox2SDK();
+ }
+ if (sdk == null) {
+ throw new ESboxException(
+ MessageFormat.format("Project ''{0}'' uses an unsupported scratchbox version {1}",
+ project.getName(),
+ version));
+ }
+
+ return sdk;
+ }
+
+ public synchronized String getTargetName() {
+ return readProperty(targetNameProperty);
+ }
+
+ public synchronized String getSDKName() {
+ String sboxVersion = readProperty(scratchboxVersionProperty);
+ if (sboxVersion == null)
+ return null;
+ if (sboxVersion.equals("1"))
+ return IScratchbox1SDK.NAME;
+ if (sboxVersion.equals("2"))
+ return IScratchbox2SDK.NAME;
+ return null;
+ }
+
+ public synchronized String getScratchboxVersion(IProject project) {
+ return readProperty(scratchboxVersionProperty);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/OldStyleWorkspaceProjectPropertiesProvider.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/OldStyleWorkspaceProjectPropertiesProvider.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/OldStyleWorkspaceProjectPropertiesProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.project.core.*;
+
+/**
+ * Implementation of oldStyleProjectPropertiesProvider to allow converting
+ * old projects to the current format.
+ * @author eswartz
+ *
+ */
+public class OldStyleWorkspaceProjectPropertiesProvider implements
+ IOldStyleProjectPropertiesProvider {
+
+ // NOTE: these nature IDs are stored here to avoid forcing this feature
+ // to depend on C/C++ or Python.
+ private static final String ESBOX_NATURE_ID = "org.indt.esbox.core.ESboxNature";
+ private static final String ESBOX_PYTHON_NATURE_ID = "org.indt.esbox.core.esboxPythonNature";
+
+ private boolean isNatureInProject(IProject _project, String id) {
+ if(_project != null && _project.isOpen()){
+ try {
+ IProjectNature nature = _project.getNature(id);
+ if(nature != null) {
+ return true;
+ }
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Cannot detect project nature", e);
+ }
+ }
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IOldStyleProjectPropertiesProvider#createProjectProperties(org.eclipse.core.resources.IProject)
+ */
+ public IProjectProperties createProjectProperties(IProject project) {
+ if (isNatureInProject(project, ESBOX_NATURE_ID)
+ || isNatureInProject(project, ESBOX_PYTHON_NATURE_ID))
+ return new OldStyleProjectProperties(project);
+ return null;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/ScratchboxPackageManagerProvider.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/ScratchboxPackageManagerProvider.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/ScratchboxPackageManagerProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core;
+
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.linux.packages.core.*;
+import org.maemo.esbox.linux.packages.core.aptpkgconfig.AptPackageManager;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+/**
+ * This implementation creates APT package managers for scratchbox targets.
+ * @author eswartz
+ *
+ */
+public class ScratchboxPackageManagerProvider implements
+ IPackageManagerProvider {
+
+ /**
+ *
+ */
+ public ScratchboxPackageManagerProvider() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.linux.packages.core.IPackageManagerProvider#createPackageManager(org.maemo.esbox.core.sdk.ISDKTarget)
+ */
+ public IPackageManager createPackageManager(ISDKTarget sdkTarget) {
+ if (!(sdkTarget instanceof IScratchboxSDKTarget))
+ return null;
+
+ // in sb2, apt commands must be run as root
+ IProcessLauncherFactory aptProcessLauncherFactory;
+ if (sdkTarget instanceof IScratchboxSDKTarget)
+ aptProcessLauncherFactory = ((IScratchboxSDKTarget) sdkTarget).getProcessLauncherFactoryForInstall();
+ else
+ aptProcessLauncherFactory = sdkTarget.getProcessLauncherFactory();
+
+ IProcessLauncherFactory pkgconfigProcessLauncherFactory =
+ sdkTarget.getProcessLauncherFactory();
+
+ IPackageManager manager = new AptPackageManager(sdkTarget,
+ aptProcessLauncherFactory,
+ pkgconfigProcessLauncherFactory);
+ return manager;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/ScratchboxPropertyTester.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/ScratchboxPropertyTester.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/ScratchboxPropertyTester.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,89 @@
+package org.maemo.esbox.maemosdk.core;
+
+import org.eclipse.core.expressions.IPropertyTester;
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox2SDKTarget;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.project.core.ProjectManager;
+
+/**
+ * Test properties of ESbox resources for use in UI filtering and activation
+ * <p>
+ * <li>isRemoteTarget -- tell if the current build target can be a remote target (e.g. ARM)
+ * <li>isEmulatorTarget -- tell if the current build target can be an emulator target
+ * <li>isX86Target -- tell if the current build target is an x86 target
+ * <li>isARMELTarget -- tell if the current build target is an ARMEL target
+ *
+ * @author eswartz
+ *
+ */
+public class ScratchboxPropertyTester extends PropertyTester implements
+ IPropertyTester {
+
+ protected IProject getProject(Object receiver) {
+ IResource rsrc = null;
+ if (receiver instanceof IResource) {
+ rsrc = (IResource) receiver;
+ } else if (receiver instanceof IAdaptable) {
+ rsrc = (IResource) (((IAdaptable) receiver).getAdapter(IResource.class));
+ }
+ if (rsrc == null)
+ return null;
+ return rsrc.getProject();
+ }
+
+ protected ISDKTarget getSDKTarget(IProject project) {
+ try {
+ return ProjectManager.getInstance().getSDKTarget(project);
+ } catch (ESboxException e) {
+ return null;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ public boolean test(Object receiver, String property, Object[] args,
+ Object expectedValue) {
+
+ IProject project = getProject(receiver);
+ if (project != null) {
+ // TODO: Avoid actually reading the project metadata to get the target
+ // since, for the first invocation in a new workspace, this can make a submenu
+ // close as it's being opened if we need to put up a progress dialog to
+ // initialize the SDKs.
+ //
+ ISDKTarget sdkTarget = getSDKTarget(project);
+ if (sdkTarget != null) {
+ boolean isSbox2 = sdkTarget instanceof IScratchbox2SDKTarget;
+ boolean isX86 = sdkTarget.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_X86);
+ boolean isARM = sdkTarget.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL);
+
+ if (property.equals("isEmulatorTarget")) {
+ // sb2 doesn't YET ship an x86 emulator
+ return !isSbox2 || isARM;
+ }
+
+ if (property.equals("isRemoteTarget")) {
+ return isARM;
+ }
+ if (property.equals("isX86Target")) {
+ return isX86;
+ }
+ if (property.equals("isARMELTarget")) {
+ return isARM;
+ }
+ }
+ }
+
+
+ return false;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/BaseScratchboxExecutionEnvironment.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/BaseScratchboxExecutionEnvironment.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/BaseScratchboxExecutionEnvironment.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core.execEnv;
+
+import org.maemo.esbox.core.execEnv.BaseExecutionEnvironment;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class BaseScratchboxExecutionEnvironment extends BaseExecutionEnvironment {
+ /** Base id for scratchbox execution environment ids */
+ public static final String SB_EXEC_ENV_BASE = Activator.PLUGIN_ID + ".execution_environment";
+
+ public BaseScratchboxExecutionEnvironment(String id, String name) {
+ super(id, name);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/GTKExecutionEnvironment.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/GTKExecutionEnvironment.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/GTKExecutionEnvironment.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core.execEnv;
+
+
+/**
+ * Environment for GTK applications in X11
+ * @author eswartz
+ *
+ */
+public class GTKExecutionEnvironment extends X11ExecutionEnvironment {
+ @SuppressWarnings("hiding")
+ public static final String ID = SB_EXEC_ENV_BASE + ".gtk";
+ public GTKExecutionEnvironment() {
+ super(ID, "GTK");
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/MaemoExecutionEnvironment.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/MaemoExecutionEnvironment.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/MaemoExecutionEnvironment.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core.execEnv;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ESboxScriptLauncher;
+import org.maemo.esbox.project.core.ProjectManager;
+
+/**
+ * Environment for Maemo applications
+ * @author eswartz
+ *
+ */
+public class MaemoExecutionEnvironment extends X11ExecutionEnvironment {
+ @SuppressWarnings("hiding")
+ public static final String ID = SB_EXEC_ENV_BASE + ".maemo";
+
+
+ public MaemoExecutionEnvironment() {
+ super(ID, "Maemo");
+ }
+
+ public MaemoExecutionEnvironment(String id, String name) {
+ super(id, name);
+ }
+
+
+ @Override
+ public void establishEnvironment(Shell shell, IProject project)
+ throws CoreException {
+ // see if Maemo is running
+ ISDKTarget sdkTarget;
+ try {
+ sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
+ if (!ESboxScriptLauncher.getInstance().isMaemoStarted(sdkTarget)) {
+ if (MessageDialog.openQuestion(shell, "Launch Maemo?",
+ "Maemo is not running. Would you like to launch it now?")) {
+ ESboxScriptLauncher.getInstance().startMaemo(sdkTarget);
+ }
+ }
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logAndShowError("Error querying Maemo status", e);
+ // don't fail the launch
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/X11ExecutionEnvironment.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/X11ExecutionEnvironment.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/execEnv/X11ExecutionEnvironment.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core.execEnv;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ESboxScriptLauncher;
+import org.maemo.esbox.project.core.ProjectManager;
+
+/**
+ * Environment for X11-based programs
+ * @author eswartz
+ *
+ */
+public class X11ExecutionEnvironment extends BaseScratchboxExecutionEnvironment {
+
+ /**
+ *
+ */
+ public static final String ID = SB_EXEC_ENV_BASE + ".x11";
+
+ public X11ExecutionEnvironment() {
+ super(ID, "X11");
+ }
+
+ public X11ExecutionEnvironment(String id, String name) {
+ super(id, name);
+ }
+
+ @Override
+ public void establishEnvironment(Shell shell, IProject project)
+ throws CoreException {
+ super.establishEnvironment(shell, project);
+
+ ISDKTarget sdkTarget;
+ try {
+ sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
+ } catch (ESboxException e1) {
+ throw new CoreException(Activator.createErrorStatus("Not an ESbox project: " + project, e1));
+ }
+
+ try {
+ if (!ESboxScriptLauncher.getInstance().isXServerStarted(sdkTarget)) {
+
+ if (MessageDialog.openQuestion(shell, "Launch X Server?",
+ "The X server is not running. Would you like to launch it now?")) {
+ ESboxScriptLauncher.getInstance().startX();
+ }
+ }
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logAndShowError("Error querying X status", e);
+ // don't fail the launch
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ESboxScriptLauncher.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ESboxScriptLauncher.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ESboxScriptLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,668 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core.scratchbox;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.*;
+
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.project.core.ProjectManager;
+
+import java.io.*;
+import java.util.List;
+
+/**
+ * Class handle all methods that needs some graphical environment.
+ * It invokes graphical thing that are ordered in window - preferences -
+ * Scratchbox preferences.
+ * @author kosola
+ * modified by Raul Fernandes Herbster
+ * modified by eswartz
+ */
+public class ESboxScriptLauncher {
+
+ private static ESboxScriptLauncher singleton = null;
+
+ /**
+ * Constructor
+ */
+ private ESboxScriptLauncher() {
+ }
+
+ public static synchronized ESboxScriptLauncher getInstance() {
+ if (singleton == null)
+ singleton = new ESboxScriptLauncher();
+ return singleton;
+ }
+
+ /**
+ * Method that start X-environment for Scratchbox
+ * @throws ScratchboxException
+ */
+ public void startX() throws ESboxException {
+
+ XLauncher.getInstance().startX(CorePlugin.getDefault().getCorePreferenceProvider());
+ }
+
+ /**
+ * Method that stop X-environment for Scratchbox
+ * @throws ScratchboxException
+ */
+ public void stopX(ISDKTarget sdkTarget) throws ESboxException {
+
+ if (sdkTarget != null && MaemoLauncher.getInstance().isMaemoRunning(sdkTarget))
+ throw new ESboxException("Maemo is still running. Stop Maemo first");
+
+ XLauncher.getInstance().stopX(CorePlugin.getDefault().getCorePreferenceProvider());
+ }
+
+ /**
+ * Kill all instances of a given process
+ * @param processName executable name
+ * @param processLabel the user-visible name for the process
+ * @throws ScratchboxException
+ */
+ public void killProcess(IMachine machine, String processName, String processLabel) throws ESboxException {
+
+ List<IProcess> processes = machine.getProcessLister().getProcesses(new ProcessFilterCmdLineRegexp(".*" + processName + ".*"));
+ for (IProcess process : processes) {
+ try {
+ process.terminate();
+ } catch (IOException e) {
+ throw new ESboxException("Error killing " + processName, e);
+ }
+ }
+ }
+
+ /**
+ * Method that run command autogen.sh for the project
+ * @param project
+ * @throws ESboxException
+ */
+ public void runAutogen(IProject project) throws ESboxException {
+ runAutogen(project, null, null);
+ }
+
+ /**
+ * Method that runs command autogen.sh and waits if a progress monitor
+ * is supplied.
+ *
+ * @param project
+ * @param monitor if null, do not wait; else wait and report progress through the monitor
+ * @param path if <code>null</code> use the project path, else override to run autogen elsewhere
+ * @return exit code, if monitor is not null
+ */
+ public int runAutogen(IProject project, IProgressMonitor monitor, IPath path) throws ESboxException {
+ ensureBuildMachine(project, null);
+ return runScript(path != null ? path : project.getLocation(),
+ "./autogen.sh", "Running automake script (autogen.sh) [" + project.getName() + "]",
+ "Error running script autogen.sh", monitor, project);
+ }
+
+ /**
+ * run ./configure for the project
+ *
+ * @param project
+ * @throws ESboxException
+ */
+ public void runConfigure(IProject project) throws ESboxException {
+ runConfigure(project, null, null);
+ }
+
+ /**
+ * Method that run command ./configure and wait if a progress monitor
+ * is supplied.
+ *
+ * @param project
+ * @param monitor if null, do not wait; else wait and report progress through the monitor
+ * @param path if <code>null</code>, use the project location, else override the directory
+ * @return exit code, if monitor is not null
+ * @throws ESboxException
+ */
+ public int runConfigure(IProject project, IProgressMonitor monitor, IPath path) throws ESboxException {
+ ensureBuildMachine(project, null);
+ return runScript(path != null ? path : project.getLocation(),
+ "./configure", "Running automake script (configure) [" + project.getName() + "]",
+ "Error running script configure", monitor, project);
+ }
+
+ /**
+ * This method ensures that a Makefile exists in the project, by running autogen or configure
+ * as needed. It also rebuilds Makefiles if configure has changed, or rebuilds configure
+ * if configure.ac or autogen.sh has changed.
+ *
+ * @param project
+ * @param monitor if null, do not wait; else wait and report progress through the monitor
+ * @param path if <code>null</code> use the project path, else override to run scripts elsewhere
+ * @param makefileName the name of the makefile to look for, or <code>null</code> for "Makefile"
+ */
+ public void runEstablishAutoMakefiles(IProject project, IProgressMonitor monitor, IPath path,
+ String makefileName) throws ESboxException {
+
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ monitor.beginTask("", 3);
+
+ // make sure machine is available
+ ensureBuildMachine(project, new SubProgressMonitor(monitor, 1));
+
+ if (path == null)
+ path = project.getLocation();
+
+ if (makefileName == null)
+ makefileName = "Makefile";
+
+ boolean triedToAutomake = false;
+
+ // XXX: the project is assumed to be visible to the remote machine, so we don't translate or use IFileStore here
+ File autogen_sh = path.append("autogen.sh").toFile();
+ File configure_ac = path.append("configure.ac").toFile();
+ File configure = path.append("configure").toFile();
+ File makefile_am = path.append(makefileName + ".am").toFile();
+ File makefile = path.append(makefileName).toFile();
+
+ boolean runAutogen = false;
+
+ if (autogen_sh.exists() &&
+ ((configure.exists() && autogen_sh.lastModified() > configure.lastModified())
+ || (makefile.exists() && autogen_sh.lastModified() > makefile.lastModified()))) {
+ // timestamps out of date (note: depend on last-generated files, not the _ac or _am
+ // ones, since autogen doesn't modify the _ac or _am files)
+ runAutogen = true;
+ } else if (configure_ac.exists() && configure.exists() && configure_ac.lastModified() > configure.lastModified()) {
+ // timestamps out of date
+ runAutogen = true;
+ } else if (configure_ac.exists() && !configure.exists()) {
+ // configure must be created
+ runAutogen = true;
+ }
+
+ boolean failedAutogen = false;
+ if (runAutogen) {
+ IProgressMonitor subMonitor = monitor != null ?
+ new SubProgressMonitor(monitor, 1) : new NullProgressMonitor();
+
+ // see if autogen.sh exists
+ if (autogen_sh.exists()) {
+ if (runAutogen(project, subMonitor, path) != 0) {
+ failedAutogen = true;
+ }
+ triedToAutomake = true;
+ } else if (configure_ac.exists()){
+ // run autoconf
+ if (runScript(path, "autoconf", "Running autoconf [" + project.getName() + "]",
+ "Error autoconfiguring project", subMonitor, project) != 0) {
+ failedAutogen = true;
+ }
+ triedToAutomake = true;
+ } else {
+ // um... either the logic is wrong or the user deleted the file in between
+ }
+ } else {
+ if (monitor != null)
+ monitor.worked(1);
+ }
+
+ boolean runConfigure = false;
+
+ if (!failedAutogen) {
+ if (configure.exists() && makefile.exists() && configure.lastModified() > makefile.lastModified()) {
+ // timestamps out of date
+ runConfigure = true;
+ } else if (makefile_am.exists() && makefile.exists() && makefile_am.lastModified() > makefile.lastModified()) {
+ // timestamps out of date
+ runConfigure = true;
+ } else if (configure.exists() && !makefile.exists()) {
+ // must create makefile
+ runConfigure = true;
+ }
+ }
+
+ boolean failedConfigure = false;
+
+ if (runConfigure) {
+ // run configure
+ IProgressMonitor subMonitor = monitor != null ?
+ new SubProgressMonitor(monitor, 1) : new NullProgressMonitor();
+
+ // configure exists, so run it
+ if (runConfigure(project, subMonitor, path) != 0) {
+ failedConfigure = true;
+ }
+ triedToAutomake = true;
+ } else {
+ if (monitor != null)
+ monitor.worked(1);
+ }
+
+
+ // final check
+ if (failedConfigure || failedAutogen) {
+ String message = "Autogen or configure ran with errors.\nCheck the Console for autotools messages.";
+ throw new ESboxException(message);
+
+ } else if (!makefile.exists()) {
+ String message = "Cannot find or create " + makefileName + " in project '" + project.getName() + "'.\n";
+ if (triedToAutomake)
+ message += "\nCheck the Console for autotools messages.";
+ throw new ESboxException(message);
+ }
+
+ monitor.done();
+
+ }
+
+ /**
+ * This doesn't invoke any code, but deletes any generated automake files
+ * so that they will be re-run in the future.
+ * @param project
+ */
+ public void resetAutomakeState(IProject project, String makefileName) {
+ if (makefileName == null)
+ makefileName = "Makefile";
+
+ // make sure the outside build state hasn't changed in the meantime
+ try {
+ project.refreshLocal(IProject.DEPTH_ONE, new NullProgressMonitor());
+ } catch (CoreException e1) {
+ Activator.getErrorLogger().logError("Error refreshing project", e1);
+ }
+
+ // see if generated files exist
+ IFile configure_ac = project.getFile("configure.ac");
+ IFile configure = project.getFile("configure");
+ IFile makefile = project.getFile(makefileName);
+
+ if (configure_ac.exists()) {
+ try {
+ // it is an automake project
+ if (configure.exists())
+ configure.delete(true, new NullProgressMonitor());
+ if (makefile.exists())
+ makefile.delete(true, new NullProgressMonitor());
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Error deleting generated automake files", e);
+ }
+ } else {
+ // hmm... touch the Makefile. This isn't nice for SCM but it's all we can do besides
+ // deleting the executable, which is no nicer.
+ if (makefile.exists()) {
+ try {
+ makefile.touch(new NullProgressMonitor());
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Error touching Makefile", e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Validate that the project appears to be an autotools or Makefile project.
+ * @param project
+ * @return true if some key files were found.
+ */
+ public boolean validateAutomakeState(IProject project, String makefileName) {
+ if (makefileName == null)
+ makefileName = "Makefile";
+
+ // see if generated files exist
+ IFile autogen_sh = project.getFile("autogen.sh");
+ IFile configure_ac = project.getFile("configure.ac");
+ IFile configure = project.getFile("configure");
+ IFile makefile = project.getFile(makefileName);
+
+ return autogen_sh.exists() || makefile.exists() || configure.exists() || configure_ac.exists();
+ }
+
+ /**
+ * Run 'scriptname' in 'path' location with 'wait' for 'project'.
+ * Once complete, refreshes the project.
+ * @param path
+ * @param scriptname the script, with "./" if needed
+ * @param comment
+ * @param errormessage
+ * @param monitor if not null, wait for progress to finish
+ * @param project
+ * @return exit code (if monitor is not null)
+ */
+ private int runScript(IPath path, String scriptname, final String comment,
+ String errormessage, IProgressMonitor monitor, final IProject project) throws ESboxException {
+ verifyFiles(new IPath[] { path.append(scriptname) });
+
+ IPath wd = path;
+
+ final ISDKTarget sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
+ IPath wdInScratchbox = sdkTarget.convertHostToTargetPath(wd);
+
+ IProcessLauncherFactory launcherFactory = sdkTarget.getProcessLauncherFactory();
+
+ final IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ launcherFactory, wdInScratchbox,
+ scriptname);
+
+ final Process process = processLauncher.createProcess();
+
+ final MessageConsole console = CorePlugin.getDefault().getConsole(
+ true,
+ sdkTarget,
+ comment);
+
+
+ if (monitor == null) {
+ WorkspaceJob job = new WorkspaceJob(comment) {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ monitor.beginTask("", 2);
+ monitor.subTask(comment);
+ try {
+ processLauncher.redirectToConsole(console);
+ try {
+ while (true) {
+ if (monitor.isCanceled()) {
+ process.destroy();
+ return Status.CANCEL_STATUS;
+ }
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ try {
+ process.exitValue();
+ break;
+ } catch (IllegalThreadStateException e) {
+ // still running
+ }
+ monitor.worked(1);
+ }
+ } finally {
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ } finally {
+ monitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.setRule(project);
+ job.schedule();
+ return -1;
+ } else {
+ final int[] exits = { -1 };
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+
+ public void run(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("", 2);
+ monitor.subTask(comment);
+ try {
+ OutputStream out = console.newOutputStream();
+ exits[0] = processLauncher.waitAndRead(out, out, new SubProgressMonitor(monitor, 1));
+ project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
+ } finally {
+ monitor.done();
+ }
+ }
+
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(
+ runnable,
+ project,
+ 0,
+ monitor);
+ } catch (OperationCanceledException e) {
+ // ignore
+ } catch (Exception e) {
+ throw new ESboxException(e);
+ }
+ return exits[0];
+ }
+ }
+
+ /**
+ * Create a job which will build a debian package in the project's directory. Waits for completion.
+ * @return IStatus status of build
+ */
+ public void createDebianPackage(final IProject project, IProgressMonitor monitor) throws ESboxException {
+ monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ monitor.subTask("Creating package");
+
+ IPath path = project.getLocation();
+
+ verifyFiles(new IPath[] { path.append("debian"),
+ path.append("debian/changelog"),
+ path.append("debian/control"),
+ path.append("debian/rules") });
+
+ ISDKTarget target = ProjectManager.getInstance().getSDKTarget(project);
+
+ IProcessLauncherFactory launcherFactory = target.getProcessLauncherFactory();
+
+ String cmd = "dpkg-buildpackage -rfakeroot -d";
+
+ // launch command inside Scratchbox
+ final IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ launcherFactory, target.convertHostToTargetPath(path),
+ CommandLineArguments.createFromCommandLine(cmd));
+
+ Process sbp = processLauncher.createProcess();
+
+ processLauncher.redirectToConsole(true, null, "Making Debian package [" + project.getName() + "]");
+
+ monitor.worked(1);
+
+ int exit;
+ try {
+ exit = waitForProcess(sbp, monitor);
+ if (exit != 0) {
+ throw new ESboxException("Package creation failed; see Console (exit code " + exit + ")");
+ }
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch (CoreException e) {
+ throw new ESboxException(e);
+ }
+ } catch (InterruptedException e1) {
+ throw new ESboxException("Package creation interrupted");
+ }
+
+ monitor.done();
+
+ }
+
+ /**
+ * Wait for a running process to complete, allowing user to cancel (which kills the process)
+ * @param process the process
+ * @param monitor a progress monitor
+ * @return exit code
+ * @throws InterruptedException if process is canceled
+ */
+ public int waitForProcess(Process process, IProgressMonitor monitor) throws InterruptedException {
+ while (true) {
+ // wait a while to avoid polling
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ throw e;
+ }
+
+ try {
+ // see if the process terminated yet
+ return process.exitValue();
+ } catch (IllegalThreadStateException e) {
+ // thrown by #exitValue() when not finished, good
+ }
+
+ // see if user canceled
+ if (monitor.isCanceled()) {
+ process.destroy();
+ throw new InterruptedException();
+ }
+ }
+ }
+
+ private void verifyFiles(IPath[] files) throws ESboxException {
+ for (IPath file : files) {
+ if (!file.toFile().exists())
+ throw new ESboxException("File " + file.toPortableString()
+ + " does not exist");
+ }
+ }
+
+ /**
+ * Build a Debian package in the background.
+ * @param project
+ */
+ public void runCreateDebianPackage(final IProject project) {
+ WorkspaceJob job = new WorkspaceJob("Creating Debian package") {
+
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ createDebianPackage(project, monitor);
+ } catch (ESboxException e) {
+ return Activator.createErrorStatus("Failed to create Debian package", e);
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
+ }
+
+ public boolean isMaemoStarted(ISDKTarget sdkTarget) {
+ try {
+ if (!isXServerStarted(sdkTarget))
+ return false;
+ } catch (ESboxException e1) {
+ }
+
+ try {
+ return MaemoLauncher.getInstance().isMaemoRunning(sdkTarget);
+ } catch (ESboxException e) {
+ Activator.getErrorLogger().logError("Cannot test maemo status", e);
+ return false;
+ }
+ }
+
+ public boolean isXServerStarted(IPreferenceProvider prefProvider) throws ESboxException {
+ return XLauncher.getInstance().isXServerStarted(prefProvider);
+ }
+
+ /** Get the name of the script that launches processes in a standalone manner.
+ * @param sdkTarget
+ * @return script name, never <code>null</code>
+ */
+ /*
+ public String getStandaloneScriptName(ISDKTarget sdkTarget) {
+ return "run-standalone.sh";
+ }
+ */
+
+ /**
+ * Tell if the target supports a "run-standalone" script.
+ * @param sdkTarget
+ * @return
+ */
+ /*
+ public boolean hasRunStandaloneScript(ISDKTarget sdkTarget) {
+ // XXX: do this better
+ if (sdkTarget == null)
+ return true;
+ return sdkTarget.getPlatform().getName().toLowerCase().matches("gregale|bora|chinook|diablo");
+ }
+ */
+
+ /** Stop Maemo if it is running. */
+ public void stopMaemo(ISDKTarget sdkTarget) throws ESboxException {
+ // maemo processes can still be running...
+ //if (!isXServerStarted(sdkTarget))
+ // throw new ScratchboxException("Cannot stop Maemo. Start X Server first");
+
+ MaemoLauncher.getInstance().stopMaemo(sdkTarget);
+ }
+
+ /**
+ * Start X and Maemo if it is not running.
+ * <p>
+ * This kills maemo if X is not running, since maemo may be left hanging is X is killed.
+ */
+ public void startMaemo(ISDKTarget sdkTarget) throws ESboxException {
+ if (!XLauncher.getInstance().isXServerStarted(sdkTarget)) {
+ MaemoLauncher.getInstance().killMaemo(sdkTarget);
+ }
+ XLauncher.getInstance().startXIfNeeded(sdkTarget);
+ if (XLauncher.getInstance().isXServerStarted(sdkTarget)) {
+ MaemoLauncher.getInstance().startMaemo(sdkTarget);
+ }
+ }
+
+ /**
+ * Restart X and Maemo if it is running.
+ * <p>
+ * This kills maemo if X is not running, since maemo may be left hanging is X is killed.
+ */
+ public void restartMaemo(ISDKTarget sdkTarget) throws ESboxException {
+ if (!XLauncher.getInstance().isXServerStarted(sdkTarget)) {
+ MaemoLauncher.getInstance().killMaemo(sdkTarget);
+ }
+ XLauncher.getInstance().startXIfNeeded(sdkTarget);
+
+ if (XLauncher.getInstance().isXServerStarted(sdkTarget)) {
+ MaemoLauncher.getInstance().restartMaemo(sdkTarget);
+ }
+ }
+
+ /** Kill maemo. Does not kill X.
+ */
+ public void killMaemo(ISDKTarget target) throws ESboxException {
+ MaemoLauncher.getInstance().killMaemo(target);
+ }
+
+
+ /**
+ * Make sure the build machine associated with the project is alive.
+ * This must be called from the UI thread or some other top-level caller,
+ * since it can deadlock.
+ * @param project
+ * @param monitor
+ */
+ public void ensureBuildMachine(IProject project,
+ IProgressMonitor monitor) throws ESboxException {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ ISDK sdk = ProjectManager.getInstance().getSDK(project);
+ if (sdk == null)
+ throw new ESboxException("Invalid SDK for project: " + project);
+ IMachine machine = sdk.getMachine();
+ IStatus status = MachineManager.getInstance().acquireMachine(machine, monitor);
+ if (!status.isOK())
+ throw new ESboxException(status.getMessage(), status.getException());
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoLauncher.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoLauncher.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial implementation
+ * Ed Swartz (Nokia) - adaptation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * This class maintains knowledge about whether maemo is running in
+ * a target and controls access to starting, stopping, and querying status.
+ * @author eswartz
+ *
+ */
+public class MaemoLauncher {
+
+ private static final String MAEMO_LAUNCHER_APP = "maemo-launcher";
+ private static MaemoLauncher instance;
+
+ public synchronized static MaemoLauncher getInstance() {
+ if (instance == null) {
+ instance = new MaemoLauncher();
+ }
+ return instance;
+ }
+
+ /**
+ * Test whether maemo is running. We look for 'maemo-launcher' in the process list.
+ * @param sdkTarget
+ * @return true if maemo process found
+ * @throws ESboxException if query is impossible
+ */
+ private boolean testMaemoLauncher(ISDKTarget sdkTarget) throws ESboxException {
+ List<IProcess> runningProcesses = getMaemoLaunchers(sdkTarget.getSDK().getMachine());
+ return runningProcesses.size() > 0;
+ }
+
+ private List<IProcess> getMaemoLaunchers(IMachine machine) {
+ // includes scratchbox call that launched maemo-launcher
+ List<IProcess> runningProcesses =
+ machine.getProcessLister().getProcesses(new ProcessFilterCmdLineRegexp(
+ ".*/"+MAEMO_LAUNCHER_APP+"\\s+.*"));
+ return runningProcesses;
+ }
+
+ /**
+ * Test whether maemo is started by testing the existence of the maemo-launcher daemon
+ * @param sdkTarget
+ * @return flag
+ */
+ public boolean isMaemoRunning(ISDKTarget sdkTarget) throws ESboxException {
+ return testMaemoLauncher(sdkTarget);
+ }
+
+ /**
+ * Start maemo if it's not running.
+ * @param sdkTarget
+ * @throws ESboxException if already running or cannot be started
+ */
+ public void startMaemo(ISDKTarget sdkTarget) throws ESboxException {
+ if (isMaemoRunning(sdkTarget))
+ throw new ScratchboxException("Maemo is already running");
+
+ ScratchboxFacade.getInstance().startMaemoCommand(sdkTarget);
+ }
+
+ /**
+ * Stop maemo if it's running
+ * @param sdkTarget
+ * @throws ESboxException if not running or cannot be stopped
+ */
+ public void stopMaemo(ISDKTarget sdkTarget) throws ESboxException {
+ // always try... may be half-initialized
+ //if (!isMaemoRunning(sdkTarget))
+ // throw new ScratchboxException("Maemo is not running, or failed to launch.");
+
+ ScratchboxFacade.getInstance().stopMaemoCommand(sdkTarget);
+ }
+
+ /**
+ * Restart maemo
+ * @param sdkTarget
+ * @throws ESboxException if cannot be restarted
+ */
+ public void restartMaemo(ISDKTarget sdkTarget) throws ESboxException {
+ ScratchboxFacade.getInstance().restartMaemoCommand(sdkTarget);
+ }
+
+ /**
+ * Kill maemo by forcibly killing instances of the launcher left behind
+ * @param sdkTarget
+ * @throws ESboxException
+ */
+ public void killMaemo(ISDKTarget sdkTarget) throws ESboxException {
+ List<IProcess> pids = getMaemoLaunchers(sdkTarget.getSDK().getMachine());
+ if (pids.size() == 0)
+ return;
+
+ try {
+ for (IProcess process : pids) {
+ process.terminate();
+ }
+ } catch (IOException e) {
+
+ }
+
+ // try again
+ pids = getMaemoLaunchers(sdkTarget.getSDK().getMachine());
+ if (pids.size() == 0)
+ return;
+
+ try {
+ for (IProcess process : pids) {
+ process.kill();
+ }
+ } catch (IOException e) {
+ throw new ESboxException("Could not kill " + MAEMO_LAUNCHER_APP, e);
+ }
+
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoRootstrap.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoRootstrap.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/MaemoRootstrap.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core.scratchbox;
+
+/**
+ * The data associated with a maemo SDK+ rootstrap
+ * @author eswartz
+ *
+ */
+public class MaemoRootstrap {
+ private final String name;
+ private final String architecture;
+ private final String description;
+
+ public MaemoRootstrap(String name, String architecture, String description) {
+ this.name = name;
+ this.architecture = architecture;
+ this.description = description;
+
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getArchitecture() {
+ return architecture;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((architecture == null) ? 0 : architecture.hashCode());
+ result = prime * result
+ + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final MaemoRootstrap other = (MaemoRootstrap) obj;
+ if (architecture == null) {
+ if (other.architecture != null)
+ return false;
+ } else if (!architecture.equals(other.architecture))
+ return false;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/PersistentCache.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/PersistentCache.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/PersistentCache.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core.scratchbox;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.Policy;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+
+import java.io.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This object stores (key, value) pairs for cached data which is expensive to compute.
+ * The keys are unique strings. Values are serializable objects.
+ * The cache is loaded and stored with the plugin.
+ * @author eswartz
+ *
+ */
+public class PersistentCache {
+
+ /**
+ * Default filename, under workspace metadata for this plugin's state, where
+ * the cache is stored.
+ */
+ private static final String SCRATCHBOX_CACHE_FILE = "scratchbox_cache.dat";
+
+ /**
+ * The environment variable which, if defined, overrides the file above.
+ * It should be a full filesystem path.
+ */
+ private static final String SCRATCHBOX_CACHE_ENV = "SCRATCHBOX_CACHE";
+
+ private Map<String, Object> data;
+
+ public PersistentCache() {
+ data = new HashMap<String, Object>();
+ }
+
+ /**
+ * Try to load the cache from plugin state.
+ */
+ public void load() {
+ File state = getCacheFile();
+ if (state == null)
+ return;
+ try {
+ ObjectInputStream ois = new ObjectInputStream(new FileInputStream(state));
+ try {
+ data = (Map<String, Object>) ois.readObject();
+ } catch (ClassNotFoundException e) {
+ Activator.getErrorLogger().logError("Cannot unserialize data", e);
+ } finally {
+ Policy.close(ois);
+ }
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+ /**
+ * @return
+ */
+ private File getCacheFile() {
+ // check for argument passed to unit test
+ String sboxCache = System.getenv(SCRATCHBOX_CACHE_ENV);
+ if (sboxCache != null && sboxCache.length() > 0) {
+ return new File(sboxCache);
+ }
+ if (Activator.getDefault() == null)
+ return null;
+ IPath stateLocation = Activator.getDefault().getStateLocation();
+ File state = stateLocation.append(SCRATCHBOX_CACHE_FILE).toFile();
+ return state;
+ }
+
+ /**
+ * Save the cache to plugin state.
+ */
+ public void save() {
+ File state = getCacheFile();
+ if (state == null)
+ return;
+ ObjectOutputStream oos;
+ try {
+ oos = new ObjectOutputStream(new FileOutputStream(state));
+ } catch (IOException e1) {
+ Activator.getErrorLogger().logError("Cannot write cache data", e1);
+ return;
+ }
+ try {
+ oos.writeObject(data);
+ } catch (IOException e) {
+ Activator.getErrorLogger().logError("Cannot serialize cache data", e);
+ } finally {
+ Policy.close(oos);
+ }
+ }
+
+ /**
+ * Delete the entries in the cache.
+ */
+ public synchronized void clear() {
+ data.clear();
+ }
+
+ /**
+ * Get a value from the cache.
+ * @param key KEY_xxx
+ * @return
+ */
+ public synchronized Object get(String key) {
+ return data.get(key);
+ }
+
+ /**
+ * Store a value in the cache
+ * @param key KEY_xxx
+ * @param value
+ */
+ public synchronized void set(String key, Object value) {
+ data.put(key, value);
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxException.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxException.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxException.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.core.scratchbox;
+
+import org.maemo.esbox.core.ESboxException;
+
+/**
+ * General exception generated by communication API.
+ */
+public class ScratchboxException extends ESboxException {
+
+ /**
+ * Serial version number of exception.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor.
+ * @param message the message of the exception.
+ */
+ public ScratchboxException(String message) {
+ super(message);
+ }
+
+ public ScratchboxException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * @param string
+ * @param e
+ */
+ public ScratchboxException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxFacade.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxFacade.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxFacade.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,988 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.core.scratchbox;
+
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.core.machine.IMachine;
+
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommand;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.*;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.sbrsh.*;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+
+import java.util.*;
+
+/**
+ * This class implements some services frequently called by clients which need
+ * to know Scratchbox configuration values.
+ * <p>
+ * All the methods are synchronized because executing a scratchbox 1 command (at least) may require
+ * a target switch, and we don't want these to compete.
+ * <p>
+ * These methods may return cached results, but this may be switched
+ * using #setUseCachedData(boolean) or #clearCachedData().
+ */
+public class ScratchboxFacade {
+
+ private static ScratchboxFacade singleton = null;
+
+ private List<String> emptyArguments = new ArrayList<String>();
+
+ private boolean useCaching;
+
+ private PersistentCache cache;
+
+ /** String for URI of machine where we detected scratchbox 1 */
+ private static final String SB1_MACHINE = "sb1_machine";
+ /** String for scratchbox 1 version or <code>null</code> */
+ private static final String SB1_VERSION = "sb1_version";
+ /** String for URI of machine where we detected scratchbox 2 */
+ private static final String SB2_MACHINE = "sb2_machine";
+ /** String for scratchbox 2 version or <code>null</code> */
+ private static final String SB2_VERSION = "sb2_version";
+ /** String[] scratchbox 1 target name array */
+ private static final String SB1_TARGETS = "sb1_targets";
+ /** String[] scratchbox 2 target name array */
+ private static final String SB2_TARGETS = "sb2_targets";
+ /** Map<String,Map<String, String>> of sb2 target names to a map of the target directory to host directory path mappings */
+ private static final String SB2_TARGET_TO_PATH_MAPPINGS_MAP = "sb2_target_to_path_mappings_map";
+ /** Map<String,String> of sb2 target names to rootstrap paths */
+ private static final String SB2_TARGET_TO_ROOTSTRAP_MAP = "sb2_target_to_rootstrap_map";
+
+ /**
+ * Constructor.
+ *
+ * Construct and Scratchbox abstraction to call services of Scratchbox
+ * environment.
+ */
+ private ScratchboxFacade() {
+ useCaching = true; //!GeneralUtils.isJUnitRunning();
+ cache = new PersistentCache();
+ cache.load();
+ }
+
+ /**
+ * Return an instance of Scratchbox.
+ *
+ * @return an instance of Scratchbox.
+ */
+ public static synchronized ScratchboxFacade getInstance() {
+ if (singleton == null)
+ singleton = new ScratchboxFacade();
+ return singleton;
+ }
+
+ public synchronized boolean isUsingCachedData() {
+ return useCaching;
+ }
+
+ public synchronized void useCachedData(boolean use) {
+ this.useCaching = use;
+ }
+
+ public synchronized void clearCachedData() {
+ if (useCaching) {
+ cache.clear();
+ }
+ }
+
+ public synchronized void saveCachedData() {
+ if (useCaching) {
+ cache.save();
+ }
+ }
+
+ /** Get the cached value for a key (KEY_...),
+ * or <code>null</code> if not registered
+ * @param key the KEY... key name
+ * @return the cached value or <code>null</code> if not registered or caching is not used
+ */
+ private Object getCachedValue(String key) {
+ if (useCaching)
+ return cache.get(key);
+ else
+ return null;
+ }
+
+ /** Store the cached value for a key.
+ * @param key
+ * @param value or <code>null</code> (does not delete a value)
+ */
+ private void setCachedValue(String key, Object value) {
+ if (useCaching)
+ cache.set(key, value);
+ }
+
+ private void throwBadESboxException(IScratchboxSDK sdk) throws ESboxException {
+ throw new ESboxException("Unrecognized or unexpected scratchbox version: " + sdk);
+ }
+
+ /** SB1 is usually installed to contain softlinks into /usr/bin, but the .tar.gz
+ * installation method doesn't do this. So be sure to handle sb1 commands which might not be on /usr/bin. */
+ private ICommandAbstractor getSb1WrappedCommandAbstractor(final ICommandAbstractor commandAbstractor) {
+ return new ICommandAbstractor() {
+
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return commandAbstractor.getPreferenceValue(key);
+ }
+
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ final IProcessLauncherFactory launcherFactory = commandAbstractor.getProcessLauncherFactory();
+ IProcessLauncherFactory wrappedLauncherFactory = new IProcessLauncherFactory() {
+
+ public IProcessLauncher createProcessLaunchHandler(
+ IPath workingDirectory,
+ List<String> commandLine,
+ Properties environment) {
+ if (environment == null) {
+ environment = getStandardEnvironment();
+ }
+
+ // fallback for cases where sbox is installed via .tar.gz with no softlinks into /usr/bin
+ String path = environment.getProperty("PATH");
+ if (path == null)
+ path = ":/usr/bin:/bin";
+ else if (!path.startsWith(":"))
+ path = ":" + path;
+ path = "/scratchbox/tools/bin" + path;
+ environment.put("PATH", path);
+
+ return launcherFactory.createProcessLaunchHandler(workingDirectory, commandLine, environment);
+ }
+
+ public Properties getStandardEnvironment() {
+ return launcherFactory.getStandardEnvironment();
+ }
+
+ };
+ return wrappedLauncherFactory;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.command.ICommandAbstractor#getFileSystemAccess()
+ */
+ public IFileSystemAccess getFileSystemAccess() {
+ return commandAbstractor.getFileSystemAccess();
+ }
+
+ };
+ }
+
+ /** Get a command abstractor for the host. */
+ public ICommandAbstractor getHostCommandAbstractor(final IMachine machine) {
+ return new ICommandAbstractor() {
+
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return new PreferenceProvider(machine,
+ CorePlugin.getDefault().getPreferenceStore()).
+ getPreferenceValue(key);
+ }
+
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return machine.getProcessLauncherFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.command.ICommandAbstractor#getFileSystemAccess()
+ */
+ public IFileSystemAccess getFileSystemAccess() {
+ return machine.getFileSystemAccess();
+ }
+ };
+ }
+
+ /** Get a command abstractor for an SDK. Scratchbox commands can
+ * run outside scratchbox, so launch these as native processes. */
+ public ICommandAbstractor getCommandAbstractor(final ISDK sdk) {
+ ICommandAbstractor commandAbstractor = new ICommandAbstractor() {
+
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return sdk.getPreferenceValue(key);
+ }
+
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return sdk.getMachine().getProcessLauncherFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.command.ICommandAbstractor#getFileSystemAccess()
+ */
+ public IFileSystemAccess getFileSystemAccess() {
+ return sdk.getMachineFileSystemAccess();
+ }
+ };
+
+ // be sure to account for possibly missing softlinks
+ if (sdk instanceof IScratchbox1SDK) {
+ commandAbstractor = getSb1WrappedCommandAbstractor(commandAbstractor);
+ }
+
+ return commandAbstractor;
+ }
+
+ /** Get a command launcher for an SDK target. These must be executed
+ * within the context of scratchbox. */
+ public ICommandAbstractor getCommandAbstractor(final ISDKTarget sdkTarget) {
+ return new ICommandAbstractor() {
+
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return sdkTarget.getPreferenceValue(key);
+ }
+
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ return sdkTarget.getProcessLauncherFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.command.ICommandAbstractor#getFileSystemAccess()
+ */
+ public IFileSystemAccess getFileSystemAccess() {
+ return sdkTarget.getTargetFileSystemAccess();
+ }
+ };
+ }
+
+ private void ensureCurrentMachine(String machineKey, IMachine machine) {
+ String current = (String) getCachedValue(machineKey);
+ if (current != null) {
+ String machineURI = machine.getURI().toString();
+ if (!current.equals(machineURI)) {
+ // just zap
+ clearCachedData();
+ }
+ setCachedValue(machineKey, machineURI);
+ }
+ }
+ /**
+ * Return the current version of Scratchbox 1.
+ * @param machine
+ * @return the current version of Scratchbox 1.
+ * @throws ESboxException
+ * if any problem related to Scratchbox communication occurs,
+ * including no scratchbox 1 detected
+ */
+ public synchronized String getCurrentSbox1Version(IMachine machine)
+ throws ESboxException {
+ // find cached value
+ ensureCurrentMachine(SB1_MACHINE, machine);
+ String version = (String) getCachedValue(SB1_VERSION);
+ if (version != null)
+ return version;
+
+ // do the hard work
+ ICommandAbstractor commandAbstractor = getHostCommandAbstractor(machine);
+ commandAbstractor = getSb1WrappedCommandAbstractor(commandAbstractor);
+ GetVesionScratchboxCommand getVersionCommand = new GetVesionScratchboxCommand(
+ commandAbstractor, 1);
+
+ String currentVersion = getVersionCommand.performCommand(new ArrayList<String>());
+
+ // remember cached value
+ setCachedValue(SB1_VERSION, currentVersion);
+
+ return currentVersion;
+ }
+
+ /**
+ * Return the current version of Scratchbox 2
+ * @return the current version of Scratchbox 2.
+ * @throws ESboxException
+ * if any problem related to Scratchbox communication occurs,
+ * including no scratchbox 2 detected
+ */
+ public synchronized String getCurrentSbox2Version(IMachine machine)
+ throws ESboxException {
+ // find cached value
+ ensureCurrentMachine(SB2_MACHINE, machine);
+ String version = (String) getCachedValue(SB2_VERSION);
+ if (version != null)
+ return version;
+
+ // do the hard work
+ ICommandAbstractor commandAbstractor = getHostCommandAbstractor(machine);
+ GetVesionScratchboxCommand getVersionCommand = new GetVesionScratchboxCommand(
+ commandAbstractor, 2);
+
+ String currentVersion = getVersionCommand.performCommand(new ArrayList<String>());
+
+ // remember cached value
+ setCachedValue(SB2_VERSION, currentVersion);
+
+ return currentVersion;
+ }
+
+ /**
+ * Return the list of available compilers in Scratchbox 1.
+ * @param sdk
+ *
+ * @return a list with the available compilers in Scratchbox.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized List<String> getCompilers(IScratchboxSDK sdk) throws ESboxException {
+ if (sdk instanceof IScratchbox1SDK) {
+ ListCompilersCommand listCompilersCommand = new ListCompilersCommand(getCommandAbstractor(sdk));
+ return listCompilersCommand.performCommand(emptyArguments);
+ }
+ else if (sdk instanceof IScratchbox2SDK) {
+ ListCompilersSb2Command listCompilersCommand = new ListCompilersSb2Command(getCommandAbstractor(sdk));
+ return listCompilersCommand.performCommand(emptyArguments);
+ }
+ else {
+ throwBadESboxException(sdk);
+ return null;
+ }
+ }
+
+ /**
+ * Return the list of available cputransp method at Scratchbox.
+ * @param sdk
+ *
+ * @return a list with the available cputransp method at Scratchbox.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized List<String> getCputransp(IScratchboxSDK sdk) throws ESboxException {
+ if (sdk instanceof IScratchbox1SDK) {
+ ListCputranspCommand listCputranspCommand = new ListCputranspCommand(getCommandAbstractor(sdk));
+ return listCputranspCommand.performCommand(emptyArguments);
+ }
+ else if (sdk instanceof IScratchbox2SDK) {
+ ListCputranspSb2Command listCputranspCommand = new ListCputranspSb2Command(getCommandAbstractor(sdk));
+ return listCputranspCommand.performCommand(emptyArguments);
+ }
+ else {
+ throwBadESboxException(sdk);
+ return null;
+ }
+ }
+
+ /**
+ * Return the list of available devkits at Scratchbox.
+ * @param sdk
+ *
+ * @return a list with the available devkits at Scratchbox.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized List<String> getDevkits(IScratchbox1SDK sdk) throws ESboxException {
+ ListDevkitsCommand listDevkitsCommand = new ListDevkitsCommand(getCommandAbstractor(sdk));
+ return listDevkitsCommand.performCommand(new ArrayList<String>());
+ }
+
+ /**
+ * Return the list of available targets at Scratchbox.
+ *
+ * @return a list with the available targets at Scratchbox.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized List<String> getTargets(IScratchboxSDK sdk) throws ESboxException {
+ int sboxVersion = getSboxVersion(sdk);
+ String machineKey, targetsKey;
+ if (sboxVersion == 1) {
+ machineKey = SB1_MACHINE;
+ targetsKey = SB1_TARGETS;
+ } else {
+ machineKey = SB2_MACHINE;
+ targetsKey = SB2_TARGETS;
+ }
+ ensureCurrentMachine(machineKey, sdk.getMachine());
+
+ String[] targetsArray = (String[]) getCachedValue(targetsKey);
+ if (targetsArray != null)
+ return Arrays.asList(targetsArray);
+
+ ListTargetsCommand listTargetsCommand = new ListTargetsCommand(
+ getCommandAbstractor(sdk), sboxVersion);
+ List<String> targets = listTargetsCommand.performCommand(new ArrayList<String>());
+
+ setCachedValue(targetsKey, (String[]) targets.toArray(new String[targets.size()]));
+
+ return targets;
+ }
+
+ private int getSboxVersion(IScratchboxSDK sdk) throws ESboxException {
+ if (sdk instanceof IScratchbox1SDK)
+ return 1;
+ else if (sdk instanceof IScratchbox2SDK)
+ return 2;
+ else
+ throwBadESboxException(sdk);
+ return 0;
+ }
+
+ /**
+ * Return the current sessions of Scratchbox.
+ *
+ * @return a list with current sessions Scratchbox.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized List<String> getSessions(IScratchbox1SDK sdk) throws ESboxException {
+ ListSessionsCommand listSessionsCommand = new ListSessionsCommand(getCommandAbstractor(sdk));
+ return listSessionsCommand.performCommand(new ArrayList<String>());
+ }
+
+ /**
+ * Return the current target name of Scratchbox 1 or 2.
+ * @param sdk
+ *
+ * @return the current target of Scratchbox 1 or 2.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized String getCurrentTarget(IScratchboxSDK sdk) throws ESboxException {
+ ICommand getCurrentTargetCommand = null;
+ if (sdk instanceof IScratchbox1SDK)
+ getCurrentTargetCommand = new GetCurrentTargetCommand(getCommandAbstractor(sdk), sdk);
+ else if (sdk instanceof IScratchbox2SDK)
+ getCurrentTargetCommand = new GetCurrentTargetSb2Command(getCommandAbstractor(sdk));
+ else
+ throwBadESboxException(sdk);
+ return (String) getCurrentTargetCommand.performCommand(new ArrayList<String>());
+ }
+
+ /**
+ * Return the current target of Scratchbox.
+ * @param sdk
+ *
+ * @return the current target of Scratchbox.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized IScratchboxSDKTarget getCurrentSDKTarget(IScratchboxSDK sdk) throws ESboxException {
+ String targetName = getCurrentTarget(sdk);
+ return (IScratchboxSDKTarget) sdk.findSDKTarget(targetName);
+ }
+
+ /**
+ * Create a new target for Scratchbox 1. An target must have a name, and the
+ * compiler, devkits and cputransp must be available in Scratchbox.
+ * @param sdk
+ *
+ * @param targetName
+ * the name of the new target.
+ * @param compiler
+ * the compiler name of the new target.
+ * @param devkits
+ * the devkits of the new target. The devkits must be split using
+ * ":";
+ * @param cputransp
+ * the cputransp method of the new target.
+ * @return true, if the target is created successfully.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean createTarget(IScratchbox1SDK sdk, String targetName,
+ String compiler, String devkits, String cputransp)
+ throws ESboxException {
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+ params.add(compiler);
+ params.add(devkits);
+ params.add(cputransp);
+
+ CreateTargetCommand createTargetCommand = new CreateTargetCommand(sdk, getCommandAbstractor(sdk));
+
+ setCachedValue(SB1_TARGETS, null);
+
+ return (Boolean) createTargetCommand.performCommand(params);
+ }
+
+ /**
+ * Create a new target for Scratchbox 2. An target must have a name, and the
+ * compiler, and cputransp must be available in Scratchbox.
+ * @param sdk
+ *
+ * @param targetName
+ * the name of the new target.
+ * @param compiler
+ * the compiler path of the new target.
+ * @param cputransp
+ * the cputransp method of the new target, or <code>null</code> for default
+ * @return true, if the target is created successfully.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean createTarget(IScratchbox2SDK sdk, String targetName,
+ String compiler, String cputransp)
+ throws ESboxException {
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+ params.add(compiler);
+ params.add(cputransp);
+
+ CreateTargetSb2Command createTargetCommand = new CreateTargetSb2Command(sdk, getCommandAbstractor(sdk));
+
+ setCachedValue(SB2_TARGETS, null);
+
+ return (Boolean) createTargetCommand.performCommand(params);
+ }
+
+ /**
+ * Create a new rootstrap target for Scratchbox 2. The target is named
+ * after a maemo-rootstrap available target.
+ * @param sdk
+ * @param targetName
+ * the name of the new target.
+ * @param useHostTools if true, use the host toolchain rather than installing devkits in the rootstrap
+ * @param force if true, then overwrite any existing rootstrap; if false, then let the user choose (in the console :/)
+ * whether to overwrite or keep an existing one
+ * @return true if succeeded, false if failed
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean createRootstrapTarget(IScratchbox2SDK sdk, String targetName, boolean useHostTools, boolean force, IProgressMonitor monitor)
+ throws ESboxException {
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+ params.add(Boolean.toString(useHostTools));
+ params.add(Boolean.toString(force));
+
+ CreateMaemoRootstrapSb2Command createTargetCommand =
+ new CreateMaemoRootstrapSb2Command(sdk, getCommandAbstractor(sdk), monitor);
+
+ setCachedValue(SB2_TARGETS, null);
+
+ return createTargetCommand.performCommand(params);
+ }
+
+ /**
+ * Create a new rootstrap target for Scratchbox 2. The target is named
+ * after a maemo-rootstrap available target.
+ * @param sdk
+ * @param targetName
+ * the name of the new target.
+ * @param force if true, then overwrite any existing rootstrap; if false, then let the user choose (in the console :/)
+ * whether to overwrite or keep an existing one
+ * @return true if succeeded, false if failed
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean removeRootstrap(IScratchbox2SDK sdk, String targetName, boolean force, IProgressMonitor monitor)
+ throws ESboxException {
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+ params.add(Boolean.toString(force));
+
+ RemoveMaemoRootstrapSb2Command removeTargetCommand =
+ new RemoveMaemoRootstrapSb2Command(getCommandAbstractor(sdk), monitor);
+
+ setCachedValue(SB2_TARGETS, null);
+ setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP, null);
+ setCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP, null);
+
+ return removeTargetCommand.performCommand(params);
+ }
+
+ /**
+ * Remove a target from Scratchbox 1 or 2. A target with the given name must exist.
+ * @param isdk
+ *
+ * @param targetName
+ * the name of the target to be removed.
+ * @return true, if the operation is performed successfully.
+ * @throws ESboxException
+ * if the name of the target to be removed does not exist or if
+ * some problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean removeTarget(IScratchboxSDK sdk, String targetName)
+ throws ESboxException {
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+
+ ICommand removeTargetCommand;
+ if (sdk instanceof IScratchbox1SDK) {
+ removeTargetCommand = new RemoveTargetCommand(sdk, getCommandAbstractor(sdk));
+ setCachedValue(SB1_TARGETS, null);
+ }
+ else {
+ removeTargetCommand = new RemoveTargetSb2Command(sdk, getCommandAbstractor(sdk));
+ setCachedValue(SB2_TARGETS, null);
+ setCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP, null);
+ setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP, null);
+ }
+
+ return (Boolean) removeTargetCommand.performCommand(params);
+ }
+
+ /**
+ * Select another available target as current Scratchbox target.
+ * @param sdk
+ *
+ * @param targetName
+ * the name of the new target.
+ * @return true, if the operation is performed successfully.
+ * @throws ESboxException
+ * if the target to be selected does not exists or if some
+ * problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean selectTarget(IScratchbox1SDK sdk, String targetName)
+ throws ESboxException {
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+
+ SelectTargetCommand selectTargetCommand = new SelectTargetCommand(getCommandAbstractor(sdk), sdk);
+
+ return (Boolean) selectTargetCommand.performCommand(params);
+ }
+
+ /**
+ * Kill an Scratchbox process.
+ *
+ * @param signal
+ * the signal emitted to scratchbox processes.
+ * @return true, if the is performed successfully.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean killProcess(IScratchbox1SDK sdk, String signal)
+ throws ESboxException {
+ List<String> params = new ArrayList<String>();
+ params.add(signal);
+
+ KillallCommand killallCommand = new KillallCommand(getCommandAbstractor(sdk));
+
+ return (Boolean) killallCommand.performCommand(params);
+ }
+
+ /**
+ * Kill an Scratchbox process.
+ * @return true, if the is performed successfully.
+ * @throws ESboxException
+ * if some problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean killProcess(IScratchbox1SDK sdk)
+ throws ESboxException {
+ List<String> params = new ArrayList<String>();
+
+ KillallCommand killallCommand = new KillallCommand(getCommandAbstractor(sdk));
+
+ return (Boolean) killallCommand.performCommand(params);
+ }
+
+ /**
+ * Configure sbrsh settings of an certain target.
+ * @param sdk
+ *
+ * @param targetName
+ * the name of the target to be configured.
+ * @param targetDeviceIP
+ * the IP of the device.
+ * @param targetDevicePort
+ * the port of the device.
+ * @param nfsServerAddr
+ * the IP of NFS server.
+ * @return true, if the configuration is performed successfully; false,
+ * otherwise.
+ * @throws ESboxException
+ * if any problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean configureSbrsh(IScratchboxSDK sdk, String targetName,
+ String targetDeviceAddr, String nfsServerAddr)
+ throws ESboxException {
+ ConfigureSbrshCommand configureSbrshCommand = new ConfigureSbrshCommand(getCommandAbstractor(sdk));
+
+ List<String> params = new ArrayList<String>();
+
+ params.add(targetName);
+ params.add(targetDeviceAddr);
+ params.add(nfsServerAddr);
+
+ return (Boolean) configureSbrshCommand.performCommand(params);
+ }
+
+ /**
+ * Add the target to an access list. Such list contains all targets that can
+ * be access the remote device.
+ * @param sdk
+ *
+ * @param targetNameProperty
+ * the target name to be added to the list.
+ * @param username
+ * the user name.
+ * @param ipAddr
+ * the IP of the desktop.
+ * @return true, if the configuration is performed successfully; false,
+ * otherwise.
+ * @throws ESboxException
+ * if any problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean addSbrshAccessList(IScratchboxSDK sdk, String targetDeviceAddr,
+ String username, String ipAddr) throws ESboxException {
+ AddSbrshCommand addSbrshCommand = new AddSbrshCommand(getCommandAbstractor(sdk));
+
+ List<String> params = new ArrayList<String>();
+
+ params.add(targetDeviceAddr);
+ params.add(username);
+ params.add(ipAddr);
+
+ return (Boolean) addSbrshCommand.performCommand(params);
+ }
+
+ /**
+ * Mount a target at the remove device.
+ *
+ * @param targetName
+ * the name of the target to be mounted.
+ * @return true, if the configuration is performed successfully; false,
+ * otherwise.
+ * @throws ESboxException
+ * if any problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean mountTarget(IScratchboxSDK sdk, String targetName)
+ throws ESboxException {
+ MountTargetSbrshCommand mountTargetCommand = new MountTargetSbrshCommand(getCommandAbstractor(sdk));
+
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+
+ return (Boolean) mountTargetCommand.performCommand(params);
+ }
+
+ /**
+ * Unmount a target at the remote device.
+ *
+ * @param targetName
+ * the name of the target to be unmounted.
+ * @return true, if the configuration is performed successfully; false,
+ * otherwise.
+ * @throws ESboxException
+ * if any problem related to Scratchbox communication occurs.
+ */
+ public synchronized boolean unmountTarget(IScratchboxSDK sdk, String targetName)
+ throws ESboxException {
+ UnmountTargetSbrshCommand unmountTargetCommand = new UnmountTargetSbrshCommand(getCommandAbstractor(sdk));
+
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+
+ return (Boolean) unmountTargetCommand.performCommand(params);
+ }
+
+ /**
+ * Show the configuration of the target.
+ *
+ * @param targetName
+ * the target name to be shown.
+ * @return a target representation which contains the configuration of the
+ * target with the given name.
+ * @throws ESboxException
+ * if any problem related to Scratchbox communication occurs.
+ */
+ /*
+ public synchronized ScratchboxTarget showTarget(IScratchboxSDK sdk, String targetName)
+ throws ESboxException {
+ ShowTargetCommand showTargetCommand = new ShowTargetCommand();
+
+ List<String> params = new ArrayList<String>();
+ params.add(targetName);
+
+ return showTargetCommand.performCommand(getCommandLauncher(sdk), params);
+ }*/
+
+ /**
+ * Start maemo. This runs synchronously.
+ *
+ * @param sdkTarget
+ * @return
+ * @throws ESboxException
+ */
+ public synchronized boolean startMaemoCommand(ISDKTarget sdkTarget)
+ throws ESboxException {
+ MaemoCommand maemoCommand = new MaemoCommand(getCommandAbstractor(sdkTarget), sdkTarget);
+ return (Boolean) maemoCommand.startMaemoCommand(sdkTarget);
+ }
+
+ /**
+ * Restart maemo. This runs synchronously.
+ *
+ * @return
+ * @throws ESboxException
+ */
+ public synchronized boolean restartMaemoCommand(ISDKTarget sdkTarget) throws ESboxException {
+ MaemoCommand maemoCommand = new MaemoCommand(getCommandAbstractor(sdkTarget), sdkTarget);
+ return (Boolean) maemoCommand.restartMaemoCommand(sdkTarget);
+ }
+
+ /**
+ * Stop maemo. This runs synchronously.
+ * @return
+ * @throws ESboxException
+ */
+ public synchronized boolean stopMaemoCommand(ISDKTarget sdkTarget) throws ESboxException {
+ MaemoCommand maemoCommand = new MaemoCommand(getCommandAbstractor(sdkTarget), sdkTarget);
+ return (Boolean) maemoCommand.stopMaemoCommand(sdkTarget);
+ }
+
+ /**
+ * Execute a command inside Scratchbox.
+ *
+ * @param cmdLine
+ * the command and arguments to be executed inside Scratchbox.
+ * @return a List that contains the values returned by the command.
+ * @throws ESboxException
+ * if any problem related to Scratchbox communication occurs.
+ */
+ public synchronized List<String> execSimpleCommand(ISDKTarget sdkTarget, List<String> cmdLine)
+ throws ESboxException {
+ SimpleCommand commandToExec = new SimpleCommand(getCommandAbstractor(sdkTarget));
+
+ return commandToExec.performCommand(cmdLine);
+ }
+
+ /**
+ * Get the MaemoRootstrap items available for installation. This includes any that
+ * might already be defined.
+ * @return List, never null
+ * @throws ESboxException
+ */
+ public synchronized List<MaemoRootstrap> getAvailableMaemoRootstraps(IMachine machine) throws ESboxException {
+ ListAvailableMaemoRootstrapsSb2Command command = new ListAvailableMaemoRootstrapsSb2Command(getHostCommandAbstractor(machine));
+ return command.performCommand(emptyArguments);
+ }
+
+ /**
+ * Get the names of rootstraps already installed. This may inclue those that do
+ * not have targets associated.
+ * @param sdk the SDK to check
+ * @return List, never null
+ * @throws ESboxException
+ */
+ public synchronized List<String> getInstalledMaemoRootstraps(IScratchboxSDK sdk) throws ESboxException {
+ ListInstalledMaemoRootstrapsSb2Command command = new ListInstalledMaemoRootstrapsSb2Command(getHostCommandAbstractor(sdk.getMachine()));
+ return command.performCommand(emptyArguments);
+ }
+
+ /**
+ * Invoke sb2-show path on the given path(s) to return the mappings.
+ * @param hostPaths array of paths to map
+ * @return map of resolved host paths to target paths
+ * @throws ESboxException
+ */
+ public synchronized Map<IPath, IPath> getSb2PathMapping(IScratchbox2SDKTarget sdkTarget, List<IPath> hostPaths) throws ESboxException {
+ // find cached value
+ ensureCurrentMachine(SB2_MACHINE, sdkTarget.getSDK().getMachine());
+ Map<String, Map<String, String>> targetToPathMappingsMap = null;
+ Map<String, String> storedPathMappings = null;
+ targetToPathMappingsMap = (Map<String, Map<String, String>>) getCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP);
+ if (targetToPathMappingsMap != null) {
+ storedPathMappings = targetToPathMappingsMap.get(sdkTarget.getName());
+ }
+
+ Map<IPath, IPath> returnedPathMappings = new HashMap<IPath, IPath>();
+
+ // locate entries known to the cache
+ List<IPath> needToLookupHostPaths;
+ if (storedPathMappings != null) {
+ needToLookupHostPaths = new ArrayList<IPath>();
+ for (IPath hostPath : hostPaths) {
+ String targetPath = storedPathMappings.get(hostPath.toPortableString());
+ if (targetPath != null) {
+ returnedPathMappings.put(hostPath, new Path(targetPath));
+ } else {
+ needToLookupHostPaths.add(hostPath);
+ }
+ }
+ } else {
+ needToLookupHostPaths = hostPaths;
+ }
+
+ if (needToLookupHostPaths.size() == 0) {
+ return returnedPathMappings;
+ }
+
+ // do the hard work for the paths not covered by the cache
+ ShowPathMappingSb2Command command = new ShowPathMappingSb2Command(getCommandAbstractor(sdkTarget));
+ List<String> paths = new ArrayList<String>(needToLookupHostPaths.size());
+ for (IPath path : needToLookupHostPaths) {
+ paths.add(path.toPortableString());
+ }
+
+ Map<IPath, IPath> newPathMappings = (Map<IPath, IPath>) command.performCommand(paths);
+ returnedPathMappings.putAll(newPathMappings);
+
+ // update cache
+ if (storedPathMappings == null) {
+ storedPathMappings = new HashMap<String, String>();
+ }
+ for (Map.Entry<IPath, IPath> entry : newPathMappings.entrySet()) {
+ storedPathMappings.put(entry.getKey().toPortableString(), entry.getValue().toPortableString());
+ }
+ if (targetToPathMappingsMap == null) {
+ targetToPathMappingsMap = new HashMap<String, Map<String,String>>();
+ }
+ targetToPathMappingsMap.put(sdkTarget.getName(), storedPathMappings);
+
+ setCachedValue(SB2_TARGET_TO_PATH_MAPPINGS_MAP, targetToPathMappingsMap);
+
+ return returnedPathMappings;
+ }
+
+ /**
+ * Get the path where a maemo rootstrap is installed
+ * @param scratchbox2SDK
+ * @return path of rootstrap
+ * @throws ESboxException if not located
+ */
+ public synchronized IPath getMaemoRootstrapPath(IScratchbox2SDKTarget sdkTarget) throws ESboxException {
+ // find cached value
+ ensureCurrentMachine(SB2_MACHINE, sdkTarget.getSDK().getMachine());
+ Map<String, String> targetToRootstrapMap = null;
+ targetToRootstrapMap = (Map<String, String>) getCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP);
+ if (targetToRootstrapMap != null) {
+ String rootstrap = targetToRootstrapMap.get(sdkTarget.getName());
+ if (rootstrap != null) {
+ return new Path(rootstrap);
+ }
+ }
+
+ // do the hard work
+ GetMaemoRootstrapLocationCommand command = new GetMaemoRootstrapLocationCommand(
+ getCommandAbstractor(sdkTarget.getSDK()), sdkTarget);
+ IPath rootstrapPath = (IPath) command.performCommand(emptyArguments);
+
+ // store cached value
+ if (targetToRootstrapMap == null)
+ targetToRootstrapMap = new HashMap<String, String>();
+ targetToRootstrapMap.put(sdkTarget.getName(), rootstrapPath.toPortableString());
+ setCachedValue(SB2_TARGET_TO_ROOTSTRAP_MAP, targetToRootstrapMap);
+
+ return rootstrapPath;
+ }
+
+ /**
+ * Get the command template for launching qemu under gdb with this target
+ * @param sdkTarget
+ * @param architecture one of {@link IScratchboxSDKTarget#ARCHITECTURE_ARMEL} or {@link IScratchboxSDKTarget#ARCHITECTURE_X86};
+ * usually from sdkTarget.getArchitecture()
+ * @return String or null if no cputransp used or not using qemu
+ */
+ public synchronized String getGdbQemuCommandPattern(ISDKTarget sdkTarget, String architecture) throws ESboxException {
+ GetGdbQemuCommandPatternCommand command = new GetGdbQemuCommandPatternCommand(sdkTarget,
+ getCommandAbstractor(sdkTarget),
+ getSboxVersion((IScratchboxSDK) sdkTarget.getSDK()));
+ List<String> arguments = new ArrayList<String>(1);
+ arguments.add(architecture);
+ return command.performCommand(arguments);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxTarget.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxTarget.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.core.scratchbox;
+
+import java.util.List;
+
+/**
+ * Representation of Scratchbox target. It contains the name, compiler,
+ * devkits and CPU-transparency of a target.
+ */
+public class ScratchboxTarget implements Comparable<Object> {
+
+ private String name;
+
+ private String compiler;
+
+ private List<String> devkits;
+
+ private String cputransp;
+
+ /**
+ * @return the name of the target
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name
+ * the target's name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the compiler
+ */
+ public String getCompiler() {
+ return compiler;
+ }
+
+ /**
+ * @param compiler
+ * the compiler to set
+ */
+ public void setCompiler(String compiler) {
+ this.compiler = compiler;
+ }
+
+ /**
+ * @return the devkits
+ */
+ public List<String> getDevkits() {
+ return devkits;
+ }
+
+ /**
+ * @param devkits
+ * the devkits to set
+ */
+ public void setDevkits(List<String> devkits) {
+ this.devkits = devkits;
+ }
+
+ /**
+ * @return the cputransp
+ */
+ public String getCputransp() {
+ return cputransp;
+ }
+
+ /**
+ * @param cputransp
+ * the cputransp to set
+ */
+ public void setCputransp(String cputransp) {
+ this.cputransp = cputransp;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object o) {
+ ScratchboxTarget target = (ScratchboxTarget) o;
+ return getName().compareTo(target.getName());
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxTargetSwitcher.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxTargetSwitcher.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/ScratchboxTargetSwitcher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.core.scratchbox;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox1SDK;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox1SDKTarget;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+/**
+ * Utility class to handle switching scratchbox targets and
+ * get user approval to kill existing sessions if needed.
+ * @author eswartz
+ *
+ */
+public abstract class ScratchboxTargetSwitcher {
+
+ /**
+ * Ensure the current SDK target can host the given target, asking
+ * user for approval to terminate existing sessions if they are running.
+ * @param target an SDK target (SB1 or anything else)
+ * @throws ESboxException if target could not be switched
+ */
+ public static void ensureCurrentTarget(ISDKTarget target) throws ESboxException {
+ // only scratchbox 1 cares about "current targets"
+ if (!(target instanceof IScratchbox1SDKTarget)) {
+ return;
+ }
+
+ IScratchbox1SDK sdk = ((IScratchbox1SDK) target.getSDK());
+ final String currentTarget = ScratchboxFacade.getInstance().getCurrentTarget(sdk);
+ final String targetName = target.getName();
+ if (currentTarget.equals(targetName)) {
+ return;
+ }
+
+ // see if maemo is running, since it needs to be killed to switch targets
+ // but isn't considered a "session" every time
+ boolean isMaemoRunning = ESboxScriptLauncher.getInstance().isMaemoStarted(target);
+
+ // now try to switch and see if shells are open
+ boolean failedToSwitch = false;
+ try {
+ ScratchboxFacade.getInstance().selectTarget(sdk, targetName);
+ } catch (final ScratchboxException e) {
+ // sb-conf: You must close your other Scratchbox sessions first
+ // or
+ // Note: Couldn't reselect the target. There are other Scratchbox sessions open.
+ if (e.getLocalizedMessage().contains("Scratchbox sessions")) {
+ failedToSwitch = true;
+ } else {
+ throw e;
+ }
+ }
+
+ if (isMaemoRunning || failedToSwitch) {
+ final boolean[] ret = {false};
+
+ if (!GeneralUtils.isJUnitRunning()) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ ret[0] = MessageDialog.openQuestion(
+ null,
+ "Scratchbox Target Conflict",
+ MessageFormat.format(
+ "The scratchbox 1 target needs to be switched from ''{0}'' to ''{1}'', but existing sessions are active.\n\n"+
+ "Kill existing Scratchbox sessions? (You may manually close them first, if desired, then select 'No' to retry)",
+ currentTarget, targetName));
+ };
+ });
+ } else {
+ ret[0] = true;
+ }
+
+ // if user accepts, kill existing ones
+ if (ret[0]) {
+ if (isMaemoRunning) {
+ // a target selection may succeed even if X and maemo are running... kill them first.
+ // We kill X too because some processes won't be killed by maemo-launcher.
+ try {
+ ESboxScriptLauncher.getInstance().killMaemo(target);
+ } catch (ESboxException e2) {
+ // ignore
+ }
+ try {
+ ESboxScriptLauncher.getInstance().stopX(target);
+ } catch (ESboxException e2) {
+ // ignore
+ }
+ }
+
+ // now kill the scratchbox sessions the "approved" way
+ try {
+ ScratchboxFacade.getInstance().killProcess(sdk);
+
+ // wait politely
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+
+ }
+
+ } catch (ScratchboxException e2) {
+ // sb-conf killall can fail in the event there is some process with a space in its
+ // name... just log it and keep going
+ Activator.getErrorLogger().logError("Problem killing scratchbox sessions", e2);
+ }
+
+ // double-check, since it doesn't really work!
+ List<String> sessions = ScratchboxFacade.getInstance().getSessions(sdk);
+ if (sessions.size() > 0) {
+ // forcibly kill processes
+ List<String> cmdLine = CommandLineArguments.createFromVarArgs(
+ "kill", "-9");
+ cmdLine.addAll(sessions);
+
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ sdk.getMachineProcessLauncherFactory(), null, cmdLine);
+ Process process;
+ try {
+ process = processLauncher.createProcess();
+ process.waitFor();
+ } catch (final Exception e1) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ MessageDialog.openError(
+ null,
+ "Scratchbox Target Conflict",
+ MessageFormat.format(
+ "Couldn''t kill scratchbox processes:\n\n{0}\n\nRetrying the target selection anyway.",
+ e1.getLocalizedMessage()));
+ };
+ });
+ }
+ }
+
+ }
+
+ // always retry, and rethrow if fails
+ ScratchboxFacade.getInstance().selectTarget(sdk, targetName);
+ }
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/XLauncher.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/XLauncher.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/scratchbox/XLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,279 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial implementation
+ * Ed Swartz (Nokia) - adaptation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.core.scratchbox;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.env.*;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineRegistry;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
+
+import java.net.Socket;
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * This class maintains knowledge about whether the X server is running in
+ * the host, and controls access to starting, stopping, and querying status.
+ * @author eswartz
+ *
+ */
+public class XLauncher {
+
+ private static XLauncher instance;
+
+ private Job launchingXJob;
+
+ public synchronized static XLauncher getInstance() {
+ if (instance == null) {
+ instance = new XLauncher();
+ }
+ return instance;
+ }
+
+ /**
+ * Test a connection to the X server denoted by 'display'. This performs
+ * an immediate check and is ignorant if a launch is in progress.
+ * @param display the DISPLAY value, e.g. ":2" or ":0.0" or "myhost:0"
+ * @return true if connection succeeded
+ * @throws ESboxException if query is impossible
+ */
+ private boolean testXConnection(String display) throws ESboxException {
+ String[] parts = display.split(":");
+ if (parts.length != 2)
+ throw new ESboxException(
+ MessageFormat.format("DISPLAY variable ''{0}'' does not have expected syntax [host]:<number>[.<number>]",
+ display));
+ String host = parts[0];
+ if (host.equals("unix")) {
+ Activator.getErrorLogger().logError(
+ MessageFormat.format("Support for testing X connection over UNIX domain sockets is not implemented; assuming success (DISPLAY=''{0}'')",
+ display), null);
+ return true;
+ }
+
+ if (host.length() == 0) {
+ host = null;
+ }
+
+ String[] displayParts = parts[1].split("\\.");
+ int displayNumber = 0;
+ try {
+ displayNumber = Integer.parseInt(displayParts[0]);
+ } catch (NumberFormatException e) {
+ throw new ESboxException(
+ MessageFormat.format("DISPLAY variable ''{0}'' does not have expected syntax [host]:<number>[.<number>]",
+ display));
+ }
+
+ try {
+ /*Socket socket =*/ new Socket(host, 6000 + displayNumber);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ /**
+ * Test whether the X server is started by testing a connection to the server.
+ * @param prefProvider
+ * @return
+ */
+ public boolean isXServerStarted(IPreferenceProvider prefProvider) throws ESboxException {
+ return testXConnection(getDisplayValue(prefProvider));
+ }
+
+ /** Be nice and start X if needed before starting/restarting maemo */
+ public void startXIfNeeded(IPreferenceProvider prefProvider) throws ESboxException {
+ waitForXLaunch();
+ if (!isXServerStarted(prefProvider)) {
+ startX(prefProvider);
+ waitForXLaunch();
+ }
+ }
+
+ /**
+ * Wait forever for the X launching job (if any) to complete.
+ * This returns only when the job is complete. It does not
+ * reflect a successful launch of the server.
+ */
+ private void waitForXLaunch() {
+ while (true) {
+ synchronized (this) {
+ if (launchingXJob == null) {
+ return;
+ }
+ if (launchingXJob != null) {
+ if (launchingXJob.getResult() != null) {
+ return;
+ }
+ }
+ }
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ return;
+ }
+ }
+ }
+
+ public void startX(final IPreferenceProvider prefProvider) throws ESboxException {
+ waitForXLaunch();
+
+ if (isXServerStarted(prefProvider))
+ throw new ScratchboxException("X Server is already running");
+
+ String viewer = getDisplayXServerCommand(prefProvider);
+ final String display = getDisplayValue(prefProvider);
+
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine(viewer);
+
+ if (cmdLine.size() > 0) {
+
+ IMachine localMachine = MachineRegistry.getInstance().getLocalMachine();
+ if (localMachine == null)
+ throw new ESboxException("Cannot find local machine");
+
+ IProcessLauncherFactory factory = localMachine.getProcessLauncherFactory();
+
+ Properties env = null;
+
+ // XXX: HOST$XSERVER_PATH is hack to get Cygwin visible from Windows
+ String path = getXServerPath(prefProvider);
+ if (path != null) {
+ env = factory.getStandardEnvironment();
+ env.put("PATH", path);
+ }
+
+ // launch command
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(factory,
+ null,
+ cmdLine,
+ env);
+
+ final Process process = processLauncher.createProcess();
+
+ final MessageConsole console = processLauncher.redirectToConsole(true, null, "Starting X Server");
+
+ synchronized(this) {
+ launchingXJob = new Job("Waiting for X Server") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ while (true) {
+ try {
+ if (testXConnection(display))
+ break;
+ } catch (ESboxException e) {
+ return Activator.createErrorStatus("Failed to check X connection", e);
+ }
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ }
+
+ try {
+ // see if the process terminated yet
+ int exit = process.exitValue();
+
+ console.newMessageStream().println("Process exited with code 0x" + Integer.toHexString(exit));
+
+ // report failure outside this job else we can get stuck here
+ // if someone queries the job status from the UI thread
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ Activator.getErrorLogger().logAndShowError("X server did not launch; check the Console.", null);
+ }
+
+ });
+ break;
+ } catch (IllegalThreadStateException e) {
+ // not finished, good
+ }
+ }
+ synchronized (XLauncher.this) {
+ launchingXJob = null;
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ launchingXJob.schedule();
+ }
+ } else {
+ Activator.getErrorLogger().logAndShowError("No X server configured in ESbox preferences", null);
+ }
+
+ }
+
+ public void stopX(IPreferenceProvider prefProvider) throws ESboxException {
+ waitForXLaunch();
+
+ if (!isXServerStarted(prefProvider))
+ throw new ScratchboxException("X Server was not started. Start X Server first");
+
+ String server = getDisplayXServerCommand(prefProvider);
+
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine(server);
+
+ // find server to kill
+ if (cmdLine.size() > 0) {
+ IMachine localMachine = MachineRegistry.getInstance().getLocalMachine();
+ if (localMachine == null)
+ throw new ESboxException("Cannot find local machine");
+
+ ESboxScriptLauncher.getInstance().killProcess(localMachine, cmdLine.get(0), "X Server");
+ }
+ }
+
+
+ private String getDisplayXServerCommand(IPreferenceProvider prefProvider) {
+ String command = prefProvider.getPreferenceValue(
+ ESboxPreferenceConstants.DISPLAY_X_COMMAND);
+
+ command = command.replaceAll("\\$\\{DISPLAY\\}", getDisplayValue(prefProvider));
+ return command;
+ }
+
+ // TODO: see if this needs to be SDK-specific
+ private String getDisplayValue(IPreferenceProvider prefProvider) {
+ IEnvironmentVariableBlock envBlock = EnvironmentVariableManager.getInstance().getGlobalEnvironmentBlock();
+ IEnvironmentVariable variable = envBlock.getVariable(ESboxCommonVariables.DISPLAY);
+ if (variable == null)
+ return ESboxCommonVariables.DISPLAY_DEFAULT_VALUE;
+ else if (variable.getValue() != null)
+ return variable.getValue();
+ else
+ return System.getenv("DISPLAY"); // get from system
+ }
+
+ // TODO: see if this needs to be SDK-specific
+ private String getXServerPath(IPreferenceProvider prefProvider) {
+ IEnvironmentVariableBlock envBlock = EnvironmentVariableManager.getInstance().getGlobalEnvironmentBlock();
+ IEnvironmentVariable variable = envBlock.getVariable(ESboxCommonVariables.XSERVER_PATH);
+ if (variable == null)
+ return null;
+ else
+ return variable.getValue();
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox1SDK.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox1SDK.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox1SDK.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.core.sdk;
+
+
+/**
+ * This interface provides scratchbox 1-specific functionality to an ISDK
+ * @author eswartz
+ *
+ */
+public interface IScratchbox1SDK extends IScratchboxSDK {
+ public static final String NAME = "Scratchbox 1"; //$NON-NLS-1$
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox1SDKTarget.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox1SDKTarget.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox1SDKTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.core.sdk;
+
+
+/**
+ * This interface provides scratchbox 1-specific functionality to an IScratchboxSDKTarget
+ * @author eswartz
+ *
+ */
+public interface IScratchbox1SDKTarget extends IScratchboxSDKTarget {
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox2SDK.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox2SDK.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox2SDK.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+
+
+/**
+ * This interface provides scratchbox 2-specific functionality to an ISDK
+ * @author eswartz
+ *
+ */
+public interface IScratchbox2SDK extends IScratchboxSDK {
+ public static final String NAME = "Scratchbox 2"; //$NON-NLS-1$
+
+ /**
+ * Get the directory where Scratchbox 2 configuration files are located
+ * (usually $HOME/.scratchbox2)
+ * @return path
+ */
+ public IPath getScratchbox2ConfigDirectory();
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox2SDKTarget.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox2SDKTarget.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchbox2SDKTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.core.sdk;
+
+/**
+ * This interface provides scratchbox 2-specific functionality to an IScratchboxSDKTarget.
+ * @author eswartz
+ *
+ */
+public interface IScratchbox2SDKTarget extends IScratchboxSDKTarget {
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDK.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDK.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDK.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.core.sdk;
+
+import org.maemo.esbox.core.sdk.ISDK;
+
+/**
+ * This interface provides scratchbox-specific functionality to an ISDK
+ * @author eswartz
+ *
+ */
+public interface IScratchboxSDK extends ISDK {
+ /**
+ * If appropriate, get the cached value of the current scratchbox target.
+ *
+ * @return cached name, or <code>null</code>
+ */
+ String getCachedCurrentTarget();
+
+ /**
+ * Set the last detected current scratchbox target.
+ * @param currentTarget
+ */
+ void setCachedCurrentTarget(String currentTarget);
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDKTarget.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDKTarget.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/IScratchboxSDKTarget.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.core.sdk;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+/**
+ * This interface provides scratchbox-specific functionality to an ISDKTarget.
+ * <p>
+ * This provides a means to differentiate build and install commands, which require different
+ * styles of root acquisition and also different mapping modes in scratchbox 2.
+ * @author eswartz
+ *
+ */
+public interface IScratchboxSDKTarget extends ISDKTarget {
+ public static String ARCHITECTURE_X86 = "X86";
+ public static String ARCHITECTURE_ARMEL = "ARMEL";
+ public static String ARCHITECTURE_UNKNOWN = "(unknown architecture)";
+
+ /**
+ * Get the rootstrap root directory.
+ * @return IPath where rootstrap is installed, or <code>null</code> if unknown
+ */
+ IPath getRootstrapPath();
+
+ /** Create a process launcher factory for running install (apt/dpkg/etc) commands.
+ * The default {@link #getProcessLauncherFactory()} provides launchers for build commands.
+ */
+ IProcessLauncherFactory getProcessLauncherFactoryForInstall();
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKFacade.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKFacade.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/maemosdk/core/sdk/ScratchboxSDKFacade.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.core.sdk;
+
+import java.util.List;
+
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+
+/**
+ * This facade provides access to IScratchbox[1|2]SDK instances
+ * gathered at startup.
+ *
+ * @author eswartz
+ *
+ */
+public class ScratchboxSDKFacade {
+ private static ScratchboxSDKFacade instance;
+
+ public static synchronized ScratchboxSDKFacade getInstance() {
+ if (instance == null) {
+ instance = new ScratchboxSDKFacade();
+ }
+ return instance;
+ }
+
+ private ScratchboxSDKFacade() { }
+
+ /**
+ * Get the (first) scratchbox 1 installation on the system.
+ * @return {@link IScratchbox1SDK}, never <code>null</code>
+ * @throws ScratchboxException if no scratchbox 1 SDK available
+ * */
+ public IScratchbox1SDK getScratchbox1SDK() throws ScratchboxException {
+ List<ISDK> sdks = SDKFactory.getInstance().getSDKs();
+ for (ISDK sdk : sdks) {
+ if (sdk instanceof IScratchbox1SDK) {
+ return (IScratchbox1SDK) sdk;
+ }
+ }
+ throw new ScratchboxException("No scratchbox 1 SDKs installed");
+ }
+
+ /**
+ * Get the (first) scratchbox 2 installation on the system.
+ * @return {@link IScratchbox1SDK}, never <code>null</code>
+ * @throws ScratchboxException if no scratchbox 2 SDK available
+ * */
+ public IScratchbox2SDK getScratchbox2SDK() throws ScratchboxException {
+ List<ISDK> sdks = SDKFactory.getInstance().getSDKs();
+ for (ISDK sdk : sdks) {
+ if (sdk instanceof IScratchbox2SDK) {
+ return (IScratchbox2SDK) sdk;
+ }
+ }
+ throw new ScratchboxException("No scratchbox 2 SDKs installed");
+ }
+
+ /**
+ * Get all scratchbox targets
+ * @return array of IScratchboxSDKTarget, never <code>null</code>
+ */
+ public IScratchboxSDKTarget[] getScratchboxSDKTargets() {
+ ISDKTarget[] sb1Targets = new ISDKTarget[0];
+ ISDKTarget[] sb2Targets = new ISDKTarget[0];
+ try {
+ sb1Targets = getScratchbox1SDK().getSDKTargets();
+ } catch (ScratchboxException e) {
+
+ }
+ try {
+ sb2Targets = getScratchbox2SDK().getSDKTargets();
+ } catch (ScratchboxException e) {
+
+ }
+
+ IScratchboxSDKTarget[] sdkTargets = new IScratchboxSDKTarget[
+ sb1Targets.length + sb2Targets.length];
+ int idx = 0;
+ for (ISDKTarget sdkTarget : sb1Targets) {
+ sdkTargets[idx++] = (IScratchboxSDKTarget) sdkTarget;
+ }
+ for (ISDKTarget sdkTarget : sb2Targets) {
+ sdkTargets[idx++] = (IScratchboxSDKTarget) sdkTarget;
+ }
+
+ return sdkTargets;
+ }
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/.project
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/.project (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.maemosdk.cpp.templates</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/META-INF/MANIFEST.MF
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/META-INF/MANIFEST.MF (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Maemo C/C++ Templates Plug-in
+Bundle-SymbolicName: org.maemo.esbox.maemosdk.cpp.templates;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Vendor: INdT / Nokia
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/build.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/build.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+bin.includes = META-INF/,\
+ plugin.xml,\
+ templates/,\
+ plugin.properties
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/plugin.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/plugin.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/plugin.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+Category.Simple=Simple
+Category.GTK=GTK
+Category.Hildon=Hildon
+Category.Maemo=Maemo
+
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/plugin.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/plugin.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.maemo.esbox.project.core.esbox_templates">
+ <template
+ category="Simple"
+ executionEnvironment="org.maemo.esbox.core.execution_environment.unknown"
+ filterPattern=".*"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.emptyproject"
+ location="templates/EmptyProject/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.automake"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+
+ <template
+ category="GTK"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.gtk"
+ filterPattern=".*"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.makefile.gtk_hello"
+ location="templates/GTKHelloWorld/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.makefile"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+
+ <template
+ category="Maemo"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern="CHINOOK|DIABLO"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.maemo_pad"
+ location="templates/MaemoPad/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.automake"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+
+ <template
+ category="Hildon"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern="SCIROCCO|GREGALE|BORA"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.makefile.hildon_hello_world_3"
+ location="templates/HildonHelloWorldMake3/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.makefile"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+ <template
+ category="Hildon"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern="CHINOOK|DIABLO"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.makefile.hildon_hello_world"
+ location="templates/HildonHelloWorldMake/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.makefile"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+ <template
+ category="Hildon"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern="CHINOOK|DIABLO"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.hildon_gui"
+ location="templates/HildonGUIApplication/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.automake"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+ <template
+ category="Hildon"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern="CHINOOK|DIABLO"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.hildon_plugin"
+ location="templates/HildonDesktopPlugins/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.automake"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+
+ <template
+ category="Maemo"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern="GREGALE|CHINOOK|DIABLO"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.drawexample"
+ location="templates/CppDrawExample/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.cpp"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+ <template
+ category="Maemo"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern="GREGALE|CHINOOK|DIABLO"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.gconfexample"
+ location="templates/CppGconfExample/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.cpp"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+ <template
+ category="Maemo"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern="GREGALE|CHINOOK|DIABLO"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.helloworld"
+ location="templates/CppHelloWorld/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.cpp"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+ <template
+ category="Maemo"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern="GREGALE|CHINOOK|DIABLO"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.helloworld18n"
+ location="templates/CppHelloWorldI18n/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.cpp"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+ <template
+ category="Maemo"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern="GREGALE|CHINOOK|DIABLO"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.newhelloworld"
+ location="templates/CppNewHelloWorld/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.cpp"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+ <template
+ category="Maemo"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern="CHINOOK|DIABLO"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.socketexample"
+ location="templates/SocketExample/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.cpp"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+ <template
+ category="Maemo"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern=".*"
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.maemoproject"
+ location="templates/MaemoProject/template.xml"
+ projectType="org.maemo.esbox.maemosdk.cpp.templates.projectType.cpp"
+ projectNature="org.maemo.esbox.cpp.project.core.ESboxCppNature">
+ </template>
+ </extension>
+ <extension
+ point="org.maemo.esbox.project.core.esbox_templateAssociations">
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.emptyproject">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.hildon_gui">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.hildon_plugin">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.makefile.emptyproject">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.makefile.hildon_hello_world">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.makefile.gtk_hello">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.maemo_pad">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.drawexample">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.gconfexample">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.helloworld">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.helloworld18n">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.newhelloworld">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.socketexample">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ <template
+ id="org.maemo.esbox.maemosdk.cpp.templates.template.executable.cpp.maemoproject">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.base">
+ </toolChain>
+ </template>
+ </extension>
+
+</plugin>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/COPYING.LESSER
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/COPYING.LESSER (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/COPYING.LESSER
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = src
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/autogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/autogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -x
+glib-gettextize --copy --force
+libtoolize --copy --automake
+intltoolize --copy --force --automake
+
+aclocal-1.8
+autoconf
+autoheader
+automake-1.8 --add-missing --copy --foreign
+./configure --enable-maintainer-mode
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/autogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/configure.ac
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/configure.ac (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+AC_INIT(draw_example, 0.2)
+AC_PREREQ(2.59)
+
+AM_INIT_AUTOMAKE([1.7.9])
+AC_CONFIG_HEADERS([config.h])
+
+AC_GNU_SOURCE
+AC_CANONICAL_HOST
+AM_MAINTAINER_MODE
+
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_CXX
+
+AC_CONFIG_FILES([Makefile
+ src/Makefile])
+
+PKG_CHECK_MODULES(LIBHILDONMM, hildonmm >= 0.9.6)
+AC_SUBST(LIBHILDONMM_CFLAGS)
+AC_SUBST(LIBHILDONMM_LIBS)
+
+AC_OUTPUT
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/configure.ac
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = foreign
+
+bin_PROGRAMS = draw_example
+draw_example_SOURCES = main.cpp \
+ mywindow.cpp \
+ mywindow.h
+
+draw_example_LDADD = $(LIBHILDONMM_LIBS)
+draw_example_CXXFLAGS = $(LIBHILDONMM_CFLAGS)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/main.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/main.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/main.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : main.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : Draw Example
+ ============================================================================
+ */
+
+#include "config.h"
+
+#include <hildonmm.h>
+#include <iostream>
+
+#include "mywindow.h"
+
+int main(int argc, char *argv[])
+{
+ /* Initialize gtkmm and checks the arguments passed to your application */
+ Gtk::Main main_loop(&argc, &argv);
+
+ /* Initialize the hildomm libraries */
+ Hildon::init();
+
+ /* Initialize libosso environment */
+ osso_context_t* osso_context = osso_initialize(PACKAGE_NAME, PACKAGE_VERSION, TRUE, 0);
+ if(!osso_context)
+ std::cerr << "osso_initialize() failed." << std::endl;
+
+ /* Set the application name */
+ Glib::set_application_name(PACKAGE_STRING);
+
+ /* Create an object for the main Window and attach it to the program */
+ MyWindow window;
+ Hildon::Program::get_instance()->add_window(window);
+
+ /* Begin the main application */
+ main_loop.run(window);
+
+ /* Clean the libosso environment */
+ osso_deinitialize(osso_context);
+
+ return 0;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/main.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/mywindow.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/mywindow.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/mywindow.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : Draw Example
+ ============================================================================
+ */
+
+#include <cmath> // Header for rand()
+#include <gtkmm.h>
+#include <hildonmm.h>
+
+#include "mywindow.h"
+
+/* Class constructor */
+MyWindow::MyWindow() :
+ m_item_exit("Exit"),
+ m_frame_box(false, 10), // homogeneous: false, spacing: 10
+ m_label_border("Border color"),
+ m_label_fill("Fill color"),
+ m_button_draw("Draw"),
+ m_button_clear("Clear")
+{
+ /* "Quit" menu button */
+ m_item_exit.signal_activate().connect(sigc::mem_fun(*this,
+ &MyWindow::on_menu_quit));
+
+ /* Border color button */
+ m_cb_border.connect_property_changed("color", sigc::mem_fun(*this,
+ &MyWindow::on_border_color_button_color_changed));
+
+ /* Fill color button */
+ m_cb_fill.connect_property_changed("color", sigc::mem_fun(*this,
+ &MyWindow::on_fill_color_button_color_changed));
+
+ /* Clear button */
+ m_button_clear.signal_clicked().connect(sigc::mem_fun(*this,
+ &MyWindow::on_button_clear_clicked));
+
+ /* Draw box */
+ m_button_draw.signal_clicked().connect(sigc::mem_fun(*this,
+ &MyWindow::on_button_draw_clicked));
+
+ /* Attach the menu object to the application */
+ set_menu(m_main);
+
+ /* Add items to the menu */
+ m_main.append(m_item_exit);
+ m_main.show_all();
+
+ /* Attach the menu object to the application */
+ set_menu(m_main);
+
+ /* Add the m_frame_box to window: */
+ add(m_frame_box);
+
+ /* Add items to the combo box: */
+ m_combo_box.append_text("Circle");
+ m_combo_box.append_text("Line");
+ m_combo_box.append_text("Rectangle");
+
+ /* Button box get its items: */
+ m_button_box.pack_start(m_combo_box);
+ m_button_box.pack_start(m_label_border);
+ m_button_box.pack_start(m_cb_border);
+ m_button_box.pack_start(m_label_fill);
+ m_button_box.pack_start(m_cb_fill);
+ m_button_box.pack_start(m_button_draw);
+ m_button_box.pack_start(m_button_clear);
+
+ /* frame_box receives button_box and draw_area: */
+ m_frame_box.pack_start(m_button_box, Gtk::PACK_SHRINK);
+ m_frame_box.pack_start(m_draw_area);
+
+ /* Make all menu widgets visible */
+ show_all();
+
+ /* Initialize Cairo context */
+ cairo_ctx = m_draw_area.get_window()->create_cairo_context();
+}
+
+/* Class destructor */
+MyWindow::~MyWindow()
+{
+}
+
+/* Callback methods */
+void MyWindow::on_menu_quit()
+{
+ /* Close the window */
+ hide();
+}
+
+void MyWindow::on_border_color_button_color_changed()
+{
+ /* The border color button gets the properties of the chosen color */
+ m_cb_border.get_property("color", m_color_border);
+}
+
+void MyWindow::on_fill_color_button_color_changed()
+{
+ /* The fill color button gets the properties of the chosen color */
+ m_cb_fill.get_property("color", m_color_fill);
+}
+
+void MyWindow::on_button_draw_clicked()
+{
+ Glib::ustring text = m_combo_box.get_active_text();
+ if (text == "Circle") // If "Circle" option from combo box gets selected
+ on_combo_circle_selected();
+ if (text == "Line") // If "Line" option from combo box gets selected
+ on_combo_line_selected();
+ if (text == "Rectangle") // If "Rectangle" option from combo box gets selected
+ on_combo_rectangle_selected();
+}
+
+void MyWindow::on_button_clear_clicked()
+{
+ /* These variables captures the total width and height of draw_area */
+ const int width = m_draw_area.get_width();
+ const int height = m_draw_area.get_height();
+
+ cairo_ctx->save();
+
+ /* Set background color (from color_bg)
+ Notice that we're getting a percentage (0 to 1) of the color
+ components from color_bg, since it is needed by set_source_rgb */
+ cairo_ctx->set_source_rgb(1, 1, 1);
+ cairo_ctx->paint();
+ cairo_ctx->restore();
+}
+
+void MyWindow::on_combo_circle_selected()
+{
+ const int width = m_draw_area.get_width();
+ const int height = m_draw_area.get_height();
+
+ /* These variables creates a randomic number in order to draw the object on different places */
+ int randx = rand()%width;
+ int randy = rand()%height;
+ int rands = rand()%50;
+
+ cairo_ctx->save();
+
+ /* Set fill color (from color_fill) */
+ cairo_ctx->set_source_rgb(m_color_fill.get_red_p(), m_color_fill.get_green_p(),
+ m_color_fill.get_blue_p());
+
+ /* Here we draw the circle */
+ cairo_ctx->arc(randx, randy, rands, 0.0, 2.0 * M_PI);
+ cairo_ctx->close_path();
+ cairo_ctx->fill();
+ cairo_ctx->stroke();
+
+ /* Set border color */
+ cairo_ctx->set_line_width(rands/4); // Set border line width to 1/4 of rands
+
+ /* Notice that set_source_rgba has a fourth parameter that is the level
+ of alpha you want on the object you're drawing */
+ cairo_ctx->set_source_rgba(m_color_border.get_red_p(), m_color_border.get_green_p(),
+ m_color_border.get_blue_p(), 0.5);
+ cairo_ctx->arc(randx, randy, rands, 0.0, 2.0 * M_PI);
+ cairo_ctx->close_path();
+ cairo_ctx->stroke();
+
+ cairo_ctx->restore();
+}
+
+void MyWindow::on_combo_line_selected()
+{
+ const int width = m_draw_area.get_width();
+ const int height = m_draw_area.get_height();
+
+ int randx = rand()%width;
+ int randy = rand()%height;
+ int randh = rand()%width;
+ int randw = rand()%height;
+
+ cairo_ctx->save();
+
+ /* Set border color (from color_border) */
+ cairo_ctx->set_source_rgb(m_color_border.get_red_p(), m_color_border.get_green_p(),
+ m_color_border.get_blue_p());
+
+ /* Here we draw the line (we only draw the "border" color since it is too
+ thin to have a fill color. */
+ cairo_ctx->move_to(randx, randy);
+ cairo_ctx->line_to(randh, randw);
+ cairo_ctx->close_path();
+ cairo_ctx->stroke();
+
+ cairo_ctx->restore();
+}
+
+void MyWindow::on_combo_rectangle_selected()
+{
+ const int width = m_draw_area.get_width();
+ const int height = m_draw_area.get_height();
+
+ int randx = rand()%width;
+ int randy = rand()%height;
+ int randw = rand()%100;
+ int randh = rand()%100;
+
+ cairo_ctx->save();
+
+ /* Set fill color (from color_fill) */
+ cairo_ctx->set_source_rgb(m_color_fill.get_red_p(), m_color_fill.get_green_p(),
+ m_color_fill.get_blue_p());
+
+ /* Here we draw the rectangle */
+ cairo_ctx->rectangle(randx, randy, randh, randw);
+ cairo_ctx->close_path();
+ cairo_ctx->fill();
+ cairo_ctx->stroke();
+
+ /* Set border color (from color_border) */
+ cairo_ctx->set_line_width(randw/4);
+ cairo_ctx->set_source_rgba(m_color_border.get_red_p(), m_color_border.get_green_p(),
+ m_color_border.get_blue_p(), 0.5);
+ cairo_ctx->rectangle(randx, randy, randh, randw);
+ cairo_ctx->close_path();
+ cairo_ctx->stroke();
+
+ cairo_ctx->restore();
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/mywindow.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/mywindow.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/mywindow.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/mywindow.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow.h
+ Author : $(author)
+ Version : $(version)
+ Description : Draw Example
+ ============================================================================
+ */
+
+#ifndef MYWINDOW_H
+#define MYWINDOW_H
+
+#include <gtkmm.h>
+#include <hildonmm.h>
+
+class MyWindow : public Hildon::Window
+{
+public:
+ MyWindow();
+ virtual ~MyWindow();
+
+protected:
+ /* Signal handlers */
+ void on_menu_quit(); // "Quit" menu button
+ void on_border_color_button_color_changed(); // "Border" color button
+ void on_fill_color_button_color_changed(); // "Fill" color button
+ void on_button_clear_clicked(); // "Clear" button
+ void on_button_draw_clicked(); // "Draw" button
+ void on_combo_circle_selected(); // "Circle" combo option
+ void on_combo_line_selected(); // "Line" combo option
+ void on_combo_rectangle_selected(); // "Rectangle" combo option
+
+ /* Menu object */
+ Gtk::Menu m_main;
+
+ /* The menu items */
+ Gtk::MenuItem m_item_exit;
+
+ /* Main box (parent of all other boxes) */
+ Gtk::HBox m_frame_box;
+
+ /* Button box (Vertical) */
+ Gtk::VButtonBox m_button_box;
+
+ /* Drawing area */
+ Gtk::DrawingArea m_draw_area;
+
+ /* Combo box */
+ Gtk::ComboBoxText m_combo_box;
+
+ /* Border color items */
+ Gdk::Color m_color_border; // Holds selected color
+ Gtk::Label m_label_border; // Label for border color button
+ Hildon::ColorButton m_cb_border; // Border color button itself
+
+ /* Fill color items */
+ Gdk::Color m_color_fill;
+ Gtk::Label m_label_fill;
+ Hildon::ColorButton m_cb_fill;
+
+ /* Action buttons */
+ Gtk::Button m_button_clear;
+ Gtk::Button m_button_draw;
+
+ /* Cairo Context */
+ Cairo::RefPtr<Cairo::Context> cairo_ctx;
+};
+
+#endif /* MYWINDOW_H */
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/src/mywindow.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+#Template Default Values
+CppDrawExample.Ctemplate.label=Maemo Draw Example Project
+CppDrawExample.Ctemplate.description=This program shows use of Gtk::DrawingArea.\n\n\
+This project requires the maemomm packages. \
+Please see\n\n\thttp://maemo.org/development/documentation/programming_languages/\n\nfor details.\n\n\
+NOTE: this application requires the 'doctools' devkit in your scratchbox target. \n\n\
+If you get the error:\n\n\tconfigure: error: Your intltool is too old. \
+You need intltool 0.23 or later.\n\nwhen configuring, then for scratchbox 1, invoke a command like:\n\n\
+\tsb-conf setup CHINOOK_ARMEL --force --cputransp=/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2 \
+--compiler=cs2005q3.2-glibc2.5-arm --devkits=perl:debian-etch:maemo3-tools:cputransp:doctools\n\n\
+(or establish a similar configuration via sb-menu), then invoke "Build Application > Generate Configure" and rebuild.
+CppDrawExample.basics.label=Basic Settings
+CppDrawExample.basics.description=Basic properties of a project
+CppDrawExample.author.label=Author
+CppDrawExample.author.description=Name of the author
+CppDrawExample.version.label=Version
+CppDrawExample.version.description=Your application version
+CppDrawExample.version.default=0.1
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="INdT"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="CppDrawExampleProject" label="%CppDrawExample.Ctemplate.label" description="%CppDrawExample.Ctemplate.description"
+ help="help.html">
+
+ <property-group id="basics" label="%CppDrawExample.basics.label" description="%CppDrawExample.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%CppDrawExample.author.label"
+ description="%CppDrawExample.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="version"
+ label="%CppDrawExample.version.label"
+ description="%CppDrawExample.version.description"
+ type="input"
+ pattern=".*"
+ default="%CppDrawExample.version.default"
+ hidden="false"
+ persist="true"/>
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING.LESSER"/>
+ <simple name="target" value="COPYING.LESSER"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="configure.ac"/>
+ <simple name="target" value="configure.ac"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="autogen.sh"/>
+ <simple name="target" value="autogen.sh"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="Makefile.am"/>
+ <simple name="target" value="Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/main.cpp"/>
+ <simple name="target" value="src/main.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow.cpp"/>
+ <simple name="target" value="src/mywindow.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow.h"/>
+ <simple name="target" value="src/mywindow.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/Makefile.am"/>
+ <simple name="target" value="src/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="maemo-cplusplus-env" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildonmm" />
+ </simple-array>
+ </process>
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppDrawExample/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/COPYING.LESSER
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/COPYING.LESSER (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/COPYING.LESSER
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = src
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/autogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/autogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -x
+glib-gettextize --copy --force
+libtoolize --copy --automake
+intltoolize --copy --force --automake
+
+aclocal-1.8
+autoconf
+autoheader
+automake-1.8 --add-missing --copy --foreign
+./configure --enable-maintainer-mode
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/autogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/configure.ac
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/configure.ac (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+AC_INIT(gconf_example, 0.1)
+AC_PREREQ(2.59)
+
+AM_INIT_AUTOMAKE([1.7.9])
+AC_CONFIG_HEADERS([config.h])
+
+AC_GNU_SOURCE
+AC_CANONICAL_HOST
+AM_MAINTAINER_MODE
+
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_CXX
+
+AC_CONFIG_FILES([Makefile
+ src/Makefile])
+
+PKG_CHECK_MODULES(LIBHILDONMM, hildonmm >= 0.9.6)
+AC_SUBST(LIBHILDONMM_CFLAGS)
+AC_SUBST(LIBHILDONMM_LIBS)
+
+PKG_CHECK_MODULES(LIBGCONFMM, gconfmm-2.6 >= 2.20.0)
+AC_SUBST(LIBGCONFMM_CFLAGS)
+AC_SUBST(LIBGCONFMM_LIBS)
+
+AC_OUTPUT
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/configure.ac
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = foreign
+
+bin_PROGRAMS = gconf_example
+gconf_example_SOURCES = main.cpp \
+ mywindow.cpp \
+ mywindow.h
+
+gconf_example_LDADD = $(LIBHILDONMM_LIBS) $(LIBGCONFMM_LIBS)
+gconf_example_CXXFLAGS = $(LIBHILDONMM_CFLAGS) $(LIBGCONFMM_CFLAGS)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/main.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/main.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/main.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : main.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : GConf Example
+ ============================================================================
+ */
+
+#include "config.h"
+
+#include <gconfmm.h>
+#include <hildonmm.h>
+#include <iostream>
+
+#include "mywindow.h"
+
+int main(int argc, char *argv[])
+{
+ /* Initialize gtkmm and checks the arguments passed to your application */
+ Gnome::Conf::init();
+ Gtk::Main main_loop(&argc, &argv);
+
+ /* Initialize the hildomm libraries */
+ Hildon::init();
+
+ /* Initialize libosso environment */
+ osso_context_t* osso_context = osso_initialize(PACKAGE_NAME, PACKAGE_VERSION, TRUE, 0);
+ if(!osso_context)
+ std::cerr << "osso_initialize() failed." << std::endl;
+
+ /* Set the application name */
+ Glib::set_application_name(PACKAGE_STRING);
+
+ /* Create an object for the main Window and attach it to the program */
+ MyWindow window;
+ Hildon::Program::get_instance()->add_window(window);
+
+ /* Begin the main application */
+ main_loop.run(window);
+
+ /* Clean the libosso environment */
+ osso_deinitialize(osso_context);
+
+ return 0;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/main.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/mywindow.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/mywindow.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/mywindow.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : GConf Example
+ ============================================================================
+ */
+
+#include <gconfmm.h>
+#include <glibmm.h>
+#include <gtkmm.h>
+#include <hildonmm.h>
+
+#include "mywindow.h"
+
+/* Class constructor */
+MyWindow::MyWindow():
+ m_checkbutton ("Check Button State"),
+ m_label ("Text Box Entry"),
+ m_save("Save"),
+ m_item_exit("Exit"),
+ gconf_textentry("/apps/gconf_example/textentry"), /* Define where GConf will store the text entry */
+ gconf_checkbox("/apps/gconf_example/checkbox") /* Define where GConf will store the check box state */
+{
+
+ /* Add items to the menu */
+ m_main.append(m_item_exit);
+ m_main.show_all();
+
+ set_menu(m_main);
+
+ /* Create the widgets */
+ add(vbox);
+ vbox.set_border_width(50);
+
+ vbox.pack_start(hbox1);
+ vbox.pack_start(hbox2);
+ vbox.pack_start(hbox3);
+
+ hbox1.pack_start(m_label);
+ hbox1.pack_start(m_entry);
+ hbox2.pack_start(m_checkbutton);
+ hbox3.pack_start(m_save);
+
+ /* Returns the GConf handler */
+ gconf = Gnome::Conf::Client::get_default_client();
+
+ /* Attach the callback functions to the activate signal */
+ m_save.signal_clicked().connect(sigc::mem_fun(*this, &MyWindow::on_save_clicked));
+ m_item_exit.signal_activate().connect(sigc::mem_fun(*this, &MyWindow::on_menu_quit));
+
+ /* Call the method to load the application information */
+ restore();
+
+ /* Show all widgets on the screen */
+ show_all();
+}
+
+/* Class destructor */
+MyWindow::~MyWindow()
+{
+}
+
+/* Callback function, which will be called to close the application */
+void MyWindow::on_menu_quit()
+{
+ hide();
+}
+
+/* Save current status */
+void MyWindow::on_save_clicked()
+{
+ /* Get the check button state and store it on GConf */
+ if (m_checkbutton.get_active())
+ gconf->set(gconf_checkbox, true, error);
+ else
+ gconf->set(gconf_checkbox, false, error);
+
+ /* Store the text entry content on GConf */
+ gconf->set(gconf_textentry, m_entry.get_text(), error);
+}
+
+/* Load configuration status */
+void MyWindow::restore(void)
+{
+ /* Get the stored check button state and set the widget accordingly */
+ if (gconf->get_bool(gconf_checkbox, error))
+ m_checkbutton.set_active();
+
+ /* Get the stored text entry content and set the widget accordingly */
+ m_entry.set_text(gconf->get_string(gconf_textentry, error));
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/mywindow.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/mywindow.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/mywindow.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/mywindow.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow.h
+ Author : $(author)
+ Version : $(version)
+ Description : GConf Example
+ ============================================================================
+ */
+
+#ifndef MYWINDOW_H
+#define MYWINDOW_H
+
+#include <gconfmm.h>
+#include <glibmm.h>
+#include <gtkmm.h>
+#include <hildonmm.h>
+
+class MyWindow : public Hildon::Window
+{
+public:
+ MyWindow();
+ virtual ~MyWindow();
+ void restore();
+
+protected:
+ void on_save_clicked();
+ void on_menu_quit();
+
+ Gtk::Menu m_main;
+ Gtk::MenuItem m_item_exit;
+ Gtk::VBox vbox;
+ Gtk::HBox hbox1;
+ Gtk::HBox hbox2;
+ Gtk::HBox hbox3;
+ Gtk::CheckButton m_checkbutton;
+ Gtk::Label m_label;
+ Gtk::Entry m_entry;
+ Gtk::Button m_save;
+
+ Glib::RefPtr<Gnome::Conf::Client> gconf;
+ std::auto_ptr<Glib::Error> error;
+
+ Glib::ustring gconf_textentry;
+ Glib::ustring gconf_checkbox;
+};
+
+#endif /* MYWINDOW_H */
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/src/mywindow.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+#Template Default Values
+CppGconfExample.Ctemplate.label=Maemo Gconf Example Project
+CppGconfExample.Ctemplate.description=This program shows use of Gnome::Conf::Client.\n\n\
+This project requires the maemomm packages. \
+Please see\n\n\thttp://maemo.org/development/documentation/programming_languages/\n\nfor details.
+CppGconfExample.basics.label=Basic Settings
+CppGconfExample.basics.description=Basic properties of a project
+CppGconfExample.author.label=Author
+CppGconfExample.author.description=Name of the author
+CppGconfExample.version.label=Version
+CppGconfExample.version.description=Your application version
+CppGconfExample.version.default=0.1
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="INdT"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="CppGconfExampleProject" label="%CppGconfExample.Ctemplate.label" description="%CppGconfExample.Ctemplate.description"
+ help="help.html">
+
+ <property-group id="basics" label="%CppGconfExample.basics.label" description="%CppGconfExample.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%CppGconfExample.author.label"
+ description="%CppGconfExample.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="version"
+ label="%CppGconfExample.version.label"
+ description="%CppGconfExample.version.description"
+ type="input"
+ pattern=".*"
+ default="%CppGconfExample.version.default"
+ hidden="false"
+ persist="true"/>
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING.LESSER"/>
+ <simple name="target" value="COPYING.LESSER"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="autogen.sh"/>
+ <simple name="target" value="autogen.sh"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="configure.ac"/>
+ <simple name="target" value="configure.ac"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="Makefile.am"/>
+ <simple name="target" value="Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/main.cpp"/>
+ <simple name="target" value="src/main.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow.cpp"/>
+ <simple name="target" value="src/mywindow.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow.h"/>
+ <simple name="target" value="src/mywindow.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/Makefile.am"/>
+ <simple name="target" value="src/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="maemo-cplusplus-env" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildonmm" />
+ <element value="gconfmm-2.6" />
+ </simple-array>
+ </process>
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppGconfExample/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/COPYING.LESSER
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/COPYING.LESSER (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/COPYING.LESSER
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = src
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/autogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/autogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -x
+glib-gettextize --copy --force
+libtoolize --copy --automake
+intltoolize --copy --force --automake
+
+aclocal-1.8
+autoconf
+autoheader
+automake-1.8 --add-missing --copy --foreign
+./configure --enable-maintainer-mode
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/autogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/configure.ac
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/configure.ac (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+AC_INIT(helloworld, 0.1)
+AC_PREREQ(2.59)
+
+AM_INIT_AUTOMAKE([1.7.9])
+AC_CONFIG_HEADERS([config.h])
+
+AC_GNU_SOURCE
+AC_CANONICAL_HOST
+AM_MAINTAINER_MODE
+
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_CXX
+
+AC_CONFIG_FILES([Makefile
+ src/Makefile])
+
+PKG_CHECK_MODULES(LIBHILDONMM, hildonmm >= 0.9.6)
+AC_SUBST(LIBHILDONMM_CFLAGS)
+AC_SUBST(LIBHILDONMM_LIBS)
+
+AC_OUTPUT
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/configure.ac
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = foreign
+
+bin_PROGRAMS = helloworld
+helloworld_SOURCES = main.cpp \
+ mywindow.cpp \
+ mywindow.h
+
+helloworld_LDADD = $(LIBHILDONMM_LIBS)
+helloworld_CXXFLAGS = $(LIBHILDONMM_CFLAGS)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/main.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/main.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/main.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : main.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : CPP Hello Example
+ ============================================================================
+ */
+
+#include <hildonmm.h>
+#include <iostream>
+
+#include "mywindow.h"
+
+int main(int argc, char *argv[])
+{
+ /* Initialize gtkmm and checks the arguments passed to your application */
+ Gtk::Main main_loop(&argc, &argv);
+
+ /* Initialize the hildomm libraries */
+ Hildon::init();
+
+ /* Initialize libosso environment */
+ osso_context_t* osso_context = osso_initialize("helloworld", "1.0.0", TRUE, 0);
+ if(!osso_context)
+ std::cerr << "osso_initialize() failed." << std::endl;
+
+ /* Set the application name */
+ Glib::set_application_name("$(message)");
+
+ /* Create an object for the main Window and attach it to the program */
+ MyWindow window;
+ Hildon::Program::get_instance()->add_window(window);
+
+ /* Begin the main application */
+ main_loop.run(window);
+
+ /* Clean the libosso environment */
+ osso_deinitialize(osso_context);
+
+ return 0;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/main.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/mywindow.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/mywindow.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/mywindow.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : CPP Hello Example
+ ============================================================================
+ */
+
+#include <gtkmm.h>
+#include <hildonmm.h>
+
+#include "mywindow.h"
+
+/* Class constructor */
+MyWindow::MyWindow() :
+ m_item_exit("Exit"),
+ m_item_helloworld("Say Hello")
+{
+ /* Add items to the menu */
+ m_main.append(m_item_helloworld);
+ m_main.append(m_item_exit);
+ m_main.show_all();
+
+ /* Attach the menu object to the application */
+ set_menu(m_main);
+
+ /* Attach the callback function to signal handler */
+ m_item_exit.signal_activate().connect(sigc::mem_fun(*this, &MyWindow::on_menu_quit));
+ m_item_helloworld.signal_activate().connect(sigc::mem_fun(*this, &MyWindow::on_menu_helloworld));
+
+ /* Make all menu widgets visible */
+ show_all();
+}
+
+/* Class destructor */
+MyWindow::~MyWindow()
+{
+}
+
+/* Callback function for menu exit */
+void MyWindow::on_menu_quit()
+{
+ /* Close the window */
+ hide();
+}
+
+void MyWindow::on_menu_helloworld()
+{
+ /* Create and show a "Hello World" dialog */
+ Hildon::Note helloworld_note(Hildon::NOTE_TYPE_INFORMATION, "$(message)");
+ helloworld_note.run();
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/mywindow.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/mywindow.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/mywindow.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/mywindow.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow.h
+ Author : $(author)
+ Version : $(version)
+ Description : CPP Hello Example
+ ============================================================================
+ */
+
+#ifndef MYWINDOW_H
+#define MYWINDOW_H
+
+#include <gtkmm.h>
+#include <hildonmm.h>
+
+class MyWindow : public Hildon::Window
+{
+public:
+ MyWindow();
+ virtual ~MyWindow();
+
+protected:
+ /* Signal handlers */
+ void on_menu_quit();
+ void on_menu_helloworld();
+
+ /* Menu object */
+ Gtk::Menu m_main;
+
+ /* The menu items */
+ Gtk::MenuItem m_item_exit;
+ Gtk::MenuItem m_item_helloworld;
+};
+
+#endif /* MYWINDOW_H */
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/src/mywindow.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,15 @@
+#Template Default Values
+CppHelloWorld.Ctemplate.label=Maemo Hello World Cpp Project
+CppHelloWorld.Ctemplate.description=This is a simple Hello World program.\n\n\
+This project requires the maemomm packages. \
+Please see\n\n\thttp://maemo.org/development/documentation/programming_languages/\n\nfor details.
+CppHelloWorld.basics.label=Basic Settings
+CppHelloWorld.basics.description=Basic properties of a project
+CppHelloWorld.author.label=Author
+CppHelloWorld.author.description=Name of the author
+CppHelloWorld.version.label=Version
+CppHelloWorld.version.description=Your application version
+CppHelloWorld.version.default=0.1
+CppHelloWorld.message.default=Hello World!!!
+CppHelloWorld.message.description=Your hello world greeting message
+CppHelloWorld.message.label=Hello world greeting
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="INdT"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="CppHelloWorldProject" label="%CppHelloWorld.Ctemplate.label" description="%CppHelloWorld.Ctemplate.description"
+ help="help.html">
+
+ <property-group id="basics" label="%CppHelloWorld.basics.label" description="%CppHelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%CppHelloWorld.author.label"
+ description="%CppHelloWorld.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="version"
+ label="%CppHelloWorld.version.label"
+ description="%CppHelloWorld.version.description"
+ type="input"
+ pattern=".*"
+ default="%CppHelloWorld.version.default"
+ hidden="false"
+ persist="true"/>
+ <property id="message"
+ label="%CppHelloWorld.message.label"
+ description="%CppHelloWorld.message.description"
+ type="input"
+ pattern=".*"
+ default="%CppHelloWorld.message.default"
+ hidden="false"
+ persist="true"/>
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING.LESSER"/>
+ <simple name="target" value="COPYING.LESSER"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="autogen.sh"/>
+ <simple name="target" value="autogen.sh"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="configure.ac"/>
+ <simple name="target" value="configure.ac"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="Makefile.am"/>
+ <simple name="target" value="Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/main.cpp"/>
+ <simple name="target" value="src/main.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow.cpp"/>
+ <simple name="target" value="src/mywindow.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow.h"/>
+ <simple name="target" value="src/mywindow.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/Makefile.am"/>
+ <simple name="target" value="src/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="maemo-cplusplus-env" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildonmm" />
+ </simple-array>
+ </process>
+
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorld/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/COPYING.LESSER
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/COPYING.LESSER (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/COPYING.LESSER
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = src po
+
+INTLTOOL_FILES = intltool-extract.in \
+ intltool-merge.in \
+ intltool-update.in
+
+EXTRA_DIST = $(INTLTOOL_FILES)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/autogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/autogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -x
+glib-gettextize --copy --force
+libtoolize --copy --automake
+intltoolize --copy --force --automake
+
+aclocal-1.8
+autoconf
+autoheader
+automake-1.8 --add-missing --copy --foreign
+./configure --enable-maintainer-mode
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/autogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/configure.ac
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/configure.ac (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+AC_INIT(helloworld-i18n, 0.1)
+AC_PREREQ(2.59)
+
+AM_INIT_AUTOMAKE([1.7.9])
+AC_CONFIG_HEADERS([config.h])
+
+AC_GNU_SOURCE
+AC_CANONICAL_HOST
+AM_MAINTAINER_MODE
+
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_CXX
+
+IT_PROG_INTLTOOL([0.35.0])
+GETTEXT_PACKAGE="$PACKAGE_NAME"
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"],
+ [The domain to use with gettext])
+AM_GLIB_GNU_GETTEXT
+
+HELLOWORLD_LOCALEDIR=[${datadir}/locale]
+AC_SUBST(HELLOWORLD_LOCALEDIR)
+
+AC_CONFIG_FILES([Makefile
+ src/Makefile
+ po/Makefile.in])
+
+PKG_CHECK_MODULES(LIBHILDONMM, hildonmm >= 0.9.6)
+AC_SUBST(LIBHILDONMM_CFLAGS)
+AC_SUBST(LIBHILDONMM_LIBS)
+
+AC_OUTPUT
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/configure.ac
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/LINGUAS.htm
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/LINGUAS.htm (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/LINGUAS.htm 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3 @@
+en_GB
+pt_BR
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/LINGUAS.htm
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/POTFILES.in
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/POTFILES.in (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/POTFILES.in 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,2 @@
+src/main.cpp
+src/mywindow.cpp
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/POTFILES.in
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/en_GB.po
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/en_GB.po (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/en_GB.po 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: helloworld_i18n\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-10-10 12:18-0400\n"
+"PO-Revision-Date: 2007-10-05 16:14-0300\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../src/main.cpp:25
+msgid "osso_initialize() failed."
+msgstr ""
+
+#: ../src/mywindow.cpp:9
+msgid "Exit"
+msgstr ""
+
+#: ../src/mywindow.cpp:10
+msgid "Say Hello"
+msgstr ""
+
+#. Create and show a "Hello World" dialog
+#: ../src/mywindow.cpp:43
+msgid "Hello World!"
+msgstr ""
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/en_GB.po
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/pt_BR.po
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/pt_BR.po (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/pt_BR.po 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: helloworld_i18n\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-10-10 12:18-0400\n"
+"PO-Revision-Date: 2007-10-05 16:14-0300\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../src/main.cpp:25
+msgid "osso_initialize() failed."
+msgstr "osso_initialize() falhou"
+
+#: ../src/mywindow.cpp:9
+msgid "Exit"
+msgstr "Sair"
+
+#: ../src/mywindow.cpp:10
+msgid "Say Hello"
+msgstr "Diga Alô"
+
+#. Create and show a "Hello World" dialog
+#: ../src/mywindow.cpp:43
+msgid "Hello World!"
+msgstr "Alô Mundo!"
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/po/pt_BR.po
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = foreign
+
+bin_PROGRAMS = helloworld-i18n
+helloworld_i18n_SOURCES = main.cpp \
+ mywindow.cpp \
+ mywindow.h
+
+helloworld_i18n_LDADD = $(LIBHILDONMM_LIBS)
+helloworld_i18n_CXXFLAGS = $(LIBHILDONMM_CFLAGS) -DHELLOWORLD_LOCALEDIR=\"${HELLOWORLD_LOCALEDIR}\"
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/helloworld.htm
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/helloworld.htm
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/main.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/main.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/main.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : main.cc
+ Author : $(author)
+ Version : $(version)
+ Description : CPP Hello World I18n
+ ============================================================================
+ */
+
+#include "config.h"
+
+#include <hildonmm.h>
+#include <iostream>
+#include <glibmm/i18n.h> /* Must be after <iostream> */
+
+#include "mywindow.h"
+
+int main(int argc, char *argv[])
+{
+ /* i18n initialization */
+ bindtextdomain(GETTEXT_PACKAGE, HELLOWORLD_LOCALEDIR);
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+ textdomain(GETTEXT_PACKAGE);
+
+ /* Initialize gtkmm and checks the arguments passed to your application */
+ Gtk::Main main_loop(&argc, &argv);
+
+ /* Initialize the hildomm libraries */
+ Hildon::init();
+
+ /* Initialize libosso environment */
+ osso_context_t* osso_context = osso_initialize(PACKAGE_NAME, PACKAGE_VERSION, TRUE, 0);
+ if(!osso_context)
+ std::cerr << _("osso_initialize() failed.") << std::endl;
+
+ /* Set the application name */
+ Glib::set_application_name(PACKAGE_STRING);
+
+ /* Create an object for the main Window and attach it to the program */
+ MyWindow window;
+ Hildon::Program::get_instance()->add_window(window);
+
+ /* Begin the main application */
+ main_loop.run(window);
+
+ /* Clean the libosso environment */
+ osso_deinitialize(osso_context);
+
+ return 0;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/main.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/mywindow.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/mywindow.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/mywindow.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : CPP Hello World I18n
+ ============================================================================
+ */
+
+#include <glibmm/i18n.h>
+#include <gtkmm.h>
+#include <hildonmm.h>
+
+#include "mywindow.h"
+
+/* Class constructor */
+MyWindow::MyWindow() :
+ m_item_exit(_("Exit")),
+ m_item_helloworld(_("Say Hello"))
+{
+ /* Add items to the menu */
+ m_main.append(m_item_helloworld);
+ m_main.append(m_item_exit);
+ m_main.show_all();
+
+ /* Attach the menu object to the application */
+ set_menu(m_main);
+
+ /* Attach the callback function to signal handler */
+ m_item_exit.signal_activate().connect(sigc::mem_fun(*this, &MyWindow::on_menu_quit));
+ m_item_helloworld.signal_activate().connect(sigc::mem_fun(*this, &MyWindow::on_menu_helloworld));
+
+ /* Make all menu widgets visible */
+ show_all();
+}
+
+/* Class destructor */
+MyWindow::~MyWindow()
+{
+}
+
+/* Callback function for menu exit */
+void MyWindow::on_menu_quit()
+{
+ /* Close the window */
+ hide();
+}
+
+void MyWindow::on_menu_helloworld()
+{
+ /* Create and show a "Hello World" dialog */
+ Hildon::Note helloworld_note(Hildon::NOTE_TYPE_INFORMATION, _("$(message)"));
+ helloworld_note.run();
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/mywindow.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/mywindow.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/mywindow.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/mywindow.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow.h
+ Author : $(author)
+ Version : $(version)
+ Description : CPP Hello World I18n
+ ============================================================================
+ */
+
+#ifndef MYWINDOW_H
+#define MYWINDOW_H
+
+#include <gtkmm.h>
+#include <hildonmm.h>
+
+class MyWindow : public Hildon::Window
+{
+public:
+ MyWindow();
+ virtual ~MyWindow();
+
+protected:
+ /* Signal handlers */
+ void on_menu_quit();
+ void on_menu_helloworld();
+
+ /* Menu object */
+ Gtk::Menu m_main;
+
+ /* The menu items */
+ Gtk::MenuItem m_item_exit;
+ Gtk::MenuItem m_item_helloworld;
+};
+
+#endif /* MYWINDOW_H */
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/src/mywindow.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+#Template Default Values
+CppHelloworldI18n.Ctemplate.label=Maemo Hello World I18n Cpp Project
+CppHelloworldI18n.Ctemplate.description=This is a simple Hello World project with internationalization \
+support using GNU gettext.\n\n\
+This project requires the maemomm packages. \
+Please see\n\n\thttp://maemo.org/development/documentation/programming_languages/\n\nfor details.\n\n\
+NOTE: this application requires the 'doctools' devkit in your scratchbox target. \n\n\
+If you get the error:\n\n\
+\tconfigure: error: Your intltool is too old. You need intltool 0.23 or later.\n\n\
+when configuring, then for scratchbox 1, invoke a command like:\n\n\
+\tsb-conf setup CHINOOK_ARMEL --force --cputransp=/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2 \
+--compiler=cs2005q3.2-glibc2.5-arm --devkits=perl:debian-etch:maemo3-tools:cputransp:doctools\n\n\
+(or establish a similar configuration via sb-menu), then invoke "Build Application > Generate Configure" and rebuild.
+CppHelloworldI18n.basics.label=Basic Settings
+CppHelloworldI18n.basics.description=Basic properties of a project
+CppHelloworldI18n.author.label=Author
+CppHelloworldI18n.author.description=Name of the author
+CppHelloworldI18n.version.label=Version
+CppHelloworldI18n.version.description=Your application version
+CppHelloworldI18n.version.default=0.1
+CppHelloworldI18n.message.default=Hello World!!!
+CppHelloworldI18n.message.description=Your hello world greeting message
+CppHelloworldI18n.message.label=Hello world greeting
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="INdT"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="CppHelloworldI18nProject" label="%CppHelloworldI18n.Ctemplate.label" description="%CppHelloworldI18n.Ctemplate.description"
+ help="help.html">
+
+ <property-group id="basics" label="%CppHelloworldI18n.basics.label" description="%CppHelloworldI18n.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%CppHelloworldI18n.author.label"
+ description="%CppHelloworldI18n.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="version"
+ label="%CppHelloworldI18n.version.label"
+ description="%CppHelloworldI18n.version.description"
+ type="input"
+ pattern=".*"
+ default="%CppHelloworldI18n.version.default"
+ hidden="false"
+ persist="true"/>
+ <property id="message"
+ label="%CppHelloworldI18n.message.label"
+ description="%CppHelloworldI18n.message.description"
+ type="input"
+ pattern=".*"
+ default="%CppHelloworldI18n.message.default"
+ hidden="false"
+ persist="true"/>
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING.LESSER"/>
+ <simple name="target" value="COPYING.LESSER"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="autogen.sh"/>
+ <simple name="target" value="autogen.sh"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="configure.ac"/>
+ <simple name="target" value="configure.ac"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="Makefile.am"/>
+ <simple name="target" value="Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/main.cpp"/>
+ <simple name="target" value="src/main.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow.cpp"/>
+ <simple name="target" value="src/mywindow.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow.h"/>
+ <simple name="target" value="src/mywindow.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/Makefile.am"/>
+ <simple name="target" value="src/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/helloworld.htm"/>
+ <simple name="target" value="src/helloworld.htm"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="po/en_GB.po"/>
+ <simple name="target" value="po/en_GB.po"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="po/pt_BR.po"/>
+ <simple name="target" value="po/pt_BR.po"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="po/LINGUAS.htm"/>
+ <simple name="target" value="po/LINGUAS.htm"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="po/POTFILES.in"/>
+ <simple name="target" value="po/POTFILES.in"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="maemo-cplusplus-env" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildonmm" />
+ </simple-array>
+ </process>
+
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppHelloWorldI18n/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/COPYING.LESSER
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/COPYING.LESSER (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/COPYING.LESSER
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = src
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/autogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/autogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -x
+glib-gettextize --copy --force
+libtoolize --copy --automake
+intltoolize --copy --force --automake
+
+aclocal-1.8
+autoconf
+autoheader
+automake-1.8 --add-missing --copy --foreign
+./configure --enable-maintainer-mode
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/autogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/configure.ac
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/configure.ac (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+AC_INIT(new_helloworld, 0.1)
+AC_PREREQ(2.59)
+
+AM_INIT_AUTOMAKE([1.7.9])
+AC_CONFIG_HEADERS([config.h])
+
+AC_GNU_SOURCE
+AC_CANONICAL_HOST
+AM_MAINTAINER_MODE
+
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_CXX
+
+AC_CONFIG_FILES([Makefile
+ src/Makefile])
+
+PKG_CHECK_MODULES(LIBHILDONMM, hildonmm >= 0.9.6)
+AC_SUBST(LIBHILDONMM_CFLAGS)
+AC_SUBST(LIBHILDONMM_LIBS)
+
+PKG_CHECK_MODULES(LIBHILDONFMMM, hildon-fmmm >= 0.9.6)
+AC_SUBST(LIBHILDONFMMM_CFLAGS)
+AC_SUBST(LIBHILDONFMMM_LIBS)
+
+AC_OUTPUT
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/configure.ac
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = foreign
+
+bin_PROGRAMS = new_helloworld
+new_helloworld_SOURCES = main.cpp \
+ mywindow.cpp \
+ mywindow.h
+
+new_helloworld_LDADD = $(LIBHILDONMM_LIBS) $(LIBHILDONFMMM_LIBS)
+new_helloworld_CXXFLAGS = $(LIBHILDONMM_CFLAGS) $(LIBHILDONFMMM_CFLAGS)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/main.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/main.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/main.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : main.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : New CPP Hello World
+ ============================================================================
+ */
+
+#include "config.h"
+
+#include <hildonmm.h>
+#include <iostream>
+
+#include "mywindow.h"
+
+int main(int argc, char *argv[])
+{
+ /* Initialize gtkmm and checks the arguments passed to your application */
+ Gtk::Main main_loop(&argc, &argv);
+
+ /* Initialize the hildomm libraries */
+ Hildon::init();
+
+ /* Initialize libosso environment */
+ osso_context_t* osso_context = osso_initialize(PACKAGE_NAME, PACKAGE_VERSION, TRUE, 0);
+ if(!osso_context)
+ std::cerr << "osso_initialize() failed." << std::endl;
+
+ /* Set the application name */
+ Glib::set_application_name(PACKAGE_STRING);
+
+ /* Create an object for the main Window and attach it to the program */
+ MyWindow window;
+ Hildon::Program::get_instance()->add_window(window);
+
+ /* Begin the main application */
+ main_loop.run(window);
+
+ /* Clean the libosso environment */
+ osso_deinitialize(osso_context);
+
+ return 0;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/main.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/mywindow.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/mywindow.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/mywindow.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : New CPP Hello World
+ ============================================================================
+ */
+
+#include <fstream>
+#include <gtkmm.h>
+#include <hildon-fmmm.h>
+#include <hildonmm.h>
+#include <iostream>
+
+#include "mywindow.h"
+
+/* Class constructor */
+MyWindow::MyWindow() :
+ m_item_exit("Exit"),
+ m_item_helloworld("Say \"Hello\""),
+ m_item_helloworld_entry("Say \"Hello\" From Text Box"),
+ m_item_helloworld_file("Say \"Hello\" From File"),
+ m_label("Type some text"),
+ m_button("Quit"),
+ m_tool_open(Gtk::Stock::OPEN),
+ m_tool_save(Gtk::Stock::SAVE),
+ m_image(Gtk::Stock::HELP, Gtk::ICON_SIZE_DIALOG),
+ m_note(Hildon::NOTE_TYPE_CONFIRMATION_BUTTON, "Quit application?")
+{
+ m_tool_entry.add(m_tb_entry);
+ m_tool_entry.set_expand();
+
+ /* Add Tollbar items to Toolbar */
+ m_toolbar.append(m_tool_open);
+ m_toolbar.append(m_tool_save);
+ m_toolbar.append(m_tool_separator);
+ m_toolbar.append(m_tool_entry);
+
+ /* Add ToolBar */
+ add_toolbar(m_toolbar);
+ m_toolbar.show_all();
+
+ /* Add items to the menu */
+ m_main.append(m_item_helloworld);
+ m_main.append(m_item_helloworld_entry);
+ m_main.append(m_item_helloworld_file);
+ m_main.append(m_item_exit);
+ m_main.show_all();
+
+ /* Add dialog box buttons */
+ m_note.add_button(Gtk::Stock::YES, Gtk::RESPONSE_YES);
+ m_note.add_button(Gtk::Stock::NO, Gtk::RESPONSE_NO);
+
+ /* Attach the menu object to the application */
+ set_menu(m_main);
+
+ /* Attach the callback function to signal handler signal */
+ m_item_exit.signal_activate().connect(sigc::mem_fun(*this, &MyWindow::on_menu_quit));
+ m_item_helloworld.signal_activate().connect(sigc::mem_fun(*this, &MyWindow::on_menu_helloworld));
+ m_item_helloworld_entry.signal_activate().connect(sigc::mem_fun(*this, &MyWindow::on_menu_helloworld_entry));
+ m_button.signal_clicked().connect(sigc::mem_fun(*this, &MyWindow::on_menu_quit));
+ m_item_helloworld_file.signal_activate().connect(sigc::mem_fun(*this, &MyWindow::on_menu_helloworld_file));
+ m_tool_open.signal_clicked().connect(sigc::mem_fun(*this, &MyWindow::on_open_click));
+ m_tool_save.signal_clicked().connect(sigc::mem_fun(*this, &MyWindow::on_save_click));
+ m_note.signal_response().connect(sigc::mem_fun(*this, &MyWindow::on_note_response));
+
+ /* Handle click on X button in the title bar */
+ this->signal_delete_event().connect(sigc::mem_fun(*this, &MyWindow::on_delete_event));
+
+ /* Attach the frame_box to window application */
+ add(m_frame_box);
+
+ /* Sets the "text" property to the value of entry. */
+ m_entry.set_text("My \"Hello World!\"");
+
+ /* All widgets should use the same amount of space */
+ m_hbox_button.set_homogeneous(true);
+ m_frame_box.set_homogeneous(true);
+
+ /* Adding the widgets to boxes */
+ m_hbox_button.pack_start(m_button, Gtk::PACK_SHRINK);
+ m_hbox_textbox.pack_start(m_label);
+ m_hbox_textbox.pack_start(m_entry);
+ m_hbox_textbox.pack_start(m_image);
+ m_frame_box.pack_start(m_hbox_textbox);
+ m_frame_box.pack_start(m_hbox_button, Gtk::PACK_SHRINK);
+
+ /* Make all menu widgets visible */
+ show_all();
+}
+
+/* Class destructor */
+MyWindow::~MyWindow()
+{
+}
+
+/* Callback function, which will be called to close the application */
+void MyWindow::on_menu_quit()
+{
+ m_note.run();
+}
+
+bool MyWindow::on_delete_event(GdkEventAny *event)
+{
+ m_note.run();
+ return true;
+}
+
+/* Note response handler */
+void MyWindow::on_note_response(int response_id)
+{
+ if (response_id == Gtk::RESPONSE_YES) {
+ /* Close the window */
+ this->hide();
+ } else {
+ /* Close the dialog box */
+ m_note.hide();
+ }
+}
+
+/* Callback function, which will be called when the "Say Hello" menu is activated */
+void MyWindow::on_menu_helloworld()
+{
+ /* Create and show a "Hello World" dialog */
+ Hildon::Note helloworld_note(Hildon::NOTE_TYPE_INFORMATION, "$(message)");
+ helloworld_note.run();
+}
+
+/* Callback function, which will be called when the "Say Hello from text box" menu is activated */
+void MyWindow::on_menu_helloworld_entry()
+{
+ Hildon::Note helloworld_note(Hildon::NOTE_TYPE_INFORMATION_THEME, m_entry.get_text());
+ helloworld_note.run();
+}
+
+/* Callback function, which will be called when the "Say Hello from file" menu is activated */
+void MyWindow::on_menu_helloworld_file()
+{
+ std::string line="";
+ std::fstream file;
+
+ file.open(m_tb_entry.get_text().c_str());
+
+ if (!file) {
+ std::cerr << "File cannot be opened!" << std::endl;
+ Gtk::MessageDialog dialog(*this, "File cannot be open!", false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+ } else {
+ std::getline (file,line);
+ Hildon::Note helloworld_note(Hildon::NOTE_TYPE_INFORMATION_THEME, line);
+ helloworld_note.run();
+ }
+
+ file.close();
+}
+
+void MyWindow::on_open_click()
+{
+ Hildon::FileChooserDialog dialog(*this, Gtk::FILE_CHOOSER_ACTION_OPEN);
+
+ /* Show the dialog and wait for a user response: */
+ int response = dialog.run();
+
+ if (response == Gtk::RESPONSE_OK) {
+ std::string filename = dialog.get_filename();
+ m_tb_entry.set_text(filename.c_str());
+ }
+}
+
+void MyWindow::on_save_click()
+{
+ std::ofstream file;
+
+ file.open(m_tb_entry.get_text().c_str());
+ if (!file) {
+ Gtk::MessageDialog dialog(*this, "File cannot be saved!", false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+ } else {
+ file.close();
+ std::remove(m_tb_entry.get_text().c_str());
+ file.open(m_tb_entry.get_text().c_str(), std::ios::trunc);
+ file << m_entry.get_text().c_str();
+ Gtk::MessageDialog dialog(*this, "File saved!");
+ dialog.set_title("Info");
+ dialog.run();
+ }
+
+ file.close();
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/mywindow.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/mywindow.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/mywindow.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/mywindow.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow.h
+ Author : $(author)
+ Version : $(version)
+ Description : New CPP Hello World
+ ============================================================================
+ */
+
+#ifndef MYWINDOW_H
+#define MYWINDOW_H
+
+#include <gtkmm.h>
+#include <hildonmm.h>
+
+class MyWindow : public Hildon::Window
+{
+public:
+ MyWindow();
+ virtual ~MyWindow();
+
+protected:
+ /* Signal handlers */
+ void on_menu_quit();
+ bool on_delete_event(GdkEventAny *);
+ void on_menu_helloworld();
+ void on_menu_helloworld_entry();
+ void on_menu_helloworld_file();
+ void on_note_response(int);
+ void on_open_click();
+ void on_save_click();
+
+ /* Menu object */
+ Gtk::Menu m_main;
+
+ /* The menu items */
+ Gtk::MenuItem m_item_exit;
+ Gtk::MenuItem m_item_helloworld;
+ Gtk::MenuItem m_item_helloworld_entry;
+ Gtk::MenuItem m_item_helloworld_file;
+
+ /* Widgets */
+ Gtk::VBox m_frame_box;
+ Gtk::HBox m_hbox_textbox;
+ Gtk::HBox m_hbox_button;
+ Gtk::Label m_label;
+ Gtk::Entry m_entry;
+ Gtk::Entry m_tb_entry;
+ Gtk::Button m_button;
+ Gtk::Image m_image;
+
+ /* Toolbar */
+ Gtk::Toolbar m_toolbar;
+ Gtk::ToolButton m_tool_open;
+ Gtk::ToolButton m_tool_save;
+ Gtk::SeparatorToolItem m_tool_separator;
+ Gtk::ToolItem m_tool_entry;
+
+ /* Quit confimation dialog box */
+ Hildon::Note m_note;
+};
+
+#endif /* MYWINDOW_H */
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/src/mywindow.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,15 @@
+#Template Default Values
+CppNewHelloWorld.Ctemplate.label=Maemo New Hello World Cpp Project
+CppNewHelloWorld.Ctemplate.description=This is a simple Hello World project demonstratng file load and save dialogs.\n\n\
+This project requires the hildonmm packages. \
+Please see\n\n\thttp://maemo.org/development/documentation/programming_languages/\n\nfor details.
+CppNewHelloWorld.basics.label=Basic Settings
+CppNewHelloWorld.basics.description=Basic properties of a project
+CppNewHelloWorld.author.label=Author
+CppNewHelloWorld.author.description=Name of the author
+CppNewHelloWorld.version.label=Version
+CppNewHelloWorld.version.description=Your application version
+CppNewHelloWorld.version.default=0.1
+CppNewHelloWorld.message.default=Hello World!!!
+CppNewHelloWorld.message.description=Your hello world greeting message
+CppNewHelloWorld.message.label=Hello world greeting
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="INdT"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="CppNewHelloWorldProject" label="%CppNewHelloWorld.Ctemplate.label" description="%CppNewHelloWorld.Ctemplate.description"
+ help="help.html">
+
+ <property-group id="basics" label="%CppNewHelloWorld.basics.label" description="%CppNewHelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%CppNewHelloWorld.author.label"
+ description="%CppNewHelloWorld.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="version"
+ label="%CppNewHelloWorld.version.label"
+ description="%CppNewHelloWorld.version.description"
+ type="input"
+ pattern=".*"
+ default="%CppNewHelloWorld.version.default"
+ hidden="false"
+ persist="true"/>
+ <property id="message"
+ label="%CppNewHelloWorld.message.label"
+ description="%CppNewHelloWorld.message.description"
+ type="input"
+ pattern=".*"
+ default="%CppNewHelloWorld.message.default"
+ hidden="false"
+ persist="true"/>
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING.LESSER"/>
+ <simple name="target" value="COPYING.LESSER"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="autogen.sh"/>
+ <simple name="target" value="autogen.sh"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="configure.ac"/>
+ <simple name="target" value="configure.ac"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="Makefile.am"/>
+ <simple name="target" value="Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/main.cpp"/>
+ <simple name="target" value="src/main.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow.cpp"/>
+ <simple name="target" value="src/mywindow.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow.h"/>
+ <simple name="target" value="src/mywindow.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/Makefile.am"/>
+ <simple name="target" value="src/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="maemo-cplusplus-env" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildonmm" />
+ <element value="hildon-fmmm" />
+ </simple-array>
+ </process>
+
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/CppNewHelloWorld/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = src
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/autogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/autogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -x
+glib-gettextize --copy --force
+libtoolize --copy --automake
+intltoolize --copy --force --automake
+
+aclocal-1.8
+autoconf
+autoheader
+automake-1.8 --add-missing --copy --foreign
+./configure --enable-maintainer-mode
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/autogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/configure.ac
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/configure.ac (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+AC_INIT($(projectName), 0.1)
+AC_PREREQ(2.59)
+
+AM_INIT_AUTOMAKE([1.7.9])
+AC_CONFIG_HEADERS([config.h])
+
+AC_GNU_SOURCE
+AC_CANONICAL_HOST
+AM_MAINTAINER_MODE
+
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_CXX
+
+AC_CONFIG_FILES([Makefile
+ src/Makefile])
+
+AC_OUTPUT
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/configure.ac
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/src/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/src/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,16 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = foreign
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3 @@
+#Template Default Values
+EmptyProject.Ctemplate.label=Empty Automake Project
+EmptyProject.Ctemplate.description=This is an empty automake-based project.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="EmptyProject" label="%EmptyProject.Ctemplate.label"
+ description="%EmptyProject.Ctemplate.description"
+ help="help.html">
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="autogen.sh"/>
+ <simple name="target" value="autogen.sh"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="configure.ac"/>
+ <simple name="target" value="configure.ac"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="Makefile.am"/>
+ <simple name="target" value="Makefile.am"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/Makefile.am"/>
+ <simple name="target" value="src/Makefile.am"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/EmptyProject/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/COPYING.LESSER
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/COPYING.LESSER (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/COPYING.LESSER
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/Makefile
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/Makefile (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = -Wall \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED
+
+helloworld: src/helloworld.c
+ $(CC) src/helloworld.c -g -o helloworld $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
+
+all: helloworld
+
+clean:
+ rm -f *.o helloworld
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/Makefile
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/src/helloworld.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/src/helloworld.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/src/helloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : helloworld.c
+ Author : $(author)
+ Version : $(version)
+ Description : Hello World GTK
+ ============================================================================
+ */
+
+#include <gtk/gtk.h>
+
+/* This is a callback function. The data arguments are ignored
+ * in this example. More on callbacks below. */
+void hello( GtkWidget *widget,
+ gpointer data )
+{
+ g_print ("Hello World\n");
+}
+
+gint delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
+ /* If you return FALSE in the "delete_event" signal handler,
+ * GTK will emit the "destroy" signal. Returning TRUE means
+ * you don't want the window to be destroyed.
+ * This is useful for popping up 'are you sure you want to quit?'
+ * type dialogs. */
+
+ g_print ("delete event occurred\n");
+
+ /* Change TRUE to FALSE and the main window will be destroyed with
+ * a "delete_event". */
+
+ return TRUE;
+}
+
+/* Another callback */
+void destroy( GtkWidget *widget,
+ gpointer data )
+{
+ gtk_main_quit ();
+}
+
+int main( int argc,
+ char *argv[] )
+{
+ /* GtkWidget is the storage type for widgets */
+ GtkWidget *window;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application. */
+ gtk_init (&argc, &argv);
+
+ /* create a new window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ /* When the window is given the "delete_event" signal (this is given
+ * by the window manager, usually by the "close" option, or on the
+ * titlebar), we ask it to call the delete_event () function
+ * as defined above. The data passed to the callback
+ * function is NULL and is ignored in the callback function. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event), NULL);
+
+ /* Here we connect the "destroy" event to a signal handler.
+ * This event occurs when we call gtk_widget_destroy() on the window,
+ * or if we return FALSE in the "delete_event" callback. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy), NULL);
+
+ /* Sets the border width of the window. */
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Creates a new button with the label "Hello World". */
+ button = gtk_button_new_with_label ("$(message)");
+
+ /* When the button receives the "clicked" signal, it will call the
+ * function hello() passing it NULL as its argument. The hello()
+ * function is defined above. */
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hello), NULL);
+
+ /* This will cause the window to be destroyed by calling
+ * gtk_widget_destroy(window) when "clicked". Again, the destroy
+ * signal could come from here, or the window manager. */
+ g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ G_OBJECT (window));
+
+ /* This packs the button into the window (a gtk container). */
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ /* The final step is to display this newly created widget. */
+ gtk_widget_show (button);
+
+ /* and the window */
+ gtk_widget_show (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or
+ * mouse event). */
+ gtk_main ();
+
+ return 0;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/src/helloworld.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,13 @@
+#Template Default Values
+GTKHelloWorld.Ctemplate.label=GTK Hello World Project
+GTKHelloWorld.Ctemplate.description=This is a simple Hello World project written in GTK+.
+GTKHelloWorld.basics.label=Basic Settings
+GTKHelloWorld.basics.description=Basic properties of a project
+GTKHelloWorld.author.label=Author
+GTKHelloWorld.author.description=Name of the author
+GTKHelloWorld.version.label=Version
+GTKHelloWorld.version.description=Your application version
+GTKHelloWorld.version.default=0.1
+GTKHelloWorld.message.default=Hello World!!!
+GTKHelloWorld.message.description=Your hello world greeting message
+GTKHelloWorld.message.label=Hello world greeting
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="INdT"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="GTKHelloWorldCProject" label="%GTKHelloWorld.Ctemplate.label" description="%GTKHelloWorld.Ctemplate.description"
+ help="help.html">
+ <property-group id="basics" label="%GTKHelloWorld.basics.label" description="%GTKHelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%GTKHelloWorld.author.label"
+ description="%GTKHelloWorld.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="version"
+ label="%GTKHelloWorld.version.label"
+ description="%GTKHelloWorld.version.description"
+ type="input"
+ pattern=".*"
+ default="%GTKHelloWorld.version.default"
+ hidden="false"
+ persist="true"/>
+ <property id="message"
+ label="%GTKHelloWorld.message.label"
+ description="%GTKHelloWorld.message.description"
+ type="input"
+ pattern=".*"
+ default="%GTKHelloWorld.message.default"
+ hidden="false"
+ persist="true"/>
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING.LESSER"/>
+ <simple name="target" value="COPYING.LESSER"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/helloworld.c"/>
+ <simple name="target" value="src/helloworld.c"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.eclipse.cdt.managedbuilder.gnu.ui.SimpleGNUMakefileGenerator">
+ <simple name="projectName" value="$(projectName)"/>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="gdb" />
+ <element value="libgtk2.0-dev" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="gtk+-2.0" />
+ </simple-array>
+ </process>
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/GTKHelloWorld/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,447 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+Version 2.1, February 1999
+
+
+Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+as the successor of the GNU Library Public License, version 2, hence
+the version number 2.1.]
+
+Preamble
+The licenses for most software are designed to take away your freedom
+to share and change it. By contrast, the GNU General Public Licenses
+are intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.
+
+This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations
+below.
+
+When we speak of free software, we are referring to freedom of use, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish); that you receive source code or can get it
+if you want it; that you can change the software and use pieces of it
+in new free programs; and that you are informed that you can do these
+things.
+
+To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+For example, if you distribute copies of the library, whether gratis or
+for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+To protect each distributor, we want to make it very clear that there
+is no warranty for the free library. Also, if the library is modified
+by someone else and passed on, the recipients should know that what
+they have is not the original version, so that the original author's
+reputation will not be affected by problems that might be introduced by
+others.
+
+Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that any
+patent license obtained for a version of the library must be consistent
+with the full freedom of use specified in this license.
+
+Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License. This license, the GNU Lesser General Public
+License, applies to certain designated libraries, and is quite
+different from the ordinary General Public License. We use this license
+for certain libraries in order to permit linking those libraries into
+non-free programs.
+
+When a program is linked with a library, whether statically or using a
+shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less of
+an advantage over competing non-free programs. These disadvantages are
+the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it
+becomes a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free library
+does the same job as widely used non-free libraries. In this case,
+there is little to gain by limiting the free library to free software
+only, so we use the Lesser General Public License.
+
+In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of free
+software. For example, permission to use the GNU C Library in non-free
+programs enables many more people to use the whole GNU operating
+system, as well as its variant, the GNU/Linux operating system.
+
+Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run that
+program using a modified version of the Library.
+
+The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or other
+authorized party saying it may be distributed under the terms of this
+Lesser General Public License (also called "this License"). Each
+licensee is addressed as "you".
+
+A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+The "Library", below, refers to any such software library or work which
+has been distributed under these terms. A "work based on the Library"
+means either the Library or any derivative work under copyright law:
+that is to say, a work containing the Library or a portion of it,
+either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+"Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control
+compilation and installation of the library.
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of running
+a program using the Library is not restricted, and output from such a
+program is covered only if its contents constitute a work based on the
+Library (independent of the use of the Library in a tool for writing
+it). Whether that is true depends on what the Library does and what the
+program that uses the Library does.
+
+1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and distribute a copy of this License along with the Library.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Library or any portion of
+it, thus forming a work based on the Library, and copy and distribute
+such modifications or work under the terms of Section 1 above, provided
+that you also meet all of these conditions:
+
+
+a) The modified work must itself be a software library.
+b) You must cause the files modified to carry prominent notices stating
+that you changed the files and the date of any change.
+c) You must cause the whole of the work to be licensed at no charge to
+all third parties under the terms of this License.
+d) If a facility in the modified Library refers to a function or a
+table of data to be supplied by an application program that uses the
+facility, other than as an argument passed when the facility is
+invoked, then you must make a good faith effort to ensure that, in the
+event an application does not supply such function or table, the
+facility still operates, and performs whatever part of its purpose
+remains meaningful.
+(For example, a function in a library to compute square roots has a
+purpose that is entirely well-defined independent of the application.
+Therefore, Subsection 2d requires that any application-supplied
+function or table used by this function must be optional: if the
+application does not supply it, the square root function must still
+compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of a
+storage or distribution medium does not bring the other work under the
+scope of this License.
+
+3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+Once this change is made in a given copy, it is irreversible for that
+copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+This option is useful when you wish to copy part of the code of the
+Library into a program that is not a library.
+
+4. You may copy and distribute the Library (or a portion or derivative
+of it, under Section 2) in object code or executable form under the
+terms of Sections 1 and 2 above provided that you accompany it with the
+complete corresponding machine-readable source code, which must be
+distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange.
+
+If distribution of object code is made by offering access to copy from
+a designated place, then offering equivalent access to copy the source
+code from the same place satisfies the requirement to distribute the
+source code, even though third parties are not compelled to copy the
+source along with the object code.
+
+5. A program that contains no derivative of any portion of the Library,
+but is designed to work with the Library by being compiled or linked
+with it, is called a "work that uses the Library". Such a work, in
+isolation, is not a derivative work of the Library, and therefore falls
+outside the scope of this License.
+
+However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License. Section
+6 states terms for distribution of such executables.
+
+When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+If such an object file uses only numerical parameters, data structure
+layouts and accessors, and small macros and small inline functions (ten
+lines or less in length), then the use of the object file is
+unrestricted, regardless of whether it is legally a derivative work.
+(Executables containing this object code plus portions of the Library
+will still fall under Section 6.)
+
+Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6, whether
+or not they are linked directly with the Library itself.
+
+6. As an exception to the Sections above, you may also combine or link
+a "work that uses the Library" with the Library to produce a work
+containing portions of the Library, and distribute that work under
+terms of your choice, provided that the terms permit modification of
+the work for the customer's own use and reverse engineering for
+debugging such modifications.
+
+You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+
+a) Accompany the work with the complete corresponding machine-readable
+source code for the Library including whatever changes were used in the
+work (which must be distributed under Sections 1 and 2 above); and, if
+the work is an executable linked with the Library, with the complete
+machine-readable "work that uses the Library", as object code and/or
+source code, so that the user can modify the Library and then relink to
+produce a modified executable containing the modified Library. (It is
+understood that the user who changes the contents of definitions files
+in the Library will not necessarily be able to recompile the
+application to use the modified definitions.)
+b) Use a suitable shared library mechanism for linking with the
+Library. A suitable mechanism is one that (1) uses at run time a copy
+of the library already present on the user's computer system, rather
+than copying library functions into the executable, and (2) will
+operate properly with a modified version of the library, if the user
+installs one, as long as the modified version is interface-compatible
+with the version that the work was made with.
+c) Accompany the work with a written offer, valid for at least three
+years, to give the same user the materials specified in Subsection 6a,
+above, for a charge no more than the cost of performing this
+distribution.
+d) If distribution of the work is made by offering access to copy from
+a designated place, offer equivalent access to copy the above specified
+materials from the same place.
+e) Verify that the user has already received a copy of these materials
+or that you have already sent this user a copy.
+For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies the
+executable.
+
+It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise permitted,
+and provided that you do these two things:
+
+
+a) Accompany the combined library with a copy of the same work based on
+the Library, uncombined with any other library facilities. This must be
+distributed under the terms of the Sections above.
+b) Give prominent notice with the combined library of the fact that
+part of it is a work based on the Library, and explaining where to find
+the accompanying uncombined form of the same work.
+8. You may not copy, modify, sublicense, link with, or distribute the
+Library except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense, link with, or distribute the
+Library is void, and will automatically terminate your rights under
+this License. However, parties who have received copies, or rights,
+from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying the
+Library or works based on it.
+
+10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent license
+would not permit royalty-free redistribution of the Library by all
+those who receive copies directly or indirectly through you, then the
+only way you could satisfy both it and this License would be to refrain
+entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply, and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is implemented
+by public license practices. Many people have made generous
+contributions to the wide range of software distributed through that
+system in reliance on consistent application of that system; it is up
+to the author/donor to decide if he or she is willing to distribute
+software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may
+add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among countries
+not thus excluded. In such case, this License incorporates the
+limitation as if written in the body of this License.
+
+13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time. Such
+new versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a license
+version number, you may choose any version ever published by the Free
+Software Foundation.
+
+14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free Software
+Foundation; we sometimes make exceptions for this. Our decision will be
+guided by the two goals of preserving the free status of all
+derivatives of our free software and of promoting the sharing and reuse
+of software generally.
+
+NO WARRANTY
+
+15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH
+YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+SUBDIRS = src data
+
+EXTRA_DIST= \
+autogen.sh \
+intltool-extract.in \
+intltool-merge.in \
+intltool-update.in \
+debian/rules \
+debian/control \
+debian/copyright \
+debian/changelog \
+debian/maemo-hello-world-applet.install
+
+deb_dir = $(top_builddir)/debian-build
+
+INCLUDES = $(DEPS_CFLAGS)
+
+deb: dist
+ -mkdir $(deb_dir)
+ cd $(deb_dir) && tar xzf ../$(top_builddir)/$(PACKAGE)-$(VERSION).tar.gz
+ cd $(deb_dir)/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -rfakeroot
+ -rm -rf $(deb_dir)/$(PACKAGE)-$(VERSION)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/autogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/autogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -x
+glib-gettextize --copy --force
+libtoolize --copy --automake
+intltoolize --copy --force --automake
+
+aclocal-1.8
+autoconf
+autoheader
+automake-1.8 --add-missing --copy --foreign
+./configure --enable-maintainer-mode
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/autogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/configure.ac
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/configure.ac (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,71 @@
+AC_PREREQ(2.59)
+AC_INIT(maemo-hello-world-applet, 0.1, xxxx at maemo.org)
+
+AM_INIT_AUTOMAKE
+AM_CONFIG_HEADER(config.h)
+
+dnl ##################
+dnl This script generates host names
+dnl ##################
+AC_CANONICAL_HOST
+
+dnl ##################
+dnl Check for installed programs that is needed
+dnl ##################
+AC_PROG_CC
+AM_PROG_CC_STDC
+AC_PROG_INSTALL
+AC_PROG_RANLIB
+AC_PROG_INTLTOOL([0.21])
+AC_PROG_LIBTOOL
+
+AM_PATH_GLIB_2_0
+
+AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes, no)
+if test "x$HAVE_PKG_CONFIG" = "xno"; then
+AC_MSG_ERROR([You need to install pkg-config tool])
+fi
+
+dnl ##################
+dnl Compiler flags, note that the -ansi flag is not used because
+dnl in that case the rint function is not available in math.h
+dnl ##################
+
+CFLAGS="$CFLAGS -g -Wall -Werror -ansi -Wmissing-prototypes -Wmissing-declarations"
+
+dnl ##################
+dnl Check needed headers, like C standard headers, GLib, GStreamer etc.
+dnl ##################
+AC_HEADER_STDC
+
+GLIB_REQUIRED=2.6.0
+GTK_REQUIRED=2.4.0
+LIBOSSO_REQUIRED=0.8.3
+
+PKG_CHECK_MODULES(HELLO, [
+glib-2.0 >= $GLIB_REQUIRED,
+gtk+-2.0 >= $GTK_REQUIRED,
+libhildondesktop
+])
+
+AC_SUBST(HELLO_LIBS)
+AC_SUBST(HELLO_CFLAGS)
+
+dnl ##################
+dnl directories
+dnl ##################
+
+localedir=`pkg-config osso-af-settings --variable=localedir`
+AC_SUBST(localedir)
+
+pluginlibdir=`pkg-config osso-af-settings --variable=hildondesktoplibdir`
+AC_SUBST(pluginlibdir)
+
+AC_OUTPUT([Makefile
+ src/Makefile
+ data/Makefile
+ data/com.nokia.hello-world-applet.service
+ data/hello-world-applet.desktop
+])
+
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/configure.ac
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,30 @@
+# Copyright (C) 2005 Nokia Corporation.
+#
+# This software is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+
+service_DATA = com.nokia.hello-world-applet.service
+
+icon_26x26_DATA = icons/26x26/hello-world.26.png
+icon_40x40_DATA = icons/40x40/hello-world.40.png
+icon_scalable_DATA = icons/scalable/hello-world.64.png
+
+helloworldappletdir=$(datadir)/applications/hildon
+
+helloworldapplet_DATA = hello-world-applet.desktop
+
+
+EXTRA_DIST = $(helloworldapplet_DATA) $(service_DATA) $(icon_26x26_DATA) $(icon_40x40_DATA) $(icon_scalable_DATA)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/com.nokia.hello-world-applet.service.in
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/com.nokia.hello-world-applet.service.in (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/com.nokia.hello-world-applet.service.in 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+# Sample service description file
+[D-BUS Service]
+Name=com.nokia.hello-world-applet
+Exec=/usr/bin/hello-world
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/com.nokia.hello-world-applet.service.in
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/hello-world-applet.desktop.in
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/hello-world-applet.desktop.in (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/hello-world-applet.desktop.in 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Name=Hello, world
+Comment=Example hello
+Type=default
+X-Path=libhello_applet.so
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/hello-world-applet.desktop.in
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/26x26/hello-world.26.png
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/26x26/hello-world.26.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/40x40/hello-world.40.png
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/40x40/hello-world.40.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/scalable/hello-world.64.png
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/data/icons/scalable/hello-world.64.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/changelog
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/changelog (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/changelog 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,65 @@
+hello-world-applet (0.8) unstable; urgency=low
+
+ * Ported to new plugin APIs
+
+ -- Maemo Integration <integration at maemo.org> Thu, 8 Nov 2007 12:32:17 +0200
+
+hello-world-applet (0.7) unstable; urgency=low
+
+ * Added dependency to desktop. Fixes: NB#72684
+
+ -- Maemo Integration <integration at maemo.org> Thu, 11 Oct 2007 11:09:17 +0300
+
+hello-world-applet (0.6) unstable; urgency=low
+
+ * Added task navigator plugin example code.
+ * postinst script now adds desktop entries to the configuration files under
+ /etc
+ * Added postrm script
+
+ -- Maemo Integration <integration at maemo.org> Mon, 01 Oct 2007 16:24:14 +0300
+
+hello-world-applet (0.5.1) unstable; urgency=low
+
+ * Added build dependencies to hildon-desktop-dev and
+ hildon-control-panel-dev
+ * Changed maintainer to Maemo Integration.
+
+ -- Maemo Integration <integration at maemo.org> Mon, 06 Aug 2007 14:31:27 +0300
+
+hello-world-applet (0.5) unstable; urgency=low
+
+ * Ported to new Hildon
+
+ -- Marius Vollmer <marius.vollmer at nokia.com> Sun, 10 Jun 2007 22:34:11 -0700
+
+hello-world-applet (0.4) unstable; urgency=low
+
+ * Added postinst with lost of trickery to get icons recognized.
+
+ -- Marius Vollmer <marius.vollmer at nokia.com> Thu, 11 May 2006 19:03:18 +0300
+
+hello-world-applet (0.3) unstable; urgency=low
+
+ * Ported to IT-2006
+
+ -- Marius Vollmer <marius.vollmer at nokia.com> Thu, 11 May 2006 13:54:36 +0300
+
+hello-world-applet (0.2) unstable; urgency=low
+
+ * With control panel applet and status bar plugin now.
+
+ -- Marius Vollmer <marius.vollmer at nokia.com> Fri, 9 Sep 2005 12:14:29 +0300
+
+hello-world-applet (0.1) unstable; urgency=low
+
+ * Intermediate release with icons and a shared library.
+
+ -- Marius Vollmer <marius.vollmer at nokia.com> Wed, 17 Aug 2005 15:56:13 +0300
+
+hello-world-applet (0.0) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Marius Vollmer <marius.vollmer at nokia.com> Mon, 23 May 2005 14:54:40 +0300
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/changelog
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/control
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/control (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/control 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,19 @@
+Source: hello-world-applet
+Section: misc
+Priority: optional
+Maintainer: Mr Maemo <xxxx at maemo.org>
+Build-Depends: libgtk2.0-dev (>=2.4.0-1), pkg-config, libhildondesktop-dev
+Standards-Version: 3.6.1
+
+Package: hello-world-applet
+Section: user/internet
+Architecture: any
+Depends: ${shlibs:Depends},${launcher:Depends}
+Description: Maemo Hello World home panel applet
+ Home panel applet for showing Hello World.
+ The debian/changelog is:
+ hello-world-applet (0.1) experimental; urgency=low
+ .
+ * Created package
+ .
+ -- Mr Maemo <xxxx at maemo.org> Tue, 30 May 2006 10:04:45 +0200
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/control
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/copyright
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/copyright (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/copyright 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+Copyright: (c) 2005 Nokia Corporation
+
+This package is licensed under the GNU LGPL license
+For further information please refer to the COPYING file
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/copyright
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/maemo-hello-world-applet.install
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/maemo-hello-world-applet.install (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/maemo-hello-world-applet.install 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,2 @@
+usr/lib/hildon-desktop/*.so
+usr/share/applications/hildon-home/hello-world-applet.desktop
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/maemo-hello-world-applet.install
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/postinst
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/postinst (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/postinst 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,47 @@
+#! /bin/sh
+
+# The clock might be wrong and we know that we need to update the icon
+# cache so we just force it.
+
+gtk-update-icon-cache -f /usr/share/icons/hicolor
+
+# Now that the icon cache is uptodate, we move the .desktop file into
+# place. Doing this only now prevents the Task navigator from
+# reconstructing the menu before the icon is available. This trick is
+# not really necessary when using maemo-select-menu-location (as we do
+# below), since maemo-select-menu-location will trigger the
+# reconstructing of the Taks navigator menu as well.
+
+( cd /usr/share/applications/hildon/ && mv hello-world-applet.inactive hello-world-applet.desktop )
+
+# Now we are ready to let the user move the entry around, but only if
+# this is a new install
+
+oldversion="$2"
+if [ -z "$oldversion" ]; then
+ maemo-select-menu-location hello-world-applet.desktop
+fi
+
+#We add the desktop entry to the tasknavigator, statusbar and home configuration files
+
+path="/etc/hildon-desktop"
+home_conf="$path/home.conf"
+sb_conf="$path/statusbar.conf"
+tn_conf="$path/tasknavigator.conf"
+
+home_entry="[/usr/share/applications/hildon-home/hello-world-home.desktop]"
+sb_entry="[/usr/share/applications/hildon-status-bar/hello-world-sb.desktop]"
+tn_entry="[/usr/share/applications/hildon-navigator/hello-world-tn.desktop]"
+
+echo $home_entry | cat - $home_conf > $path/home_conf.tmp
+mv $path/home_conf.tmp $home_conf
+
+echo $sb_entry | cat - $sb_conf > $path/sb_conf.tmp
+mv $path/sb_conf.tmp $sb_conf
+
+echo $tn_entry | cat - $tn_conf > $path/tn_conf.tmp
+mv $path/tn_conf.tmp $tn_conf
+
+#DEBHELPER#
+
+exit 0
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/postinst
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/rules
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/rules (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/rules 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,92 @@
+#!/usr/bin/make -f
+
+# export DH_VERBOSE=1
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+CFLAGS = -Wall -g
+PACKAGENAME = maemo-hello-world-applet
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+CFLAGS += -O0
+else
+CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+INSTALL_PROGRAM += -s
+endif
+
+config.status:
+ dh_testdir
+ # Add here commands to configure the package.
+ CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) clean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package
+ $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
+
+# Build architecture-independent files here.
+binary-indep: build install
+ # We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ # dh_installchangelogs
+ dh_installdocs
+ # dh_installexamples
+ dh_install -v --sourcedir=debian/build
+ # dh_installmenu
+ # dh_installdebconf
+ # dh_installlogrotate
+ # dh_installemacsen
+ # dh_installpam
+ # dh_installmime
+ # dh_installinit
+ # dh_installcron
+ # dh_installinfo
+ # dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ # dh_perl
+ # dh_python
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps -V
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/debian/rules
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+pluginlib_LTLIBRARIES = libhello_applet.la
+
+common_CFLAGS = \
+$(HELLO_CFLAGS) \
+-DPREFIX=\"$(prefix)\" \
+-DLOCALEDIR=\"$(localedir)\"
+
+common_LDADD = \
+$(HELLO_LIBS)
+
+libhello_applet_la_LDFLAGS= -module -avoid-version
+
+libhello_applet_la_CFLAGS = $(common_CFLAGS)
+
+libhello_applet_la_LIBADD = $(common_LDADD)
+
+libhello_applet_la_SOURCES = \
+hello-world-home.h \
+hello-world-home.c \
+libhelloworld.h \
+libhelloworld.c
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/hello-world-home.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/hello-world-home.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/hello-world-home.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,69 @@
+
+/*
+ * This file is part of hello-world-home-applet example app.
+ *
+ * Copyright (C) 2006 Nokia Corporation. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+*
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include <libhildondesktop/libhildondesktop.h>
+
+#include "hello-world-home.h"
+#include "libhelloworld.h"
+
+
+HD_DEFINE_PLUGIN (HelloHomePlugin, hello_home_plugin, HILDON_DESKTOP_TYPE_HOME_ITEM);
+
+static void
+hello_home_plugin_init (HelloHomePlugin *home_plugin)
+{
+ GtkWidget *button;
+
+ button = hello_world_button_new (10);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (hello_world_dialog_show),
+ NULL);
+
+ gtk_widget_show_all (button);
+
+ /* Set the resizing behavior */
+ hildon_desktop_home_item_set_resize_type (HILDON_DESKTOP_HOME_ITEM (home_plugin),
+ HILDON_DESKTOP_HOME_ITEM_RESIZE_BOTH);
+
+ gtk_container_add (GTK_CONTAINER (home_plugin), button);
+}
+
+static void
+hello_home_plugin_class_init (HelloHomePluginClass *class)
+{
+}
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/hello-world-home.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/hello-world-home.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/hello-world-home.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/hello-world-home.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,68 @@
+
+/*
+ * This file is part of hello-world-home-applet example app.
+ *
+ * Copyright (C) 2006 Nokia Corporation. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+*
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#ifndef HELLO_HOME_PLUGIN_H
+#define HELLO_HOME_PLUGIN_H
+
+#include <glib-object.h>
+
+#include <libhildondesktop/hildon-desktop-home-item.h>
+
+G_BEGIN_DECLS
+
+/* Common struct types declarations */
+typedef struct _HelloHomePlugin HelloHomePlugin;
+typedef struct _HelloHomePluginClass HelloHomePluginClass;
+typedef struct _HelloHomePluginPrivate HelloHomePluginPrivate;
+
+/* Common macros */
+#define HELLO_TYPE_HOME_PLUGIN (hello_statusbar_plugin_get_type ())
+#define HELLO_HOME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HELLO_TYPE_HOME_PLUGIN, HelloHomePlugin))
+#define HELLO_HOME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HELLO_TYPE_HOME_PLUGIN, HelloHomePluginClass))
+#define HELLO_IS_HOME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HELLO_TYPE_HOME_PLUGIN))
+#define HELLO_IS_HOME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HELLO_TYPE_HOME_PLUGIN))
+#define HELLO_HOME_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HELLO_TYPE_HOME_PLUGIN, HelloHomePluginClass))
+
+/* Instance struct */
+struct _HelloHomePlugin
+{
+ HildonDesktopHomeItem hitem;
+
+ HelloHomePluginPrivate *priv;
+};
+
+/* Class struct */
+struct _HelloHomePluginClass
+{
+ HildonDesktopHomeItemClass parent_class;
+};
+
+GType hello_home_plugin_get_type (void);
+
+G_END_DECLS
+
+#endif
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/hello-world-home.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/libhelloworld.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/libhelloworld.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/libhelloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,130 @@
+
+/*
+ * This file is part of hello-world-home-applet example app.
+ *
+ * Copyright (C) 2006 Nokia Corporation. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#include "libhelloworld.h"
+#include <glib/gprintf.h>
+
+static void
+window_destroy (GtkWidget* widget, gpointer data)
+{
+ gtk_main_quit ();
+}
+
+static void
+button_clicked (GtkButton* button, gpointer data)
+{
+ gtk_widget_destroy (GTK_WIDGET (data));
+}
+
+GtkWindow *
+hello_world_new (void)
+{
+ GtkWidget *window, *vbox, *label, *button;
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ gtk_container_set_border_width (GTK_CONTAINER (window), 20);
+
+ gtk_window_set_title (GTK_WINDOW (window), "Hello World!");
+
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (window_destroy), NULL);
+
+ vbox = gtk_vbox_new (FALSE, 10);
+ label = gtk_label_new ("Hello World!");
+ button = gtk_button_new_with_label("Close");
+
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (button_clicked), window);
+
+ gtk_box_pack_start (GTK_BOX(vbox), label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(vbox), button, FALSE, FALSE, 0);
+
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+
+ gtk_widget_show_all (window);
+
+ return GTK_WINDOW (window);
+}
+
+GtkDialog *
+hello_world_dialog_new ()
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_dialog_new_with_buttons ("Hello World",
+ NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT |
+ GTK_DIALOG_NO_SEPARATOR,
+ "Close",
+ GTK_RESPONSE_OK,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
+ gtk_label_new ("Hello World!"));
+ gtk_widget_show_all (dialog);
+
+ return GTK_DIALOG (dialog);
+}
+
+void
+hello_world_dialog_show ()
+{
+ GtkWidget *dialog = GTK_WIDGET(hello_world_dialog_new ());
+ gtk_dialog_run (GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+}
+
+GtkWidget *
+hello_world_button_new (int padding)
+{
+ GtkIconTheme *icon_theme;
+ GdkPixbuf *icon;
+ GtkWidget *icon_image, *button;
+
+ icon_theme = gtk_icon_theme_get_default ();
+ icon = gtk_icon_theme_load_icon (icon_theme,
+ "hello-world",
+ 40,
+ 0,
+ NULL);
+ if (icon == NULL)
+ icon = gtk_icon_theme_load_icon (icon_theme,
+ "qgn_list_gene_default_app",
+ 40,
+ 0,
+ NULL);
+
+ icon_image = gtk_image_new_from_pixbuf (icon);
+ gtk_misc_set_padding (GTK_MISC (icon_image), padding, padding);
+ g_object_unref (G_OBJECT (icon));
+ button = gtk_button_new ();
+ gtk_container_add (GTK_CONTAINER (button), icon_image);
+
+ gtk_widget_show_all (button);
+
+ return button;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/libhelloworld.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/libhelloworld.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/libhelloworld.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/libhelloworld.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,40 @@
+/*
+ * This file is part of hello-world-home-applet example app.
+ *
+ * Copyright (C) 2006 Nokia Corporation. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+
+#ifndef LIBHELLOWORLD_H
+#define LIBHELLOWORLD_H
+
+#include <gtk/gtk.h>
+
+GtkWindow *hello_world_new (void);
+GtkDialog *hello_world_dialog_new (void);
+GtkWidget *hello_world_button_new (int padding);
+
+void hello_world_dialog_show (void);
+
+
+#endif /* !LIBHELLOWORLD_H */
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/src/libhelloworld.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,16 @@
+#Template Default Values
+HildonDesktopPlugin.Ctemplate.label=Hildon Desktop Plug-ins
+HildonDesktopPlugin.Ctemplate.description=A Hildon Desktop Plug-in Project, which registers a plugin \
+which an application can invoke. \n\n\
+This project requires the maemomm packages. \
+Please see\n\n\thttp://maemo.org/development/documentation/programming_languages/\n\nfor details.
+HildonDesktopPlugin.basics.label=Basic Settings
+HildonDesktopPlugin.basics.description=Basic properties of a project
+HildonDesktopPlugin.author.label=Author
+HildonDesktopPlugin.author.description=Name of the author
+HildonDesktopPlugin.copyright.label=Copyright notice
+HildonDesktopPlugin.copyright.description=Your copyright notice
+HildonDesktopPlugin.copyright.default=Your copyright notice
+HildonDesktopPlugin.message.default=Hello World!!!
+HildonDesktopPlugin.message.description=Your hello world greeting message
+HildonDesktopPlugin.message.label=Hello world greeting
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="HildonDesktopPluginsCProject" label="%HildonDesktopPlugin.Ctemplate.label" description="%HildonDesktopPlugin.Ctemplate.description"
+ help="help.html">
+ <property-group id="basics" label="%HildonDesktopPlugin.basics.label" description="%HildonDesktopPlugin.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%HildonDesktopPlugin.author.label"
+ description="%HildonDesktopPlugin.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="copyright"
+ label="%HildonDesktopPlugin.copyright.label"
+ description="%HildonDesktopPlugin.copyright.description"
+ type="input"
+ pattern=".*"
+ default="%HildonDesktopPlugin.copyright.default"
+ hidden="false"
+ persist="true"/>
+ <property id="message"
+ label="%HildonDesktopPlugin.message.label"
+ description="%HildonDesktopPlugin.message.description"
+ type="input"
+ pattern=".*"
+ default="%HildonDesktopPlugin.message.default"
+ hidden="false"
+ persist="true"/>
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="autogen.sh"/>
+ <simple name="target" value="autogen.sh"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="configure.ac"/>
+ <simple name="target" value="configure.ac"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="Makefile.am"/>
+ <simple name="target" value="Makefile.am"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+
+ <element>
+ <simple name="source" value="src/Makefile.am"/>
+ <simple name="target" value="src/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/hello-world-home.c"/>
+ <simple name="target" value="src/hello-world-home.c"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/hello-world-home.h"/>
+ <simple name="target" value="src/hello-world-home.h"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/libhelloworld.c"/>
+ <simple name="target" value="src/libhelloworld.c"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/libhelloworld.h"/>
+ <simple name="target" value="src/libhelloworld.h"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/control"/>
+ <simple name="target" value="debian/control"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/copyright"/>
+ <simple name="target" value="debian/copyright"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/maemo-hello-world-applet.install"/>
+ <simple name="target" value="debian/maemo-hello-world-applet.install"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/rules"/>
+ <simple name="target" value="debian/rules"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/changelog"/>
+ <simple name="target" value="debian/changelog"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/postinst"/>
+ <simple name="target" value="debian/postinst"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="data/Makefile.am"/>
+ <simple name="target" value="data/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/com.nokia.hello-world-applet.service.in"/>
+ <simple name="target" value="data/com.nokia.hello-world-applet.service.in"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/hello-world-applet.desktop.in"/>
+ <simple name="target" value="data/hello-world-applet.desktop.in"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="data/icons/scalable/hello-world.64.png"/>
+ <simple name="target" value="data/icons/scalable/hello-world.64.png"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/icons/26x26/hello-world.26.png"/>
+ <simple name="target" value="data/icons/26x26/hello-world.26.png"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/icons/40x40/hello-world.40.png"/>
+ <simple name="target" value="data/icons/40x40/hello-world.40.png"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+
+ </complex-array>
+
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="libhildondesktop-dev" />
+ <element value="libhildondesktop0-dbg" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="libhildondesktop" />
+ <element value="gtk+-2.0" />
+ <element value="glib-2.0" />
+ </simple-array>
+ </process>
+
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonDesktopPlugins/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,447 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+Version 2.1, February 1999
+
+
+Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+as the successor of the GNU Library Public License, version 2, hence
+the version number 2.1.]
+
+Preamble
+The licenses for most software are designed to take away your freedom
+to share and change it. By contrast, the GNU General Public Licenses
+are intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.
+
+This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations
+below.
+
+When we speak of free software, we are referring to freedom of use, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish); that you receive source code or can get it
+if you want it; that you can change the software and use pieces of it
+in new free programs; and that you are informed that you can do these
+things.
+
+To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+For example, if you distribute copies of the library, whether gratis or
+for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+To protect each distributor, we want to make it very clear that there
+is no warranty for the free library. Also, if the library is modified
+by someone else and passed on, the recipients should know that what
+they have is not the original version, so that the original author's
+reputation will not be affected by problems that might be introduced by
+others.
+
+Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that any
+patent license obtained for a version of the library must be consistent
+with the full freedom of use specified in this license.
+
+Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License. This license, the GNU Lesser General Public
+License, applies to certain designated libraries, and is quite
+different from the ordinary General Public License. We use this license
+for certain libraries in order to permit linking those libraries into
+non-free programs.
+
+When a program is linked with a library, whether statically or using a
+shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less of
+an advantage over competing non-free programs. These disadvantages are
+the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it
+becomes a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free library
+does the same job as widely used non-free libraries. In this case,
+there is little to gain by limiting the free library to free software
+only, so we use the Lesser General Public License.
+
+In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of free
+software. For example, permission to use the GNU C Library in non-free
+programs enables many more people to use the whole GNU operating
+system, as well as its variant, the GNU/Linux operating system.
+
+Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run that
+program using a modified version of the Library.
+
+The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or other
+authorized party saying it may be distributed under the terms of this
+Lesser General Public License (also called "this License"). Each
+licensee is addressed as "you".
+
+A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+The "Library", below, refers to any such software library or work which
+has been distributed under these terms. A "work based on the Library"
+means either the Library or any derivative work under copyright law:
+that is to say, a work containing the Library or a portion of it,
+either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+"Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control
+compilation and installation of the library.
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of running
+a program using the Library is not restricted, and output from such a
+program is covered only if its contents constitute a work based on the
+Library (independent of the use of the Library in a tool for writing
+it). Whether that is true depends on what the Library does and what the
+program that uses the Library does.
+
+1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and distribute a copy of this License along with the Library.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Library or any portion of
+it, thus forming a work based on the Library, and copy and distribute
+such modifications or work under the terms of Section 1 above, provided
+that you also meet all of these conditions:
+
+
+a) The modified work must itself be a software library.
+b) You must cause the files modified to carry prominent notices stating
+that you changed the files and the date of any change.
+c) You must cause the whole of the work to be licensed at no charge to
+all third parties under the terms of this License.
+d) If a facility in the modified Library refers to a function or a
+table of data to be supplied by an application program that uses the
+facility, other than as an argument passed when the facility is
+invoked, then you must make a good faith effort to ensure that, in the
+event an application does not supply such function or table, the
+facility still operates, and performs whatever part of its purpose
+remains meaningful.
+(For example, a function in a library to compute square roots has a
+purpose that is entirely well-defined independent of the application.
+Therefore, Subsection 2d requires that any application-supplied
+function or table used by this function must be optional: if the
+application does not supply it, the square root function must still
+compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of a
+storage or distribution medium does not bring the other work under the
+scope of this License.
+
+3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+Once this change is made in a given copy, it is irreversible for that
+copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+This option is useful when you wish to copy part of the code of the
+Library into a program that is not a library.
+
+4. You may copy and distribute the Library (or a portion or derivative
+of it, under Section 2) in object code or executable form under the
+terms of Sections 1 and 2 above provided that you accompany it with the
+complete corresponding machine-readable source code, which must be
+distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange.
+
+If distribution of object code is made by offering access to copy from
+a designated place, then offering equivalent access to copy the source
+code from the same place satisfies the requirement to distribute the
+source code, even though third parties are not compelled to copy the
+source along with the object code.
+
+5. A program that contains no derivative of any portion of the Library,
+but is designed to work with the Library by being compiled or linked
+with it, is called a "work that uses the Library". Such a work, in
+isolation, is not a derivative work of the Library, and therefore falls
+outside the scope of this License.
+
+However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License. Section
+6 states terms for distribution of such executables.
+
+When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+If such an object file uses only numerical parameters, data structure
+layouts and accessors, and small macros and small inline functions (ten
+lines or less in length), then the use of the object file is
+unrestricted, regardless of whether it is legally a derivative work.
+(Executables containing this object code plus portions of the Library
+will still fall under Section 6.)
+
+Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6, whether
+or not they are linked directly with the Library itself.
+
+6. As an exception to the Sections above, you may also combine or link
+a "work that uses the Library" with the Library to produce a work
+containing portions of the Library, and distribute that work under
+terms of your choice, provided that the terms permit modification of
+the work for the customer's own use and reverse engineering for
+debugging such modifications.
+
+You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+
+a) Accompany the work with the complete corresponding machine-readable
+source code for the Library including whatever changes were used in the
+work (which must be distributed under Sections 1 and 2 above); and, if
+the work is an executable linked with the Library, with the complete
+machine-readable "work that uses the Library", as object code and/or
+source code, so that the user can modify the Library and then relink to
+produce a modified executable containing the modified Library. (It is
+understood that the user who changes the contents of definitions files
+in the Library will not necessarily be able to recompile the
+application to use the modified definitions.)
+b) Use a suitable shared library mechanism for linking with the
+Library. A suitable mechanism is one that (1) uses at run time a copy
+of the library already present on the user's computer system, rather
+than copying library functions into the executable, and (2) will
+operate properly with a modified version of the library, if the user
+installs one, as long as the modified version is interface-compatible
+with the version that the work was made with.
+c) Accompany the work with a written offer, valid for at least three
+years, to give the same user the materials specified in Subsection 6a,
+above, for a charge no more than the cost of performing this
+distribution.
+d) If distribution of the work is made by offering access to copy from
+a designated place, offer equivalent access to copy the above specified
+materials from the same place.
+e) Verify that the user has already received a copy of these materials
+or that you have already sent this user a copy.
+For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies the
+executable.
+
+It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise permitted,
+and provided that you do these two things:
+
+
+a) Accompany the combined library with a copy of the same work based on
+the Library, uncombined with any other library facilities. This must be
+distributed under the terms of the Sections above.
+b) Give prominent notice with the combined library of the fact that
+part of it is a work based on the Library, and explaining where to find
+the accompanying uncombined form of the same work.
+8. You may not copy, modify, sublicense, link with, or distribute the
+Library except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense, link with, or distribute the
+Library is void, and will automatically terminate your rights under
+this License. However, parties who have received copies, or rights,
+from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying the
+Library or works based on it.
+
+10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent license
+would not permit royalty-free redistribution of the Library by all
+those who receive copies directly or indirectly through you, then the
+only way you could satisfy both it and this License would be to refrain
+entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply, and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is implemented
+by public license practices. Many people have made generous
+contributions to the wide range of software distributed through that
+system in reliance on consistent application of that system; it is up
+to the author/donor to decide if he or she is willing to distribute
+software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may
+add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among countries
+not thus excluded. In such case, this License incorporates the
+limitation as if written in the body of this License.
+
+13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time. Such
+new versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a license
+version number, you may choose any version ever published by the Free
+Software Foundation.
+
+14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free Software
+Foundation; we sometimes make exceptions for this. Our decision will be
+guided by the two goals of preserving the free status of all
+derivatives of our free software and of promoting the sharing and reuse
+of software generally.
+
+NO WARRANTY
+
+15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH
+YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,37 @@
+# List extras to package
+EXTRA_DIST = \
+ autogen.sh \
+ debian/postinst \
+ debian/copyright \
+ debian/control \
+ debian/rules \
+ debian/changelog \
+ debian/postinst \
+ src/*
+
+# Sub directories
+SUBDIRS = data po
+
+# Includes
+INCLUDES = $(DEPS_CFLAGS) $(HILDON_CFLAGS) $(OSSO_CFLAGS) $(HILDONFM_CFLAGS)
+
+# Binary
+bin_PROGRAMS = \
+ $(packageName)
+# /Binary
+
+# Sources
+$(packageName)_SOURCES = \
+ src/main.c
+# /Sources
+
+# LDADD
+$(packageName)_LDADD = \
+ $(DEPS_LIBS) $(HILDON_LIBS) $(OSSO_LIBS) $(HILDONFM_LIBS)
+# /LDADD
+
+deb: dist
+ -mkdir $(top_builddir)/debian-build
+ cd $(top_builddir)/debian-build && tar zxf ../$(top_builddir)/$(PACKAGE)-$(VERSION).tar.gz
+ cd $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -rfakeroot
+ rm -rf $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/autogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/autogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -x
+glib-gettextize --copy --force
+libtoolize --copy --automake
+intltoolize --copy --force --automake
+
+aclocal-1.8
+autoconf
+autoheader
+automake-1.8 --add-missing --copy --foreign
+./configure --enable-maintainer-mode
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/autogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/configure.ac
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/configure.ac (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,74 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT(src/main.c)
+AM_CONFIG_HEADER(config.h)
+
+PACKAGE=$(packageName)
+VERSION=$(version)
+
+AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
+
+AC_PROG_CC
+AC_STDC_HEADERS
+AC_PROG_INSTALL
+dnl AC_PREFIX_DEFAULT(/var/lib/install/usr)
+AC_PREFIX_DEFAULT(/usr)
+
+CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wmissing-prototypes -Wmissing-declarations"
+
+PKG_CHECK_MODULES(DEPS, gtk+-2.0 >= 2.2 glib-2.0 >= 2.2)
+AC_SUBST(DEPS_CFLAGS)
+AC_SUBST(DEPS_LIBS)
+
+PKG_CHECK_MODULES(HILDON, hildon-1 >= 0.8.4)
+AC_SUBST(HILDON_LIBS)
+AC_SUBST(HILDON_CFLAGS)
+
+PKG_CHECK_MODULES(OSSO, libosso >= 0.8.4 gnome-vfs-2.0 >= 2.2 hildon-help)
+AC_SUBST(OSSO_LIBS)
+AC_SUBST(OSSO_CFLAGS)
+
+PKG_CHECK_MODULES(HILDONFM, hildon-fm-2 >= 0.8.4)
+AC_SUBST(HILDONFM_LIBS)
+AC_SUBST(HILDONFM_CFLAGS)
+
+
+PKG_CHECK_MODULES(OSSOSETTINGS, osso-af-settings >= 0.8.4)
+
+localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
+hildondesktopentrydir=/usr/share/dbus-1/services
+hildoncpdesktopentrydir=/usr/
+hildonstatusbarplugindir=`$PKG_CONFIG hildon-status-bar-lib --variable=pluginlibdir`
+hildoncplibdir=`$PKG_CONFIG hildon-control-panel --variable=pluginlibdir`
+hildoniconthemedir=$HOME/.icons/hicolor
+
+# Localization-related
+dnl AC_PROG_INTLTOOL([0.23])
+dnl GETTEXT_PACKAGE=$(packageName)
+dnl AC_SUBST( GETTEXT_PACKAGE )
+dnl AC_DEFINE_UNQUOTED( GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of gettext package ])
+dnl ALL_LINGUAS="de en_GB en_US es fi fr it pt_BR ru"
+dnl AC_SUBST(ALL_LINGUAS)
+dnl AM_GLIB_GNU_GETTEXT
+USE_NLS=no
+AC_SUBST(USE_NLS)
+
+AC_SUBST(localedir)
+AC_DEFINE_UNQUOTED(localedir,"$localedir",[localedir])
+AC_SUBST(desktopentrydir)
+AC_SUBST(hildondesktopentrydir)
+AC_SUBST(hildoncpdesktopentrydir)
+AC_SUBST(hildonstatusbarplugindir)
+AC_SUBST(hildoncplibdir)
+AC_SUBST(hildoniconthemedir)
+
+# po/Makefile.in
+AC_OUTPUT([
+ Makefile
+ src/Makefile
+ data/Makefile
+ po/Makefile
+ data/com.nokia.$(packageName).service
+ data/$(packageName).desktop
+ debian/rules
+])
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/configure.ac
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+# This software is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+
+dbusdir=$(datadir)/dbus-1/services
+dbus_DATA=com.nokia.$(packageName).service
+
+desktopdir=$(datadir)/applications/hildon
+desktop_DATA = $(packageName).desktop
+
+EXTRA_DIST = $(dbus_DATA) $(desktop_DATA)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/Makefile.in
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/Makefile.in (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/Makefile.in 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,360 @@
+# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# This software is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = data
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/com.nokia.maemohello.service.in \
+ $(srcdir)/maemohello.desktop.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(mkdir_p)
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = maemohello.desktop com.nokia.maemohello.service
+SOURCES =
+DIST_SOURCES =
+am__installdirs = "$(DESTDIR)$(dbusdir)" "$(DESTDIR)$(desktopdir)"
+dbusDATA_INSTALL = $(INSTALL_DATA)
+desktopDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dbus_DATA) $(desktop_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPS_CFLAGS = @DEPS_CFLAGS@
+DEPS_LIBS = @DEPS_LIBS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+HILDONFM_CFLAGS = @HILDONFM_CFLAGS@
+HILDONFM_LIBS = @HILDONFM_LIBS@
+HILDONLGPL_CFLAGS = @HILDONLGPL_CFLAGS@
+HILDONLGPL_LIBS = @HILDONLGPL_LIBS@
+HILDON_CFLAGS = @HILDON_CFLAGS@
+HILDON_LIBS = @HILDON_LIBS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OSSOSETTINGS_CFLAGS = @OSSOSETTINGS_CFLAGS@
+OSSOSETTINGS_LIBS = @OSSOSETTINGS_LIBS@
+OSSO_CFLAGS = @OSSO_CFLAGS@
+OSSO_LIBS = @OSSO_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+desktopentrydir = @desktopentrydir@
+exec_prefix = @exec_prefix@
+hildoncpdesktopentrydir = @hildoncpdesktopentrydir@
+hildoncplibdir = @hildoncplibdir@
+hildondesktopentrydir = @hildondesktopentrydir@
+hildoniconthemedir = @hildoniconthemedir@
+hildonstatusbarplugindir = @hildonstatusbarplugindir@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+dbusdir = $(prefix)/lib/dbus-1.0/services
+dbus_DATA = com.nokia.maemohello.service
+desktopdir = $(datadir)/applications/hildon
+desktop_DATA = maemohello.desktop
+EXTRA_DIST = $(dbus_DATA) $(desktop_DATA)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign data/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign data/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+maemohello.desktop: $(top_builddir)/config.status $(srcdir)/maemohello.desktop.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+com.nokia.maemohello.service: $(top_builddir)/config.status $(srcdir)/com.nokia.maemohello.service.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+uninstall-info-am:
+install-dbusDATA: $(dbus_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(dbusdir)" || $(mkdir_p) "$(DESTDIR)$(dbusdir)"
+ @list='$(dbus_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(dbusDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(dbusdir)/$$f'"; \
+ $(dbusDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(dbusdir)/$$f"; \
+ done
+
+uninstall-dbusDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dbus_DATA)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(dbusdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(dbusdir)/$$f"; \
+ done
+install-desktopDATA: $(desktop_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(desktopdir)" || $(mkdir_p) "$(DESTDIR)$(desktopdir)"
+ @list='$(desktop_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(desktopDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(desktopdir)/$$f'"; \
+ $(desktopDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(desktopdir)/$$f"; \
+ done
+
+uninstall-desktopDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(desktop_DATA)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(desktopdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(desktopdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(dbusdir)" "$(DESTDIR)$(desktopdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dbusDATA install-desktopDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dbusDATA uninstall-desktopDATA \
+ uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-dbusDATA install-desktopDATA install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-dbusDATA uninstall-desktopDATA uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/Makefile.in
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/PACKAGE.desktop.in
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/PACKAGE.desktop.in (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/PACKAGE.desktop.in 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Name=$(applicationName)
+Exec=@prefix@/bin/$(packageName)
+Icon=qgn_list_documents
+X-Window-Icon=maemopad-window
+X-Window-Icon-Dimmed=maemopad-window-dimmed
+X-Osso-Service=$(packageName)
+X-Osso-Type=application/x-executable
+X-HildonDesk-ShowInToolbar=true
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/PACKAGE.desktop.in
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/com.nokia.PACKAGE.service.in
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/com.nokia.PACKAGE.service.in (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/com.nokia.PACKAGE.service.in 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=com.nokia.$(packageName)
+Exec=@prefix@/bin/$(packageName)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/data/com.nokia.PACKAGE.service.in
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/changelog
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/changelog (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/changelog 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+$(packageName) (1.0.0) unstable; urgency=low
+
+ * Created from template.
+
+ -- $(author) <$(authorEmail)> Thu, 24 Apr 2008 17:22:00 -0600
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/changelog
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/control
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/control (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/control 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+Source: $(packageName)
+Section: user/other
+Priority: optional
+Maintainer: $(author) <$(authorEmail)>
+Build-Depends: debhelper (>= 4.0.0), intltool, hildon-base-lib-dev, hildon-libs-dev, hildon-fm-dev,
+ libgtk2.0-dev, libosso-gnomevfs2-dev, libglib2.0-dev, libdbus-glib-1-dev, libosso-dev
+Standards-Version: 3.6.0
+
+Package: $(packageName)
+Architecture: any
+#Depends: maemo
+Description: Helloworld with automake & .deb generation
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/control
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/copyright
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/copyright (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/copyright 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+Copyright: (c) 2005 Nokia Corporation
+
+This package is licensed under the GNU LGPL license
+For further information please refer to the COPYING file
+
+
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/copyright
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/postinst
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/postinst (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/postinst 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,9 @@
+#!/bin/sh
+#update the icon cache
+gtk-update-icon-cache -f /usr/share/icons/hicolor
+
+# copy the desktop file for use
+( cd /usr/share/applications/hildon/ && mv $(packageName).inactive $(packageName).desktop )
+
+# select the installation folder
+maemo-select-menu-location $(packageName).desktop
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/postinst
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/rules.in
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/rules.in (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/rules.in 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,90 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+
+CFLAGS = -Wall -g
+PACKAGENAME = $(packageName)
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+ INSTALL_PROGRAM += -s
+endif
+
+config.status: configure
+ dh_testdir
+ # Add here commands to configure the package.
+ CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ mv debian/rules debian/rules.save
+ -$(MAKE) distclean
+ mv debian/rules.save debian/rules
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/tmp
+ #$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp/var/lib/install
+ $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
+
+ # See postinst for why we do this.
+ ( cd $(CURDIR)/debian/tmp/usr/share/applications/hildon \
+ && mv $(packageName).desktop $(packageName).inactive \
+ )
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/debian/rules.in
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/ChangeLog
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/ChangeLog (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/ChangeLog 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1 @@
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/ChangeLog
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/Makefile.am
===================================================================
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/POTFILES.in
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/POTFILES.in (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/POTFILES.in 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1 @@
+src/main.c
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/po/POTFILES.in
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,2 @@
+EXTRA_DIST = \
+ main.c
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/localisation.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/localisation.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/localisation.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : localisation.h
+ Author : $(author)
+ Version : $(version)
+ Description : Header with localization facilities
+ ============================================================================
+ */
+#ifndef LOCALISATION_H
+#define LOCALISATION_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(String) gettext(String)
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+#define locale_init() setlocale(LC_ALL, "");\
+ bindtextdomain(GETTEXT_PACKAGE, localedir);\
+ textdomain(GETTEXT_PACKAGE);
+#else /* NLS is disabled */
+#define locale_init()
+#define _(String) (String)
+#define N_(String) (String)
+#define textdomain(String) (String)
+#define gettext(String) (String)
+#define dgettext(Domain,String) (String)
+#define dcgettext(Domain,String,Type) (String)
+#define bindtextdomain(Domain,Directory) (Domain)
+#define bind_textdomain_codeset(Domain,Codeset) (Codeset)
+#endif /* ENABLE_NLS */
+
+#endif /* LOCALISATION_H */
+#ifndef LOCALISATION_H
+#define LOCALISATION_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(String) gettext(String)
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+#define locale_init() setlocale(LC_ALL, "");\
+ bindtextdomain(GETTEXT_PACKAGE, localedir);\
+ textdomain(GETTEXT_PACKAGE);
+#else /* NLS is disabled */
+#define locale_init()
+#define _(String) (String)
+#define N_(String) (String)
+#define textdomain(String) (String)
+#define gettext(String) (String)
+#define dgettext(Domain,String) (String)
+#define dcgettext(Domain,String,Type) (String)
+#define bindtextdomain(Domain,Directory) (Domain)
+#define bind_textdomain_codeset(Domain,Codeset) (Codeset)
+#endif /* ENABLE_NLS */
+
+#endif /* LOCALISATION_H */
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/localisation.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/main.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/main.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/main.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : main.c
+ Author : $(author)
+ Version : $(version)
+ Description : Hildon GUI Application in C
+ ============================================================================
+ */
+/* Includes */
+#include <hildon/hildon-program.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtkbutton.h>
+#include <libosso.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "localisation.h"
+/* Defines to add the application to dbus and keep it running
+ * Please do not modify "APP_NAME" (or other defines) to different name
+ */
+#define APP_NAME "$(packageName)"
+#define APP_VER "$(version)"
+#define APP_SERVICE "com.nokia.$(packageName)"
+#define APP_METHOD "/com/nokia/$(packageName)"
+/* end defines */
+
+static void button_clicked (GtkButton* button, gpointer data)
+{
+ gtk_main_quit();
+}
+
+static gint
+dbus_callback (const gchar *interface, const gchar *method,
+ GArray *arguments, gpointer data,
+ osso_rpc_t *retval)
+{
+ printf ("dbus: %s, %s\n", interface, method);
+
+ if (!strcmp (method, "top_application"))
+ gtk_window_present (GTK_WINDOW (data));
+
+ return DBUS_TYPE_INVALID;
+}
+
+int main( int argc, char* argv[] )
+{
+ /* Create needed variables */
+ HildonProgram *program;
+ HildonWindow *window;
+ GtkWidget *button;
+ osso_context_t *osso_cont;
+ osso_return_t ret;
+
+ osso_cont = osso_initialize(APP_NAME, APP_VER, TRUE, NULL);
+ if (osso_cont == NULL)
+ {
+ fprintf (stderr, "osso_initialize failed.\n");
+ exit (1);
+ }
+
+ /* Initialize the GTK. */
+ gtk_init( &argc, &argv );
+
+ /* Create the hildon program and setup the title */
+ program = HILDON_PROGRAM(hildon_program_get_instance());
+ g_set_application_name("$(applicationName)");
+
+ /* Create HildonWindow and set it to HildonProgram */
+ window = HILDON_WINDOW(hildon_window_new());
+ hildon_program_add_window(program, window);
+
+ /* Quit program when window is closed. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (gtk_main_quit), NULL);
+
+ /* Quit program when window is otherwise destroyed. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
+
+ /* Create button and add it to main view */
+ button = gtk_button_new_with_label(_("$(message)"));
+ gtk_container_add(GTK_CONTAINER(window),
+ button);
+
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (button_clicked), NULL);
+
+ ret = osso_rpc_set_cb_f (osso_cont,
+ APP_SERVICE,
+ APP_METHOD,
+ APP_SERVICE,
+ dbus_callback, GTK_WIDGET( window ));
+ if (ret != OSSO_OK) {
+ fprintf (stderr, "osso_rpc_set_cb_f failed: %d.\n", ret);
+ exit (1);
+ }
+
+ /* Begin the main application */
+ gtk_widget_show_all ( GTK_WIDGET ( window ) );
+ gtk_main();
+
+ /* Exit */
+ return 0;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/src/main.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+#Template Default Values
+HildonGUIApplication.Ctemplate.label=Hildon GUI Project
+HildonGUIApplication.Ctemplate.description=A simple Hildon Project in C with localization and Debian packaging support. \
+The application displays a button which when clicked closes the application.\n\n\
+NOTE: this application requires the 'doctools' devkit in your scratchbox target. \n\n\
+If you get the error:\n\n\
+\tconfigure: error: Your intltool is too old. You need intltool 0.23 or later.\n\n\
+when configuring, then for scratchbox 1, invoke a command like:\n\n\
+\tsb-conf setup CHINOOK_ARMEL --force --cputransp=/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2 \
+--compiler=cs2005q3.2-glibc2.5-arm --devkits=perl:debian-etch:maemo3-tools:cputransp:doctools\n\n\
+(or establish a similar configuration via sb-menu), then invoke "Build Application > Generate Configure" and rebuild.
+HildonGUIApplication.basics.label=Basic Settings
+HildonGUIApplication.basics.description=Basic properties of a project
+HildonGUIApplication.author.label=Author
+HildonGUIApplication.authorEmail.description=Name of the author
+HildonGUIApplication.authorEmail.label=Author E-mail
+HildonGUIApplication.authorEmail.description=E-mail of the author
+HildonGUIApplication.message.default=Hello World!!!
+HildonGUIApplication.message.description=Your hello world greeting message
+HildonGUIApplication.message.label=Hello world greeting
+HildonGUIApplication.applicationName.label=Application Name
+HildonGUIApplication.applicationName.description=Name of application
+HildonGUIApplication.packageName.label=Package Name
+HildonGUIApplication.packageName.description=Name of the package
+HildonGUIApplication.version.label=Version
+HildonGUIApplication.version.description=Version of application
+HildonGUIApplication.version.default=0.1
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="HildonGUIAppCProject" label="%HildonGUIApplication.Ctemplate.label" description="%HildonGUIApplication.Ctemplate.description"
+ help="help.html">
+ <property-group id="basics" label="%HildonGUIApplication.basics.label" description="%HildonGUIApplication.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%HildonGUIApplication.author.label"
+ description="%HildonGUIApplication.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="authorEmail"
+ label="%HildonGUIApplication.authorEmail.label"
+ description="%HildonGUIApplication.authorEmail.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="message"
+ label="%HildonGUIApplication.message.label"
+ description="%HildonGUIApplication.message.description"
+ type="input"
+ pattern=".*"
+ default="%HildonGUIApplication.message.default"
+ hidden="false"
+ persist="true"/>
+ <property id="applicationName"
+ label="%HildonGUIApplication.applicationName.label"
+ description="%HildonGUIApplication.applicationName.description"
+ type="input"
+ pattern=".*"
+ default="Hildon GUI Application"
+ hidden="false"
+ persist="false"/>
+ <property id="packageName"
+ label="%HildonGUIApplication.packageName.label"
+ description="%HildonGUIApplication.packageName.description"
+ type="input"
+ pattern=".*"
+ default="hildonguiapp"
+ hidden="false"
+ persist="false"/>
+ <property id="version"
+ label="%HildonGUIApplication.version.label"
+ description="%HildonGUIApplication.version.description"
+ type="input"
+ pattern=".*"
+ default="%HildonGUIApplication.version.default"
+ hidden="false"
+ persist="true"/>
+
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="autogen.sh"/>
+ <simple name="target" value="autogen.sh"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="configure.ac"/>
+ <simple name="target" value="configure.ac"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="Makefile.am"/>
+ <simple name="target" value="Makefile.am"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/localisation.h"/>
+ <simple name="target" value="src/localisation.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/main.c"/>
+ <simple name="target" value="src/main.c"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/Makefile.am"/>
+ <simple name="target" value="src/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="po/ChangeLog"/>
+ <simple name="target" value="po/ChangeLog"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="po/Makefile.am"/>
+ <simple name="target" value="po/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="po/POTFILES.in"/>
+ <simple name="target" value="po/POTFILES.in"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/control"/>
+ <simple name="target" value="debian/control"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/copyright"/>
+ <simple name="target" value="debian/copyright"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/postinst"/>
+ <simple name="target" value="debian/postinst"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/rules.in"/>
+ <simple name="target" value="debian/rules.in"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/changelog"/>
+ <simple name="target" value="debian/changelog"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="data/com.nokia.PACKAGE.service.in"/>
+ <simple name="target" value="data/com.nokia.$(packageName).service.in"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="data/Makefile.am"/>
+ <simple name="target" value="data/Makefile.am"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="data/Makefile.in"/>
+ <simple name="target" value="data/Makefile.in"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/PACKAGE.desktop.in"/>
+ <simple name="target" value="data/$(packageName).desktop.in"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="libhildonfm2-dev" />
+ <element value="libhildonfm2-dbg" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildon-1" />
+ <element value="hildon-fm-2" />
+ <element value="gnome-vfs-2.0" />
+ <element value="hildon-help" />
+ <element value="gtk+-2.0" />
+ <element value="glib-2.0" />
+ </simple-array>
+ </process>
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonGUIApplication/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/COPYING.LESSER
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/COPYING.LESSER (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/COPYING.LESSER
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/Makefile
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/Makefile (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,31 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = `pkg-config --cflags gtk+-2.0 hildon-1` -ansi -Wall
+
+LIBS = `pkg-config --libs gtk+-2.0 hildon-1`
+
+TARGET = {{baseName}}{{exe}}
+
+SOURCES = src/main.c
+
+$(TARGET): $(SOURCES)
+ $(CC) -g -o $(TARGET) $(SOURCES) $(CFLAGS) $(LIBS)
+
+all: $(TARGET)
+
+clean:
+ rm -f $(TARGET)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/Makefile
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/src/main.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/src/main.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/src/main.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : main.cc
+ Author : $(author)
+ Version : $(version)
+ Description : Hello World Hildon
+ ============================================================================
+ */
+
+#include <hildon/hildon-program.h>
+#include <gtk/gtk.h>
+
+int main(int argc, char *argv[]) {
+
+ HildonProgram *program;
+ HildonWindow *window;
+
+ gtk_init(&argc, &argv);
+
+ program = HILDON_PROGRAM(hildon_program_get_instance());
+ g_set_application_name("Hello World");
+
+ window = HILDON_WINDOW(hildon_window_new());
+ hildon_program_add_window(program, window);
+
+ gtk_container_add(GTK_CONTAINER(window),
+ GTK_WIDGET(gtk_label_new("$(message)")));
+
+ gtk_widget_show_all(GTK_WIDGET(window));
+
+ g_signal_connect(G_OBJECT(window), "delete_event",
+ G_CALLBACK(gtk_main_quit), NULL);
+
+ gtk_main();
+
+ return 0;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/src/main.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,15 @@
+#Template Default Values
+HildonHelloWorldMake.Ctemplate.label=Hildon Hello World Make Project (4.x+)
+HildonHelloWorldMake.Ctemplate.description=A Hildon Hello World make-based project which shows a message in the application window. \
+\n\nThis project requires the maemomm packages. \
+Please see\n\n\thttp://maemo.org/development/documentation/programming_languages/\n\nfor details.
+HildonHelloWorldMake.basics.label=Basic Settings
+HildonHelloWorldMake.basics.description=Basic properties of a project
+HildonHelloWorldMake.author.label=Author
+HildonHelloWorldMake.author.description=Name of the author
+HildonHelloWorldMake.version.label=Version
+HildonHelloWorldMake.version.description=Your application version
+HildonHelloWorldMake.version.default=0.1
+HildonHelloWorldMake.message.default=Hello World!!!
+HildonHelloWorldMake.message.description=Your hello world greeting message
+HildonHelloWorldMake.message.label=Hello world greeting
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="INdT"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="HelloWorldMakeCProject" label="%HildonHelloWorldMake.Ctemplate.label" description="%HildonHelloWorldMake.Ctemplate.description"
+ help="help.html">
+ <property-group id="basics" label="%HildonHelloWorldMake.basics.label" description="%HildonHelloWorldMake.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%HildonHelloWorldMake.author.label"
+ description="%HildonHelloWorldMake.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="version"
+ label="%HildonHelloWorldMake.version.label"
+ description="%HildonHelloWorldMake.version.description"
+ type="input"
+ pattern=".*"
+ default="%HildonHelloWorldMake.version.default"
+ hidden="false"
+ persist="true"/>
+ <property id="message"
+ label="%HildonHelloWorldMake.message.label"
+ description="%HildonHelloWorldMake.message.description"
+ type="input"
+ pattern=".*"
+ default="%HildonHelloWorldMake.message.default"
+ hidden="false"
+ persist="true"/>
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="src/main.c"/>
+ <simple name="target" value="src/main.c"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING.LESSER"/>
+ <simple name="target" value="COPYING.LESSER"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.eclipse.cdt.managedbuilder.gnu.ui.SimpleGNUMakefileGenerator">
+ <simple name="projectName" value="$(projectName)"/>
+ </process>
+
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="libhildon1-dev" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildon-1" />
+ <element value="gtk+-2.0" />
+ </simple-array>
+ </process>
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/COPYING.LESSER
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/COPYING.LESSER (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/COPYING.LESSER
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/Makefile
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/Makefile (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,31 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = `pkg-config --cflags gtk+-2.0 hildon-libs` -ansi -Wall
+
+LIBS = `pkg-config --libs gtk+-2.0 hildon-libs`
+
+TARGET = {{baseName}}{{exe}}
+
+SOURCES = src/main.c
+
+$(TARGET): $(SOURCES)
+ $(CC) -g -o $(TARGET) $(SOURCES) $(CFLAGS) $(LIBS)
+
+all: $(TARGET)
+
+clean:
+ rm -f $(TARGET)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/Makefile
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/src/main.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/src/main.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/src/main.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : main.cc
+ Author : $(author)
+ Version : $(version)
+ Description : Hello World Hildon
+ ============================================================================
+ */
+
+#include <hildon-widgets/hildon-program.h>
+#include <gtk/gtk.h>
+
+int main(int argc, char *argv[]) {
+
+ HildonProgram *program;
+ HildonWindow *window;
+
+ gtk_init(&argc, &argv);
+
+ program = HILDON_PROGRAM(hildon_program_get_instance());
+ g_set_application_name("Hello World");
+
+ window = HILDON_WINDOW(hildon_window_new());
+ hildon_program_add_window(program, window);
+
+ gtk_container_add(GTK_CONTAINER(window),
+ GTK_WIDGET(gtk_label_new("$(message)")));
+
+ gtk_widget_show_all(GTK_WIDGET(window));
+
+ g_signal_connect(G_OBJECT(window), "delete_event",
+ G_CALLBACK(gtk_main_quit), NULL);
+
+ gtk_main();
+
+ return 0;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/src/main.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+#Template Default Values
+HildonHelloWorldMake.Ctemplate.label=Hildon Hello World Make Project (1.x-3.x)
+HildonHelloWorldMake.Ctemplate.description=A Hildon Hello World make-based project which shows a message in the application window. \n\n\
+This project requires the maemomm packages. \
+If needed, add this repository to your scratchbox /etc/apt/sources.list:\n\n\
+\tdeb http://repository.maemo.org/extras [bora|gregale] free non-free\n\n\
+and invoke 'fakeroot apt-get update' and 'fakeroot apt-get install libhildonmm libhildonmm-dev' first.
+HildonHelloWorldMake.basics.label=Basic Settings
+HildonHelloWorldMake.basics.description=Basic properties of a project
+HildonHelloWorldMake.author.label=Author
+HildonHelloWorldMake.author.description=Name of the author
+HildonHelloWorldMake.version.label=Version
+HildonHelloWorldMake.version.description=Your application version
+HildonHelloWorldMake.version.default=0.1
+HildonHelloWorldMake.message.default=Hello World!!!
+HildonHelloWorldMake.message.description=Your hello world greeting message
+HildonHelloWorldMake.message.label=Hello world greeting
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="INdT"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="HelloWorldMakeCProject" label="%HildonHelloWorldMake.Ctemplate.label" description="%HildonHelloWorldMake.Ctemplate.description"
+ help="help.html">
+ <property-group id="basics" label="%HildonHelloWorldMake.basics.label" description="%HildonHelloWorldMake.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%HildonHelloWorldMake.author.label"
+ description="%HildonHelloWorldMake.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="version"
+ label="%HildonHelloWorldMake.version.label"
+ description="%HildonHelloWorldMake.version.description"
+ type="input"
+ pattern=".*"
+ default="%HildonHelloWorldMake.version.default"
+ hidden="false"
+ persist="true"/>
+ <property id="message"
+ label="%HildonHelloWorldMake.message.label"
+ description="%HildonHelloWorldMake.message.description"
+ type="input"
+ pattern=".*"
+ default="%HildonHelloWorldMake.message.default"
+ hidden="false"
+ persist="true"/>
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="src/main.c"/>
+ <simple name="target" value="src/main.c"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING.LESSER"/>
+ <simple name="target" value="COPYING.LESSER"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.eclipse.cdt.managedbuilder.gnu.ui.SimpleGNUMakefileGenerator">
+ <simple name="projectName" value="$(projectName)"/>
+ </process>
+
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="gdb" />
+ <element value="hildon-libs" /> <!-- unsure what dev pkg is/was -->
+ <element value="libgtk2.0-dev" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildon-libs" />
+ <element value="gtk+-2.0" />
+ </simple-array>
+ </process>
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/HildonHelloWorldMake3/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,447 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+Version 2.1, February 1999
+
+
+Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+as the successor of the GNU Library Public License, version 2, hence
+the version number 2.1.]
+
+Preamble
+The licenses for most software are designed to take away your freedom
+to share and change it. By contrast, the GNU General Public Licenses
+are intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.
+
+This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations
+below.
+
+When we speak of free software, we are referring to freedom of use, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish); that you receive source code or can get it
+if you want it; that you can change the software and use pieces of it
+in new free programs; and that you are informed that you can do these
+things.
+
+To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+For example, if you distribute copies of the library, whether gratis or
+for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+To protect each distributor, we want to make it very clear that there
+is no warranty for the free library. Also, if the library is modified
+by someone else and passed on, the recipients should know that what
+they have is not the original version, so that the original author's
+reputation will not be affected by problems that might be introduced by
+others.
+
+Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that any
+patent license obtained for a version of the library must be consistent
+with the full freedom of use specified in this license.
+
+Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License. This license, the GNU Lesser General Public
+License, applies to certain designated libraries, and is quite
+different from the ordinary General Public License. We use this license
+for certain libraries in order to permit linking those libraries into
+non-free programs.
+
+When a program is linked with a library, whether statically or using a
+shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less of
+an advantage over competing non-free programs. These disadvantages are
+the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it
+becomes a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free library
+does the same job as widely used non-free libraries. In this case,
+there is little to gain by limiting the free library to free software
+only, so we use the Lesser General Public License.
+
+In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of free
+software. For example, permission to use the GNU C Library in non-free
+programs enables many more people to use the whole GNU operating
+system, as well as its variant, the GNU/Linux operating system.
+
+Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run that
+program using a modified version of the Library.
+
+The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or other
+authorized party saying it may be distributed under the terms of this
+Lesser General Public License (also called "this License"). Each
+licensee is addressed as "you".
+
+A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+The "Library", below, refers to any such software library or work which
+has been distributed under these terms. A "work based on the Library"
+means either the Library or any derivative work under copyright law:
+that is to say, a work containing the Library or a portion of it,
+either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+"Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control
+compilation and installation of the library.
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of running
+a program using the Library is not restricted, and output from such a
+program is covered only if its contents constitute a work based on the
+Library (independent of the use of the Library in a tool for writing
+it). Whether that is true depends on what the Library does and what the
+program that uses the Library does.
+
+1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and distribute a copy of this License along with the Library.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Library or any portion of
+it, thus forming a work based on the Library, and copy and distribute
+such modifications or work under the terms of Section 1 above, provided
+that you also meet all of these conditions:
+
+
+a) The modified work must itself be a software library.
+b) You must cause the files modified to carry prominent notices stating
+that you changed the files and the date of any change.
+c) You must cause the whole of the work to be licensed at no charge to
+all third parties under the terms of this License.
+d) If a facility in the modified Library refers to a function or a
+table of data to be supplied by an application program that uses the
+facility, other than as an argument passed when the facility is
+invoked, then you must make a good faith effort to ensure that, in the
+event an application does not supply such function or table, the
+facility still operates, and performs whatever part of its purpose
+remains meaningful.
+(For example, a function in a library to compute square roots has a
+purpose that is entirely well-defined independent of the application.
+Therefore, Subsection 2d requires that any application-supplied
+function or table used by this function must be optional: if the
+application does not supply it, the square root function must still
+compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of a
+storage or distribution medium does not bring the other work under the
+scope of this License.
+
+3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+Once this change is made in a given copy, it is irreversible for that
+copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+This option is useful when you wish to copy part of the code of the
+Library into a program that is not a library.
+
+4. You may copy and distribute the Library (or a portion or derivative
+of it, under Section 2) in object code or executable form under the
+terms of Sections 1 and 2 above provided that you accompany it with the
+complete corresponding machine-readable source code, which must be
+distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange.
+
+If distribution of object code is made by offering access to copy from
+a designated place, then offering equivalent access to copy the source
+code from the same place satisfies the requirement to distribute the
+source code, even though third parties are not compelled to copy the
+source along with the object code.
+
+5. A program that contains no derivative of any portion of the Library,
+but is designed to work with the Library by being compiled or linked
+with it, is called a "work that uses the Library". Such a work, in
+isolation, is not a derivative work of the Library, and therefore falls
+outside the scope of this License.
+
+However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License. Section
+6 states terms for distribution of such executables.
+
+When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+If such an object file uses only numerical parameters, data structure
+layouts and accessors, and small macros and small inline functions (ten
+lines or less in length), then the use of the object file is
+unrestricted, regardless of whether it is legally a derivative work.
+(Executables containing this object code plus portions of the Library
+will still fall under Section 6.)
+
+Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6, whether
+or not they are linked directly with the Library itself.
+
+6. As an exception to the Sections above, you may also combine or link
+a "work that uses the Library" with the Library to produce a work
+containing portions of the Library, and distribute that work under
+terms of your choice, provided that the terms permit modification of
+the work for the customer's own use and reverse engineering for
+debugging such modifications.
+
+You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+
+a) Accompany the work with the complete corresponding machine-readable
+source code for the Library including whatever changes were used in the
+work (which must be distributed under Sections 1 and 2 above); and, if
+the work is an executable linked with the Library, with the complete
+machine-readable "work that uses the Library", as object code and/or
+source code, so that the user can modify the Library and then relink to
+produce a modified executable containing the modified Library. (It is
+understood that the user who changes the contents of definitions files
+in the Library will not necessarily be able to recompile the
+application to use the modified definitions.)
+b) Use a suitable shared library mechanism for linking with the
+Library. A suitable mechanism is one that (1) uses at run time a copy
+of the library already present on the user's computer system, rather
+than copying library functions into the executable, and (2) will
+operate properly with a modified version of the library, if the user
+installs one, as long as the modified version is interface-compatible
+with the version that the work was made with.
+c) Accompany the work with a written offer, valid for at least three
+years, to give the same user the materials specified in Subsection 6a,
+above, for a charge no more than the cost of performing this
+distribution.
+d) If distribution of the work is made by offering access to copy from
+a designated place, offer equivalent access to copy the above specified
+materials from the same place.
+e) Verify that the user has already received a copy of these materials
+or that you have already sent this user a copy.
+For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies the
+executable.
+
+It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise permitted,
+and provided that you do these two things:
+
+
+a) Accompany the combined library with a copy of the same work based on
+the Library, uncombined with any other library facilities. This must be
+distributed under the terms of the Sections above.
+b) Give prominent notice with the combined library of the fact that
+part of it is a work based on the Library, and explaining where to find
+the accompanying uncombined form of the same work.
+8. You may not copy, modify, sublicense, link with, or distribute the
+Library except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense, link with, or distribute the
+Library is void, and will automatically terminate your rights under
+this License. However, parties who have received copies, or rights,
+from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying the
+Library or works based on it.
+
+10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent license
+would not permit royalty-free redistribution of the Library by all
+those who receive copies directly or indirectly through you, then the
+only way you could satisfy both it and this License would be to refrain
+entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply, and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is implemented
+by public license practices. Many people have made generous
+contributions to the wide range of software distributed through that
+system in reliance on consistent application of that system; it is up
+to the author/donor to decide if he or she is willing to distribute
+software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may
+add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among countries
+not thus excluded. In such case, this License incorporates the
+limitation as if written in the body of this License.
+
+13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time. Such
+new versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a license
+version number, you may choose any version ever published by the Free
+Software Foundation.
+
+14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free Software
+Foundation; we sometimes make exceptions for this. Our decision will be
+guided by the two goals of preserving the free status of all
+derivatives of our free software and of promoting the sharing and reuse
+of software generally.
+
+NO WARRANTY
+
+15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH
+YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+#
+# This file is part of maemopad
+#
+# Copyright (C) 2005 Nokia Corporation.
+#
+# This software is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+
+EXTRA_DIST = \
+ autogen.sh \
+ intltool-extract.in \
+ intltool-merge.in \
+ intltool-update.in \
+ debian/changelog \
+ debian/control \
+ debian/copyright \
+ debian/rules \
+ debian/maemopad.links
+
+SUBDIRS = src data po
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/autogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/autogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -x
+glib-gettextize --copy --force
+libtoolize --automake --copy --force
+intltoolize --automake --copy --force
+aclocal-1.7
+autoconf --force
+autoheader --force
+automake-1.7 --add-missing --copy --force-missing --foreign
+./configure --enable-maintainer-mode
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/autogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/configure.ac
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/configure.ac (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,98 @@
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(maemopad, `date +%Y%m%d`)
+AM_CONFIG_HEADER(config.h)
+
+AC_CANONICAL_HOST
+
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+AC_PROG_INTLTOOL([0.23])
+AC_HEADER_STDC
+
+# Option to enable debugging
+AC_ARG_ENABLE(debug,
+ [AC_HELP_STRING([ --enable-debug],[Debugging (default=no)])],
+ [with_debug=yes], [with_debug=no])
+
+if test "x$with_debug" == "xyes" ; then
+ CFLAGS="$CFLAGS -ggdb -O0 -DDEBUG -Wall -ansi -pedantic"
+else
+ CFLAGS="$CFLAGS -O2 -Wall -ansi -pedantic"
+fi
+
+# Hildon library dependsncies
+PKG_CHECK_MODULES(HILDON, hildon-1 >= 0.9.50 hildon-fm-2 hildon-help)
+AC_SUBST(HILDON_LIBS)
+AC_SUBST(HILDON_CFLAGS)
+
+# Only used for the .service file path
+PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.60)
+
+# OSSO application framework dependencies
+PKG_CHECK_MODULES(OSSO, osso-af-settings >= 0.8.5 libosso >= 0.9.17 gnome-vfs-2.0 >= 2.8.4.11 gnome-vfs-module-2.0 >= 2.8.4.11)
+AC_SUBST(OSSO_LIBS)
+AC_SUBST(OSSO_CFLAGS)
+
+# Localisation
+GETTEXT_PACKAGE=$PACKAGE
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "${GETTEXT_PACKAGE}", [Name of gettext package])
+ALL_LINGUAS="en_GB"
+AM_GLIB_GNU_GETTEXT
+
+# To make application visible in maemo Task Navigator it needs a Desktop
+# file for the application.
+# D-BUS service file is needed to be able to launch the maemo application
+# and connect it to D-BUS services.
+# The following line defines install directories for these files.
+desktopentrydir=`$PKG_CONFIG osso-af-settings --variable=desktopentrydir`
+serviceentrydir=`$PKG_CONFIG osso-af-settings --variable=dbusservicedir`
+
+# Application locale install directory
+localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
+
+# Application pixmaps install directory
+pixmapdir=`$PKG_CONFIG osso-af-settings --variable=hildonpixmapdir`
+
+# Application icon install directories
+icon_26x26dir=$datadir/icons/hicolor/26x26/hildon
+icon_34x34dir=$datadir/icons/hicolor/34x34/hildon
+icon_40x40dir=$datadir/icons/hicolor/40x40/hildon
+icon_50x50dir=$datadir/icons/hicolor/50x50/hildon
+icon_scalabledir=$datadir/icons/hicolor/scalable/hildon
+
+# Help file install directory
+helpfile_engbdir=$datadir/osso-help/en_GB
+
+# Hildon control panel plugin install directories
+pluginlibdir=`$PKG_CONFIG hildon-control-panel --variable=plugindir`
+plugindesktopentrydir=`$PKG_CONFIG hildon-control-panel --variable=plugindesktopentrydir`
+
+# Define as variables in Makefiles
+AC_SUBST(desktopentrydir)
+AC_SUBST(serviceentrydir)
+AC_SUBST(localedir)
+AC_SUBST(pixmapdir)
+AC_SUBST(icon_26x26dir)
+AC_SUBST(icon_34x34dir)
+AC_SUBST(icon_40x40dir)
+AC_SUBST(icon_50x50dir)
+AC_SUBST(icon_scalabledir)
+AC_SUBST(pluginlibdir)
+AC_SUBST(plugindesktopentrydir)
+AC_SUBST(helpfile_engbdir)
+
+AC_DEFINE_UNQUOTED([LOCALEDIR], "${localedir}", [Runtime locale catalog files path])
+AC_DEFINE_UNQUOTED([PIXMAPDIR], "${pixmapdir}", [Runtime pixmap files path])
+
+# Produce output files
+AC_OUTPUT(
+ Makefile \
+ src/Makefile \
+ data/Makefile \
+ po/Makefile.in \
+ po/Makefile
+)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/configure.ac
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+#
+# This file is part of maemopad
+#
+# Copyright (C) 2005 Nokia Corporation.
+#
+# This software is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+
+serviceentry_DATA = com.nokia.maemopad.service
+
+desktopentry_DATA = maemopad.desktop
+
+icon_26x26_DATA = icons/26x26/maemopad.png
+icon_40x40_DATA = icons/40x40/maemopad.png
+icon_scalable_DATA = icons/scalable/maemopad.png
+
+helpfile_engb_DATA = help/en_GB/MaemoPad.xml
+
+EXTRA_DIST = $(serviceentry_DATA) $(desktopentry_DATA) $(icon_26x26_DATA) $(icon_40x40_DATA) $(icon_scalable_DATA) $(helpfile_engb_DATA)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/com.nokia.maemopad.service
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/com.nokia.maemopad.service (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/com.nokia.maemopad.service 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=com.nokia.maemopad
+Exec=/usr/bin/maemopad
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/com.nokia.maemopad.service
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/help/en_GB/MaemoPad.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/help/en_GB/MaemoPad.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/help/en_GB/MaemoPad.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ossohelpsource>
+ <folder>
+ <title>MaemoPad</title>
+ <topic>
+ <topictitle>Main Topic</topictitle>
+ <context contextUID="Example_MaemoPad_Content" />
+ <para>This is a help file with example content.</para>
+ </topic>
+ </folder>
+</ossohelpsource>
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/help/en_GB/MaemoPad.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/26x26/maemopad.png
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/26x26/maemopad.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/40x40/maemopad.png
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/40x40/maemopad.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/scalable/maemopad.png
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/icons/scalable/maemopad.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/maemopad.desktop
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/maemopad.desktop (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/maemopad.desktop 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=0.1
+Type=Application
+Name=MaemoPad
+Exec=/usr/bin/maemopad
+Icon=maemopad
+X-Window-Icon=maemopad
+X-Window-Icon-Dimmed=maemopad
+X-Osso-Service=maemopad
+X-Osso-Type=application/x-executable
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/data/maemopad.desktop
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/changelog
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/changelog (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/changelog 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+maemopad (1.5) unstable; urgency=low
+
+ * Ported for SDK 2.0
+ * HildonProgram and HildonWindow taken into use
+
+ -- Maemo Integration <integration at maemo.org> Thu, 04 May 2006 14:40:07 +0200
+
+maemopad (1.4) unstable; urgency=low
+
+ * Changed required version numbers in configure.in to match those in the device.
+ * Fixed icon names in sample maemopad.desktop file.
+
+ -- Maemo Integration <integration at maemo.org> Thu, 24 Nov 2005 18:02:43 +0200
+
+maemopad (1.3) unstable; urgency=low
+
+ * Cleaned up autotools.
+
+ -- Maemo Integration <integration at maemo.org> Wed, 2 Nov 2005 16:18:05 +0200
+
+maemopad (1.2) unstable; urgency=low
+
+ * Made application installer installable.
+
+ -- Maemo Integration <integration at maemo.org> Tue, 11 Oct 2005 17:34:43 +0300
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/changelog
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/control
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/control (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/control 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+Source: maemopad
+Section: user/office
+Priority: optional
+Maintainer: Maemo Integration <integration at maemo.org>
+Build-Depends: debhelper (>= 4.0.0), intltool, libhildon1-dev,
+ libgtk2.0-dev, libosso-gnomevfs2-dev,
+ libglib2.0-dev, libdbus-glib-1-dev, libosso-dev
+Standards-Version: 3.6.0
+
+Package: maemopad
+Architecture: any
+Description: text editor application for editing plain-text documents.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/control
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/copyright
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/copyright (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/copyright 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+Copyright: (c) 2005 Nokia Corporation
+
+This package is licensed under the GNU LGPL license
+For further information please refer to the COPYING file
+
+
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/copyright
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/maemopad.install
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/maemopad.install (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/maemopad.install 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1 @@
+usr/share/locale/en_GB/LC_MESSAGES/maemopad.mo
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/maemopad.install
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/maemopad.links
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/maemopad.links (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/maemopad.links 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1 @@
+/usr/share/applications/hildon/maemopad.desktop etc/others-menu/extra_applications/0112_maemopad.desktop
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/maemopad.links
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/rules
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/rules (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/rules 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,85 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+
+CFLAGS = -Wall -g
+PACKAGENAME = maemopad
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+ INSTALL_PROGRAM += -s
+endif
+
+config.status: configure
+ dh_testdir
+ # Add here commands to configure the package.
+ CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+
+configure:
+ ./autogen.sh
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) distclean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/tmp
+ #$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp/var/lib/install
+ $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/debian/rules
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po/POTFILES.in
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po/POTFILES.in (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po/POTFILES.in 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+# List of MaemoPad source files to be localized
+
+../src/main.c
+../src/ui/interface.c
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po/POTFILES.in
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po/en_GB.po
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po/en_GB.po (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po/en_GB.po 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,89 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#: ../src/main.c:60
+msgid ""
+msgstr ""
+"Project-Id-Version: maemopad 1.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2005-04-14 00:16-0200\n"
+"PO-Revision-Date: 2005-04-14 00:16-0200\n"
+"Last-Translator: Osvaldo Santana Neto <osvaldo.santana at indt.org.br>\n"
+"Language-Team: pt_BR <pt_BR at indt.org.br>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../src/ui/interface.c:123
+msgid "maemopad_save_changes_made"
+msgstr "Save changes?"
+
+#: ../src/ui/interface.c:124
+msgid "maemopad_yes"
+msgstr "Yes"
+
+#: ../src/ui/interface.c:125
+msgid "maemopad_no"
+msgstr "No"
+
+#: ../src/ui/interface.c:143
+msgid "maemopad_invalid_uri"
+msgstr "Invalid URI!"
+
+#: ../src/ui/interface.c:147
+msgid "maemopad_save_failed"
+msgstr "Save failed!"
+
+#: ../src/ui/interface.c:151
+msgid "maemopad_open_failed"
+msgstr "Open failed!"
+
+#: ../src/ui/interface.c:190
+msgid "File"
+msgstr "File"
+
+#: ../src/ui/interface.c:191
+msgid "New"
+msgstr "New"
+
+#: ../src/ui/interface.c:192
+msgid "Open"
+msgstr "Open"
+
+#: ../src/ui/interface.c:193
+msgid "Save"
+msgstr "Save"
+
+#: ../src/ui/interface.c:194
+msgid "Save As..."
+msgstr "Save As..."
+
+#: ../src/ui/interface.c:195
+msgid "Edit"
+msgstr "Edit"
+
+#: ../src/ui/interface.c:196
+msgid "Cut"
+msgstr "Cut"
+
+#: ../src/ui/interface.c:197
+msgid "Copy"
+msgstr "Copy"
+
+#: ../src/ui/interface.c:198
+msgid "Paste"
+msgstr "Paste"
+
+#: ../src/ui/interface.c:199
+msgid "Font"
+msgstr "Font"
+
+#: ../src/ui/interface.c:200
+msgid "Full Screen"
+msgstr "Full Screen"
+
+#: ../src/ui/interface.c:202
+msgid "Close"
+msgstr "Close"
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/po/en_GB.po
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+# This file is part of maemopad
+#
+# Copyright (C) 2005 Nokia Corporation.
+#
+# This software is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+
+bin_PROGRAMS = maemopad
+
+maemopad_LDADD = $(HILDON_LIBS) $(OSSO_LIBS)
+
+maemopad_CFLAGS= $(HILDON_CFLAGS) $(OSSO_CFLAGS)
+
+maemopad_SOURCES = \
+ main.c \
+ appdata.h \
+ ui/interface.h \
+ ui/interface.c \
+ ui/callbacks.h \
+ ui/callbacks.c
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/appdata.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/appdata.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/appdata.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,38 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef MAEMOPAD_APPDATA_H
+#define MAEMOPAD_APPDATA_H
+
+#include <libosso.h>
+
+typedef struct _AppData AppData;
+
+struct _AppData
+{
+ HildonProgram *program; /* handle to application */
+ HildonWindow *window; /* handle to app's window */
+ osso_context_t *osso; /* handle to osso */
+};
+
+#endif
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/appdata.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/main.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/main.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/main.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,104 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <ui/interface.h>
+#include <appdata.h>
+
+#include <gtk/gtkmain.h>
+
+#include <hildon/hildon-program.h>
+
+#include <libintl.h>
+#include <locale.h>
+#include <libosso.h>
+
+#define _(String) gettext(String)
+
+#include <config.h>
+
+/*
+ * create our application specific data
+ * This consists of allocating some space
+ * for the AppData structure, and also
+ * creating the list store that will act
+ * as a model for the contact list.
+ * The other elements of the AppData structure
+ * are implicitly set by the call to g_new0
+ * which zeroes the memory of the AppData, thereby
+ * setting create_new to FALSE, and iter to NULL.
+ *
+ */
+
+static AppData *create_data ()
+{
+ AppData *result = g_new0( AppData, 1 );
+
+ result->osso = osso_initialize ( PACKAGE, VERSION, TRUE, NULL );
+ g_assert ( result->osso );
+ return result;
+}
+
+/* Here we clean up all the data that we allocated */
+static void destroy_data ( AppData *data )
+{
+ g_free ( data );
+}
+
+int main( int argc, char* argv[] )
+{
+ AppData* data;
+ HildonProgram* program;
+ MainView* main_view;
+
+ /* Initialise the locale stuff */
+ setlocale ( LC_ALL, "" );
+ bindtextdomain ( GETTEXT_PACKAGE, LOCALEDIR );
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+ textdomain ( GETTEXT_PACKAGE );
+
+ /* Init the gtk - must be called before any hildon stuff */
+ gtk_init( &argc, &argv );
+
+ /* Create the hildon application and setup the title */
+ program = HILDON_PROGRAM ( hildon_program_get_instance () );
+ g_set_application_name ( _("MaemoPad") );
+
+ /* Create the data and views for our application */
+ data = create_data ();
+ data->program = program;
+ main_view = interface_main_view_new ( data );
+ hildon_program_add_window( data->program, data->window );
+
+ gtk_signal_connect( G_OBJECT(data->window), "delete_event", gtk_main_quit, NULL );
+
+ /* Begin the main app */
+ gtk_widget_show ( GTK_WIDGET ( program ) );
+ gtk_main();
+
+ /* Clean up */
+ interface_main_view_destroy ( main_view );
+ destroy_data ( data );
+
+ return 0;
+}
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/main.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/callbacks.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/callbacks.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/callbacks.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,303 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <ui/callbacks.h>
+#include <ui/interface.h>
+#include <gtk/gtk.h>
+#include <libintl.h>
+/* strlen needed from string.h */
+#include <string.h>
+/* Gnome VFS for file i/o */
+#include <libgnomevfs/gnome-vfs.h>
+
+/* Privates: */
+void read_file_to_buffer ( MainView* mainview );
+void write_buffer_to_file ( MainView* mainview );
+
+/* cut */
+void callback_edit_cut( GtkAction * action, gpointer data )
+{
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* do cut */
+ gtk_text_buffer_cut_clipboard(GTK_TEXT_BUFFER(mainview->buffer), mainview->clipboard, TRUE);
+}
+
+/* copy */
+void callback_edit_copy( GtkAction * action, gpointer data )
+{
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* do copy */
+ gtk_text_buffer_copy_clipboard (GTK_TEXT_BUFFER(mainview->buffer), mainview->clipboard);
+}
+
+/* paste */
+void callback_edit_paste( GtkAction * action, gpointer data )
+{
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* do paste */
+ gtk_text_buffer_paste_clipboard (GTK_TEXT_BUFFER (mainview->buffer), mainview->clipboard, NULL, TRUE);
+}
+
+/* new */
+void callback_file_new(GtkAction * action, gpointer data)
+{
+ gint answer;
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* save changes note if file is edited */
+ if( mainview->file_edited ) {
+ answer = interface_save_changes_note( mainview );
+ if( answer == CONFRESP_YES ) {
+ if( mainview->file_name == NULL ) {
+ mainview->file_name = interface_file_chooser ( mainview, GTK_FILE_CHOOSER_ACTION_SAVE );
+ }
+ write_buffer_to_file ( mainview );
+ }
+ }
+ /* clear buffer, filename and free buffer text */
+ gtk_text_buffer_set_text ( GTK_TEXT_BUFFER (mainview->buffer), "", -1 );
+ mainview->file_name = NULL;
+ mainview->file_edited = FALSE;
+}
+
+/* open */
+void callback_file_open(GtkAction * action, gpointer data)
+{
+ gint answer;
+ gchar* filename = NULL;
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* save changes note if file is edited */
+ if( mainview->file_edited ) {
+ answer = interface_save_changes_note( mainview );
+ if( answer == CONFRESP_YES ) {
+ /* check is we had a new file */
+ if( mainview->file_name == NULL ) {
+ mainview->file_name = interface_file_chooser ( mainview, GTK_FILE_CHOOSER_ACTION_SAVE );
+ }
+ write_buffer_to_file ( mainview );
+ }
+ }
+
+ /* open new file */
+ filename = interface_file_chooser ( mainview, GTK_FILE_CHOOSER_ACTION_OPEN );
+
+ /* if we got a file name from chooser -> open file */
+ if( filename != NULL ) {
+ mainview->file_name = filename;
+ read_file_to_buffer ( mainview );
+ mainview->file_edited = FALSE;
+ }
+}
+
+/* save */
+void callback_file_save(GtkAction * action, gpointer data)
+{
+ gchar* filename = NULL;
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* check is we had a new file */
+ if( mainview->file_name != NULL ) {
+ write_buffer_to_file ( mainview );
+ } else {
+ filename = interface_file_chooser ( mainview, GTK_FILE_CHOOSER_ACTION_SAVE );
+ /* if we got a file name from chooser -> save file */
+ if( filename != NULL ) {
+ mainview->file_name = filename;
+ write_buffer_to_file ( mainview );
+ mainview->file_edited = FALSE;
+ }
+ }
+}
+
+/* save as... */
+void callback_file_saveas(GtkAction * action, gpointer data)
+{
+ gchar* filename = NULL;
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ filename = interface_file_chooser ( mainview, GTK_FILE_CHOOSER_ACTION_SAVE );
+
+ /* if we got a file name from chooser -> save file */
+ if( filename != NULL ) {
+ mainview->file_name = filename;
+ write_buffer_to_file ( mainview );
+ mainview->file_edited = FALSE;
+ }
+}
+
+/* font */
+void callback_font( GtkAction * action, gpointer data )
+{
+ PangoFontDescription* new_font = NULL;
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ new_font = interface_font_chooser( mainview );
+
+ /* if we got a new font from chooser -> change font */
+ if( new_font != NULL ) {
+ mainview->font_desc = new_font;
+ gtk_widget_modify_font ( mainview->textview, mainview->font_desc );
+ }
+}
+
+/* fullscreen */
+void callback_fullscreen( GtkAction * action, gpointer data )
+{
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* toggle fullscreen on<->off */
+ mainview->fullscreen = !mainview->fullscreen;
+
+ if (mainview->fullscreen) {
+ gtk_window_fullscreen(GTK_WINDOW(mainview->data->window));
+ } else {
+ gtk_window_unfullscreen(GTK_WINDOW(mainview->data->window));
+ }
+}
+
+/* help */
+void callback_help( GtkAction * action, gpointer data )
+{
+ osso_return_t retval;
+
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ retval = hildon_help_show(
+ mainview->data->osso, /* osso_context */
+ HELP_TOPIC_ID, /* topic id */
+ HILDON_HELP_SHOW_DIALOG);
+}
+
+/* buffer edited */
+void callback_buffer_modified ( GtkAction * action, gpointer data )
+{
+ /* connect pointer to our MainView struct */
+ MainView *mainview = NULL;
+ mainview = ( MainView * ) data;
+ g_assert(mainview != NULL && mainview->data != NULL );
+
+ /* change state */
+ mainview->file_edited = TRUE;
+}
+
+/* Privates */
+
+/* read file */
+void read_file_to_buffer ( MainView* mainview )
+{
+ GnomeVFSResult vfs_result;
+ GnomeVFSHandle *handle = NULL;
+ GnomeVFSFileSize in_bytes;
+ GnomeVFSFileInfo finfo;
+ gchar *temp_buffer = NULL;
+ g_assert( mainview != NULL );
+
+ /* try to get file info */
+ vfs_result = gnome_vfs_get_file_info(mainview->file_name, &finfo, GNOME_VFS_FILE_INFO_DEFAULT);
+ if ( vfs_result != GNOME_VFS_OK ) {
+ interface_error( MAEMOPAD_ERROR_OPEN_FAILED, mainview );
+ return;
+ }
+ /* try to create handle to file */
+ vfs_result = gnome_vfs_open(&handle, mainview->file_name, GNOME_VFS_OPEN_READ);
+ if ( vfs_result != GNOME_VFS_OK ) {
+ interface_error( MAEMOPAD_ERROR_OPEN_FAILED, mainview );
+ return;
+ }
+
+ /* allocate memory for temp_buffer */
+ temp_buffer = g_malloc(finfo.size + 1);
+ memset(temp_buffer, 0, finfo.size + 1);
+
+ /* read from file to buffer */
+ gnome_vfs_read(handle, temp_buffer, finfo.size, &in_bytes);
+
+ /* set text to screen */
+ gtk_text_buffer_set_text( GTK_TEXT_BUFFER (mainview->buffer), temp_buffer, -1);
+
+ /* free temp, close file and return */
+ g_free(temp_buffer);
+ gnome_vfs_close(handle);
+}
+
+
+
+/* write to file */
+void write_buffer_to_file ( MainView* mainview )
+{
+ GnomeVFSResult vfs_result;
+ GnomeVFSHandle *handle = NULL;
+ GnomeVFSFileSize out_bytes;
+ gchar *temp_buffer = NULL;
+ GtkTextIter start, end;
+ g_assert( mainview != NULL );
+
+ /* try to create handle to file */
+ vfs_result = gnome_vfs_create(&handle, mainview->file_name, GNOME_VFS_OPEN_WRITE, 0, 0600);
+ if ( vfs_result != GNOME_VFS_OK ) {
+ interface_error( MAEMOPAD_ERROR_SAVE_FAILED, mainview );
+ return;
+ }
+
+ /* find start and end of text */
+ gtk_text_buffer_get_bounds( GTK_TEXT_BUFFER (mainview->buffer), &start, &end);
+
+ /* copy all text from screen to temp_buffer */
+ temp_buffer = gtk_text_buffer_get_slice( GTK_TEXT_BUFFER (mainview->buffer), &start, &end, TRUE);
+
+ /* write text to file */
+ gnome_vfs_write(handle, temp_buffer, strlen(temp_buffer), &out_bytes);
+
+ /* free temp, close file and return */
+ g_free(temp_buffer);
+ gnome_vfs_close(handle);
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/callbacks.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/callbacks.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/callbacks.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/callbacks.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,53 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef CALLBACKS_H
+#define CALLBACKS_H
+
+#include <ui/interface.h>
+#include <gtk/gtk.h>
+#include <appdata.h>
+#include <hildon/hildon-help.h>
+
+#define HELP_TOPIC_ID "Example_MaemoPad_Content"
+
+/* edit-> cut/copy/paste */
+void callback_edit_cut ( GtkAction * action, gpointer data );
+void callback_edit_copy ( GtkAction * action, gpointer data );
+void callback_edit_paste ( GtkAction * action, gpointer data );
+/* file-> new/open/save */
+void callback_file_new ( GtkAction * action, gpointer data );
+void callback_file_open ( GtkAction * action, gpointer data );
+void callback_file_save ( GtkAction * action, gpointer data );
+void callback_file_saveas ( GtkAction * action, gpointer data );
+/* font */
+void callback_font ( GtkAction * action, gpointer data );
+/* fullscreen */
+void callback_fullscreen ( GtkAction * action, gpointer data );
+/* help */
+void callback_help ( GtkAction * action, gpointer data );
+
+/* buffer modified */
+void callback_buffer_modified ( GtkAction * action, gpointer data );
+
+#endif
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/callbacks.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/interface.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/interface.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/interface.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,376 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <ui/interface.h>
+#include <ui/callbacks.h>
+#include <gtk/gtk.h>
+#include <libintl.h>
+
+#include <hildon/hildon-file-chooser-dialog.h>
+#include <hildon/hildon-note.h>
+#include <hildon/hildon-font-selection-dialog.h>
+
+
+/* Privates: */
+
+static void create_menu( MainView *main );
+static void create_toolbar( MainView *main );
+void create_textarea( MainView *main );
+
+/* Creates and initialises a main_view */
+MainView* interface_main_view_new( AppData *data )
+{
+ /* Zero memory with g_new0 */
+ MainView* result = g_new0( MainView, 1 );
+ /* Create GTK vbox which will be our text area */
+ GtkWidget *main_vbox = gtk_vbox_new( FALSE, 0 );
+ result->clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_set_can_store(result->clipboard, NULL, 0);
+
+ /* Initialize interface data */
+ result->file_edited = FALSE;
+ /* Store handle to app's data to view's data */
+ result->data = data;
+ /* Store handle to hildon_window to app's data */
+ result->data->window = HILDON_WINDOW(hildon_window_new());
+ /* Create all our necessary parts */
+ create_textarea( result );
+ create_toolbar( result );
+ create_menu( result );
+ /* Put GTK vbox to app's view */
+ gtk_container_add( GTK_CONTAINER( result->data->window ), main_vbox );
+ /* Put scrolledwindow to GTK vbox and show it */
+ gtk_box_pack_start( GTK_BOX( main_vbox ), result->scrolledwindow, TRUE, TRUE, 0 );
+ gtk_widget_show( main_vbox );
+ /* Focus on textarea */
+ gtk_widget_grab_focus( GTK_WIDGET(result->textview ));
+ /* Initialize our textview's file (no file opened yet) */
+ result->file_edited=FALSE;
+ result->file_name=NULL;
+ /* Return with new mainview handle */
+ return result;
+}
+
+/* clean up the allocated memory */
+void interface_main_view_destroy( MainView *main )
+{
+ g_free( main );
+}
+
+/* File chooser */
+gchar* interface_file_chooser(MainView * mainview, GtkFileChooserAction action)
+{
+ GtkWidget *dialog;
+ gchar* filename = NULL;
+
+ dialog = hildon_file_chooser_dialog_new( GTK_WINDOW(mainview->data->program), action);
+ gtk_widget_show_all (GTK_WIDGET(dialog));
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
+ {
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+ }
+ gtk_widget_destroy (dialog);
+ return filename;
+}
+
+/* Font chooser */
+PangoFontDescription* interface_font_chooser( MainView * main )
+{
+ HildonFontSelectionDialog *dialog = NULL;
+
+ PangoFontDescription *font = NULL;
+ gint size;
+ gboolean bold, italic;
+ gchar *family = NULL;
+
+ font = pango_font_description_new();
+
+ /* create dialog */
+ dialog = HILDON_FONT_SELECTION_DIALOG ( hildon_font_selection_dialog_new( NULL, NULL ) );
+
+ gtk_widget_show_all (GTK_WIDGET(dialog));
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
+ {
+ g_object_get(G_OBJECT(dialog),
+ "family", &family,
+ "size", &size,
+ "bold", &bold,
+ "italic", &italic,
+ NULL);
+ pango_font_description_set_family(font, family);
+ pango_font_description_set_size(font, size * PANGO_SCALE);
+ if (bold) {
+ pango_font_description_set_weight(font, PANGO_WEIGHT_BOLD);
+ } else {
+ pango_font_description_set_weight(font, PANGO_WEIGHT_NORMAL);
+ }
+ if (italic) {
+ pango_font_description_set_style(font, PANGO_STYLE_ITALIC);
+ } else {
+ pango_font_description_set_style(font, PANGO_STYLE_NORMAL);
+ }
+ }
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+
+ return font;
+}
+
+/* Save changes note */
+gint interface_save_changes_note(MainView * main)
+{
+ HildonNote *hn = NULL;
+ gint response = FALSE;
+
+ g_assert(main != NULL && main->data->program != NULL);
+
+ hn = HILDON_NOTE(hildon_note_new_confirmation_add_buttons
+ (GTK_WINDOW(main->data->program),
+ _("maemopad_save_changes_made"),
+ _("maemopad_yes"), CONFRESP_YES,
+ _("maemopad_no"), CONFRESP_NO,
+ NULL, NULL));
+ response = gtk_dialog_run(GTK_DIALOG(hn));
+ gtk_widget_destroy(GTK_WIDGET(hn));
+ return response;
+}
+
+/* Error note */
+void interface_error( MaemopadError me, MainView *main )
+{
+ GtkWidget *dialog = NULL;
+ gchar *msg = NULL;
+
+ switch (me) {
+
+ case MAEMOPAD_ERROR_INVALID_URI:
+ msg = g_strdup( _("maemopad_invalid_uri") );
+ break;
+
+ case MAEMOPAD_ERROR_SAVE_FAILED:
+ msg = g_strdup( _("maemopad_save_failed") );
+ break;
+
+ case MAEMOPAD_ERROR_OPEN_FAILED:
+ msg = g_strdup( _("maemopad_open_failed") );
+ break;
+
+ case MAEMOPAD_NO_ERROR:
+ return;
+
+ default:
+ g_assert_not_reached();
+ }
+
+ dialog = hildon_note_new_information( GTK_WINDOW( main->data->program ), msg );
+
+ gtk_dialog_run( GTK_DIALOG( dialog ) );
+ gtk_widget_destroy( dialog );
+ g_free( msg );
+}
+
+/* Privates */
+
+/* Create the menu items needed for the drop down menu */
+static void create_menu( MainView *main )
+{
+ /* Create needed handles */
+ GtkMenu *main_menu;
+ GtkWidget *file_menu, *edit_menu;
+ GtkWidget *separator = NULL;
+ GtkWidget *help = NULL, *close = NULL;
+
+ /* Create main menu and new menus for submenus in our drop down menu */
+ main_menu = GTK_MENU( gtk_menu_new () );
+ file_menu = gtk_menu_new ();
+ edit_menu = gtk_menu_new ();
+
+ /* Create the menu items */
+ main->file_item = gtk_menu_item_new_with_label ( _("File") );
+ main->new_item = gtk_menu_item_new_with_label ( _("New") );
+ main->open_item = gtk_menu_item_new_with_label ( _("Open") );
+ main->save_item = gtk_menu_item_new_with_label ( _("Save") );
+ main->saveas_item = gtk_menu_item_new_with_label ( _("Save As...") );
+ main->edit_item = gtk_menu_item_new_with_label ( _("Edit") );
+ main->cut_item = gtk_menu_item_new_with_label ( _("Cut") );
+ main->copy_item = gtk_menu_item_new_with_label ( _("Copy") );
+ main->paste_item = gtk_menu_item_new_with_label ( _("Paste") );
+ main->font_item = gtk_menu_item_new_with_label ( _("Font") );
+ main->fullscreen_item = gtk_menu_item_new_with_label ( _("Full Screen") );
+ separator = gtk_separator_menu_item_new();
+ help = gtk_menu_item_new_with_label( _("Help") );
+ close = gtk_menu_item_new_with_label( _("Close") );
+
+ /* Add menu items to right menus */
+ gtk_menu_append( main_menu, main->file_item );
+ gtk_menu_append( file_menu, main->new_item );
+ gtk_menu_append( file_menu, main->open_item );
+ gtk_menu_append( file_menu, main->save_item );
+ gtk_menu_append( file_menu, main->saveas_item );
+ gtk_menu_append( main_menu, main->edit_item );
+ gtk_menu_append( edit_menu, main->cut_item );
+ gtk_menu_append( edit_menu, main->copy_item );
+ gtk_menu_append( edit_menu, main->paste_item );
+ gtk_menu_append( main_menu, main->font_item );
+ gtk_menu_append( main_menu, main->fullscreen_item );
+ gtk_menu_append( main_menu, separator );
+ gtk_menu_append( main_menu, help );
+ gtk_menu_append( main_menu, close );
+
+ /* Add submenus to the right items */
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM (main->file_item), file_menu );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM (main->edit_item), edit_menu );
+
+ /* Attach the callback functions to the activate signal */
+ g_signal_connect( G_OBJECT( main->new_item ), "activate",
+ G_CALLBACK ( callback_file_new), main );
+ g_signal_connect( G_OBJECT( main->open_item ), "activate",
+ G_CALLBACK ( callback_file_open), main );
+ g_signal_connect( G_OBJECT( main->save_item ), "activate",
+ G_CALLBACK ( callback_file_save), main );
+ g_signal_connect( G_OBJECT( main->saveas_item ), "activate",
+ G_CALLBACK ( callback_file_saveas), main );
+ g_signal_connect( G_OBJECT( main->cut_item ), "activate",
+ G_CALLBACK ( callback_edit_cut), main );
+ g_signal_connect( G_OBJECT( main->copy_item ), "activate",
+ G_CALLBACK( callback_edit_copy ), main );
+ g_signal_connect( G_OBJECT( main->paste_item ), "activate",
+ G_CALLBACK( callback_edit_paste ), main );
+ g_signal_connect( G_OBJECT( main->font_item ), "activate",
+ G_CALLBACK ( callback_font ), main );
+ g_signal_connect( G_OBJECT( main->fullscreen_item ), "activate",
+ G_CALLBACK ( callback_fullscreen ), main );
+ g_signal_connect( G_OBJECT( help ), "activate",
+ G_CALLBACK ( callback_help ), main );
+ g_signal_connect( G_OBJECT( close ), "activate", gtk_main_quit, NULL );
+
+ /* Add menu to HildonWindow */
+ hildon_window_set_menu(main->data->window, main_menu);
+
+ /* We need to show menu items */
+ gtk_widget_show_all( GTK_WIDGET( main_menu ) );
+}
+
+
+/* Create toolbar to mainview */
+static void create_toolbar ( MainView *main )
+{
+ /* Create new GTK toolbar */
+ main->toolbar = gtk_toolbar_new ();
+
+ /* Set toolbar properties */
+ gtk_toolbar_set_orientation( GTK_TOOLBAR(main->toolbar), GTK_ORIENTATION_HORIZONTAL);
+ gtk_toolbar_set_style( GTK_TOOLBAR(main->toolbar), GTK_TOOLBAR_BOTH_HORIZ);
+
+ /* Make menus and buttons to toolbar: */
+ /* Create toolitems using defined items from stock */
+ main->new_tb = gtk_tool_button_new_from_stock(GTK_STOCK_NEW);
+ main->open_tb = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN);
+ main->save_tb = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE);
+ main->saveas_tb = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE_AS);
+ main->separator_tb1 = gtk_separator_tool_item_new();
+ main->cut_tb = gtk_tool_button_new_from_stock(GTK_STOCK_CUT);
+ main->copy_tb = gtk_tool_button_new_from_stock(GTK_STOCK_COPY);
+ main->paste_tb = gtk_tool_button_new_from_stock(GTK_STOCK_PASTE);
+ main->separator_tb2 = gtk_separator_tool_item_new();
+ main->font_tb = gtk_tool_button_new_from_stock( GTK_STOCK_SELECT_FONT );
+ main->fullscreen_tb = gtk_tool_button_new_from_stock( GTK_STOCK_ZOOM_FIT );
+
+ /* Insert items to toolbar */
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->new_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->open_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->save_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->saveas_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->separator_tb1, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->cut_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->copy_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->paste_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->separator_tb2, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->font_tb, -1);
+ gtk_toolbar_insert ( GTK_TOOLBAR(main->toolbar), main->fullscreen_tb, -1);
+
+ /* Connect signals to buttons */
+ g_signal_connect(G_OBJECT(main->new_tb), "clicked",
+ G_CALLBACK(callback_file_new), main);
+ g_signal_connect(G_OBJECT(main->open_tb), "clicked",
+ G_CALLBACK(callback_file_open), main);
+ g_signal_connect(G_OBJECT(main->save_tb), "clicked",
+ G_CALLBACK(callback_file_save), main);
+ g_signal_connect(G_OBJECT(main->saveas_tb), "clicked",
+ G_CALLBACK(callback_file_saveas), main);
+ g_signal_connect(G_OBJECT(main->cut_tb), "clicked",
+ G_CALLBACK(callback_edit_cut), main);
+ g_signal_connect(G_OBJECT(main->copy_tb), "clicked",
+ G_CALLBACK(callback_edit_copy), main);
+ g_signal_connect(G_OBJECT(main->paste_tb), "clicked",
+ G_CALLBACK(callback_edit_paste), main);
+ g_signal_connect(G_OBJECT(main->font_tb), "clicked",
+ G_CALLBACK(callback_font), main);
+ g_signal_connect(G_OBJECT(main->fullscreen_tb), "clicked",
+ G_CALLBACK(callback_fullscreen), main);
+
+ /* Add toolbar to the HildonWindow */
+ hildon_window_add_toolbar(main->data->window, GTK_TOOLBAR(main->toolbar));
+
+ /* Show toolbar */
+ gtk_widget_show_all (GTK_WIDGET(main->toolbar));
+ gtk_widget_show_all (GTK_WIDGET(main->data->window) );
+}
+
+/* Create the text area */
+void create_textarea( MainView *main )
+{
+ /* Scrolled window */
+ main->scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_show(main->scrolledwindow);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(main->scrolledwindow),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ /* Text view */
+ main->textview = gtk_text_view_new ();
+
+ /* Some text view settings */
+ gtk_text_view_set_editable ( GTK_TEXT_VIEW (main->textview), TRUE );
+ gtk_text_view_set_left_margin (GTK_TEXT_VIEW (main->textview), 10 );
+ gtk_text_view_set_right_margin (GTK_TEXT_VIEW (main->textview), 10 );
+
+ /* Get handle */
+ main->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (main->textview));
+
+ /* Enable Rich Text Support */
+ gtk_text_buffer_set_can_paste_rich_text ( main->buffer, TRUE );
+ gtk_text_buffer_set_rich_text_format ( main->buffer, "RTF" );
+
+ /* Put textview under scrolledwindow and show it*/
+ gtk_container_add(GTK_CONTAINER(main->scrolledwindow), main->textview);
+ gtk_widget_show(main->textview);
+
+ /* Change default font throughout the widget */
+ main->font_desc = pango_font_description_from_string ("Monospace Regular 22");
+ gtk_widget_modify_font (main->textview, main->font_desc);
+
+ /* Connect signals */
+ g_signal_connect (G_OBJECT (main->buffer), "modified-changed",
+ G_CALLBACK(callback_buffer_modified), main);
+ g_signal_connect (G_OBJECT (main->buffer), "changed",
+ G_CALLBACK(callback_buffer_modified), main);
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/interface.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/interface.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/interface.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/interface.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,107 @@
+/*
+ * This file is part of maemopad
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef INTERFACE_H
+#define INTERFACE_H
+
+#include <gtk/gtk.h>
+#include <hildon/hildon-program.h>
+#include <appdata.h>
+
+#define _(String) gettext(String)
+
+/* confirmation responses */
+#define CONFRESP_YES 1
+#define CONFRESP_NO 2
+#define CONFRESP_OK 3
+#define CONFRESP_CANCEL 4
+#define CONFRESP_ERROR 5
+
+#define MAIN_VIEW_NAME "MainView"
+
+typedef enum {
+ MAEMOPAD_NO_ERROR = 0,
+ MAEMOPAD_ERROR_INVALID_URI,
+ MAEMOPAD_ERROR_SAVE_FAILED,
+ MAEMOPAD_ERROR_OPEN_FAILED
+} MaemopadError;
+
+/* Struct to include view's information */
+typedef struct _MainView MainView;
+struct _MainView
+{
+ /* Handle to app's data */
+ AppData *data;
+
+ /* Fullscreen mode is on (TRUE) or off (FALSE) */
+ gboolean fullscreen;
+
+ /* Items for menu */
+ GtkWidget *file_item;
+ GtkWidget *new_item;
+ GtkWidget *open_item;
+ GtkWidget *save_item;
+ GtkWidget *saveas_item;
+ GtkWidget *edit_item;
+ GtkWidget *cut_item;
+ GtkWidget *copy_item;
+ GtkWidget *paste_item;
+ GtkWidget *font_item;
+ GtkWidget *fullscreen_item;
+
+ /* Toolbar */
+ GtkWidget* toolbar;
+ GtkWidget* iconw;
+ GtkToolItem* new_tb;
+ GtkToolItem* open_tb;
+ GtkToolItem* save_tb;
+ GtkToolItem* saveas_tb;
+ GtkToolItem* separator_tb1;
+ GtkToolItem* cut_tb;
+ GtkToolItem* copy_tb;
+ GtkToolItem* paste_tb;
+ GtkToolItem* separator_tb2;
+ GtkToolItem* font_tb;
+ GtkToolItem* fullscreen_tb;
+
+ /* Textview related */
+ GtkWidget* scrolledwindow; /* textview is under this widget */
+ GtkWidget* textview; /* widget that shows the text */
+ GtkTextBuffer* buffer; /* buffer that contains the text */
+ GtkClipboard* clipboard; /* clipboard for copy/paste */
+
+ PangoFontDescription* font_desc; /* font used in textview */
+
+ gboolean file_edited; /* tells is our file on view edited */
+ gchar* file_name; /* directory/file under editing */
+};
+
+/* Publics: */
+MainView* interface_main_view_new( AppData* data );
+void interface_main_view_destroy( MainView* main );
+char* interface_file_chooser( MainView* main, GtkFileChooserAction action );
+PangoFontDescription* interface_font_chooser( MainView * main );
+gint interface_save_changes_note( MainView* main );
+void interface_error( MaemopadError me, MainView *main );
+
+#endif
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/src/ui/interface.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,31 @@
+#Template Default Values
+MaemoPad.Ctemplate.label=MaemoPad Project
+MaemoPad.Ctemplate.description=MaemoPad Project Tutorial from maemo.org.\n\n\
+NOTE: this application requires the 'doctools' devkit in your scratchbox target. \n\n\
+If you get the error:\n\n\
+\tconfigure: error: Your intltool is too old. You need intltool 0.23 or later.\n\n\
+when configuring, then for scratchbox 1, invoke a command like:\n\n\
+\tsb-conf setup CHINOOK_ARMEL --force --cputransp=/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2 \
+--compiler=cs2005q3.2-glibc2.5-arm --devkits=perl:debian-etch:maemo3-tools:cputransp:doctools\n\n\
+(or establish a similar configuration via sb-menu), then invoke "Build Application > Generate Configure" and rebuild.
+MaemoPad.basics.label=Basic Settings
+MaemoPad.basics.description=Basic properties of a project
+MaemoPad.author.label=Author
+MaemoPad.authorEmail.description=Name of the author
+MaemoPad.authorEmail.label=Author E-mail
+MaemoPad.authorEmail.description=E-mail of the author
+MaemoPad.copyright.label=Copyright notice
+MaemoPad.copyright.description=Your copyright notice
+MaemoPad.copyright.default=Your copyright notice
+MaemoPad.message.default=Hello World!!!
+MaemoPad.message.description=Your hello world greeting message
+MaemoPad.message.label=Hello world greeting
+MaemoPad.applicationName.label=Application Name
+MaemoPad.applicationName.description=Name of application
+MaemoPad.applicationName.default=MaemoPad
+MaemoPad.packageName.label=Package Name
+MaemoPad.packageName.description=Name of the package
+MaemoPad.packageName.default=maemopad
+MaemoPad.version.label=Version
+MaemoPad.version.description=Version of application
+MaemoPad.version.default=0.1
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
+ copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="MaemoPadProject" label="%MaemoPad.Ctemplate.label" description="%MaemoPad.Ctemplate.description"
+ help="help.html">
+ <property-group id="basics" label="%MaemoPad.basics.label" description="%MaemoPad.basics.description" type="PAGES-ONLY" help="help.html">
+
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="autogen.sh"/>
+ <simple name="target" value="autogen.sh"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="configure.ac"/>
+ <simple name="target" value="configure.ac"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="Makefile.am"/>
+ <simple name="target" value="Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/main.c"/>
+ <simple name="target" value="src/main.c"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/Makefile.am"/>
+ <simple name="target" value="src/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/appdata.h"/>
+ <simple name="target" value="src/appdata.h"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/ui/callbacks.c"/>
+ <simple name="target" value="src/ui/callbacks.c"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/ui/callbacks.h"/>
+ <simple name="target" value="src/ui/callbacks.h"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/ui/interface.c"/>
+ <simple name="target" value="src/ui/interface.c"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/ui/interface.h"/>
+ <simple name="target" value="src/ui/interface.h"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="po/en_GB.po"/>
+ <simple name="target" value="po/en_GB.po"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="po/POTFILES.in"/>
+ <simple name="target" value="po/POTFILES.in"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/control"/>
+ <simple name="target" value="debian/control"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/copyright"/>
+ <simple name="target" value="debian/copyright"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/maemopad.links"/>
+ <simple name="target" value="debian/maemopad.links"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/maemopad.install"/>
+ <simple name="target" value="debian/maemopad.install"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/rules"/>
+ <simple name="target" value="debian/rules"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/changelog"/>
+ <simple name="target" value="debian/changelog"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/com.nokia.maemopad.service"/>
+ <simple name="target" value="data/com.nokia.maemopad.service"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/Makefile.am"/>
+ <simple name="target" value="data/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/maemopad.desktop"/>
+ <simple name="target" value="data/maemopad.desktop"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/help/en_GB/MaemoPad.xml"/>
+ <simple name="target" value="data/help/en_GB/MaemoPad.xml"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/icons/scalable/maemopad.png"/>
+ <simple name="target" value="data/icons/scalable/maemopad.png"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/icons/26x26/maemopad.png"/>
+ <simple name="target" value="data/icons/26x26/maemopad.png"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="data/icons/40x40/maemopad.png"/>
+ <simple name="target" value="data/icons/40x40/maemopad.png"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildon-application-framework-debug" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildon-1" />
+ <element value="hildon-fm-2" />
+ <element value="hildon-help" />
+ <element value="libosso" />
+ <element value="gnome-vfs-2.0" />
+ <element value="gnome-vfs-module-2.0" />
+ </simple-array>
+ </process>
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoPad/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/AUTHORS
===================================================================
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/AUTHORS
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/ChangeLog
===================================================================
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/ChangeLog
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,24 @@
+## Process this file with automake to produce Makefile.in
+## Created by Anjuta
+
+SUBDIRS = src po
+
+$(projectName)docdir = ${prefix}/doc/$(projectName)
+$(projectName)doc_DATA = \
+ README\
+ COPYING\
+ AUTHORS\
+ ChangeLog\
+ INSTALL\
+ NEWS
+
+EXTRA_DIST = $($(projectName)doc_DATA)
+
+# Copy all the spec files. Of cource, only one is actually used.
+dist-hook:
+ for specfile in *.spec; do \
+ if test -f $$specfile; then \
+ cp -p $$specfile $(distdir); \
+ fi \
+ done
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/NEWS
===================================================================
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/NEWS
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/README
===================================================================
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/README
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/autogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/autogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,159 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+DIE=0
+
+if [ -n "$GNOME2_DIR" ]; then
+ ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS"
+ LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH"
+ PATH="$GNOME2_DIR/bin:$PATH"
+ export PATH
+ export LD_LIBRARY_PATH
+fi
+
+(test -f $srcdir/configure.ac) || {
+ echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+ echo " top-level package directory"
+ exit 1
+}
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`autoconf' installed."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+(grep "^IT_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && {
+ (intltoolize --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`intltool' installed."
+ echo "You can get it from:"
+ echo " ftp://ftp.gnome.org/pub/GNOME/"
+ DIE=1
+ }
+}
+
+(grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && {
+ (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`xml-i18n-toolize' installed."
+ echo "You can get it from:"
+ echo " ftp://ftp.gnome.org/pub/GNOME/"
+ DIE=1
+ }
+}
+
+(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
+ (libtool --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`libtool' installed."
+ echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+ }
+}
+
+(grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && {
+ (grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \
+ (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`glib' installed."
+ echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
+ DIE=1
+ }
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`automake' installed."
+ echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+ NO_AUTOMAKE=yes
+}
+
+
+# if no automake, don't bother testing for aclocal
+test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: Missing \`aclocal'. The version of \`automake'"
+ echo "installed doesn't appear recent enough."
+ echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+if test -z "$*"; then
+ echo "**Warning**: I am going to run \`configure' with no arguments."
+ echo "If you wish to pass any to it, please specify them on the"
+ echo \`$0\'" command line."
+ echo
+fi
+
+case $CC in
+xlc )
+ am_opt=--include-deps;;
+esac
+
+for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.ac -print`
+do
+ dr=`dirname $coin`
+ if test -f $dr/NO-AUTO-GEN; then
+ echo skipping $dr -- flagged as no auto-gen
+ else
+ echo processing $dr
+ ( cd $dr
+
+ aclocalinclude="$ACLOCAL_FLAGS"
+
+ if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
+ echo "Creating $dr/aclocal.m4 ..."
+ test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
+ echo "Running glib-gettextize... Ignore non-fatal messages."
+ echo "no" | glib-gettextize --force --copy
+ echo "Making $dr/aclocal.m4 writable ..."
+ test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
+ fi
+ if grep "^IT_PROG_INTLTOOL" configure.ac >/dev/null; then
+ echo "Running intltoolize..."
+ intltoolize --copy --force --automake
+ fi
+ if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then
+ echo "Running xml-i18n-toolize..."
+ xml-i18n-toolize --copy --force --automake
+ fi
+ if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
+ if test -z "$NO_LIBTOOLIZE" ; then
+ echo "Running libtoolize..."
+ libtoolize --force --copy
+ fi
+ fi
+ echo "Running aclocal $aclocalinclude ..."
+ aclocal $aclocalinclude
+ if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
+ echo "Running autoheader..."
+ autoheader
+ fi
+ echo "Running automake --gnu $am_opt ..."
+ automake --add-missing --copy --gnu $am_opt
+ echo "Running autoconf ..."
+ autoconf
+ )
+ fi
+done
+
+conf_flags="--enable-maintainer-mode"
+
+if test x$NOCONFIGURE = x; then
+ echo Running $srcdir/configure $conf_flags "$@" ...
+ $srcdir/configure $conf_flags "$@" \
+ && echo Now type \`make\' to compile. || exit 1
+else
+ echo Skipping configure process.
+fi
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/autogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/configure.ac
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/configure.ac (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,44 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl Created by Anjuta application wizard.
+
+AC_INIT($(projectName), 1.0)
+
+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AM_CONFIG_HEADER(config.h)
+AM_MAINTAINER_MODE
+
+AC_ISC_POSIX
+AC_PROG_CC
+AM_PROG_CC_STDC
+AC_HEADER_STDC
+
+
+
+
+dnl ***************************************************************************
+dnl Internatinalization
+dnl ***************************************************************************
+GETTEXT_PACKAGE=$(projectName)
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
+AM_GLIB_GNU_GETTEXT
+IT_PROG_INTLTOOL([0.35.0])
+
+
+
+AM_PROG_LIBTOOL
+
+
+
+PKG_CHECK_MODULES(MAEMO_PROJECT, [gtk+-2.0 dbus-1 gconf-2.0 gthread-2.0 hildon-1 hildon-help libosso cairo])
+AC_SUBST(MAEMO_PROJECT_CFLAGS)
+AC_SUBST(MAEMO_PROJECT_LIBS)
+
+
+
+
+AC_OUTPUT([
+Makefile
+src/Makefile
+po/Makefile.in
+])
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/configure.ac
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project.desktop
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project.desktop (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project.desktop 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=0.0.1
+Type=Application
+Name=maemo-project
+Exec=/usr/bin/maemo-sdk-tablet
+Icon=ggn_list_gene_default_app
+X-Osso-Service=com.nokia.maemo-project
+X-Osso-Type=application/x-executable
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project.desktop
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project.service
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project.service (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project.service 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=com.nokia.$(projectName)
+Exec=/usr/bin/maemo-sdk-tablet
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project.service
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project_help.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project_help.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project_help.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ossohelpsource>
+ <folder>
+ <title>Maemo SDK Tablet</title>
+ <topic>
+ <topictitle>Main Topic</topictitle>
+ <context contextUID="osso_$(projectName)_Content" />
+ <para>$(projectName) application is described here.</para>
+ </topic>
+ </folder>
+</ossohelpsource>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/data/maemo-project_help.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/changelog
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/changelog (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/changelog 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+$(projectName) (1.0) ossodp; urgency=low
+
+ * Initial version.
+
+ -- $(author) <$(email)> Thu, 24 Apr 2008 17:22:00 -0600
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/changelog
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/control
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/control (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/control 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+Source: $(projectName)
+Maintainer: $(name) <$(email)>
+Section: optional
+Priority: extra
+Standards-Version: 3.7.2
+Build-Depends: debhelper (>=5)
+
+Package: $(projectName)
+Architecture: armel
+Depends:
+Description: an application for maemo based Internet tablets
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/control
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/rules
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/rules (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/rules 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,75 @@
+#!/usr/bin/make -f
+
+
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+
+CFLAGS = -Wall -g
+PACKAGENAME = $(projectName)
+
+
+# Optimization level
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+ INSTALL_PROGRAM += -s
+endif
+
+config.status: configure
+ dh_testdir
+
+ CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+
+
+configure:
+ ./autogen.sh
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+
+ $(MAKE)
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ -$(MAKE) distclean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/debian/rules
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/maemogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/maemogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/maemogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# n.b., in ESbox, this runs inside scratchbox
+
+# Check if the rootstrap is older than bora
+if [[ "$1" == "" ]]
+ then ls /usr/lib/pkgconfig/ | grep videoproto > .has_videoproto
+ else -t $1 ls /usr/lib/pkgconfig/ | grep videoproto > .has_videoproto
+fi
+
+# Check if the rootstrap is older than chinook
+if [[ "$1" == "" ]]
+ then ls /usr/lib/pkgconfig/ | grep hildon-1 > .has_hildon_1
+ else -t $1 ls /usr/lib/pkgconfig/ | grep hildon-1 > .has_hildon_1
+fi
+
+
+# Test maemo version of the target rootstrap
+scirocco=0
+bora=0
+chinook=0
+rm -f src/maemo-version.h
+test -s .has_hildon_1 && hildon1=1 && rm -f .has_hildon_1
+test -e .has_hildon_1 && hildon1=0 && rm -f .has_hildon_1
+test -s .has_videoproto && videoproto=1 && rm -f .has_videoproto
+test -e .has_videoproto && videoproto=0 && rm -f .has_videoproto
+if [[ $hildon1 == 1 ]]
+ then chinook=1
+ else if [[ $videoproto == 1 ]]
+ then bora=1
+ else scirocco=1
+ fi
+fi
+
+
+# Write the src/maemo-version.h
+echo '#ifndef _MAEMO_VERSION_H' >> src/maemo-version.h
+echo '#define _MAEMO_VERSION_H' >> src/maemo-version.h
+echo '' >> src/maemo-version.h
+echo "#define HAVE_MAEMO_SCIROCCO $scirocco" >> src/maemo-version.h
+echo "#define HAVE_MAEMO_BORA $bora" >> src/maemo-version.h
+echo "#define HAVE_MAEMO_CHINOOK $chinook" >> src/maemo-version.h
+echo '' >> src/maemo-version.h
+echo '#endif /* _MAEMO_VERSION_H */' >> src/maemo-version.h
+
+
+# Write the configure.ac changes according to the rootstrap version
+if [[ $bora == 1 || $scirocco == 1 ]]
+ then mv configure.ac configure.ac~ && cat configure.ac~ | sed -r "s/hildon\-1 hildon\-help/hildon-libs libossohelp/" > configure.ac
+ else mv configure.ac configure.ac~ && cat configure.ac~ | sed -r "s/hildon\-libs libossohelp/hildon-1 hildon-help/" > configure.ac
+fi
+
+
+# Run autogen.sh
+./autogen.sh
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/maemogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/ChangeLog
===================================================================
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/ChangeLog
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/Makefile.in.in
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/Makefile.in.in (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/Makefile.in.in 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,218 @@
+# Makefile for program source directory in GNU NLS utilities package.
+# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper at gnu.ai.mit.edu>
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+#
+# - Modified by Owen Taylor <otaylor at redhat.com> to use GETTEXT_PACKAGE
+# instead of PACKAGE and to look for po2tbl in ./ not in intl/
+#
+# - Modified by jacob berkman <jacob at ximian.com> to install
+# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
+#
+# - Modified by Rodney Dawes <dobey at novell.com> for use with intltool
+#
+# We have the following line for use by intltoolize:
+# INTLTOOL_MAKEFILE
+
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datadir = @datadir@
+datarootdir = @datarootdir@
+libdir = @libdir@
+DATADIRNAME = @DATADIRNAME@
+itlocaledir = $(prefix)/$(DATADIRNAME)/locale
+subdir = po
+install_sh = @install_sh@
+# Automake >= 1.8 provides @mkdir_p at .
+# Until it can be supposed, use the safe fallback:
+mkdir_p = $(install_sh) -d
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+
+GMSGFMT = @GMSGFMT@
+MSGFMT = @MSGFMT@
+XGETTEXT = @XGETTEXT@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
+GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
+
+ALL_LINGUAS = @ALL_LINGUAS@
+
+PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi)
+
+USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep ^$$lang$$ $(srcdir)/LINGUAS`" -o -n "`echo $$ALINGUAS|grep ' ?$$lang ?'`"; then printf "$$lang "; fi; done; fi)
+
+USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
+
+POFILES=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
+
+DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(POFILES)
+EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
+
+POTFILES = \
+# This comment gets stripped out
+
+CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
+
+.SUFFIXES:
+.SUFFIXES: .po .pox .gmo .mo .msg .cat
+
+.po.pox:
+ $(MAKE) $(GETTEXT_PACKAGE).pot
+ $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
+
+.po.mo:
+ $(MSGFMT) -o $@ $<
+
+.po.gmo:
+ file=`echo $* | sed 's,.*/,,'`.gmo \
+ && rm -f $$file && $(GMSGFMT) -o $$file $<
+
+.po.cat:
+ sed -f ../intl/po2msg.sed < $< > $*.msg \
+ && rm -f $@ && gencat $@ $*.msg
+
+
+all: all- at USE_NLS@
+
+all-yes: $(CATALOGS)
+all-no:
+
+$(GETTEXT_PACKAGE).pot: $(POTFILES)
+ $(GENPOT)
+
+install: install-data
+install-data: install-data- at USE_NLS@
+install-data-no: all
+install-data-yes: all
+ $(mkdir_p) $(DESTDIR)$(itlocaledir)
+ linguas="$(USE_LINGUAS)"; \
+ for lang in $$linguas; do \
+ dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
+ $(mkdir_p) $$dir; \
+ if test -r $$lang.gmo; then \
+ $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
+ echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
+ else \
+ $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
+ echo "installing $(srcdir)/$$lang.gmo as" \
+ "$$dir/$(GETTEXT_PACKAGE).mo"; \
+ fi; \
+ if test -r $$lang.gmo.m; then \
+ $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
+ echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
+ else \
+ if test -r $(srcdir)/$$lang.gmo.m ; then \
+ $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
+ $$dir/$(GETTEXT_PACKAGE).mo.m; \
+ echo "installing $(srcdir)/$$lang.gmo.m as" \
+ "$$dir/$(GETTEXT_PACKAGE).mo.m"; \
+ else \
+ true; \
+ fi; \
+ fi; \
+ done
+
+# Empty stubs to satisfy archaic automake needs
+dvi info tags TAGS ID:
+
+# Define this as empty until I found a useful application.
+install-exec installcheck:
+
+uninstall:
+ linguas="$(USE_LINGUAS)"; \
+ for lang in $$linguas; do \
+ rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
+ rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
+ done
+
+check: all $(GETTEXT_PACKAGE).pot
+ rm -f missing notexist
+ srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
+ if [ -r missing -o -r notexist ]; then \
+ exit 1; \
+ fi
+
+mostlyclean:
+ rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
+ rm -f .intltool-merge-cache
+
+clean: mostlyclean
+
+distclean: clean
+ rm -f Makefile Makefile.in POTFILES stamp-it
+ rm -f *.mo *.msg *.cat *.cat.m *.gmo
+
+maintainer-clean: distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+ rm -f Makefile.in.in
+
+distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: $(DISTFILES)
+ dists="$(DISTFILES)"; \
+ extra_dists="$(EXTRA_DISTFILES)"; \
+ for file in $$extra_dists; do \
+ test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \
+ done; \
+ for file in $$dists; do \
+ test -f $$file || file="$(srcdir)/$$file"; \
+ ln $$file $(distdir) 2> /dev/null \
+ || cp -p $$file $(distdir); \
+ done
+
+update-po: Makefile
+ $(MAKE) $(GETTEXT_PACKAGE).pot
+ tmpdir=`pwd`; \
+ linguas="$(USE_LINGUAS)"; \
+ for lang in $$linguas; do \
+ echo "$$lang:"; \
+ result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
+ if $$result; then \
+ if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+ rm -f $$tmpdir/$$lang.new.po; \
+ else \
+ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+ :; \
+ else \
+ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+ rm -f $$tmpdir/$$lang.new.po; \
+ exit 1; \
+ fi; \
+ fi; \
+ else \
+ echo "msgmerge for $$lang.gmo failed!"; \
+ rm -f $$tmpdir/$$lang.new.po; \
+ fi; \
+ done
+
+Makefile POTFILES: stamp-it
+ @if test ! -f $@; then \
+ rm -f stamp-it; \
+ $(MAKE) stamp-it; \
+ fi
+
+stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \
+ $(SHELL) ./config.status
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/Makefile.in.in
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/POTFILES.in
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/POTFILES.in (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/POTFILES.in 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+# List of source files containing translatable strings.
+
+src/main.c
+src/callbacks.c
+src/callbacks.h
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/po/POTFILES.in
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,33 @@
+## Process this file with automake to produce Makefile.in
+
+## Created by Anjuta
+
+gladedir = $(datadir)/$(projectName)/glade
+glade_DATA = $(projectName).glade
+
+INCLUDES = \
+ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+ -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+ $(MAEMO_PROJECT_CFLAGS)
+
+AM_CFLAGS =\
+ -Wall\
+ -g
+
+bin_PROGRAMS = $(projectName)
+
+$(projectName)_SOURCES = \
+ callbacks.c \
+ callbacks.h \
+ maemo-program.c \
+ support.h \
+ support.c \
+ interface.h \
+ main.c
+
+$(projectName)_LDFLAGS =
+
+$(projectName)_LDADD = $(MAEMO_PROJECT_LIBS)
+
+EXTRA_DIST = $(glade_DATA)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/callbacks.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/callbacks.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/callbacks.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,318 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * MAEMO EXAMPLE APPLICATION
+ *
+ * callbacks.c
+ * Copyright (C) Ubuntu User 2008 <ubuntu@>
+ *
+ * callbacks.c is free software.
+ *
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * callbacks.c is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with callbacks.c. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "maemo.h"
+#include "callbacks.h"
+
+
+#define CONNECT_SIG(signal,cb) g_signal_connect((gpointer) program, signal, G_CALLBACK(cb),data)
+
+void
+bind_standard_callbacks(MaemoProgram *program, gpointer data)
+{
+ CONNECT_SIG( "file_new", cb_file_new );
+ CONNECT_SIG( "file_open", cb_file_open );
+ CONNECT_SIG( "file_save", cb_file_save );
+ CONNECT_SIG( "file_save_as", cb_file_save_as );
+ CONNECT_SIG( "edit_undo", cb_edit_undo );
+ CONNECT_SIG( "edit_redo", cb_edit_redo );
+ CONNECT_SIG( "edit_cut", cb_edit_cut );
+ CONNECT_SIG( "edit_copy", cb_edit_copy );
+ CONNECT_SIG( "edit_paste", cb_edit_paste );
+ CONNECT_SIG( "edit_select_all", cb_edit_select_all );
+ CONNECT_SIG( "view_full_screen", cb_view_full_screen );
+ CONNECT_SIG( "tools_settings", cb_tools_settings );
+ CONNECT_SIG( "play", cb_play );
+ CONNECT_SIG( "play_stop", cb_play_stop );
+ CONNECT_SIG( "play_next", cb_play_next );
+ CONNECT_SIG( "play_previous", cb_play_previous );
+ CONNECT_SIG( "close", cb_close );
+
+ CONNECT_SIG( "state_shutdown", cb_state_shutdown );
+ CONNECT_SIG( "state_memory_low", cb_state_memory_low );
+ CONNECT_SIG( "state_save_unsaved_data", cb_state_save_unsaved_data );
+ CONNECT_SIG( "state_system_inactivity", cb_state_system_inactivity );
+ CONNECT_SIG( "state_normal_mode", cb_state_normal_mode );
+ CONNECT_SIG( "state_flight_mode", cb_state_flight_mode );
+
+ CONNECT_SIG( "hw_key_up", cb_hw_key_up );
+ CONNECT_SIG( "hw_key_down", cb_hw_key_down );
+ CONNECT_SIG( "hw_key_left", cb_hw_key_left );
+ CONNECT_SIG( "hw_key_right", cb_hw_key_right );
+ CONNECT_SIG( "hw_key_select", cb_hw_key_select );
+ CONNECT_SIG( "hw_key_menu", cb_hw_key_menu );
+ CONNECT_SIG( "hw_key_home", cb_hw_key_home );
+ CONNECT_SIG( "hw_key_power", cb_hw_key_power );
+
+ CONNECT_SIG( "zoom_level_changed", cb_zoom_level_changed );
+}
+
+/*
+ * Callbacks for the menu and toolbar button related actions.
+ */
+void
+cb_file_new(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL, "New File" );
+}
+
+void
+cb_file_open(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL,
+ "File Open" );
+}
+
+void
+cb_file_save(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL,
+ "File Save" );
+}
+
+void
+cb_file_save_as(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL,
+ "File Save As" );
+}
+
+void
+cb_edit_undo(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL, "Undo" );
+}
+
+void
+cb_edit_redo(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL, "Redo" );
+}
+
+void
+cb_edit_cut(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL, "Cut" );
+}
+
+void
+cb_edit_copy(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL, "Copy" );
+}
+
+void
+cb_edit_paste(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL, "Paste" );
+}
+
+void
+cb_edit_select_all(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL,
+ "Select All" );
+}
+
+void
+cb_view_full_screen(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL,
+ "Full Screen" );
+}
+
+void
+cb_play(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL, "Play" );
+}
+
+void
+cb_play_stop(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL,
+ "Play Stop" );
+}
+
+void
+cb_play_previous(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL,
+ "Play Previous" );
+}
+
+void
+cb_play_next(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL,
+ "Play Next" );
+}
+
+void
+cb_mute(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL, "Mute" );
+}
+
+void
+cb_tools_settings(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL,
+ "Settings..." );
+}
+
+void
+cb_close(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Remove this callback or provide a full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL, "Closing" );
+}
+
+/*
+ * Callbacks for the hardware state changes.
+ */
+void
+cb_state_shutdown(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL,
+ "Going shutdown" );
+}
+
+void
+cb_state_memory_low(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+ hildon_banner_show_information( GTK_WIDGET( program->window ), NULL,
+ "Memory Low" );
+}
+
+void
+cb_state_save_unsaved_data(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+void
+cb_state_system_inactivity(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+void
+cb_state_normal_mode(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+void
+cb_state_flight_mode(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+/*
+ * Callbacks for the hardware keys.
+ */
+void
+cb_hw_key_up(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+void
+cb_hw_key_down(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+void
+cb_hw_key_left(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+void
+cb_hw_key_right(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+void
+cb_hw_key_select(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+void
+cb_hw_key_menu(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+void
+cb_hw_key_home(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+void
+cb_hw_key_power(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+}
+
+/*
+ * Callback for the zooming.
+ */
+void
+cb_zoom_level_changed(MaemoProgram *program, gpointer data)
+{
+ /* TODO: Provide the full implementation. */
+ gint zoom_level_percent = program->zoom_level;
+}
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/callbacks.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/callbacks.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/callbacks.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/callbacks.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,68 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * MAEMO EXAMPLE APPLICATION
+ *
+ * callbacks.h
+ * Copyright (C) Ubuntu User 2008 <ubuntu@>
+ *
+ * callbacks.h is free software.
+ *
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * callbacks.h is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with callbacks.h. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "maemo.h"
+
+
+void bind_standard_callbacks(MaemoProgram *program, gpointer data);
+
+void cb_file_new(MaemoProgram *program, gpointer data);
+void cb_file_open(MaemoProgram *program, gpointer data);
+void cb_file_save(MaemoProgram *program, gpointer data);
+void cb_file_save_as(MaemoProgram *program, gpointer data);
+void cb_edit_undo(MaemoProgram *program, gpointer data);
+void cb_edit_redo(MaemoProgram *program, gpointer data);
+void cb_edit_cut(MaemoProgram *program, gpointer data);
+void cb_edit_copy(MaemoProgram *program, gpointer data);
+void cb_edit_paste(MaemoProgram *program, gpointer data);
+void cb_edit_select_all(MaemoProgram *program, gpointer data);
+void cb_view_full_screen(MaemoProgram *program, gpointer data);
+void cb_play(MaemoProgram *program, gpointer data);
+void cb_play_stop(MaemoProgram *program, gpointer data);
+void cb_play_previous(MaemoProgram *program, gpointer data);
+void cb_play_next(MaemoProgram *program, gpointer data);
+void cb_mute(MaemoProgram *program, gpointer data);
+void cb_tools_settings(MaemoProgram *program, gpointer data);
+void cb_close(MaemoProgram *program, gpointer data);
+
+void cb_state_shutdown(MaemoProgram *program, gpointer data);
+void cb_state_memory_low(MaemoProgram *program, gpointer data);
+void cb_state_save_unsaved_data(MaemoProgram *program, gpointer data);
+void cb_state_system_inactivity(MaemoProgram *program, gpointer data);
+void cb_state_normal_mode(MaemoProgram *program, gpointer data);
+void cb_state_flight_mode(MaemoProgram *program, gpointer data);
+
+void cb_hw_key_up(MaemoProgram *program, gpointer data);
+void cb_hw_key_down(MaemoProgram *program, gpointer data);
+void cb_hw_key_left(MaemoProgram *program, gpointer data);
+void cb_hw_key_right(MaemoProgram *program, gpointer data);
+void cb_hw_key_select(MaemoProgram *program, gpointer data);
+void cb_hw_key_menu(MaemoProgram *program, gpointer data);
+void cb_hw_key_home(MaemoProgram *program, gpointer data);
+void cb_hw_key_power(MaemoProgram *program, gpointer data);
+
+void cb_zoom_level_changed(MaemoProgram *program, gpointer data);
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/callbacks.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/interface.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/interface.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/interface.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+/*
+ * DO NOT EDIT THIS FILE - it is generated by Glade.
+ */
+
+GtkWidget* create_window1 (GtkWidget*);
+GtkWidget* create_error_dialog (void);
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/interface.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4434 @@
+/* Generated by GOB (v2.0.14) (do not edit directly) */
+
+/* End world hunger, donate to the World Food Programme, http://www.wfp.org */
+
+
+#line 3 "maemo-program.gob"
+
+#define MAEMO_PROGRAM_VERSION "0.9.2"
+
+/*
+ * Copyright (c) 2007-2008 Nokia Corporation.
+ *
+ * Version: 0.9.2 (Dec 28th, 2007)
+ *
+ * Contact: Jukka-Pekka Iivonen (jukka-pekka.iivonen<at>nokia.com)
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "maemo-version.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <gtk/gtk.h>
+
+#if HAVE_MAEMO_SCIROCCO || HAVE_MAEMO_BORA
+ #include <hildon-widgets/hildon-program.h>
+ #include <hildon-widgets/hildon-window.h>
+ #include <hildon-widgets/hildon-banner.h>
+ #include <osso-helplib.h>
+ #include <gdk/gdkkeysyms.h>
+#else
+ #include <hildon/hildon-program.h>
+ #include <hildon/hildon-window.h>
+ #include <hildon/hildon-banner.h>
+ #include <hildon/hildon-help.h>
+#endif
+
+#include <libosso.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
+/* I18N etc. */
+#include "support.h"
+
+#include "maemo.h"
+
+
+#line 74 "maemo-program.c"
+#define GOB_VERSION_MAJOR 2
+#define GOB_VERSION_MINOR 0
+#define GOB_VERSION_PATCHLEVEL 14
+
+#define selfp (self->_priv)
+
+#include <string.h> /* memset() */
+
+#include "maemo-program.h"
+
+#ifdef G_LIKELY
+#define ___GOB_LIKELY(expr) G_LIKELY(expr)
+#define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
+#else /* ! G_LIKELY */
+#define ___GOB_LIKELY(expr) (expr)
+#define ___GOB_UNLIKELY(expr) (expr)
+#endif /* G_LIKELY */
+/* self casting macros */
+#define SELF(x) MAEMO_PROGRAM(x)
+#define SELF_CONST(x) MAEMO_PROGRAM_CONST(x)
+#define IS_SELF(x) MAEMO_IS_PROGRAM(x)
+#define TYPE_SELF MAEMO_TYPE_PROGRAM
+#define SELF_CLASS(x) MAEMO_PROGRAM_CLASS(x)
+
+#define SELF_GET_CLASS(x) MAEMO_PROGRAM_GET_CLASS(x)
+
+/* self typedefs */
+typedef MaemoProgram Self;
+typedef MaemoProgramClass SelfClass;
+
+/* here are local prototypes */
+static void ___object_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
+static void ___object_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
+static void maemo_program_init (MaemoProgram * o) G_GNUC_UNUSED;
+static void maemo_program_class_init (MaemoProgramClass * c) G_GNUC_UNUSED;
+static void ___real_maemo_program_edit_cut (MaemoProgram * self, gpointer data);
+static void ___real_maemo_program_edit_copy (MaemoProgram * self, gpointer data);
+static void ___real_maemo_program_edit_paste (MaemoProgram * self, gpointer data);
+static void ___real_maemo_program_view_full_screen (MaemoProgram * self, gpointer data);
+static void ___real_maemo_program_close (MaemoProgram * self, gpointer data);
+static void ___real_maemo_program_zoom_level_changed (MaemoProgram * self, gpointer data);
+static void ___real_maemo_program_max_zoom_level_reached (MaemoProgram * self, gpointer data);
+static void ___real_maemo_program_min_zoom_level_reached (MaemoProgram * self, gpointer data);
+static void ___real_maemo_program_hw_key_zoom_in (MaemoProgram * self, gpointer data);
+static void ___real_maemo_program_hw_key_zoom_out (MaemoProgram * self, gpointer data);
+static void ___real_maemo_program_hw_key_full_screen (MaemoProgram * self, gpointer data);
+static void ___real_maemo_program_hw_key_close (MaemoProgram * self, gpointer data);
+static gboolean maemo_program_hw_key_press_cb (GtkWidget * widget, GdkEventKey * event, MaemoProgram * o) G_GNUC_UNUSED;
+static void maemo_program_hw_event_handler (osso_hw_state_t * state, MaemoProgram * program) G_GNUC_UNUSED;
+static void maemo_program_cb_file_new (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_file_open (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_file_save (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_file_save_as (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_edit_undo (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_edit_redo (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_edit_cut (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_edit_copy (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_edit_paste (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_edit_select_all (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_view_full_screen (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_tools_settings (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_about (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_play_play (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_play_stop (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_play_previous (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_play_next (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_play_mute (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_close (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_cb_help (GtkAction * action, MaemoProgram * self) G_GNUC_UNUSED;
+static void maemo_program_initialize (MaemoProgram * self, gchar * service_name, int argc, char * argv[]) G_GNUC_UNUSED;
+static void maemo_program_set_window (MaemoProgram * self, HildonWindow * window, GtkMenu * menu) G_GNUC_UNUSED;
+static GtkWidget * maemo_program_add_toolbar_item (MaemoProgram * self, gchar * stock, gpointer cb) G_GNUC_UNUSED;
+static void maemo_program_create_toolbar (MaemoProgram * o, MaemoMenuStructure * menu_structure) G_GNUC_UNUSED;
+static GtkWidget * maemo_program_add_menu_item (MaemoProgram * self, GtkMenu * menu, gchar * label, gpointer cb) G_GNUC_UNUSED;
+static void maemo_program_create_menu (MaemoProgram * o, MaemoMenuStructure * menu_structure) G_GNUC_UNUSED;
+static void maemo_program_initialize_about_content (MaemoProgram * program) G_GNUC_UNUSED;
+
+/*
+ * Signal connection wrapper macro shortcuts
+ */
+#define self_connect__file_new(object,func,data) maemo_program_connect__file_new((object),(func),(data))
+#define self_connect_after__file_new(object,func,data) maemo_program_connect_after__file_new((object),(func),(data))
+#define self_connect_data__file_new(object,func,data,destroy_data,flags) maemo_program_connect_data__file_new((object),(func),(data),(destroy_data),(flags))
+#define self_connect__file_open(object,func,data) maemo_program_connect__file_open((object),(func),(data))
+#define self_connect_after__file_open(object,func,data) maemo_program_connect_after__file_open((object),(func),(data))
+#define self_connect_data__file_open(object,func,data,destroy_data,flags) maemo_program_connect_data__file_open((object),(func),(data),(destroy_data),(flags))
+#define self_connect__file_save(object,func,data) maemo_program_connect__file_save((object),(func),(data))
+#define self_connect_after__file_save(object,func,data) maemo_program_connect_after__file_save((object),(func),(data))
+#define self_connect_data__file_save(object,func,data,destroy_data,flags) maemo_program_connect_data__file_save((object),(func),(data),(destroy_data),(flags))
+#define self_connect__file_save_as(object,func,data) maemo_program_connect__file_save_as((object),(func),(data))
+#define self_connect_after__file_save_as(object,func,data) maemo_program_connect_after__file_save_as((object),(func),(data))
+#define self_connect_data__file_save_as(object,func,data,destroy_data,flags) maemo_program_connect_data__file_save_as((object),(func),(data),(destroy_data),(flags))
+#define self_connect__edit_undo(object,func,data) maemo_program_connect__edit_undo((object),(func),(data))
+#define self_connect_after__edit_undo(object,func,data) maemo_program_connect_after__edit_undo((object),(func),(data))
+#define self_connect_data__edit_undo(object,func,data,destroy_data,flags) maemo_program_connect_data__edit_undo((object),(func),(data),(destroy_data),(flags))
+#define self_connect__edit_redo(object,func,data) maemo_program_connect__edit_redo((object),(func),(data))
+#define self_connect_after__edit_redo(object,func,data) maemo_program_connect_after__edit_redo((object),(func),(data))
+#define self_connect_data__edit_redo(object,func,data,destroy_data,flags) maemo_program_connect_data__edit_redo((object),(func),(data),(destroy_data),(flags))
+#define self_connect__edit_cut(object,func,data) maemo_program_connect__edit_cut((object),(func),(data))
+#define self_connect_after__edit_cut(object,func,data) maemo_program_connect_after__edit_cut((object),(func),(data))
+#define self_connect_data__edit_cut(object,func,data,destroy_data,flags) maemo_program_connect_data__edit_cut((object),(func),(data),(destroy_data),(flags))
+#define self_connect__edit_copy(object,func,data) maemo_program_connect__edit_copy((object),(func),(data))
+#define self_connect_after__edit_copy(object,func,data) maemo_program_connect_after__edit_copy((object),(func),(data))
+#define self_connect_data__edit_copy(object,func,data,destroy_data,flags) maemo_program_connect_data__edit_copy((object),(func),(data),(destroy_data),(flags))
+#define self_connect__edit_paste(object,func,data) maemo_program_connect__edit_paste((object),(func),(data))
+#define self_connect_after__edit_paste(object,func,data) maemo_program_connect_after__edit_paste((object),(func),(data))
+#define self_connect_data__edit_paste(object,func,data,destroy_data,flags) maemo_program_connect_data__edit_paste((object),(func),(data),(destroy_data),(flags))
+#define self_connect__edit_select_all(object,func,data) maemo_program_connect__edit_select_all((object),(func),(data))
+#define self_connect_after__edit_select_all(object,func,data) maemo_program_connect_after__edit_select_all((object),(func),(data))
+#define self_connect_data__edit_select_all(object,func,data,destroy_data,flags) maemo_program_connect_data__edit_select_all((object),(func),(data),(destroy_data),(flags))
+#define self_connect__view_full_screen(object,func,data) maemo_program_connect__view_full_screen((object),(func),(data))
+#define self_connect_after__view_full_screen(object,func,data) maemo_program_connect_after__view_full_screen((object),(func),(data))
+#define self_connect_data__view_full_screen(object,func,data,destroy_data,flags) maemo_program_connect_data__view_full_screen((object),(func),(data),(destroy_data),(flags))
+#define self_connect__play(object,func,data) maemo_program_connect__play((object),(func),(data))
+#define self_connect_after__play(object,func,data) maemo_program_connect_after__play((object),(func),(data))
+#define self_connect_data__play(object,func,data,destroy_data,flags) maemo_program_connect_data__play((object),(func),(data),(destroy_data),(flags))
+#define self_connect__play_stop(object,func,data) maemo_program_connect__play_stop((object),(func),(data))
+#define self_connect_after__play_stop(object,func,data) maemo_program_connect_after__play_stop((object),(func),(data))
+#define self_connect_data__play_stop(object,func,data,destroy_data,flags) maemo_program_connect_data__play_stop((object),(func),(data),(destroy_data),(flags))
+#define self_connect__play_previous(object,func,data) maemo_program_connect__play_previous((object),(func),(data))
+#define self_connect_after__play_previous(object,func,data) maemo_program_connect_after__play_previous((object),(func),(data))
+#define self_connect_data__play_previous(object,func,data,destroy_data,flags) maemo_program_connect_data__play_previous((object),(func),(data),(destroy_data),(flags))
+#define self_connect__play_next(object,func,data) maemo_program_connect__play_next((object),(func),(data))
+#define self_connect_after__play_next(object,func,data) maemo_program_connect_after__play_next((object),(func),(data))
+#define self_connect_data__play_next(object,func,data,destroy_data,flags) maemo_program_connect_data__play_next((object),(func),(data),(destroy_data),(flags))
+#define self_connect__mute(object,func,data) maemo_program_connect__mute((object),(func),(data))
+#define self_connect_after__mute(object,func,data) maemo_program_connect_after__mute((object),(func),(data))
+#define self_connect_data__mute(object,func,data,destroy_data,flags) maemo_program_connect_data__mute((object),(func),(data),(destroy_data),(flags))
+#define self_connect__tools_settings(object,func,data) maemo_program_connect__tools_settings((object),(func),(data))
+#define self_connect_after__tools_settings(object,func,data) maemo_program_connect_after__tools_settings((object),(func),(data))
+#define self_connect_data__tools_settings(object,func,data,destroy_data,flags) maemo_program_connect_data__tools_settings((object),(func),(data),(destroy_data),(flags))
+#define self_connect__close(object,func,data) maemo_program_connect__close((object),(func),(data))
+#define self_connect_after__close(object,func,data) maemo_program_connect_after__close((object),(func),(data))
+#define self_connect_data__close(object,func,data,destroy_data,flags) maemo_program_connect_data__close((object),(func),(data),(destroy_data),(flags))
+#define self_connect__zoom_level_changed(object,func,data) maemo_program_connect__zoom_level_changed((object),(func),(data))
+#define self_connect_after__zoom_level_changed(object,func,data) maemo_program_connect_after__zoom_level_changed((object),(func),(data))
+#define self_connect_data__zoom_level_changed(object,func,data,destroy_data,flags) maemo_program_connect_data__zoom_level_changed((object),(func),(data),(destroy_data),(flags))
+#define self_connect__max_zoom_level_reached(object,func,data) maemo_program_connect__max_zoom_level_reached((object),(func),(data))
+#define self_connect_after__max_zoom_level_reached(object,func,data) maemo_program_connect_after__max_zoom_level_reached((object),(func),(data))
+#define self_connect_data__max_zoom_level_reached(object,func,data,destroy_data,flags) maemo_program_connect_data__max_zoom_level_reached((object),(func),(data),(destroy_data),(flags))
+#define self_connect__min_zoom_level_reached(object,func,data) maemo_program_connect__min_zoom_level_reached((object),(func),(data))
+#define self_connect_after__min_zoom_level_reached(object,func,data) maemo_program_connect_after__min_zoom_level_reached((object),(func),(data))
+#define self_connect_data__min_zoom_level_reached(object,func,data,destroy_data,flags) maemo_program_connect_data__min_zoom_level_reached((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_zoom_in(object,func,data) maemo_program_connect__hw_key_zoom_in((object),(func),(data))
+#define self_connect_after__hw_key_zoom_in(object,func,data) maemo_program_connect_after__hw_key_zoom_in((object),(func),(data))
+#define self_connect_data__hw_key_zoom_in(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_zoom_in((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_zoom_out(object,func,data) maemo_program_connect__hw_key_zoom_out((object),(func),(data))
+#define self_connect_after__hw_key_zoom_out(object,func,data) maemo_program_connect_after__hw_key_zoom_out((object),(func),(data))
+#define self_connect_data__hw_key_zoom_out(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_zoom_out((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_full_screen(object,func,data) maemo_program_connect__hw_key_full_screen((object),(func),(data))
+#define self_connect_after__hw_key_full_screen(object,func,data) maemo_program_connect_after__hw_key_full_screen((object),(func),(data))
+#define self_connect_data__hw_key_full_screen(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_full_screen((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_up(object,func,data) maemo_program_connect__hw_key_up((object),(func),(data))
+#define self_connect_after__hw_key_up(object,func,data) maemo_program_connect_after__hw_key_up((object),(func),(data))
+#define self_connect_data__hw_key_up(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_up((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_down(object,func,data) maemo_program_connect__hw_key_down((object),(func),(data))
+#define self_connect_after__hw_key_down(object,func,data) maemo_program_connect_after__hw_key_down((object),(func),(data))
+#define self_connect_data__hw_key_down(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_down((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_left(object,func,data) maemo_program_connect__hw_key_left((object),(func),(data))
+#define self_connect_after__hw_key_left(object,func,data) maemo_program_connect_after__hw_key_left((object),(func),(data))
+#define self_connect_data__hw_key_left(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_left((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_right(object,func,data) maemo_program_connect__hw_key_right((object),(func),(data))
+#define self_connect_after__hw_key_right(object,func,data) maemo_program_connect_after__hw_key_right((object),(func),(data))
+#define self_connect_data__hw_key_right(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_right((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_select(object,func,data) maemo_program_connect__hw_key_select((object),(func),(data))
+#define self_connect_after__hw_key_select(object,func,data) maemo_program_connect_after__hw_key_select((object),(func),(data))
+#define self_connect_data__hw_key_select(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_select((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_close(object,func,data) maemo_program_connect__hw_key_close((object),(func),(data))
+#define self_connect_after__hw_key_close(object,func,data) maemo_program_connect_after__hw_key_close((object),(func),(data))
+#define self_connect_data__hw_key_close(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_close((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_menu(object,func,data) maemo_program_connect__hw_key_menu((object),(func),(data))
+#define self_connect_after__hw_key_menu(object,func,data) maemo_program_connect_after__hw_key_menu((object),(func),(data))
+#define self_connect_data__hw_key_menu(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_menu((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_home(object,func,data) maemo_program_connect__hw_key_home((object),(func),(data))
+#define self_connect_after__hw_key_home(object,func,data) maemo_program_connect_after__hw_key_home((object),(func),(data))
+#define self_connect_data__hw_key_home(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_home((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_power(object,func,data) maemo_program_connect__hw_key_power((object),(func),(data))
+#define self_connect_after__hw_key_power(object,func,data) maemo_program_connect_after__hw_key_power((object),(func),(data))
+#define self_connect_data__hw_key_power(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_power((object),(func),(data),(destroy_data),(flags))
+#define self_connect__hw_key_other(object,func,data) maemo_program_connect__hw_key_other((object),(func),(data))
+#define self_connect_after__hw_key_other(object,func,data) maemo_program_connect_after__hw_key_other((object),(func),(data))
+#define self_connect_data__hw_key_other(object,func,data,destroy_data,flags) maemo_program_connect_data__hw_key_other((object),(func),(data),(destroy_data),(flags))
+#define self_connect__state_shutdown(object,func,data) maemo_program_connect__state_shutdown((object),(func),(data))
+#define self_connect_after__state_shutdown(object,func,data) maemo_program_connect_after__state_shutdown((object),(func),(data))
+#define self_connect_data__state_shutdown(object,func,data,destroy_data,flags) maemo_program_connect_data__state_shutdown((object),(func),(data),(destroy_data),(flags))
+#define self_connect__state_memory_low(object,func,data) maemo_program_connect__state_memory_low((object),(func),(data))
+#define self_connect_after__state_memory_low(object,func,data) maemo_program_connect_after__state_memory_low((object),(func),(data))
+#define self_connect_data__state_memory_low(object,func,data,destroy_data,flags) maemo_program_connect_data__state_memory_low((object),(func),(data),(destroy_data),(flags))
+#define self_connect__state_save_unsaved_data(object,func,data) maemo_program_connect__state_save_unsaved_data((object),(func),(data))
+#define self_connect_after__state_save_unsaved_data(object,func,data) maemo_program_connect_after__state_save_unsaved_data((object),(func),(data))
+#define self_connect_data__state_save_unsaved_data(object,func,data,destroy_data,flags) maemo_program_connect_data__state_save_unsaved_data((object),(func),(data),(destroy_data),(flags))
+#define self_connect__state_system_inactivity(object,func,data) maemo_program_connect__state_system_inactivity((object),(func),(data))
+#define self_connect_after__state_system_inactivity(object,func,data) maemo_program_connect_after__state_system_inactivity((object),(func),(data))
+#define self_connect_data__state_system_inactivity(object,func,data,destroy_data,flags) maemo_program_connect_data__state_system_inactivity((object),(func),(data),(destroy_data),(flags))
+#define self_connect__state_normal_mode(object,func,data) maemo_program_connect__state_normal_mode((object),(func),(data))
+#define self_connect_after__state_normal_mode(object,func,data) maemo_program_connect_after__state_normal_mode((object),(func),(data))
+#define self_connect_data__state_normal_mode(object,func,data,destroy_data,flags) maemo_program_connect_data__state_normal_mode((object),(func),(data),(destroy_data),(flags))
+#define self_connect__state_flight_mode(object,func,data) maemo_program_connect__state_flight_mode((object),(func),(data))
+#define self_connect_after__state_flight_mode(object,func,data) maemo_program_connect_after__state_flight_mode((object),(func),(data))
+#define self_connect_data__state_flight_mode(object,func,data,destroy_data,flags) maemo_program_connect_data__state_flight_mode((object),(func),(data),(destroy_data),(flags))
+#define self_connect__state_other(object,func,data) maemo_program_connect__state_other((object),(func),(data))
+#define self_connect_after__state_other(object,func,data) maemo_program_connect_after__state_other((object),(func),(data))
+#define self_connect_data__state_other(object,func,data,destroy_data,flags) maemo_program_connect_data__state_other((object),(func),(data),(destroy_data),(flags))
+
+typedef void (*___Sig1) (MaemoProgram *, GObject *, gpointer);
+
+static void
+___marshal_Sig1 (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ register ___Sig1 callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+
+ g_return_if_fail (n_param_values == 2);
+
+ if (G_CCLOSURE_SWAP_DATA (closure)) {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ } else {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+
+ callback = (___Sig1) (marshal_data != NULL ? marshal_data : cc->callback);
+
+ callback ((MaemoProgram *)data1,
+ (GObject *) g_value_get_object (param_values + 1),
+ data2);
+}
+
+
+enum {
+ FILE_NEW_SIGNAL,
+ FILE_OPEN_SIGNAL,
+ FILE_SAVE_SIGNAL,
+ FILE_SAVE_AS_SIGNAL,
+ EDIT_UNDO_SIGNAL,
+ EDIT_REDO_SIGNAL,
+ EDIT_CUT_SIGNAL,
+ EDIT_COPY_SIGNAL,
+ EDIT_PASTE_SIGNAL,
+ EDIT_SELECT_ALL_SIGNAL,
+ VIEW_FULL_SCREEN_SIGNAL,
+ PLAY_SIGNAL,
+ PLAY_STOP_SIGNAL,
+ PLAY_PREVIOUS_SIGNAL,
+ PLAY_NEXT_SIGNAL,
+ MUTE_SIGNAL,
+ TOOLS_SETTINGS_SIGNAL,
+ CLOSE_SIGNAL,
+ ZOOM_LEVEL_CHANGED_SIGNAL,
+ MAX_ZOOM_LEVEL_REACHED_SIGNAL,
+ MIN_ZOOM_LEVEL_REACHED_SIGNAL,
+ HW_KEY_ZOOM_IN_SIGNAL,
+ HW_KEY_ZOOM_OUT_SIGNAL,
+ HW_KEY_FULL_SCREEN_SIGNAL,
+ HW_KEY_UP_SIGNAL,
+ HW_KEY_DOWN_SIGNAL,
+ HW_KEY_LEFT_SIGNAL,
+ HW_KEY_RIGHT_SIGNAL,
+ HW_KEY_SELECT_SIGNAL,
+ HW_KEY_CLOSE_SIGNAL,
+ HW_KEY_MENU_SIGNAL,
+ HW_KEY_HOME_SIGNAL,
+ HW_KEY_POWER_SIGNAL,
+ HW_KEY_OTHER_SIGNAL,
+ STATE_SHUTDOWN_SIGNAL,
+ STATE_MEMORY_LOW_SIGNAL,
+ STATE_SAVE_UNSAVED_DATA_SIGNAL,
+ STATE_SYSTEM_INACTIVITY_SIGNAL,
+ STATE_NORMAL_MODE_SIGNAL,
+ STATE_FLIGHT_MODE_SIGNAL,
+ STATE_OTHER_SIGNAL,
+ LAST_SIGNAL
+};
+
+enum {
+ PROP_0,
+ PROP_NAME,
+ PROP_WINDOW,
+ PROP_MENU,
+ PROP_FILE_MENU,
+ PROP_EDIT_MENU,
+ PROP_VIEW_MENU,
+ PROP_TOOLS_MENU,
+ PROP_PLAY_MENU,
+ PROP_TOOLBAR
+};
+
+static guint object_signals[LAST_SIGNAL] = {0};
+
+/* pointer to the class of our parent */
+static GObjectClass *parent_class = NULL;
+
+/* Short form macros */
+#define self_get_name maemo_program_get_name
+#define self_set_name maemo_program_set_name
+#define self_get_window maemo_program_get_window
+#define self_get_menu maemo_program_get_menu
+#define self_set_menu maemo_program_set_menu
+#define self_get_file_menu maemo_program_get_file_menu
+#define self_set_file_menu maemo_program_set_file_menu
+#define self_get_edit_menu maemo_program_get_edit_menu
+#define self_set_edit_menu maemo_program_set_edit_menu
+#define self_get_view_menu maemo_program_get_view_menu
+#define self_set_view_menu maemo_program_set_view_menu
+#define self_get_tools_menu maemo_program_get_tools_menu
+#define self_set_tools_menu maemo_program_set_tools_menu
+#define self_get_play_menu maemo_program_get_play_menu
+#define self_set_play_menu maemo_program_set_play_menu
+#define self_get_toolbar maemo_program_get_toolbar
+#define self_file_new maemo_program_file_new
+#define self_file_open maemo_program_file_open
+#define self_file_save maemo_program_file_save
+#define self_file_save_as maemo_program_file_save_as
+#define self_edit_undo maemo_program_edit_undo
+#define self_edit_redo maemo_program_edit_redo
+#define self_edit_cut maemo_program_edit_cut
+#define self_edit_copy maemo_program_edit_copy
+#define self_edit_paste maemo_program_edit_paste
+#define self_edit_select_all maemo_program_edit_select_all
+#define self_view_full_screen maemo_program_view_full_screen
+#define self_play maemo_program_play
+#define self_play_stop maemo_program_play_stop
+#define self_play_previous maemo_program_play_previous
+#define self_play_next maemo_program_play_next
+#define self_mute maemo_program_mute
+#define self_tools_settings maemo_program_tools_settings
+#define self_close maemo_program_close
+#define self_zoom_level_changed maemo_program_zoom_level_changed
+#define self_max_zoom_level_reached maemo_program_max_zoom_level_reached
+#define self_min_zoom_level_reached maemo_program_min_zoom_level_reached
+#define self_hw_key_zoom_in maemo_program_hw_key_zoom_in
+#define self_hw_key_zoom_out maemo_program_hw_key_zoom_out
+#define self_hw_key_full_screen maemo_program_hw_key_full_screen
+#define self_hw_key_up maemo_program_hw_key_up
+#define self_hw_key_down maemo_program_hw_key_down
+#define self_hw_key_left maemo_program_hw_key_left
+#define self_hw_key_right maemo_program_hw_key_right
+#define self_hw_key_select maemo_program_hw_key_select
+#define self_hw_key_close maemo_program_hw_key_close
+#define self_hw_key_menu maemo_program_hw_key_menu
+#define self_hw_key_home maemo_program_hw_key_home
+#define self_hw_key_power maemo_program_hw_key_power
+#define self_hw_key_other maemo_program_hw_key_other
+#define self_state_shutdown maemo_program_state_shutdown
+#define self_state_memory_low maemo_program_state_memory_low
+#define self_state_save_unsaved_data maemo_program_state_save_unsaved_data
+#define self_state_system_inactivity maemo_program_state_system_inactivity
+#define self_state_normal_mode maemo_program_state_normal_mode
+#define self_state_flight_mode maemo_program_state_flight_mode
+#define self_state_other maemo_program_state_other
+#define self_hw_key_press_cb maemo_program_hw_key_press_cb
+#define self_hw_event_handler maemo_program_hw_event_handler
+#define self_cb_file_new maemo_program_cb_file_new
+#define self_cb_file_open maemo_program_cb_file_open
+#define self_cb_file_save maemo_program_cb_file_save
+#define self_cb_file_save_as maemo_program_cb_file_save_as
+#define self_cb_edit_undo maemo_program_cb_edit_undo
+#define self_cb_edit_redo maemo_program_cb_edit_redo
+#define self_cb_edit_cut maemo_program_cb_edit_cut
+#define self_cb_edit_copy maemo_program_cb_edit_copy
+#define self_cb_edit_paste maemo_program_cb_edit_paste
+#define self_cb_edit_select_all maemo_program_cb_edit_select_all
+#define self_cb_view_full_screen maemo_program_cb_view_full_screen
+#define self_cb_tools_settings maemo_program_cb_tools_settings
+#define self_cb_about maemo_program_cb_about
+#define self_cb_play_play maemo_program_cb_play_play
+#define self_cb_play_stop maemo_program_cb_play_stop
+#define self_cb_play_previous maemo_program_cb_play_previous
+#define self_cb_play_next maemo_program_cb_play_next
+#define self_cb_play_mute maemo_program_cb_play_mute
+#define self_cb_close maemo_program_cb_close
+#define self_cb_help maemo_program_cb_help
+#define self_initialize maemo_program_initialize
+#define self_set_window maemo_program_set_window
+#define self_add_toolbar_item maemo_program_add_toolbar_item
+#define self_create_toolbar maemo_program_create_toolbar
+#define self_add_menu_item maemo_program_add_menu_item
+#define self_create_menu maemo_program_create_menu
+#define self_initialize_about_content maemo_program_initialize_about_content
+#define self_new maemo_program_new
+#define self_set_about maemo_program_set_about
+#define self_set_about_website maemo_program_set_about_website
+#define self_set_about_credits maemo_program_set_about_credits
+#define self_set_zoom_range maemo_program_set_zoom_range
+#define self_main maemo_program_main
+#define self_set_text_buffer maemo_program_set_text_buffer
+GType
+maemo_program_get_type (void)
+{
+ static GType type = 0;
+
+ if ___GOB_UNLIKELY(type == 0) {
+ static const GTypeInfo info = {
+ sizeof (MaemoProgramClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) maemo_program_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL /* class_data */,
+ sizeof (MaemoProgram),
+ 0 /* n_preallocs */,
+ (GInstanceInitFunc) maemo_program_init,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_OBJECT, "MaemoProgram", &info, (GTypeFlags)0);
+ }
+
+ return type;
+}
+
+/* a macro for creating a new object of our type */
+#define GET_NEW ((MaemoProgram *)g_object_new(maemo_program_get_type(), NULL))
+
+/* a function for creating a new object of our type */
+#include <stdarg.h>
+static MaemoProgram * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
+static MaemoProgram *
+GET_NEW_VARG (const char *first, ...)
+{
+ MaemoProgram *ret;
+ va_list ap;
+ va_start (ap, first);
+ ret = (MaemoProgram *)g_object_new_valist (maemo_program_get_type (), first, ap);
+ va_end (ap);
+ return ret;
+}
+
+
+static void
+___finalize(GObject *obj_self)
+{
+#define __GOB_FUNCTION__ "Maemo:Program::finalize"
+ MaemoProgram *self G_GNUC_UNUSED = MAEMO_PROGRAM (obj_self);
+ if(G_OBJECT_CLASS(parent_class)->finalize) \
+ (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);
+#line 181 "maemo-program.gob"
+ if(self->app_name) { g_free ((gpointer) self->app_name); self->app_name = NULL; }
+#line 520 "maemo-program.c"
+#line 198 "maemo-program.gob"
+ if(self->about_copyright) { g_free ((gpointer) self->about_copyright); self->about_copyright = NULL; }
+#line 523 "maemo-program.c"
+#line 200 "maemo-program.gob"
+ if(self->about_comments) { g_free ((gpointer) self->about_comments); self->about_comments = NULL; }
+#line 526 "maemo-program.c"
+#line 202 "maemo-program.gob"
+ if(self->about_license) { g_free ((gpointer) self->about_license); self->about_license = NULL; }
+#line 529 "maemo-program.c"
+#line 204 "maemo-program.gob"
+ if(self->about_website) { g_free ((gpointer) self->about_website); self->about_website = NULL; }
+#line 532 "maemo-program.c"
+#line 206 "maemo-program.gob"
+ if(self->about_website_label) { g_free ((gpointer) self->about_website_label); self->about_website_label = NULL; }
+#line 535 "maemo-program.c"
+#line 208 "maemo-program.gob"
+ if(self->about_authors) { g_free ((gpointer) self->about_authors); self->about_authors = NULL; }
+#line 538 "maemo-program.c"
+#line 210 "maemo-program.gob"
+ if(self->about_artists) { g_free ((gpointer) self->about_artists); self->about_artists = NULL; }
+#line 541 "maemo-program.c"
+#line 212 "maemo-program.gob"
+ if(self->about_documenters) { g_free ((gpointer) self->about_documenters); self->about_documenters = NULL; }
+#line 544 "maemo-program.c"
+#line 214 "maemo-program.gob"
+ if(self->about_translators) { g_free ((gpointer) self->about_translators); self->about_translators = NULL; }
+#line 547 "maemo-program.c"
+#line 216 "maemo-program.gob"
+ if(self->about_logo) { g_free ((gpointer) self->about_logo); self->about_logo = NULL; }
+#line 550 "maemo-program.c"
+#line 219 "maemo-program.gob"
+ if(self->help_topic_id) { g_free ((gpointer) self->help_topic_id); self->help_topic_id = NULL; }
+#line 553 "maemo-program.c"
+#line 232 "maemo-program.gob"
+ if(self->window) { gtk_widget_destroy ((gpointer) self->window); self->window = NULL; }
+#line 556 "maemo-program.c"
+#line 236 "maemo-program.gob"
+ if(self->main_menu) { gtk_widget_destroy ((gpointer) self->main_menu); self->main_menu = NULL; }
+#line 559 "maemo-program.c"
+#line 238 "maemo-program.gob"
+ if(self->file_menu) { gtk_widget_destroy ((gpointer) self->file_menu); self->file_menu = NULL; }
+#line 562 "maemo-program.c"
+#line 240 "maemo-program.gob"
+ if(self->edit_menu) { gtk_widget_destroy ((gpointer) self->edit_menu); self->edit_menu = NULL; }
+#line 565 "maemo-program.c"
+#line 242 "maemo-program.gob"
+ if(self->view_menu) { gtk_widget_destroy ((gpointer) self->view_menu); self->view_menu = NULL; }
+#line 568 "maemo-program.c"
+#line 244 "maemo-program.gob"
+ if(self->tools_menu) { gtk_widget_destroy ((gpointer) self->tools_menu); self->tools_menu = NULL; }
+#line 571 "maemo-program.c"
+#line 246 "maemo-program.gob"
+ if(self->play_menu) { gtk_widget_destroy ((gpointer) self->play_menu); self->play_menu = NULL; }
+#line 574 "maemo-program.c"
+#line 287 "maemo-program.gob"
+ if(self->toolbar) { gtk_widget_destroy ((gpointer) self->toolbar); self->toolbar = NULL; }
+#line 577 "maemo-program.c"
+#line 291 "maemo-program.gob"
+ if(self->gc_client) { g_object_unref ((gpointer) self->gc_client); self->gc_client = NULL; }
+#line 580 "maemo-program.c"
+#line 295 "maemo-program.gob"
+ if(self->buffer) { gtk_widget_destroy ((gpointer) self->buffer); self->buffer = NULL; }
+#line 583 "maemo-program.c"
+#line 299 "maemo-program.gob"
+ if(self->clipboard) { gtk_widget_destroy ((gpointer) self->clipboard); self->clipboard = NULL; }
+#line 586 "maemo-program.c"
+}
+#undef __GOB_FUNCTION__
+
+static void
+maemo_program_init (MaemoProgram * o G_GNUC_UNUSED)
+{
+#define __GOB_FUNCTION__ "Maemo:Program::init"
+#line 180 "maemo-program.gob"
+ o->app_name = NULL;
+#line 596 "maemo-program.c"
+#line 197 "maemo-program.gob"
+ o->about_copyright = NULL;
+#line 599 "maemo-program.c"
+#line 199 "maemo-program.gob"
+ o->about_comments = NULL;
+#line 602 "maemo-program.c"
+#line 201 "maemo-program.gob"
+ o->about_license = NULL;
+#line 605 "maemo-program.c"
+#line 203 "maemo-program.gob"
+ o->about_website = NULL;
+#line 608 "maemo-program.c"
+#line 205 "maemo-program.gob"
+ o->about_website_label = NULL;
+#line 611 "maemo-program.c"
+#line 207 "maemo-program.gob"
+ o->about_authors = NULL;
+#line 614 "maemo-program.c"
+#line 209 "maemo-program.gob"
+ o->about_artists = NULL;
+#line 617 "maemo-program.c"
+#line 211 "maemo-program.gob"
+ o->about_documenters = NULL;
+#line 620 "maemo-program.c"
+#line 213 "maemo-program.gob"
+ o->about_translators = NULL;
+#line 623 "maemo-program.c"
+#line 215 "maemo-program.gob"
+ o->about_logo = NULL;
+#line 626 "maemo-program.c"
+#line 218 "maemo-program.gob"
+ o->help_topic_id = NULL;
+#line 629 "maemo-program.c"
+#line 218 "maemo-program.gob"
+ o->program = NULL;
+#line 632 "maemo-program.c"
+#line 231 "maemo-program.gob"
+ o->window = NULL;
+#line 635 "maemo-program.c"
+#line 235 "maemo-program.gob"
+ o->main_menu = NULL;
+#line 638 "maemo-program.c"
+#line 237 "maemo-program.gob"
+ o->file_menu = NULL;
+#line 641 "maemo-program.c"
+#line 239 "maemo-program.gob"
+ o->edit_menu = NULL;
+#line 644 "maemo-program.c"
+#line 241 "maemo-program.gob"
+ o->view_menu = NULL;
+#line 647 "maemo-program.c"
+#line 243 "maemo-program.gob"
+ o->tools_menu = NULL;
+#line 650 "maemo-program.c"
+#line 245 "maemo-program.gob"
+ o->play_menu = NULL;
+#line 653 "maemo-program.c"
+#line 286 "maemo-program.gob"
+ o->toolbar = NULL;
+#line 656 "maemo-program.c"
+#line 290 "maemo-program.gob"
+ o->gc_client = NULL;
+#line 659 "maemo-program.c"
+#line 294 "maemo-program.gob"
+ o->buffer = NULL;
+#line 662 "maemo-program.c"
+#line 298 "maemo-program.gob"
+ o->clipboard = NULL;
+#line 665 "maemo-program.c"
+}
+#undef __GOB_FUNCTION__
+static void
+maemo_program_class_init (MaemoProgramClass * c G_GNUC_UNUSED)
+{
+#define __GOB_FUNCTION__ "Maemo:Program::class_init"
+ GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;
+
+ parent_class = g_type_class_ref (G_TYPE_OBJECT);
+
+ object_signals[FILE_NEW_SIGNAL] =
+ g_signal_new ("file_new",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, file_new),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 458: Type mismatch of \"file_new\" signal signature");
+ }
+ object_signals[FILE_OPEN_SIGNAL] =
+ g_signal_new ("file_open",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, file_open),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 464: Type mismatch of \"file_open\" signal signature");
+ }
+ object_signals[FILE_SAVE_SIGNAL] =
+ g_signal_new ("file_save",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, file_save),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 470: Type mismatch of \"file_save\" signal signature");
+ }
+ object_signals[FILE_SAVE_AS_SIGNAL] =
+ g_signal_new ("file_save_as",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, file_save_as),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 476: Type mismatch of \"file_save_as\" signal signature");
+ }
+ object_signals[EDIT_UNDO_SIGNAL] =
+ g_signal_new ("edit_undo",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, edit_undo),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 482: Type mismatch of \"edit_undo\" signal signature");
+ }
+ object_signals[EDIT_REDO_SIGNAL] =
+ g_signal_new ("edit_redo",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, edit_redo),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 488: Type mismatch of \"edit_redo\" signal signature");
+ }
+ object_signals[EDIT_CUT_SIGNAL] =
+ g_signal_new ("edit_cut",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, edit_cut),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 494: Type mismatch of \"edit_cut\" signal signature");
+ }
+ object_signals[EDIT_COPY_SIGNAL] =
+ g_signal_new ("edit_copy",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, edit_copy),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 503: Type mismatch of \"edit_copy\" signal signature");
+ }
+ object_signals[EDIT_PASTE_SIGNAL] =
+ g_signal_new ("edit_paste",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, edit_paste),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 512: Type mismatch of \"edit_paste\" signal signature");
+ }
+ object_signals[EDIT_SELECT_ALL_SIGNAL] =
+ g_signal_new ("edit_select_all",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, edit_select_all),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 522: Type mismatch of \"edit_select_all\" signal signature");
+ }
+ object_signals[VIEW_FULL_SCREEN_SIGNAL] =
+ g_signal_new ("view_full_screen",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, view_full_screen),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 528: Type mismatch of \"view_full_screen\" signal signature");
+ }
+ object_signals[PLAY_SIGNAL] =
+ g_signal_new ("play",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, play),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 541: Type mismatch of \"play\" signal signature");
+ }
+ object_signals[PLAY_STOP_SIGNAL] =
+ g_signal_new ("play_stop",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, play_stop),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 547: Type mismatch of \"play_stop\" signal signature");
+ }
+ object_signals[PLAY_PREVIOUS_SIGNAL] =
+ g_signal_new ("play_previous",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, play_previous),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 553: Type mismatch of \"play_previous\" signal signature");
+ }
+ object_signals[PLAY_NEXT_SIGNAL] =
+ g_signal_new ("play_next",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, play_next),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 559: Type mismatch of \"play_next\" signal signature");
+ }
+ object_signals[MUTE_SIGNAL] =
+ g_signal_new ("mute",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, mute),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 565: Type mismatch of \"mute\" signal signature");
+ }
+ object_signals[TOOLS_SETTINGS_SIGNAL] =
+ g_signal_new ("tools_settings",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, tools_settings),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 571: Type mismatch of \"tools_settings\" signal signature");
+ }
+ object_signals[CLOSE_SIGNAL] =
+ g_signal_new ("close",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, close),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 577: Type mismatch of \"close\" signal signature");
+ }
+ object_signals[ZOOM_LEVEL_CHANGED_SIGNAL] =
+ g_signal_new ("zoom_level_changed",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, zoom_level_changed),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 589: Type mismatch of \"zoom_level_changed\" signal signature");
+ }
+ object_signals[MAX_ZOOM_LEVEL_REACHED_SIGNAL] =
+ g_signal_new ("max_zoom_level_reached",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, max_zoom_level_reached),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 603: Type mismatch of \"max_zoom_level_reached\" signal signature");
+ }
+ object_signals[MIN_ZOOM_LEVEL_REACHED_SIGNAL] =
+ g_signal_new ("min_zoom_level_reached",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, min_zoom_level_reached),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 611: Type mismatch of \"min_zoom_level_reached\" signal signature");
+ }
+ object_signals[HW_KEY_ZOOM_IN_SIGNAL] =
+ g_signal_new ("hw_key_zoom_in",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_zoom_in),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 619: Type mismatch of \"hw_key_zoom_in\" signal signature");
+ }
+ object_signals[HW_KEY_ZOOM_OUT_SIGNAL] =
+ g_signal_new ("hw_key_zoom_out",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_zoom_out),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 640: Type mismatch of \"hw_key_zoom_out\" signal signature");
+ }
+ object_signals[HW_KEY_FULL_SCREEN_SIGNAL] =
+ g_signal_new ("hw_key_full_screen",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_full_screen),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 661: Type mismatch of \"hw_key_full_screen\" signal signature");
+ }
+ object_signals[HW_KEY_UP_SIGNAL] =
+ g_signal_new ("hw_key_up",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_up),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 672: Type mismatch of \"hw_key_up\" signal signature");
+ }
+ object_signals[HW_KEY_DOWN_SIGNAL] =
+ g_signal_new ("hw_key_down",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_down),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 678: Type mismatch of \"hw_key_down\" signal signature");
+ }
+ object_signals[HW_KEY_LEFT_SIGNAL] =
+ g_signal_new ("hw_key_left",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_left),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 684: Type mismatch of \"hw_key_left\" signal signature");
+ }
+ object_signals[HW_KEY_RIGHT_SIGNAL] =
+ g_signal_new ("hw_key_right",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_right),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 690: Type mismatch of \"hw_key_right\" signal signature");
+ }
+ object_signals[HW_KEY_SELECT_SIGNAL] =
+ g_signal_new ("hw_key_select",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_select),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 696: Type mismatch of \"hw_key_select\" signal signature");
+ }
+ object_signals[HW_KEY_CLOSE_SIGNAL] =
+ g_signal_new ("hw_key_close",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_close),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 707: Type mismatch of \"hw_key_close\" signal signature");
+ }
+ object_signals[HW_KEY_MENU_SIGNAL] =
+ g_signal_new ("hw_key_menu",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_menu),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 714: Type mismatch of \"hw_key_menu\" signal signature");
+ }
+ object_signals[HW_KEY_HOME_SIGNAL] =
+ g_signal_new ("hw_key_home",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_home),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 720: Type mismatch of \"hw_key_home\" signal signature");
+ }
+ object_signals[HW_KEY_POWER_SIGNAL] =
+ g_signal_new ("hw_key_power",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_power),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 726: Type mismatch of \"hw_key_power\" signal signature");
+ }
+ object_signals[HW_KEY_OTHER_SIGNAL] =
+ g_signal_new ("hw_key_other",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, hw_key_other),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 732: Type mismatch of \"hw_key_other\" signal signature");
+ }
+ object_signals[STATE_SHUTDOWN_SIGNAL] =
+ g_signal_new ("state_shutdown",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, state_shutdown),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 742: Type mismatch of \"state_shutdown\" signal signature");
+ }
+ object_signals[STATE_MEMORY_LOW_SIGNAL] =
+ g_signal_new ("state_memory_low",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, state_memory_low),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 748: Type mismatch of \"state_memory_low\" signal signature");
+ }
+ object_signals[STATE_SAVE_UNSAVED_DATA_SIGNAL] =
+ g_signal_new ("state_save_unsaved_data",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, state_save_unsaved_data),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 754: Type mismatch of \"state_save_unsaved_data\" signal signature");
+ }
+ object_signals[STATE_SYSTEM_INACTIVITY_SIGNAL] =
+ g_signal_new ("state_system_inactivity",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, state_system_inactivity),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 760: Type mismatch of \"state_system_inactivity\" signal signature");
+ }
+ object_signals[STATE_NORMAL_MODE_SIGNAL] =
+ g_signal_new ("state_normal_mode",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, state_normal_mode),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 766: Type mismatch of \"state_normal_mode\" signal signature");
+ }
+ object_signals[STATE_FLIGHT_MODE_SIGNAL] =
+ g_signal_new ("state_flight_mode",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, state_flight_mode),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 772: Type mismatch of \"state_flight_mode\" signal signature");
+ }
+ object_signals[STATE_OTHER_SIGNAL] =
+ g_signal_new ("state_other",
+ G_TYPE_FROM_CLASS (g_object_class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (MaemoProgramClass, state_other),
+ NULL, NULL,
+ ___marshal_Sig1,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
+ if ___GOB_UNLIKELY(sizeof(gpointer ) != sizeof(GObject *) || parent_class == NULL /* avoid warning */) {
+ g_error("maemo-program.gob line 778: Type mismatch of \"state_other\" signal signature");
+ }
+
+ c->file_new = NULL;
+ c->file_open = NULL;
+ c->file_save = NULL;
+ c->file_save_as = NULL;
+ c->edit_undo = NULL;
+ c->edit_redo = NULL;
+#line 494 "maemo-program.gob"
+ c->edit_cut = ___real_maemo_program_edit_cut;
+#line 503 "maemo-program.gob"
+ c->edit_copy = ___real_maemo_program_edit_copy;
+#line 512 "maemo-program.gob"
+ c->edit_paste = ___real_maemo_program_edit_paste;
+#line 1181 "maemo-program.c"
+ c->edit_select_all = NULL;
+#line 528 "maemo-program.gob"
+ c->view_full_screen = ___real_maemo_program_view_full_screen;
+#line 1185 "maemo-program.c"
+ c->play = NULL;
+ c->play_stop = NULL;
+ c->play_previous = NULL;
+ c->play_next = NULL;
+ c->mute = NULL;
+ c->tools_settings = NULL;
+#line 577 "maemo-program.gob"
+ c->close = ___real_maemo_program_close;
+#line 589 "maemo-program.gob"
+ c->zoom_level_changed = ___real_maemo_program_zoom_level_changed;
+#line 603 "maemo-program.gob"
+ c->max_zoom_level_reached = ___real_maemo_program_max_zoom_level_reached;
+#line 611 "maemo-program.gob"
+ c->min_zoom_level_reached = ___real_maemo_program_min_zoom_level_reached;
+#line 619 "maemo-program.gob"
+ c->hw_key_zoom_in = ___real_maemo_program_hw_key_zoom_in;
+#line 640 "maemo-program.gob"
+ c->hw_key_zoom_out = ___real_maemo_program_hw_key_zoom_out;
+#line 661 "maemo-program.gob"
+ c->hw_key_full_screen = ___real_maemo_program_hw_key_full_screen;
+#line 1206 "maemo-program.c"
+ c->hw_key_up = NULL;
+ c->hw_key_down = NULL;
+ c->hw_key_left = NULL;
+ c->hw_key_right = NULL;
+ c->hw_key_select = NULL;
+#line 707 "maemo-program.gob"
+ c->hw_key_close = ___real_maemo_program_hw_key_close;
+#line 1214 "maemo-program.c"
+ c->hw_key_menu = NULL;
+ c->hw_key_home = NULL;
+ c->hw_key_power = NULL;
+ c->hw_key_other = NULL;
+ c->state_shutdown = NULL;
+ c->state_memory_low = NULL;
+ c->state_save_unsaved_data = NULL;
+ c->state_system_inactivity = NULL;
+ c->state_normal_mode = NULL;
+ c->state_flight_mode = NULL;
+ c->state_other = NULL;
+ g_object_class->finalize = ___finalize;
+ g_object_class->get_property = ___object_get_property;
+ g_object_class->set_property = ___object_set_property;
+ {
+ GParamSpec *param_spec;
+
+ param_spec = g_param_spec_string
+ ("name" /* name */,
+ _("Name") /* nick */,
+ _("Name of the application") /* blurb */,
+ NULL /* default_value */,
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (g_object_class,
+ PROP_NAME,
+ param_spec);
+ param_spec = g_param_spec_object
+ ("window" /* name */,
+ _("Window") /* nick */,
+ _("The main window of the application") /* blurb */,
+ G_TYPE_BOXED /* object_type */,
+ (GParamFlags)(G_PARAM_READABLE));
+ g_object_class_install_property (g_object_class,
+ PROP_WINDOW,
+ param_spec);
+ param_spec = g_param_spec_object
+ ("menu" /* name */,
+ _("Menu") /* nick */,
+ _("The main menu of the application") /* blurb */,
+ G_TYPE_BOXED /* object_type */,
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (g_object_class,
+ PROP_MENU,
+ param_spec);
+ param_spec = g_param_spec_object
+ ("file_menu" /* name */,
+ _("File Menu") /* nick */,
+ _("The file menu of the application") /* blurb */,
+ G_TYPE_BOXED /* object_type */,
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (g_object_class,
+ PROP_FILE_MENU,
+ param_spec);
+ param_spec = g_param_spec_object
+ ("edit_menu" /* name */,
+ _("Edit Menu") /* nick */,
+ _("The edit menu of the application") /* blurb */,
+ G_TYPE_BOXED /* object_type */,
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (g_object_class,
+ PROP_EDIT_MENU,
+ param_spec);
+ param_spec = g_param_spec_object
+ ("view_menu" /* name */,
+ _("View Menu") /* nick */,
+ _("The view menu of the application") /* blurb */,
+ G_TYPE_BOXED /* object_type */,
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (g_object_class,
+ PROP_VIEW_MENU,
+ param_spec);
+ param_spec = g_param_spec_object
+ ("tools_menu" /* name */,
+ _("Tools Menu") /* nick */,
+ _("The tools menu of the application") /* blurb */,
+ G_TYPE_BOXED /* object_type */,
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (g_object_class,
+ PROP_TOOLS_MENU,
+ param_spec);
+ param_spec = g_param_spec_object
+ ("play_menu" /* name */,
+ _("Play Menu") /* nick */,
+ _("The palyback menu of the application") /* blurb */,
+ G_TYPE_BOXED /* object_type */,
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (g_object_class,
+ PROP_PLAY_MENU,
+ param_spec);
+ param_spec = g_param_spec_object
+ ("toolbar" /* name */,
+ _("Toolbar") /* nick */,
+ _("The main toolbar of the application") /* blurb */,
+ G_TYPE_BOXED /* object_type */,
+ (GParamFlags)(G_PARAM_READABLE));
+ g_object_class_install_property (g_object_class,
+ PROP_TOOLBAR,
+ param_spec);
+ }
+}
+#undef __GOB_FUNCTION__
+
+static void
+___object_set_property (GObject *object,
+ guint property_id,
+ const GValue *VAL G_GNUC_UNUSED,
+ GParamSpec *pspec G_GNUC_UNUSED)
+#define __GOB_FUNCTION__ "Maemo:Program::set_property"
+{
+ MaemoProgram *self G_GNUC_UNUSED;
+
+ self = MAEMO_PROGRAM (object);
+
+ switch (property_id) {
+ case PROP_NAME:
+ {
+#line 316 "maemo-program.gob"
+
+ self->app_name = g_value_get_object( VAL );
+
+#line 1335 "maemo-program.c"
+ }
+ break;
+ case PROP_MENU:
+ {
+#line 346 "maemo-program.gob"
+
+ self->main_menu = g_value_get_object( VAL );
+
+#line 1344 "maemo-program.c"
+ }
+ break;
+ case PROP_FILE_MENU:
+ {
+#line 363 "maemo-program.gob"
+
+ self->file_menu = g_value_get_object( VAL );
+
+#line 1353 "maemo-program.c"
+ }
+ break;
+ case PROP_EDIT_MENU:
+ {
+#line 380 "maemo-program.gob"
+
+ self->edit_menu = g_value_get_object( VAL );
+
+#line 1362 "maemo-program.c"
+ }
+ break;
+ case PROP_VIEW_MENU:
+ {
+#line 397 "maemo-program.gob"
+
+ self->view_menu = g_value_get_object( VAL );
+
+#line 1371 "maemo-program.c"
+ }
+ break;
+ case PROP_TOOLS_MENU:
+ {
+#line 414 "maemo-program.gob"
+
+ self->tools_menu = g_value_get_object( VAL );
+
+#line 1380 "maemo-program.c"
+ }
+ break;
+ case PROP_PLAY_MENU:
+ {
+#line 432 "maemo-program.gob"
+
+ self->play_menu = g_value_get_object( VAL );
+
+#line 1389 "maemo-program.c"
+ }
+ break;
+ default:
+/* Apparently in g++ this is needed, glib is b0rk */
+#ifndef __PRETTY_FUNCTION__
+# undef G_STRLOC
+# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__)
+#endif
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+#undef __GOB_FUNCTION__
+
+static void
+___object_get_property (GObject *object,
+ guint property_id,
+ GValue *VAL G_GNUC_UNUSED,
+ GParamSpec *pspec G_GNUC_UNUSED)
+#define __GOB_FUNCTION__ "Maemo:Program::get_property"
+{
+ MaemoProgram *self G_GNUC_UNUSED;
+
+ self = MAEMO_PROGRAM (object);
+
+ switch (property_id) {
+ case PROP_NAME:
+ {
+#line 319 "maemo-program.gob"
+
+ g_value_set_string( VAL, self->app_name );
+
+#line 1422 "maemo-program.c"
+ }
+ break;
+ case PROP_WINDOW:
+ {
+#line 332 "maemo-program.gob"
+
+ g_value_set_object( VAL, self->window );
+
+#line 1431 "maemo-program.c"
+ }
+ break;
+ case PROP_MENU:
+ {
+#line 349 "maemo-program.gob"
+
+ g_value_set_object( VAL, self->main_menu );
+
+#line 1440 "maemo-program.c"
+ }
+ break;
+ case PROP_FILE_MENU:
+ {
+#line 366 "maemo-program.gob"
+
+ g_value_set_object( VAL, self->file_menu );
+
+#line 1449 "maemo-program.c"
+ }
+ break;
+ case PROP_EDIT_MENU:
+ {
+#line 383 "maemo-program.gob"
+
+ g_value_set_object( VAL, self->edit_menu );
+
+#line 1458 "maemo-program.c"
+ }
+ break;
+ case PROP_VIEW_MENU:
+ {
+#line 400 "maemo-program.gob"
+
+ g_value_set_object( VAL, self->view_menu );
+
+#line 1467 "maemo-program.c"
+ }
+ break;
+ case PROP_TOOLS_MENU:
+ {
+#line 417 "maemo-program.gob"
+
+ g_value_set_object( VAL, self->tools_menu );
+
+#line 1476 "maemo-program.c"
+ }
+ break;
+ case PROP_PLAY_MENU:
+ {
+#line 435 "maemo-program.gob"
+
+ g_value_set_object( VAL, self->play_menu );
+
+#line 1485 "maemo-program.c"
+ }
+ break;
+ case PROP_TOOLBAR:
+ {
+#line 450 "maemo-program.gob"
+
+ g_value_set_object( VAL, self->toolbar );
+
+#line 1494 "maemo-program.c"
+ }
+ break;
+ default:
+/* Apparently in g++ this is needed, glib is b0rk */
+#ifndef __PRETTY_FUNCTION__
+# undef G_STRLOC
+# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__)
+#endif
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+#undef __GOB_FUNCTION__
+
+
+
+#line 319 "maemo-program.gob"
+gchar *
+maemo_program_get_name (MaemoProgram * self)
+#line 1514 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::get_name"
+{
+#line 310 "maemo-program.gob"
+ gchar* val; g_object_get (G_OBJECT (self), "name", &val, NULL); return val;
+}}
+#line 1521 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 316 "maemo-program.gob"
+void
+maemo_program_set_name (MaemoProgram * self, gchar * val)
+#line 1527 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_name"
+{
+#line 310 "maemo-program.gob"
+ g_object_set (G_OBJECT (self), "name", val, NULL);
+}}
+#line 1534 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 332 "maemo-program.gob"
+GObject *
+maemo_program_get_window (MaemoProgram * self)
+#line 1540 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::get_window"
+{
+#line 327 "maemo-program.gob"
+ GObject* val; g_object_get (G_OBJECT (self), "window", &val, NULL); return val;
+}}
+#line 1547 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 349 "maemo-program.gob"
+GObject *
+maemo_program_get_menu (MaemoProgram * self)
+#line 1553 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::get_menu"
+{
+#line 340 "maemo-program.gob"
+ GObject* val; g_object_get (G_OBJECT (self), "menu", &val, NULL); return val;
+}}
+#line 1560 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 346 "maemo-program.gob"
+void
+maemo_program_set_menu (MaemoProgram * self, GObject * val)
+#line 1566 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_menu"
+{
+#line 340 "maemo-program.gob"
+ g_object_set (G_OBJECT (self), "menu", val, NULL);
+}}
+#line 1573 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 366 "maemo-program.gob"
+GObject *
+maemo_program_get_file_menu (MaemoProgram * self)
+#line 1579 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::get_file_menu"
+{
+#line 357 "maemo-program.gob"
+ GObject* val; g_object_get (G_OBJECT (self), "file_menu", &val, NULL); return val;
+}}
+#line 1586 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 363 "maemo-program.gob"
+void
+maemo_program_set_file_menu (MaemoProgram * self, GObject * val)
+#line 1592 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_file_menu"
+{
+#line 357 "maemo-program.gob"
+ g_object_set (G_OBJECT (self), "file_menu", val, NULL);
+}}
+#line 1599 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 383 "maemo-program.gob"
+GObject *
+maemo_program_get_edit_menu (MaemoProgram * self)
+#line 1605 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::get_edit_menu"
+{
+#line 374 "maemo-program.gob"
+ GObject* val; g_object_get (G_OBJECT (self), "edit_menu", &val, NULL); return val;
+}}
+#line 1612 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 380 "maemo-program.gob"
+void
+maemo_program_set_edit_menu (MaemoProgram * self, GObject * val)
+#line 1618 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_edit_menu"
+{
+#line 374 "maemo-program.gob"
+ g_object_set (G_OBJECT (self), "edit_menu", val, NULL);
+}}
+#line 1625 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 400 "maemo-program.gob"
+GObject *
+maemo_program_get_view_menu (MaemoProgram * self)
+#line 1631 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::get_view_menu"
+{
+#line 391 "maemo-program.gob"
+ GObject* val; g_object_get (G_OBJECT (self), "view_menu", &val, NULL); return val;
+}}
+#line 1638 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 397 "maemo-program.gob"
+void
+maemo_program_set_view_menu (MaemoProgram * self, GObject * val)
+#line 1644 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_view_menu"
+{
+#line 391 "maemo-program.gob"
+ g_object_set (G_OBJECT (self), "view_menu", val, NULL);
+}}
+#line 1651 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 417 "maemo-program.gob"
+GObject *
+maemo_program_get_tools_menu (MaemoProgram * self)
+#line 1657 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::get_tools_menu"
+{
+#line 408 "maemo-program.gob"
+ GObject* val; g_object_get (G_OBJECT (self), "tools_menu", &val, NULL); return val;
+}}
+#line 1664 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 414 "maemo-program.gob"
+void
+maemo_program_set_tools_menu (MaemoProgram * self, GObject * val)
+#line 1670 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_tools_menu"
+{
+#line 408 "maemo-program.gob"
+ g_object_set (G_OBJECT (self), "tools_menu", val, NULL);
+}}
+#line 1677 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 435 "maemo-program.gob"
+GObject *
+maemo_program_get_play_menu (MaemoProgram * self)
+#line 1683 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::get_play_menu"
+{
+#line 426 "maemo-program.gob"
+ GObject* val; g_object_get (G_OBJECT (self), "play_menu", &val, NULL); return val;
+}}
+#line 1690 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 432 "maemo-program.gob"
+void
+maemo_program_set_play_menu (MaemoProgram * self, GObject * val)
+#line 1696 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_play_menu"
+{
+#line 426 "maemo-program.gob"
+ g_object_set (G_OBJECT (self), "play_menu", val, NULL);
+}}
+#line 1703 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 450 "maemo-program.gob"
+GObject *
+maemo_program_get_toolbar (MaemoProgram * self)
+#line 1709 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::get_toolbar"
+{
+#line 444 "maemo-program.gob"
+ GObject* val; g_object_get (G_OBJECT (self), "toolbar", &val, NULL); return val;
+}}
+#line 1716 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 458 "maemo-program.gob"
+void
+maemo_program_file_new (MaemoProgram * self, gpointer data)
+#line 1722 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 458 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 458 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 1734 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[FILE_NEW_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 464 "maemo-program.gob"
+void
+maemo_program_file_open (MaemoProgram * self, gpointer data)
+#line 1756 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 464 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 464 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 1768 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[FILE_OPEN_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 470 "maemo-program.gob"
+void
+maemo_program_file_save (MaemoProgram * self, gpointer data)
+#line 1790 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 470 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 470 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 1802 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[FILE_SAVE_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 476 "maemo-program.gob"
+void
+maemo_program_file_save_as (MaemoProgram * self, gpointer data)
+#line 1824 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 476 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 476 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 1836 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[FILE_SAVE_AS_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 482 "maemo-program.gob"
+void
+maemo_program_edit_undo (MaemoProgram * self, gpointer data)
+#line 1858 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 482 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 482 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 1870 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[EDIT_UNDO_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 488 "maemo-program.gob"
+void
+maemo_program_edit_redo (MaemoProgram * self, gpointer data)
+#line 1892 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 488 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 488 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 1904 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[EDIT_REDO_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 494 "maemo-program.gob"
+void
+maemo_program_edit_cut (MaemoProgram * self, gpointer data)
+#line 1926 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 494 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 494 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 1938 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[EDIT_CUT_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 494 "maemo-program.gob"
+static void
+___real_maemo_program_edit_cut (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 1959 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::edit_cut"
+{
+#line 497 "maemo-program.gob"
+
+ if ( self->buffer )
+ gtk_text_buffer_cut_clipboard( self->buffer,
+ self->clipboard, TRUE );
+ }}
+#line 1969 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 503 "maemo-program.gob"
+void
+maemo_program_edit_copy (MaemoProgram * self, gpointer data)
+#line 1975 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 503 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 503 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 1987 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[EDIT_COPY_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 503 "maemo-program.gob"
+static void
+___real_maemo_program_edit_copy (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 2008 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::edit_copy"
+{
+#line 506 "maemo-program.gob"
+
+ if ( self->buffer )
+ gtk_text_buffer_copy_clipboard( self->buffer,
+ self->clipboard );
+ }}
+#line 2018 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 512 "maemo-program.gob"
+void
+maemo_program_edit_paste (MaemoProgram * self, gpointer data)
+#line 2024 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 512 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 512 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2036 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[EDIT_PASTE_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 512 "maemo-program.gob"
+static void
+___real_maemo_program_edit_paste (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 2057 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::edit_paste"
+{
+#line 515 "maemo-program.gob"
+
+ if ( self->buffer )
+ gtk_text_buffer_paste_clipboard( self->buffer,
+ self->clipboard,
+ NULL, TRUE );
+ }}
+#line 2068 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 522 "maemo-program.gob"
+void
+maemo_program_edit_select_all (MaemoProgram * self, gpointer data)
+#line 2074 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 522 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 522 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2086 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[EDIT_SELECT_ALL_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 528 "maemo-program.gob"
+void
+maemo_program_view_full_screen (MaemoProgram * self, gpointer data)
+#line 2108 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 528 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 528 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2120 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[VIEW_FULL_SCREEN_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 528 "maemo-program.gob"
+static void
+___real_maemo_program_view_full_screen (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 2141 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::view_full_screen"
+{
+#line 531 "maemo-program.gob"
+
+ self->full_screen_mode = ! self->full_screen_mode;
+
+ if ( self->full_screen_mode ) {
+ gtk_window_fullscreen( GTK_WINDOW( self->window ) );
+ } else {
+ gtk_window_unfullscreen( GTK_WINDOW( self->window ) );
+ }
+ }}
+#line 2155 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 541 "maemo-program.gob"
+void
+maemo_program_play (MaemoProgram * self, gpointer data)
+#line 2161 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 541 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 541 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2173 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[PLAY_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 547 "maemo-program.gob"
+void
+maemo_program_play_stop (MaemoProgram * self, gpointer data)
+#line 2195 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 547 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 547 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2207 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[PLAY_STOP_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 553 "maemo-program.gob"
+void
+maemo_program_play_previous (MaemoProgram * self, gpointer data)
+#line 2229 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 553 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 553 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2241 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[PLAY_PREVIOUS_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 559 "maemo-program.gob"
+void
+maemo_program_play_next (MaemoProgram * self, gpointer data)
+#line 2263 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 559 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 559 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2275 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[PLAY_NEXT_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 565 "maemo-program.gob"
+void
+maemo_program_mute (MaemoProgram * self, gpointer data)
+#line 2297 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 565 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 565 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2309 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[MUTE_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 571 "maemo-program.gob"
+void
+maemo_program_tools_settings (MaemoProgram * self, gpointer data)
+#line 2331 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 571 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 571 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2343 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[TOOLS_SETTINGS_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 577 "maemo-program.gob"
+void
+maemo_program_close (MaemoProgram * self, gpointer data)
+#line 2365 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 577 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 577 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2377 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[CLOSE_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 577 "maemo-program.gob"
+static void
+___real_maemo_program_close (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 2398 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::close"
+{
+#line 580 "maemo-program.gob"
+
+ gtk_main_quit();
+ }}
+#line 2406 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 589 "maemo-program.gob"
+void
+maemo_program_zoom_level_changed (MaemoProgram * self, gpointer data)
+#line 2412 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 589 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 589 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2424 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[ZOOM_LEVEL_CHANGED_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 589 "maemo-program.gob"
+static void
+___real_maemo_program_zoom_level_changed (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 2445 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::zoom_level_changed"
+{
+#line 592 "maemo-program.gob"
+
+ GString *str;
+
+ str = g_string_new( _("Zooming to ") );
+ g_string_append_printf( str, "%d%%", self->zoom_level );
+
+ hildon_banner_show_information( GTK_WIDGET( self->window ), NULL,
+ str->str );
+ g_string_free( str, TRUE );
+ }}
+#line 2460 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 603 "maemo-program.gob"
+void
+maemo_program_max_zoom_level_reached (MaemoProgram * self, gpointer data)
+#line 2466 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 603 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 603 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2478 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[MAX_ZOOM_LEVEL_REACHED_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 603 "maemo-program.gob"
+static void
+___real_maemo_program_max_zoom_level_reached (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 2499 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::max_zoom_level_reached"
+{
+#line 606 "maemo-program.gob"
+
+ hildon_banner_show_information( GTK_WIDGET( self->window ), NULL,
+ _("Maximum Zoom Level Reached") );
+ }}
+#line 2508 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 611 "maemo-program.gob"
+void
+maemo_program_min_zoom_level_reached (MaemoProgram * self, gpointer data)
+#line 2514 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 611 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 611 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2526 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[MIN_ZOOM_LEVEL_REACHED_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 611 "maemo-program.gob"
+static void
+___real_maemo_program_min_zoom_level_reached (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 2547 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::min_zoom_level_reached"
+{
+#line 614 "maemo-program.gob"
+
+ hildon_banner_show_information( GTK_WIDGET( self->window ), NULL,
+ _("Minimum Zoom Level Reached") );
+ }}
+#line 2556 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 619 "maemo-program.gob"
+void
+maemo_program_hw_key_zoom_in (MaemoProgram * self, gpointer data)
+#line 2562 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 619 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 619 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2574 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_ZOOM_IN_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 619 "maemo-program.gob"
+static void
+___real_maemo_program_hw_key_zoom_in (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 2595 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::hw_key_zoom_in"
+{
+#line 622 "maemo-program.gob"
+
+ if ( self->zoom_level == self->max_zoom_level ) {
+ self_max_zoom_level_reached( self, data );
+ } else {
+ int i;
+
+ for ( i = 0; self->zoom_level_range[i]; i++ ) {
+ if ( self->zoom_level == self->zoom_level_range[i] ) {
+ g_assert( self->zoom_level_range[i + 1] );
+ self->zoom_level= self->zoom_level_range[i+1];
+ self_zoom_level_changed( self, data );
+ break;
+ }
+ }
+ g_assert( self->zoom_level_range[i] );
+ }
+ }}
+#line 2617 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 640 "maemo-program.gob"
+void
+maemo_program_hw_key_zoom_out (MaemoProgram * self, gpointer data)
+#line 2623 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 640 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 640 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2635 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_ZOOM_OUT_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 640 "maemo-program.gob"
+static void
+___real_maemo_program_hw_key_zoom_out (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 2656 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::hw_key_zoom_out"
+{
+#line 643 "maemo-program.gob"
+
+ if ( self->zoom_level == self->min_zoom_level ) {
+ self_min_zoom_level_reached( self, data );
+ } else {
+ int i;
+
+ for ( i = 0; self->zoom_level_range[i]; i++ ) {
+ if ( self->zoom_level == self->zoom_level_range[i] ) {
+ g_assert( i > 0 );
+ self->zoom_level= self->zoom_level_range[i-1];
+ self_zoom_level_changed( self, data );
+ break;
+ }
+ }
+ g_assert( self->zoom_level_range[i] );
+ }
+ }}
+#line 2678 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 661 "maemo-program.gob"
+void
+maemo_program_hw_key_full_screen (MaemoProgram * self, gpointer data)
+#line 2684 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 661 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 661 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2696 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_FULL_SCREEN_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 661 "maemo-program.gob"
+static void
+___real_maemo_program_hw_key_full_screen (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 2717 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::hw_key_full_screen"
+{
+#line 664 "maemo-program.gob"
+
+ self_view_full_screen( self, data );
+ }}
+#line 2725 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 672 "maemo-program.gob"
+void
+maemo_program_hw_key_up (MaemoProgram * self, gpointer data)
+#line 2731 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 672 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 672 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2743 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_UP_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 678 "maemo-program.gob"
+void
+maemo_program_hw_key_down (MaemoProgram * self, gpointer data)
+#line 2765 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 678 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 678 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2777 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_DOWN_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 684 "maemo-program.gob"
+void
+maemo_program_hw_key_left (MaemoProgram * self, gpointer data)
+#line 2799 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 684 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 684 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2811 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_LEFT_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 690 "maemo-program.gob"
+void
+maemo_program_hw_key_right (MaemoProgram * self, gpointer data)
+#line 2833 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 690 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 690 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2845 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_RIGHT_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 696 "maemo-program.gob"
+void
+maemo_program_hw_key_select (MaemoProgram * self, gpointer data)
+#line 2867 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 696 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 696 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2879 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_SELECT_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 707 "maemo-program.gob"
+void
+maemo_program_hw_key_close (MaemoProgram * self, gpointer data)
+#line 2901 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 707 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 707 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2913 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_CLOSE_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+#line 707 "maemo-program.gob"
+static void
+___real_maemo_program_hw_key_close (MaemoProgram * self G_GNUC_UNUSED, gpointer data)
+#line 2934 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::hw_key_close"
+{
+#line 710 "maemo-program.gob"
+
+ self_close( self, data );
+ }}
+#line 2942 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 714 "maemo-program.gob"
+void
+maemo_program_hw_key_menu (MaemoProgram * self, gpointer data)
+#line 2948 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 714 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 714 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2960 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_MENU_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 720 "maemo-program.gob"
+void
+maemo_program_hw_key_home (MaemoProgram * self, gpointer data)
+#line 2982 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 720 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 720 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 2994 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_HOME_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 726 "maemo-program.gob"
+void
+maemo_program_hw_key_power (MaemoProgram * self, gpointer data)
+#line 3016 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 726 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 726 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 3028 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_POWER_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 732 "maemo-program.gob"
+void
+maemo_program_hw_key_other (MaemoProgram * self, gpointer data)
+#line 3050 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 732 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 732 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 3062 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[HW_KEY_OTHER_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 742 "maemo-program.gob"
+void
+maemo_program_state_shutdown (MaemoProgram * self, gpointer data)
+#line 3084 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 742 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 742 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 3096 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[STATE_SHUTDOWN_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 748 "maemo-program.gob"
+void
+maemo_program_state_memory_low (MaemoProgram * self, gpointer data)
+#line 3118 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 748 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 748 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 3130 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[STATE_MEMORY_LOW_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 754 "maemo-program.gob"
+void
+maemo_program_state_save_unsaved_data (MaemoProgram * self, gpointer data)
+#line 3152 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 754 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 754 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 3164 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[STATE_SAVE_UNSAVED_DATA_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 760 "maemo-program.gob"
+void
+maemo_program_state_system_inactivity (MaemoProgram * self, gpointer data)
+#line 3186 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 760 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 760 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 3198 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[STATE_SYSTEM_INACTIVITY_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 766 "maemo-program.gob"
+void
+maemo_program_state_normal_mode (MaemoProgram * self, gpointer data)
+#line 3220 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 766 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 766 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 3232 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[STATE_NORMAL_MODE_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 772 "maemo-program.gob"
+void
+maemo_program_state_flight_mode (MaemoProgram * self, gpointer data)
+#line 3254 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 772 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 772 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 3266 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[STATE_FLIGHT_MODE_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 778 "maemo-program.gob"
+void
+maemo_program_state_other (MaemoProgram * self, gpointer data)
+#line 3288 "maemo-program.c"
+{
+ GValue ___param_values[2];
+ GValue ___return_val;
+
+memset (&___return_val, 0, sizeof (___return_val));
+memset (&___param_values, 0, sizeof (___param_values));
+
+#line 778 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 778 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 3300 "maemo-program.c"
+
+ ___param_values[0].g_type = 0;
+ g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
+ g_value_set_instance (&___param_values[0], (gpointer) self);
+
+ ___param_values[1].g_type = 0;
+ g_value_init (&___param_values[1], G_TYPE_OBJECT);
+ g_value_set_object (&___param_values[1], (GObject *) data);
+
+ g_signal_emitv (___param_values,
+ object_signals[STATE_OTHER_SIGNAL],
+ 0 /* detail */,
+ &___return_val);
+
+ g_value_unset (&___param_values[0]);
+ g_value_unset (&___param_values[1]);
+}
+
+#line 804 "maemo-program.gob"
+static gboolean
+maemo_program_hw_key_press_cb (GtkWidget * widget, GdkEventKey * event, MaemoProgram * o)
+#line 3322 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::hw_key_press_cb"
+{
+#line 806 "maemo-program.gob"
+
+ switch ( event->keyval ) {
+ case GDK_Up: /* Navigation key up */
+ self_hw_key_up( o, o );
+ return TRUE;
+ case GDK_Down: /* Navigation key down */
+ self_hw_key_down( o, o );
+ return TRUE;
+ case GDK_Left: /* Navigation key left */
+ self_hw_key_left( o, o );
+ return TRUE;
+ case GDK_Right: /* Navigation key right */
+ self_hw_key_right( o, o );
+ return TRUE;
+ case GDK_Return: /* Navigation key select */
+ self_hw_key_select( o, o );
+ return TRUE;
+ case GDK_F6: /* Full screen */
+ self_hw_key_full_screen( o, o );
+ return TRUE;
+ case GDK_F7: /* Increase zoom level */
+ self_hw_key_zoom_in( o, o );
+ return TRUE;
+ case GDK_F8: /* Decrease zoom level */
+ self_hw_key_zoom_out( o, o );
+ return TRUE;
+ case GDK_Escape: /* Cancel/Close button */
+ self_hw_key_close( o, o );
+ return TRUE;
+ case GDK_F4:
+ self_hw_key_menu( o, o );
+ return TRUE;
+ case GDK_F5:
+ self_hw_key_home( o, o );
+ return TRUE;
+ case GDK_Execute:
+ self_hw_key_power( o, o );
+ return TRUE;
+ }
+ self_hw_key_other( o, o );
+
+ return FALSE;
+ }}
+#line 3370 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 859 "maemo-program.gob"
+static void
+maemo_program_hw_event_handler (osso_hw_state_t * state, MaemoProgram * program)
+#line 3376 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::hw_event_handler"
+{
+#line 861 "maemo-program.gob"
+
+ gboolean flag = FALSE;
+
+ if ( state->shutdown_ind ) {
+ self_state_shutdown( program, program );
+ flag = TRUE;
+ }
+ if ( state->memory_low_ind ) {
+ self_state_memory_low( program, program );
+ flag = TRUE;
+ }
+ if ( state->save_unsaved_data_ind ) {
+ self_state_save_unsaved_data( program, program );
+ flag = TRUE;
+ }
+ if ( state->system_inactivity_ind ) {
+ self_state_system_inactivity( program, program );
+ flag = TRUE;
+ }
+
+ /* Check if device mode has not been initialized. */
+ if ( program->device_mode == OSSO_DEVMODE_INVALID ) {
+ program->device_mode = state->sig_device_mode_ind;
+ }
+
+ if ( !flag || state->sig_device_mode_ind != program->device_mode ) {
+ switch ( state->sig_device_mode_ind ) {
+ case OSSO_DEVMODE_NORMAL :
+ self_state_normal_mode( program, program );
+ flag = TRUE;
+ break;
+ case OSSO_DEVMODE_FLIGHT :
+ self_state_flight_mode( program, program );
+ flag = TRUE;
+ break;
+ default :
+ break;
+ }
+ }
+
+ if ( ! flag ) {
+ self_state_other( program, program );
+ }
+ }}
+#line 3425 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 909 "maemo-program.gob"
+static void
+maemo_program_cb_file_new (GtkAction * action, MaemoProgram * self)
+#line 3431 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_file_new"
+{
+#line 911 "maemo-program.gob"
+
+ self_file_new( self, self );
+ }}
+#line 3439 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 918 "maemo-program.gob"
+static void
+maemo_program_cb_file_open (GtkAction * action, MaemoProgram * self)
+#line 3445 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_file_open"
+{
+#line 920 "maemo-program.gob"
+
+ self_file_open( self, self );
+ }}
+#line 3453 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 927 "maemo-program.gob"
+static void
+maemo_program_cb_file_save (GtkAction * action, MaemoProgram * self)
+#line 3459 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_file_save"
+{
+#line 929 "maemo-program.gob"
+
+ self_file_save( self, self );
+ }}
+#line 3467 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 936 "maemo-program.gob"
+static void
+maemo_program_cb_file_save_as (GtkAction * action, MaemoProgram * self)
+#line 3473 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_file_save_as"
+{
+#line 938 "maemo-program.gob"
+
+ self_file_save_as( self, self );
+ }}
+#line 3481 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 945 "maemo-program.gob"
+static void
+maemo_program_cb_edit_undo (GtkAction * action, MaemoProgram * self)
+#line 3487 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_edit_undo"
+{
+#line 947 "maemo-program.gob"
+
+ self_edit_undo( self, self );
+ }}
+#line 3495 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 954 "maemo-program.gob"
+static void
+maemo_program_cb_edit_redo (GtkAction * action, MaemoProgram * self)
+#line 3501 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_edit_redo"
+{
+#line 956 "maemo-program.gob"
+
+ self_edit_redo( self, self );
+ }}
+#line 3509 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 963 "maemo-program.gob"
+static void
+maemo_program_cb_edit_cut (GtkAction * action, MaemoProgram * self)
+#line 3515 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_edit_cut"
+{
+#line 965 "maemo-program.gob"
+
+ self_edit_cut( self, self );
+ }}
+#line 3523 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 972 "maemo-program.gob"
+static void
+maemo_program_cb_edit_copy (GtkAction * action, MaemoProgram * self)
+#line 3529 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_edit_copy"
+{
+#line 974 "maemo-program.gob"
+
+ self_edit_copy( self, self );
+ }}
+#line 3537 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 981 "maemo-program.gob"
+static void
+maemo_program_cb_edit_paste (GtkAction * action, MaemoProgram * self)
+#line 3543 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_edit_paste"
+{
+#line 983 "maemo-program.gob"
+
+ self_edit_paste( self, self );
+ }}
+#line 3551 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 990 "maemo-program.gob"
+static void
+maemo_program_cb_edit_select_all (GtkAction * action, MaemoProgram * self)
+#line 3557 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_edit_select_all"
+{
+#line 992 "maemo-program.gob"
+
+ self_edit_select_all( self, self );
+ }}
+#line 3565 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 999 "maemo-program.gob"
+static void
+maemo_program_cb_view_full_screen (GtkAction * action, MaemoProgram * self)
+#line 3571 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_view_full_screen"
+{
+#line 1001 "maemo-program.gob"
+
+ self_view_full_screen( self, self );
+ }}
+#line 3579 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1008 "maemo-program.gob"
+static void
+maemo_program_cb_tools_settings (GtkAction * action, MaemoProgram * self)
+#line 3585 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_tools_settings"
+{
+#line 1010 "maemo-program.gob"
+
+ self_tools_settings( self, self );
+ }}
+#line 3593 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1017 "maemo-program.gob"
+static void
+maemo_program_cb_about (GtkAction * action, MaemoProgram * self)
+#line 3599 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_about"
+{
+#line 1019 "maemo-program.gob"
+
+ GtkAboutDialog *about;
+
+ about = gtk_about_dialog_new();
+ if ( self->about_copyright )
+ gtk_about_dialog_set_copyright( about,
+ self->about_copyright );
+ if ( self->about_comments )
+ gtk_about_dialog_set_comments( about,
+ self->about_comments );
+ if ( self->about_license )
+ gtk_about_dialog_set_license( about, self->about_license );
+ if ( self->about_website )
+ gtk_about_dialog_set_website( about, self->about_website );
+ if ( self->about_website_label )
+ gtk_about_dialog_set_website_label( about,
+ self->about_website_label);
+ if ( self->about_authors )
+ gtk_about_dialog_set_authors( about, self->about_authors );
+ if ( self->about_artists )
+ gtk_about_dialog_set_artists( about, self->about_artists );
+ if ( self->about_documenters )
+ gtk_about_dialog_set_documenters( about,
+ self->about_documenters );
+ if ( self->about_translators )
+ gtk_about_dialog_set_translator_credits( about,
+ self->about_translators );
+ gtk_about_dialog_set_logo_icon_name( about, self->about_logo );
+
+ gtk_dialog_run( (GtkDialog *) about );
+ gtk_widget_destroy( (GtkWidget *) about );
+ }}
+#line 3636 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1055 "maemo-program.gob"
+static void
+maemo_program_cb_play_play (GtkAction * action, MaemoProgram * self)
+#line 3642 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_play_play"
+{
+#line 1057 "maemo-program.gob"
+
+ self_play( self, self );
+ }}
+#line 3650 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1064 "maemo-program.gob"
+static void
+maemo_program_cb_play_stop (GtkAction * action, MaemoProgram * self)
+#line 3656 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_play_stop"
+{
+#line 1066 "maemo-program.gob"
+
+ self_play_stop( self, self );
+ }}
+#line 3664 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1073 "maemo-program.gob"
+static void
+maemo_program_cb_play_previous (GtkAction * action, MaemoProgram * self)
+#line 3670 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_play_previous"
+{
+#line 1075 "maemo-program.gob"
+
+ self_play_previous( self, self );
+ }}
+#line 3678 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1082 "maemo-program.gob"
+static void
+maemo_program_cb_play_next (GtkAction * action, MaemoProgram * self)
+#line 3684 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_play_next"
+{
+#line 1084 "maemo-program.gob"
+
+ self_play_next( self, self );
+ }}
+#line 3692 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1091 "maemo-program.gob"
+static void
+maemo_program_cb_play_mute (GtkAction * action, MaemoProgram * self)
+#line 3698 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_play_mute"
+{
+#line 1093 "maemo-program.gob"
+
+ self_mute( self, self );
+ }}
+#line 3706 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1102 "maemo-program.gob"
+static void
+maemo_program_cb_close (GtkAction * action, MaemoProgram * self)
+#line 3712 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_close"
+{
+#line 1104 "maemo-program.gob"
+
+ self_close( self, self );
+ }}
+#line 3720 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1111 "maemo-program.gob"
+static void
+maemo_program_cb_help (GtkAction * action, MaemoProgram * self)
+#line 3726 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::cb_help"
+{
+#line 1113 "maemo-program.gob"
+
+ osso_return_t retval;
+
+#if HAVE_MAEMO_SCIROCCO || HAVE_MAEMO_BORA
+ retval = ossohelp_show( self->osso_context, self->help_topic_id,
+ OSSO_HELP_SHOW_DIALOG );
+#else
+ retval = hildon_help_show( self->osso_context, self->help_topic_id,
+ HILDON_HELP_SHOW_DIALOG );
+#endif
+
+ if ( retval == OSSO_ERROR ) {
+ g_warning( "Help: Cannot find content for such topic (%s).",
+ self->help_topic_id );
+ } else if ( retval == OSSO_RPC_ERROR ) {
+ g_warning( "Help: Unable to contact HelpApp or Browser" );
+ } else if ( retval == OSSO_INVALID )
+ g_warning( "Help: Param not formal right" );
+ }}
+#line 3750 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1152 "maemo-program.gob"
+static void
+maemo_program_initialize (MaemoProgram * self, gchar * service_name, int argc, char * argv[])
+#line 3756 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::initialize"
+#line 1152 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 1152 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 3763 "maemo-program.c"
+{
+#line 1154 "maemo-program.gob"
+
+ static gint levels[] = { 80, 100, 120, 150, 200, 0 };
+ int result;
+
+
+ /* Check that we are not root. */
+ g_assert( getuid() > 0 );
+
+ /* Set default zoom level, 100% */
+ self->zoom_level = 100;
+ self->zoom_level_range = levels;
+ self->max_zoom_level = levels[4];
+ self->min_zoom_level = levels[0];
+ self->full_screen_mode = FALSE;
+
+ /* Gettext initializations. */
+ bindtextdomain( GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR );
+ bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" );
+ textdomain( GETTEXT_PACKAGE );
+
+ /* Gtk initializations. */
+ gtk_set_locale();
+ gtk_init( &argc, &argv );
+
+ /* Hildon initializations. */
+ self->program = HILDON_PROGRAM( hildon_program_get_instance() );
+ g_set_application_name( self->app_name );
+
+ /* Libosso initialize. */
+ self->osso_context = osso_initialize( service_name, VERSION, TRUE,
+ NULL );
+ g_assert( self->osso_context != NULL );
+ self->device_mode = OSSO_DEVMODE_INVALID; /* Initial value */
+
+ /* Setup callbacks for the hardware state messages. */
+ result = osso_hw_set_event_cb( self->osso_context, NULL,
+ (osso_hw_cb_f *) self_hw_event_handler,
+ (gpointer) self );
+ g_assert( result == OSSO_OK );
+
+ /* Load GConf settings. */
+ self->gc_client = gconf_client_get_default();
+ g_assert( self->gc_client != NULL );
+
+ /* Setup directories. */
+ add_pixmap_directory( PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps" );
+
+ /* Setup the clipboard. */
+ self->clipboard = gtk_clipboard_get( GDK_SELECTION_CLIPBOARD );
+ gtk_clipboard_set_can_store( self->clipboard, NULL, 0 );
+ }}
+#line 3817 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1212 "maemo-program.gob"
+static void
+maemo_program_set_window (MaemoProgram * self, HildonWindow * window, GtkMenu * menu)
+#line 3823 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_window"
+#line 1212 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 1212 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 3830 "maemo-program.c"
+{
+#line 1214 "maemo-program.gob"
+
+ g_assert( self->program != NULL );
+ g_assert( window != NULL );
+
+ /* The main application window handling. */
+ self->window = window;
+ gtk_widget_show( GTK_WIDGET( self->window ) );
+ hildon_program_add_window( self->program, self->window );
+
+ /* Connect default signal handlers. */
+ gtk_signal_connect( G_OBJECT( self->window ), "delete_event",
+ gtk_main_quit, NULL );
+ g_signal_connect( G_OBJECT( self->window ), "key_press_event",
+ G_CALLBACK( self_hw_key_press_cb ) , self );
+
+ /* Set up the menu */
+ if ( menu != NULL ) {
+ gtk_widget_show( GTK_WIDGET( menu ) );
+ self->main_menu = menu;
+ hildon_window_set_menu( self->window, self->main_menu );
+ }
+ }}
+#line 3855 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1241 "maemo-program.gob"
+static GtkWidget *
+maemo_program_add_toolbar_item (MaemoProgram * self, gchar * stock, gpointer cb)
+#line 3861 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::add_toolbar_item"
+{
+#line 1243 "maemo-program.gob"
+
+ GtkToolItem *button;
+
+ button = gtk_tool_button_new_from_stock( stock );
+ g_assert( button != NULL );
+ gtk_toolbar_insert( self->toolbar, button, -1 );
+ g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( cb ),
+ self );
+
+ return (GtkWidget *) button;
+ }}
+#line 3877 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1259 "maemo-program.gob"
+static void
+maemo_program_create_toolbar (MaemoProgram * o, MaemoMenuStructure * menu_structure)
+#line 3883 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::create_toolbar"
+{
+#line 1261 "maemo-program.gob"
+
+ MaemoSubMenuMask menus;
+
+ if ( menu_structure == NULL ) {
+ menus = MaemoMenuStandard;
+ } else {
+ menus = menu_structure->submenus;
+ }
+ o->toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
+ gtk_toolbar_set_orientation( o->toolbar, GTK_ORIENTATION_HORIZONTAL );
+ gtk_toolbar_set_style( o->toolbar, GTK_TOOLBAR_BOTH_HORIZ );
+
+ if ( menus & MaemoMenuFile ) {
+ if ( menu_structure->file_menu & MaemoFileMenuNew )
+ self_add_toolbar_item( o, GTK_STOCK_NEW,
+ self_cb_file_new );
+ if ( menu_structure->file_menu & MaemoFileMenuOpen )
+ self_add_toolbar_item( o, GTK_STOCK_OPEN,
+ self_cb_file_open );
+ if ( menu_structure->file_menu & MaemoFileMenuSave )
+ self_add_toolbar_item( o, GTK_STOCK_SAVE,
+ self_cb_file_save );
+ }
+ if ( menus & MaemoMenuEdit ) {
+ if ( menu_structure->edit_menu & MaemoEditMenuUndo ) {
+ o->button_undo = self_add_toolbar_item
+ ( o, GTK_STOCK_UNDO, self_cb_edit_undo );
+ gtk_widget_set_sensitive( o->button_undo, FALSE );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuRedo ) {
+ o->button_redo = self_add_toolbar_item
+ ( o, GTK_STOCK_REDO, self_cb_edit_redo );
+ gtk_widget_set_sensitive( o->button_redo, FALSE );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuCut ) {
+ o->button_cut = self_add_toolbar_item
+ ( o, GTK_STOCK_CUT, self_cb_edit_cut );
+ gtk_widget_set_sensitive( o->button_cut, FALSE );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuCopy ) {
+ o->button_copy = self_add_toolbar_item
+ ( o, GTK_STOCK_COPY, self_cb_edit_copy );
+ gtk_widget_set_sensitive( o->button_copy, FALSE );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuPaste ) {
+ o->button_paste = self_add_toolbar_item
+ ( o, GTK_STOCK_PASTE, self_cb_edit_paste );
+ gtk_widget_set_sensitive( o->button_paste, FALSE );
+ }
+ } else {
+ o->button_cut = NULL;
+ o->button_copy = NULL;
+ o->button_paste = NULL;
+ }
+ if ( menus & MaemoMenuPlay ) {
+ if ( menu_structure->play_menu & MaemoPlayMenuPlay )
+ o->button_play = self_add_toolbar_item
+ (o, GTK_STOCK_MEDIA_PLAY, self_cb_play_play );
+ if ( menu_structure->play_menu & MaemoPlayMenuStop )
+ o->button_stop = self_add_toolbar_item
+ (o, GTK_STOCK_MEDIA_STOP, self_cb_play_stop );
+ if ( menu_structure->play_menu & MaemoPlayMenuPrevious )
+ o->button_prev = self_add_toolbar_item
+ (o, GTK_STOCK_MEDIA_PREVIOUS,
+ self_cb_play_previous );
+ if ( menu_structure->play_menu & MaemoPlayMenuNext )
+ o->button_next = self_add_toolbar_item
+ (o, GTK_STOCK_MEDIA_NEXT, self_cb_play_next );
+ } else {
+ o->button_play = NULL;
+ o->button_stop = NULL;
+ o->button_prev = NULL;
+ o->button_next = NULL;
+ o->button_mute = NULL;
+ }
+ self_add_toolbar_item( o, GTK_STOCK_ZOOM_FIT, (gpointer)
+ self_cb_view_full_screen );
+ self_add_toolbar_item( o, GTK_STOCK_HELP, (gpointer) self_cb_help );
+
+ /* Add toolbar to the Hildon window. */
+ hildon_window_add_toolbar( o->window, o->toolbar );
+
+ gtk_widget_show_all( GTK_WIDGET( o->toolbar ) );
+ gtk_widget_show_all( GTK_WIDGET( o->window ) );
+ }}
+#line 3973 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1350 "maemo-program.gob"
+static GtkWidget *
+maemo_program_add_menu_item (MaemoProgram * self, GtkMenu * menu, gchar * label, gpointer cb)
+#line 3979 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::add_menu_item"
+{
+#line 1352 "maemo-program.gob"
+
+ GtkWidget *widget;
+
+ if ( label == NULL )
+ widget = gtk_separator_menu_item_new();
+ else {
+ widget = gtk_menu_item_new_with_label( label );
+ g_assert( widget != NULL );
+ g_signal_connect( G_OBJECT( widget ), "activate",
+ G_CALLBACK( cb ), self );
+ }
+ gtk_widget_show( widget );
+ gtk_menu_append( menu, widget );
+
+ return widget;
+ }}
+#line 4000 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1373 "maemo-program.gob"
+static void
+maemo_program_create_menu (MaemoProgram * o, MaemoMenuStructure * menu_structure)
+#line 4006 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::create_menu"
+{
+#line 1375 "maemo-program.gob"
+
+ MaemoSubMenuMask menus;
+ o->main_menu = GTK_MENU( gtk_menu_new() );
+
+ if ( menu_structure == NULL ) {
+ menus = MaemoMenuStandard;
+ } else {
+ menus = menu_structure->submenus;
+ }
+
+ if ( menus & MaemoMenuFile ) {
+ GtkWidget *widget;
+
+ /* Create 'File' Submenu. */
+ o->file_menu = GTK_MENU( gtk_menu_new() );
+ if ( menu_structure->file_menu & MaemoFileMenuNew )
+ self_add_menu_item( o, o->file_menu, _("New"),
+ self_cb_file_open );
+ if ( menu_structure->file_menu & MaemoFileMenuOpen )
+ self_add_menu_item( o, o->file_menu, _("Open..."),
+ self_cb_file_open );
+ if ( menu_structure->file_menu & MaemoFileMenuSave )
+ self_add_menu_item( o, o->file_menu, _("Save"),
+ self_cb_file_save );
+ if ( menu_structure->file_menu & MaemoFileMenuSaveAs )
+ self_add_menu_item( o, o->file_menu, _("Save As..."),
+ self_cb_file_save_as );
+ if ( menu_structure->first_submenu_name == NULL )
+ widget = gtk_menu_item_new_with_label( _("File") );
+ else
+ widget = gtk_menu_item_new_with_label
+ ( menu_structure->first_submenu_name );
+ gtk_menu_append( o->main_menu, widget );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( widget ),
+ GTK_WIDGET( o->file_menu ) );
+ } else
+ o->file_menu = NULL;
+ if ( menus & MaemoMenuEdit ) {
+ GtkWidget *widget;
+
+ /* Create 'Edit' Submenu. */
+ o->edit_menu = GTK_MENU( gtk_menu_new() );
+ if ( menu_structure->edit_menu & MaemoEditMenuUndo ) {
+ o->widget_undo = self_add_menu_item
+ ( o, o->edit_menu, _("Undo"),
+ self_cb_edit_undo );
+ gtk_widget_set_sensitive( o->widget_undo, FALSE );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuRedo ) {
+ o->widget_redo = self_add_menu_item
+ ( o, o->edit_menu, _("Redo"),
+ self_cb_edit_redo );
+ gtk_widget_set_sensitive( o->widget_redo, FALSE );
+ self_add_menu_item( o, o->edit_menu, NULL, NULL );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuCut )
+ o->widget_cut = self_add_menu_item
+ ( o, o->edit_menu, _("Cut"),
+ self_cb_edit_cut );
+ if ( menu_structure->edit_menu & MaemoEditMenuCopy )
+ o->widget_copy = self_add_menu_item
+ ( o, o->edit_menu, _("Copy"),
+ self_cb_edit_copy );
+ if ( menu_structure->edit_menu & MaemoEditMenuPaste )
+ o->widget_paste = self_add_menu_item
+ ( o, o->edit_menu, _("Paste"), self_cb_edit_paste );
+ if ( menu_structure->edit_menu & MaemoEditMenuSelectAll )
+ o->widget_select_all = self_add_menu_item
+ ( o, o->edit_menu, _("Select All"),
+ self_cb_edit_select_all );
+ widget = gtk_menu_item_new_with_label( _("Edit") );
+ gtk_menu_append( o->main_menu, widget );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( widget ),
+ GTK_WIDGET( o->edit_menu ) );
+
+ /* Set insensitive until text_buffer is set. */
+ gtk_widget_set_sensitive( o->widget_cut, FALSE );
+ gtk_widget_set_sensitive( o->widget_copy, FALSE );
+ gtk_widget_set_sensitive( o->widget_paste, FALSE );
+ gtk_widget_set_sensitive( o->widget_select_all, FALSE );
+ } else {
+ o->edit_menu = NULL;
+ o->widget_undo = NULL;
+ o->widget_redo = NULL;
+ o->widget_cut = NULL;
+ o->widget_copy = NULL;
+ o->widget_paste = NULL;
+ o->widget_select_all = NULL;
+ }
+ if ( menus & MaemoMenuView ) {
+ GtkWidget *widget;
+
+ /* Create 'View' Submenu. */
+ o->view_menu = GTK_MENU( gtk_menu_new() );
+ self_add_menu_item( o, o->view_menu, _("Full Screen"),
+ self_cb_view_full_screen );
+ widget = gtk_menu_item_new_with_label( _("View") );
+ gtk_menu_append( o->main_menu, widget );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( widget ),
+ GTK_WIDGET( o->view_menu ) );
+ } else {
+ /* Otherwise, just add full screen menu item to main menu. */
+ self_add_menu_item( o, o->main_menu, _("Full Screen"),
+ self_cb_view_full_screen );
+ o->view_menu = NULL;
+ }
+ if ( menus & MaemoMenuPlay ) {
+ GtkWidget *widget;
+
+ /* Create 'Play' Submenu. */
+ o->play_menu = GTK_MENU( gtk_menu_new() );
+ if ( menu_structure->play_menu & MaemoPlayMenuPlay )
+ o->widget_play = self_add_menu_item
+ ( o, o->play_menu, _("Play"),
+ self_cb_play_play );
+ if ( menu_structure->play_menu & MaemoPlayMenuStop ) {
+ o->widget_stop = self_add_menu_item
+ ( o, o->play_menu, _("Stop"),
+ self_cb_play_stop );
+ self_add_menu_item( o, o->play_menu, NULL, NULL );
+ }
+ if ( menu_structure->play_menu & MaemoPlayMenuPrevious )
+ o->widget_prev = self_add_menu_item
+ ( o, o->play_menu, _("Previous"),
+ self_cb_play_previous );
+ if ( menu_structure->play_menu & MaemoPlayMenuNext ) {
+ o->widget_next = self_add_menu_item
+ ( o, o->play_menu, _("Next"),
+ self_cb_play_next );
+ self_add_menu_item( o, o->play_menu, NULL, NULL );
+ }
+ if ( menu_structure->play_menu & MaemoPlayMenuMute )
+ o->widget_mute = self_add_menu_item
+ ( o, o->play_menu, _("Mute"),
+ self_cb_play_mute );
+ widget = gtk_menu_item_new_with_label( _("Playback") );
+ gtk_menu_append( o->main_menu, widget );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( widget ),
+ GTK_WIDGET( o->play_menu ) );
+ } else {
+ o->widget_play = NULL;
+ o->widget_stop = NULL;
+ o->widget_prev = NULL;
+ o->widget_next = NULL;
+ o->widget_mute = NULL;
+ }
+ if ( menus & MaemoMenuTools ) {
+ GtkWidget *widget;
+
+ /* Create 'Tools' Submenu. */
+ o->tools_menu = GTK_MENU( gtk_menu_new() );
+ if ( menu_structure->tools_menu & MaemoToolsMenuSettings )
+ self_add_menu_item( o, o->tools_menu,
+ _("Settings..."),
+ self_cb_tools_settings );
+ self_add_menu_item( o, o->tools_menu, NULL, NULL );
+ self_add_menu_item( o, o->tools_menu, _("About"),
+ self_cb_about );
+ self_add_menu_item( o, o->tools_menu, _("Help"),
+ self_cb_help );
+ self_add_menu_item( o, o->tools_menu, _("Close"),
+ self_cb_close );
+ widget = gtk_menu_item_new_with_label( _("Tools") );
+ gtk_menu_append( o->main_menu, widget );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( widget ),
+ GTK_WIDGET( o->tools_menu ) );
+ } else {
+ /* Otherwise, add these into the main level menu. */
+ self_add_menu_item( o, o->main_menu, NULL, NULL );
+ self_add_menu_item( o, o->main_menu, _("About"),
+ self_cb_about );
+ self_add_menu_item( o, o->main_menu, _("Help"),
+ self_cb_help );
+ self_add_menu_item( o, o->main_menu, _("Close"),
+ self_cb_close );
+ o->tools_menu = NULL;
+ }
+ }}
+#line 4189 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1557 "maemo-program.gob"
+static void
+maemo_program_initialize_about_content (MaemoProgram * program)
+#line 4195 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::initialize_about_content"
+{
+#line 1559 "maemo-program.gob"
+
+ program->about_copyright = NULL;
+ program->about_comments = NULL;
+ program->about_license = NULL;
+ program->about_website = NULL;
+ program->about_website_label = NULL;
+ program->about_authors = NULL;
+ program->about_artists = NULL;
+ program->about_documenters = NULL;
+ program->about_translators = NULL;
+ program->about_logo = NULL;
+ }}
+#line 4212 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1599 "maemo-program.gob"
+MaemoProgram *
+maemo_program_new (gchar * application_name, gchar * service_name, gchar * help_topic_id, int argc, char * argv[], MaemoMenuStructure * menu_structure)
+#line 4218 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::new"
+{
+#line 1603 "maemo-program.gob"
+
+ MaemoProgram *o = (MaemoProgram *) GET_NEW;
+
+
+ /* Store the application name. */
+ o->app_name = g_strdup( application_name );
+
+ /* Store the help topic id. */
+ o->help_topic_id = g_strdup( help_topic_id );
+
+ /* Run the standard initializations. */
+ self_initialize( o, service_name, argc, argv );
+
+ /* Create the default menu. */
+ self_create_menu( o, menu_structure );
+
+ /* Set up the main window. */
+ self_set_window(o, HILDON_WINDOW(hildon_window_new()), o->main_menu );
+
+ /* Create the default toolbar. */
+ self_create_toolbar( o, menu_structure );
+
+ self_initialize_about_content( o );
+
+ return o;
+ }}
+#line 4249 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1641 "maemo-program.gob"
+void
+maemo_program_set_about (MaemoProgram * self, gchar * copyright, gchar * license, gchar * comments, gchar * logo_path)
+#line 4255 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_about"
+#line 1641 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 1641 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 4262 "maemo-program.c"
+{
+#line 1644 "maemo-program.gob"
+
+ g_free( self->about_copyright );
+ self->about_copyright = g_strdup( copyright );
+ g_free( self->about_comments );
+ self->about_comments = g_strdup( comments );
+ g_free( self->about_license );
+ self->about_license = g_strdup( license );
+ g_free( self->about_logo );
+ self->about_logo = g_strdup( logo_path );
+ }}
+#line 4275 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1663 "maemo-program.gob"
+void
+maemo_program_set_about_website (MaemoProgram * self, gchar * website, gchar * website_label)
+#line 4281 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_about_website"
+#line 1663 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 1663 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 4288 "maemo-program.c"
+{
+#line 1665 "maemo-program.gob"
+
+ g_free( self->about_website );
+ self->about_website = g_strdup( website );
+ g_free( self->about_website_label );
+ self->about_website_label = g_strdup( website_label );
+ }}
+#line 4297 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1683 "maemo-program.gob"
+void
+maemo_program_set_about_credits (MaemoProgram * self, gchar * auth, gchar * art, gchar * docs, gchar * transl)
+#line 4303 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_about_credits"
+#line 1683 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 1683 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 4310 "maemo-program.c"
+{
+#line 1685 "maemo-program.gob"
+
+ g_free( self->about_authors );
+ self->about_authors = g_strdup( auth );
+ g_free( self->about_artists );
+ self->about_artists = g_strdup( art );
+ g_free( self->about_documenters );
+ self->about_documenters = g_strdup( docs );
+ g_free( self->about_translators );
+ self->about_translators = g_strdup( transl );
+ }}
+#line 4323 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1707 "maemo-program.gob"
+gboolean
+maemo_program_set_zoom_range (MaemoProgram * self, gint * zoom_levels)
+#line 4329 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_zoom_range"
+#line 1707 "maemo-program.gob"
+ g_return_val_if_fail (self != NULL, (gboolean )0);
+#line 1707 "maemo-program.gob"
+ g_return_val_if_fail (MAEMO_IS_PROGRAM (self), (gboolean )0);
+#line 4336 "maemo-program.c"
+{
+#line 1709 "maemo-program.gob"
+
+ int i, has_100 = FALSE;
+
+ if ( zoom_levels == NULL )
+ return TRUE;
+
+ /* Check that the given zoom levels are valid ones. */
+ for ( i = 0; zoom_levels[i]; i++ ) {
+ if ( i > 0 ) {
+ if ( zoom_levels[i] <= zoom_levels[i - 1] )
+ return TRUE;
+ }
+ if ( zoom_levels[i] == 100 )
+ has_100 = TRUE;
+ }
+ if ( has_100 )
+ return TRUE;
+
+ self->min_zoom_level = zoom_levels[ 0 ];
+ self->max_zoom_level = zoom_levels[ i - 1 ];
+ self->zoom_level_range = g_new0( gint, i + 1 );
+ for ( i = 0; zoom_levels[i]; i++ ) {
+ self->zoom_level_range[i] = zoom_levels[i];
+ }
+ if ( self->zoom_level != 100 ) {
+ self->zoom_level = 100;
+ self_zoom_level_changed( self, self );
+ }
+
+ return FALSE;
+ }}
+#line 4370 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1745 "maemo-program.gob"
+void
+maemo_program_main (MaemoProgram * self)
+#line 4376 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::main"
+#line 1745 "maemo-program.gob"
+ g_return_if_fail (self != NULL);
+#line 1745 "maemo-program.gob"
+ g_return_if_fail (MAEMO_IS_PROGRAM (self));
+#line 4383 "maemo-program.c"
+{
+#line 1747 "maemo-program.gob"
+
+ gtk_main();
+ }}
+#line 4389 "maemo-program.c"
+#undef __GOB_FUNCTION__
+
+#line 1756 "maemo-program.gob"
+gboolean
+maemo_program_set_text_buffer (MaemoProgram * self, GtkTextBuffer * buffer)
+#line 4395 "maemo-program.c"
+{
+#define __GOB_FUNCTION__ "Maemo:Program::set_text_buffer"
+#line 1756 "maemo-program.gob"
+ g_return_val_if_fail (self != NULL, (gboolean )0);
+#line 1756 "maemo-program.gob"
+ g_return_val_if_fail (MAEMO_IS_PROGRAM (self), (gboolean )0);
+#line 4402 "maemo-program.c"
+{
+#line 1758 "maemo-program.gob"
+
+ if ( self->widget_cut == NULL )
+ return TRUE;
+
+ self->buffer = buffer;
+ if ( buffer != NULL ) {
+ /* Set insensitive until text_buffer is set. */
+ gtk_widget_set_sensitive( self->widget_cut, TRUE );
+ gtk_widget_set_sensitive( self->widget_copy, TRUE );
+ gtk_widget_set_sensitive( self->widget_paste, TRUE );
+ gtk_widget_set_sensitive( self->widget_select_all, TRUE );
+
+ gtk_widget_set_sensitive( self->button_cut, TRUE );
+ gtk_widget_set_sensitive( self->button_copy, TRUE );
+ gtk_widget_set_sensitive( self->button_paste, TRUE );
+ } else {
+ /* Set insensitive until text_buffer is set. */
+ gtk_widget_set_sensitive( self->widget_cut, FALSE );
+ gtk_widget_set_sensitive( self->widget_copy, FALSE );
+ gtk_widget_set_sensitive( self->widget_paste, FALSE );
+ gtk_widget_set_sensitive( self->widget_select_all, FALSE );
+
+ gtk_widget_set_sensitive( self->button_cut, FALSE );
+ gtk_widget_set_sensitive( self->button_copy, FALSE );
+ gtk_widget_set_sensitive( self->button_paste, FALSE );
+ }
+
+ return FALSE;
+ }}
+#line 4434 "maemo-program.c"
+#undef __GOB_FUNCTION__
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.gob
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.gob (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.gob 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,1788 @@
+/* GType: MaemoProgram Version 0.9.2 */
+requires 2.0.0
+%alltop{
+#define MAEMO_PROGRAM_VERSION "0.9.2"
+
+/*
+ * Copyright (c) 2007-2008 Nokia Corporation.
+ *
+ * Version: 0.9.2 (Dec 28th, 2007)
+ *
+ * Contact: Jukka-Pekka Iivonen (jukka-pekka.iivonen<at>nokia.com)
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "maemo-version.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <gtk/gtk.h>
+
+#if HAVE_MAEMO_SCIROCCO || HAVE_MAEMO_BORA
+ #include <hildon-widgets/hildon-program.h>
+ #include <hildon-widgets/hildon-window.h>
+ #include <hildon-widgets/hildon-banner.h>
+ #include <osso-helplib.h>
+ #include <gdk/gdkkeysyms.h>
+#else
+ #include <hildon/hildon-program.h>
+ #include <hildon/hildon-window.h>
+ #include <hildon/hildon-banner.h>
+ #include <hildon/hildon-help.h>
+#endif
+
+#include <libosso.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
+/* I18N etc. */
+#include "support.h"
+
+#include "maemo.h"
+
+%}
+
+/**
+ * MaemoProgram:
+ *
+ * Provides a simple easy to use wrapping for all maemo specific things
+ * that an application should do during initialization and when creating
+ * the main UI widgets like the main menu and the toolbar. Basically by
+ * using this object you will get all necessary things done written in
+ * maemo Tutorial. All you need to do is to create the callbacks and the
+ * application specific things.
+ *
+ *
+ * If MaemoProgram is used the main function of the program should be like
+ * the following:
+ *
+ * int main(int argc, char *argv[])
+ * {
+ * MaemoProgram *program;
+ *
+ * g_type_init();
+ * program = maemo_program_new( "MyApp", "MyService", "MyHelpFile",
+ * argc, argv, maemoMenuStandard );
+ *
+ * ... your application specific initializations here ...
+ * ... callback registeration ...
+ *
+ * maemo_program_main( program );
+ *
+ * ... your application specific terminations here ...
+ *
+ * return 0;
+ * }
+ *
+ * Note that when the program object has been created gtk_init has been called.
+ * So you do not need to do that again in your application. Se the function
+ * specific documentation for more details (maemo_program_new).
+ *
+ * Signals:
+ * - Hardware State Signals:
+ * 'state_shutdown' : System shutdown
+ * 'state_memory_low' : Memory low
+ * 'state_save_unsaved_data' : Save buffers wakeup call
+ * 'state_system_inactivity' : System has been inactive for some time
+ * 'state_normal_mode' : Device normal mode state entered
+ * 'state_flight_mode' : Device flight mode state entered
+ * 'state_other' : Other state
+ * - Hardware Keyboard Signals:
+ * 'hw_key_up' : Navigation key Up pressed
+ * 'hw_key_down' : Navigation key Down pressed
+ * 'hw_key_left' : Navigation key Left pressed
+ * 'hw_key_right' : Navigation key Right pressed
+ * 'hw_key_select' : Navigation key Select pressed
+ * 'hw_key_full_screen' : Full Screen Key pressed (default handling)
+ * 'hw_key_zoom_in' : Zoom In Key pressed (default handling)
+ * 'hw_key_zoom_out' : Zoom Out Key pressed (default handling)
+ * 'hw_key_close' : Close Key pressed (default handling)
+ * 'hw_key_menu' : Menu key pressed
+ * 'hw_key_home' : Home key pressed
+ * 'hw_key_power' : Power key pressed
+ * 'hw_key_other' : Some other key pressed
+ * - Standard Menu / Toolbar Button Signals:
+ * 'file_open' : File->Open selected
+ * 'file_new' : File->New selected
+ * 'file_save' : File->Save selected
+ * 'file_save_as' : File->Save As selected
+ * 'edit_undo' : Edit->Undo selected
+ * 'edit_redo' : Edit->Redo selected
+ * 'edit_cut' : Edit->Cut selected (default handling)
+ * 'edit_copy' : Edit->Copy selected (default handling)
+ * 'edit_paste' : Edit->Paste selected (default handling)
+ * 'edit_select_all' : Edit->Select All selected
+ * 'view_full_screen' : View->Full screen selected (default handling)
+ * 'tools_settings' : Tools->Settings selected
+ * 'play' : Playback->Play selected
+ * 'mute' : Playback->Mute selected
+ * 'play_stop' : Playback->Stop selected
+ * 'play_next' : Playback->Next selected
+ * 'play_previous' : Playback->Previous selected
+ * 'help' : Help selected (default handling)
+ * 'close' : Close selected (default handling)
+ * - Window Management, Zooming etc. Related Signals:
+ * 'zoom_level_changed' : Zooming level has changed
+ * 'max_zoom_level_reached' : Maximum zoom level reached (default handling)
+ * 'min_zoom_level_reached' : Minimum zoom level reached (defatul handling)
+ *
+ * Signals for which default handling is provided need not be bind with a
+ * callback handler by the user unless in special conditions. It means that,
+ * for instance, full screen and close buttons work automatically. A special
+ * condition which needs a callback handler, however, might be, for example,
+ * when you want to change the layout of the widgets on the window when the user
+ * is changing from normal screen size to full screen mode and vice versa.
+ *
+ * Properties:
+ * - name : name of the application
+ * - window : the main window of the application, HildonWindow
+ * - menu : the main menu of the application, GtkMenu
+ * - file_menu : the file menu of the application, GtkMenu
+ * - edit_menu : the edit menu of the application, GtkMenu
+ * - view_menu : the view menu of the application, GtkMenu
+ * - tools_menu : the tools menu of the application, GtkMenu
+ * - toolbar : the main toolbar
+ */
+class Maemo:Program from G:Object {
+
+ /* libosso context. */
+ public osso_context_t *osso_context;
+
+ /* Device mode. */
+ public osso_devmode_t device_mode;
+
+ /* Name of the application. */
+ public gchar *app_name = {NULL}
+ destroywith g_free;
+
+ /*
+ * Zooming properties.
+ */
+
+ /* Zoom percentage level, default = 100 */
+ public gint zoom_level;
+ public gint max_zoom_level;
+ public gint min_zoom_level;
+ public gint *zoom_level_range;
+ public gboolean full_screen_mode;
+
+ /*
+ * About dialog content.
+ */
+ public gchar *about_copyright = {NULL}
+ destroywith g_free;
+ public gchar *about_comments = {NULL}
+ destroywith g_free;
+ public gchar *about_license = {NULL}
+ destroywith g_free;
+ public gchar *about_website = {NULL}
+ destroywith g_free;
+ public gchar *about_website_label = {NULL}
+ destroywith g_free;
+ public gchar *about_authors = {NULL}
+ destroywith g_free;
+ public gchar *about_artists = {NULL}
+ destroywith g_free;
+ public gchar *about_documenters = {NULL}
+ destroywith g_free;
+ public gchar *about_translators = {NULL}
+ destroywith g_free;
+ public gchar *about_logo = {NULL}
+ destroywith g_free;
+
+ public gchar *help_topic_id = {NULL}
+ destroywith g_free;
+
+
+ /*
+ *------------------------------------------------------------------------
+ * Widgets.
+ */
+
+ /* HildonProgram structure. */
+ public HildonProgram *program = NULL;
+
+ /* Window widget. */
+ public HildonWindow *window = {NULL}
+ destroywith gtk_widget_destroy;
+
+ /* Menu structure. */
+ public GtkMenu *main_menu = {NULL}
+ destroywith gtk_widget_destroy;
+ public GtkMenu *file_menu = {NULL}
+ destroywith gtk_widget_destroy;
+ public GtkMenu *edit_menu = {NULL}
+ destroywith gtk_widget_destroy;
+ public GtkMenu *view_menu = {NULL}
+ destroywith gtk_widget_destroy;
+ public GtkMenu *tools_menu = {NULL}
+ destroywith gtk_widget_destroy;
+ public GtkMenu *play_menu = {NULL}
+ destroywith gtk_widget_destroy;
+
+ /*
+ * Menu widgets to be set sensitive/insensitive according to availability
+ * of the text buffer.
+ */
+ public GtkWidget *widget_cut;
+ public GtkWidget *widget_copy;
+ public GtkWidget *widget_paste;
+ public GtkWidget *widget_select_all;
+
+ public GtkWidget *widget_play;
+ public GtkWidget *widget_stop;
+ public GtkWidget *widget_mute;
+ public GtkWidget *widget_next;
+ public GtkWidget *widget_prev;
+
+ public GtkWidget *widget_undo;
+ public GtkWidget *widget_redo;
+
+
+ /*
+ * Toolbar buttons to be set sensitive/insensitive according to
+ * availability of the text buffer.
+ */
+ public GtkWidget *button_cut;
+ public GtkWidget *button_copy;
+ public GtkWidget *button_paste;
+
+ public GtkWidget *button_play;
+ public GtkWidget *button_stop;
+ public GtkWidget *button_mute;
+ public GtkWidget *button_next;
+ public GtkWidget *button_prev;
+
+ public GtkWidget *button_undo;
+ public GtkWidget *button_redo;
+
+
+ /* The main toolbar. */
+ public GtkToolbar *toolbar = {NULL}
+ destroywith gtk_widget_destroy;
+
+ /* GConf client. */
+ public GConfClient *gc_client = {NULL}
+ destroywith g_object_unref;
+
+ /* Text buffer to be attached with the clipboard. */
+ public GtkTextBuffer *buffer = {NULL}
+ destroywith gtk_widget_destroy;
+
+ /* The clipboard to be attached with the cut/copy/paste/select operations. */
+ public GtkClipboard *clipboard = {NULL}
+ destroywith gtk_widget_destroy;
+
+ /*
+ *------------------------------------------------------------------------
+ * Properties.
+ */
+
+ /**
+ * name:
+ * Name of the application.
+ */
+ property STRING name (
+ nick = _( "Name" ),
+ blurb = _( "Name of the application" ),
+ default_value = NULL,
+ export
+ )
+ set {
+ self->app_name = g_value_get_object( VAL );
+ }
+ get {
+ g_value_set_string( VAL, self->app_name );
+ };
+
+ /**
+ * window:
+ * Main window of the application (HildonWindow).
+ */
+ property OBJECT window (
+ nick = _( "Window" ),
+ blurb = _( "The main window of the application" ),
+ export
+ )
+ get {
+ g_value_set_object( VAL, self->window );
+ };
+
+ /**
+ * menu:
+ * Main menu of the application (GtkMenu).
+ */
+ property OBJECT menu (
+ nick = _( "Menu" ),
+ blurb = _( "The main menu of the application" ),
+ default_value = NULL,
+ export
+ )
+ set {
+ self->main_menu = g_value_get_object( VAL );
+ }
+ get {
+ g_value_set_object( VAL, self->main_menu );
+ };
+
+ /**
+ * file_menu:
+ * File menu of the application (GtkMenu).
+ */
+ property OBJECT file_menu (
+ nick = _( "File Menu" ),
+ blurb = _( "The file menu of the application" ),
+ default_value = NULL,
+ export
+ )
+ set {
+ self->file_menu = g_value_get_object( VAL );
+ }
+ get {
+ g_value_set_object( VAL, self->file_menu );
+ };
+
+ /**
+ * edit_menu:
+ * Edit menu of the application (GtkMenu).
+ */
+ property OBJECT edit_menu (
+ nick = _( "Edit Menu" ),
+ blurb = _( "The edit menu of the application" ),
+ default_value = NULL,
+ export
+ )
+ set {
+ self->edit_menu = g_value_get_object( VAL );
+ }
+ get {
+ g_value_set_object( VAL, self->edit_menu );
+ };
+
+ /**
+ * view_menu:
+ * View menu of the application (GtkMenu).
+ */
+ property OBJECT view_menu (
+ nick = _( "View Menu" ),
+ blurb = _( "The view menu of the application" ),
+ default_value = NULL,
+ export
+ )
+ set {
+ self->view_menu = g_value_get_object( VAL );
+ }
+ get {
+ g_value_set_object( VAL, self->view_menu );
+ };
+
+ /**
+ * tools_menu:
+ * Tools menu of the application (GtkMenu).
+ */
+ property OBJECT tools_menu (
+ nick = _( "Tools Menu" ),
+ blurb = _( "The tools menu of the application" ),
+ default_value = NULL,
+ export
+ )
+ set {
+ self->tools_menu = g_value_get_object( VAL );
+ }
+ get {
+ g_value_set_object( VAL, self->tools_menu );
+ };
+
+
+ /**
+ * tools_menu:
+ * Tools menu of the application (GtkMenu).
+ */
+ property OBJECT play_menu (
+ nick = _( "Play Menu" ),
+ blurb = _( "The palyback menu of the application" ),
+ default_value = NULL,
+ export
+ )
+ set {
+ self->play_menu = g_value_get_object( VAL );
+ }
+ get {
+ g_value_set_object( VAL, self->play_menu );
+ };
+
+
+ /**
+ * toolbar:
+ * Main toolbar of the application (GtkToolbar).
+ */
+ property OBJECT toolbar (
+ nick = _( "Toolbar" ),
+ blurb = _( "The main toolbar of the application" ),
+ default_value = NULL,
+ export
+ )
+ get {
+ g_value_set_object( VAL, self->toolbar );
+ };
+
+ /*
+ *------------------------------------------------------------------------
+ * Signals: User selections (either from menu or from toolbar).
+ */
+ signal last NONE (OBJECT)
+ void
+ file_new(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ file_open(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ file_save(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ file_save_as(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ edit_undo(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ edit_redo(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ edit_cut(self, gpointer data)
+ {
+ if ( self->buffer )
+ gtk_text_buffer_cut_clipboard( self->buffer,
+ self->clipboard, TRUE );
+ }
+
+ signal last NONE (OBJECT)
+ void
+ edit_copy(self, gpointer data)
+ {
+ if ( self->buffer )
+ gtk_text_buffer_copy_clipboard( self->buffer,
+ self->clipboard );
+ }
+
+ signal last NONE (OBJECT)
+ void
+ edit_paste(self, gpointer data)
+ {
+ if ( self->buffer )
+ gtk_text_buffer_paste_clipboard( self->buffer,
+ self->clipboard,
+ NULL, TRUE );
+ }
+
+ signal last NONE (OBJECT)
+ void
+ edit_select_all(self, gpointer data)
+ {
+ }
+
+ signal first NONE (OBJECT)
+ void
+ view_full_screen(self, gpointer data)
+ {
+ self->full_screen_mode = ! self->full_screen_mode;
+
+ if ( self->full_screen_mode ) {
+ gtk_window_fullscreen( GTK_WINDOW( self->window ) );
+ } else {
+ gtk_window_unfullscreen( GTK_WINDOW( self->window ) );
+ }
+ }
+
+ signal last NONE (OBJECT)
+ void
+ play(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ play_stop(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ play_previous(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ play_next(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ mute(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ tools_settings(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ close(self, gpointer data)
+ {
+ gtk_main_quit();
+ }
+
+ /*
+ *-------------------------------------
+ * Signals: Zooming related.
+ */
+
+ signal last NONE (OBJECT)
+ void
+ zoom_level_changed(self, gpointer data)
+ {
+ GString *str;
+
+ str = g_string_new( _("Zooming to ") );
+ g_string_append_printf( str, "%d%%", self->zoom_level );
+
+ hildon_banner_show_information( GTK_WIDGET( self->window ), NULL,
+ str->str );
+ g_string_free( str, TRUE );
+ }
+
+ signal last NONE (OBJECT)
+ void
+ max_zoom_level_reached(self, gpointer data)
+ {
+ hildon_banner_show_information( GTK_WIDGET( self->window ), NULL,
+ _("Maximum Zoom Level Reached") );
+ }
+
+ signal last NONE (OBJECT)
+ void
+ min_zoom_level_reached(self, gpointer data)
+ {
+ hildon_banner_show_information( GTK_WIDGET( self->window ), NULL,
+ _("Minimum Zoom Level Reached") );
+ }
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_zoom_in(self, gpointer data)
+ {
+ if ( self->zoom_level == self->max_zoom_level ) {
+ self_max_zoom_level_reached( self, data );
+ } else {
+ int i;
+
+ for ( i = 0; self->zoom_level_range[i]; i++ ) {
+ if ( self->zoom_level == self->zoom_level_range[i] ) {
+ g_assert( self->zoom_level_range[i + 1] );
+ self->zoom_level= self->zoom_level_range[i+1];
+ self_zoom_level_changed( self, data );
+ break;
+ }
+ }
+ g_assert( self->zoom_level_range[i] );
+ }
+ }
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_zoom_out(self, gpointer data)
+ {
+ if ( self->zoom_level == self->min_zoom_level ) {
+ self_min_zoom_level_reached( self, data );
+ } else {
+ int i;
+
+ for ( i = 0; self->zoom_level_range[i]; i++ ) {
+ if ( self->zoom_level == self->zoom_level_range[i] ) {
+ g_assert( i > 0 );
+ self->zoom_level= self->zoom_level_range[i-1];
+ self_zoom_level_changed( self, data );
+ break;
+ }
+ }
+ g_assert( self->zoom_level_range[i] );
+ }
+ }
+
+ signal first NONE (OBJECT)
+ void
+ hw_key_full_screen(self, gpointer data)
+ {
+ self_view_full_screen( self, data );
+ }
+
+ /*
+ * Signals: Navigation keys.
+ */
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_up(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_down(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_left(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_right(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_select(self, gpointer data)
+ {
+ }
+
+ /*
+ *-------------------------------------
+ * Signals: Other keys.
+ */
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_close(self, gpointer data)
+ {
+ self_close( self, data );
+ }
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_menu(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_home(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_power(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ hw_key_other(self, gpointer data)
+ {
+ }
+
+ /*
+ * Signals: System states.
+ */
+
+ signal last NONE (OBJECT)
+ void
+ state_shutdown(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ state_memory_low(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ state_save_unsaved_data(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ state_system_inactivity(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ state_normal_mode(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ state_flight_mode(self, gpointer data)
+ {
+ }
+
+ signal last NONE (OBJECT)
+ void
+ state_other(self, gpointer data)
+ {
+ }
+
+ /*
+ *------------------------------------------------------------------------
+ * Private functions: Callbacks
+ */
+
+ /*
+ * Callback: Hardware key press (key_press_event) triggered. Signals
+ * accordingly:
+ *
+ * 'hw_key_up' : Navigation key Up pressed
+ * 'hw_key_down' : Navigation key Down pressed
+ * 'hw_key_left' : Navigation key Left pressed
+ * 'hw_key_right' : Navigation key Right pressed
+ * 'hw_key_select' : Navigation key Select pressed
+ * 'hw_key_full_screen' : Full Screen Key pressed
+ * 'hw_key_zoom_in' : Zoom In Key pressed
+ * 'hw_key_zoom_out' : Zoom Out Key pressed
+ * 'hw_key_close' : Close Key pressed
+ * 'hw_key_other' : Some other key pressed
+ */
+ private gboolean
+ hw_key_press_cb(GtkWidget *widget, GdkEventKey *event, MaemoProgram *o )
+ {
+ switch ( event->keyval ) {
+ case GDK_Up: /* Navigation key up */
+ self_hw_key_up( o, o );
+ return TRUE;
+ case GDK_Down: /* Navigation key down */
+ self_hw_key_down( o, o );
+ return TRUE;
+ case GDK_Left: /* Navigation key left */
+ self_hw_key_left( o, o );
+ return TRUE;
+ case GDK_Right: /* Navigation key right */
+ self_hw_key_right( o, o );
+ return TRUE;
+ case GDK_Return: /* Navigation key select */
+ self_hw_key_select( o, o );
+ return TRUE;
+ case GDK_F6: /* Full screen */
+ self_hw_key_full_screen( o, o );
+ return TRUE;
+ case GDK_F7: /* Increase zoom level */
+ self_hw_key_zoom_in( o, o );
+ return TRUE;
+ case GDK_F8: /* Decrease zoom level */
+ self_hw_key_zoom_out( o, o );
+ return TRUE;
+ case GDK_Escape: /* Cancel/Close button */
+ self_hw_key_close( o, o );
+ return TRUE;
+ case GDK_F4:
+ self_hw_key_menu( o, o );
+ return TRUE;
+ case GDK_F5:
+ self_hw_key_home( o, o );
+ return TRUE;
+ case GDK_Execute:
+ self_hw_key_power( o, o );
+ return TRUE;
+ }
+ self_hw_key_other( o, o );
+
+ return FALSE;
+ }
+
+ /*
+ * Callback: Hardware state event handler. Signals accordingly:
+ *
+ * 'state_shutdown' : System shutdown
+ * 'state_memory_low' : Memory low
+ * 'state_save_unsaved_data' : Save buffers wakeup call
+ * 'state_system_inactivity' : System has been inactive for some time
+ * 'state_other' : Other state
+ */
+ private void
+ hw_event_handler(osso_hw_state_t *state, MaemoProgram *program)
+ {
+ gboolean flag = FALSE;
+
+ if ( state->shutdown_ind ) {
+ self_state_shutdown( program, program );
+ flag = TRUE;
+ }
+ if ( state->memory_low_ind ) {
+ self_state_memory_low( program, program );
+ flag = TRUE;
+ }
+ if ( state->save_unsaved_data_ind ) {
+ self_state_save_unsaved_data( program, program );
+ flag = TRUE;
+ }
+ if ( state->system_inactivity_ind ) {
+ self_state_system_inactivity( program, program );
+ flag = TRUE;
+ }
+
+ /* Check if device mode has not been initialized. */
+ if ( program->device_mode == OSSO_DEVMODE_INVALID ) {
+ program->device_mode = state->sig_device_mode_ind;
+ }
+
+ if ( !flag || state->sig_device_mode_ind != program->device_mode ) {
+ switch ( state->sig_device_mode_ind ) {
+ case OSSO_DEVMODE_NORMAL :
+ self_state_normal_mode( program, program );
+ flag = TRUE;
+ break;
+ case OSSO_DEVMODE_FLIGHT :
+ self_state_flight_mode( program, program );
+ flag = TRUE;
+ break;
+ default :
+ break;
+ }
+ }
+
+ if ( ! flag ) {
+ self_state_other( program, program );
+ }
+ }
+
+ /*
+ * File->New Callback. Signals 'file_new'.
+ */
+ private void
+ cb_file_new( GtkAction *action, MaemoProgram *self )
+ {
+ self_file_new( self, self );
+ }
+
+ /*
+ * File->Open Callback. Signals 'file_open'.
+ */
+ private void
+ cb_file_open( GtkAction *action, MaemoProgram *self )
+ {
+ self_file_open( self, self );
+ }
+
+ /*
+ * File->Save Callback. Signals 'file_save'.
+ */
+ private void
+ cb_file_save( GtkAction *action, MaemoProgram *self )
+ {
+ self_file_save( self, self );
+ }
+
+ /*
+ * File->Save as... Callback. Signals 'file_save_as'.
+ */
+ private void
+ cb_file_save_as( GtkAction *action, MaemoProgram *self )
+ {
+ self_file_save_as( self, self );
+ }
+
+ /*
+ * Edit->Undo Callback. Signals 'edit_undo'.
+ */
+ private void
+ cb_edit_undo( GtkAction *action, MaemoProgram *self )
+ {
+ self_edit_undo( self, self );
+ }
+
+ /*
+ * Edit->Redo Callback. Signals 'edit_redo'.
+ */
+ private void
+ cb_edit_redo( GtkAction *action, MaemoProgram *self )
+ {
+ self_edit_redo( self, self );
+ }
+
+ /*
+ * Edit->Cut Callback. Signals 'edit_cut'.
+ */
+ private void
+ cb_edit_cut( GtkAction *action, MaemoProgram *self )
+ {
+ self_edit_cut( self, self );
+ }
+
+ /*
+ * Edit->Copy Callback. Signals 'edit_copy'.
+ */
+ private void
+ cb_edit_copy( GtkAction *action, MaemoProgram *self )
+ {
+ self_edit_copy( self, self );
+ }
+
+ /*
+ * Edit->Paste Callback. Signals 'edit_paste'.
+ */
+ private void
+ cb_edit_paste( GtkAction *action, MaemoProgram *self )
+ {
+ self_edit_paste( self, self );
+ }
+
+ /*
+ * Edit->Select All Callback. Signals 'edit_select_all'.
+ */
+ private void
+ cb_edit_select_all( GtkAction *action, MaemoProgram *self )
+ {
+ self_edit_select_all( self, self );
+ }
+
+ /*
+ * View->Full Screen Callback: Signals 'view_full_screen'.
+ */
+ private void
+ cb_view_full_screen( GtkAction *action, MaemoProgram *self )
+ {
+ self_view_full_screen( self, self );
+ }
+
+ /*
+ * Tools->Settings Callback: Signals 'tools_settings'.
+ */
+ private void
+ cb_tools_settings( GtkAction *action, MaemoProgram *self )
+ {
+ self_tools_settings( self, self );
+ }
+
+ /*
+ * About Callback: Creates the about dialog, runs it, and then destroys it.
+ */
+ private void
+ cb_about( GtkAction *action, MaemoProgram *self )
+ {
+ GtkAboutDialog *about;
+
+ about = gtk_about_dialog_new();
+ if ( self->about_copyright )
+ gtk_about_dialog_set_copyright( about,
+ self->about_copyright );
+ if ( self->about_comments )
+ gtk_about_dialog_set_comments( about,
+ self->about_comments );
+ if ( self->about_license )
+ gtk_about_dialog_set_license( about, self->about_license );
+ if ( self->about_website )
+ gtk_about_dialog_set_website( about, self->about_website );
+ if ( self->about_website_label )
+ gtk_about_dialog_set_website_label( about,
+ self->about_website_label);
+ if ( self->about_authors )
+ gtk_about_dialog_set_authors( about, self->about_authors );
+ if ( self->about_artists )
+ gtk_about_dialog_set_artists( about, self->about_artists );
+ if ( self->about_documenters )
+ gtk_about_dialog_set_documenters( about,
+ self->about_documenters );
+ if ( self->about_translators )
+ gtk_about_dialog_set_translator_credits( about,
+ self->about_translators );
+ gtk_about_dialog_set_logo_icon_name( about, self->about_logo );
+
+ gtk_dialog_run( (GtkDialog *) about );
+ gtk_widget_destroy( (GtkWidget *) about );
+ }
+
+ /*
+ * Playback->Play Callback: Signals 'play'.
+ */
+ private void
+ cb_play_play( GtkAction *action, MaemoProgram *self )
+ {
+ self_play( self, self );
+ }
+
+ /*
+ * Playback->Stop Callback: Signals 'play_stop'.
+ */
+ private void
+ cb_play_stop( GtkAction *action, MaemoProgram *self )
+ {
+ self_play_stop( self, self );
+ }
+
+ /*
+ * Playback->Previous Callback: Signals 'play_previous'.
+ */
+ private void
+ cb_play_previous( GtkAction *action, MaemoProgram *self )
+ {
+ self_play_previous( self, self );
+ }
+
+ /*
+ * Playback->Next Callback: Signals 'play_next'.
+ */
+ private void
+ cb_play_next( GtkAction *action, MaemoProgram *self )
+ {
+ self_play_next( self, self );
+ }
+
+ /*
+ * Playback->Mute Callback: Signals 'mute'.
+ */
+ private void
+ cb_play_mute( GtkAction *action, MaemoProgram *self )
+ {
+ self_mute( self, self );
+ }
+
+
+
+ /*
+ * Close Callback: Signals 'close'.
+ */
+ private void
+ cb_close( GtkAction *action, MaemoProgram *self )
+ {
+ self_close( self, self );
+ }
+
+ /*
+ * Help Callback: Implements the help.
+ */
+ private void
+ cb_help( GtkAction *action, MaemoProgram *self )
+ {
+ osso_return_t retval;
+
+#if HAVE_MAEMO_SCIROCCO || HAVE_MAEMO_BORA
+ retval = ossohelp_show( self->osso_context, self->help_topic_id,
+ OSSO_HELP_SHOW_DIALOG );
+#else
+ retval = hildon_help_show( self->osso_context, self->help_topic_id,
+ HILDON_HELP_SHOW_DIALOG );
+#endif
+
+ if ( retval == OSSO_ERROR ) {
+ g_warning( "Help: Cannot find content for such topic (%s).",
+ self->help_topic_id );
+ } else if ( retval == OSSO_RPC_ERROR ) {
+ g_warning( "Help: Unable to contact HelpApp or Browser" );
+ } else if ( retval == OSSO_INVALID )
+ g_warning( "Help: Param not formal right" );
+ }
+
+ /*
+ *------------------------------------------------------------------------
+ * Private functions: Other
+ */
+
+ /*
+ * Standard MaemoProgram initializations.
+ *
+ * (1) check that we are not the root user.
+ * (2) initialize the zooming and full screen mode settings.
+ * (3) initialize gettext.
+ * (4) initialize Gtk+.
+ * (5) create HildonProgram and set up the name of it.
+ * (6) initialize libOSSO.
+ * (7) set up callbacks for the hardware state messages.
+ * (8) load GConf settings.
+ * (9) set up pixmap directory.
+ * (10) set up the clipboard.
+ */
+ private void
+ initialize (self, gchar *service_name, int argc, char *argv[])
+ {
+ static gint levels[] = { 80, 100, 120, 150, 200, 0 };
+ int result;
+
+
+ /* Check that we are not root. */
+ g_assert( getuid() > 0 );
+
+ /* Set default zoom level, 100% */
+ self->zoom_level = 100;
+ self->zoom_level_range = levels;
+ self->max_zoom_level = levels[4];
+ self->min_zoom_level = levels[0];
+ self->full_screen_mode = FALSE;
+
+ /* Gettext initializations. */
+ bindtextdomain( GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR );
+ bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" );
+ textdomain( GETTEXT_PACKAGE );
+
+ /* Gtk initializations. */
+ gtk_set_locale();
+ gtk_init( &argc, &argv );
+
+ /* Hildon initializations. */
+ self->program = HILDON_PROGRAM( hildon_program_get_instance() );
+ g_set_application_name( self->app_name );
+
+ /* Libosso initialize. */
+ self->osso_context = osso_initialize( service_name, VERSION, TRUE,
+ NULL );
+ g_assert( self->osso_context != NULL );
+ self->device_mode = OSSO_DEVMODE_INVALID; /* Initial value */
+
+ /* Setup callbacks for the hardware state messages. */
+ result = osso_hw_set_event_cb( self->osso_context, NULL,
+ (osso_hw_cb_f *) self_hw_event_handler,
+ (gpointer) self );
+ g_assert( result == OSSO_OK );
+
+ /* Load GConf settings. */
+ self->gc_client = gconf_client_get_default();
+ g_assert( self->gc_client != NULL );
+
+ /* Setup directories. */
+ add_pixmap_directory( PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps" );
+
+ /* Setup the clipboard. */
+ self->clipboard = gtk_clipboard_get( GDK_SELECTION_CLIPBOARD );
+ gtk_clipboard_set_can_store( self->clipboard, NULL, 0 );
+ }
+
+ /*
+ * HildonWindow releated initializations.
+ * (1) adds HildonWindow to the HildonProgram.
+ * (2) connects 'delete_event' and 'key_press_event' signals to the window.
+ * (3) connects the menu to the window
+ */
+ private void
+ set_window (self, HildonWindow *window, GtkMenu *menu)
+ {
+ g_assert( self->program != NULL );
+ g_assert( window != NULL );
+
+ /* The main application window handling. */
+ self->window = window;
+ gtk_widget_show( GTK_WIDGET( self->window ) );
+ hildon_program_add_window( self->program, self->window );
+
+ /* Connect default signal handlers. */
+ gtk_signal_connect( G_OBJECT( self->window ), "delete_event",
+ gtk_main_quit, NULL );
+ g_signal_connect( G_OBJECT( self->window ), "key_press_event",
+ G_CALLBACK( self_hw_key_press_cb ) , self );
+
+ /* Set up the menu */
+ if ( menu != NULL ) {
+ gtk_widget_show( GTK_WIDGET( menu ) );
+ self->main_menu = menu;
+ hildon_window_set_menu( self->window, self->main_menu );
+ }
+ }
+
+
+ /*
+ * Adds a toolbar item to the program toolbar.
+ */
+ private GtkWidget *
+ add_toolbar_item( MaemoProgram *self, gchar *stock, gpointer cb )
+ {
+ GtkToolItem *button;
+
+ button = gtk_tool_button_new_from_stock( stock );
+ g_assert( button != NULL );
+ gtk_toolbar_insert( self->toolbar, button, -1 );
+ g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( cb ),
+ self );
+
+ return (GtkWidget *) button;
+ }
+
+ /*
+ * Create the application toolbar based on the flags given in 'menus'
+ * argument.
+ */
+ private void
+ create_toolbar(MaemoProgram *o, MaemoMenuStructure *menu_structure)
+ {
+ MaemoSubMenuMask menus;
+
+ if ( menu_structure == NULL ) {
+ menus = MaemoMenuStandard;
+ } else {
+ menus = menu_structure->submenus;
+ }
+ o->toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
+ gtk_toolbar_set_orientation( o->toolbar, GTK_ORIENTATION_HORIZONTAL );
+ gtk_toolbar_set_style( o->toolbar, GTK_TOOLBAR_BOTH_HORIZ );
+
+ if ( menus & MaemoMenuFile ) {
+ if ( menu_structure->file_menu & MaemoFileMenuNew )
+ self_add_toolbar_item( o, GTK_STOCK_NEW,
+ self_cb_file_new );
+ if ( menu_structure->file_menu & MaemoFileMenuOpen )
+ self_add_toolbar_item( o, GTK_STOCK_OPEN,
+ self_cb_file_open );
+ if ( menu_structure->file_menu & MaemoFileMenuSave )
+ self_add_toolbar_item( o, GTK_STOCK_SAVE,
+ self_cb_file_save );
+ }
+ if ( menus & MaemoMenuEdit ) {
+ if ( menu_structure->edit_menu & MaemoEditMenuUndo ) {
+ o->button_undo = self_add_toolbar_item
+ ( o, GTK_STOCK_UNDO, self_cb_edit_undo );
+ gtk_widget_set_sensitive( o->button_undo, FALSE );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuRedo ) {
+ o->button_redo = self_add_toolbar_item
+ ( o, GTK_STOCK_REDO, self_cb_edit_redo );
+ gtk_widget_set_sensitive( o->button_redo, FALSE );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuCut ) {
+ o->button_cut = self_add_toolbar_item
+ ( o, GTK_STOCK_CUT, self_cb_edit_cut );
+ gtk_widget_set_sensitive( o->button_cut, FALSE );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuCopy ) {
+ o->button_copy = self_add_toolbar_item
+ ( o, GTK_STOCK_COPY, self_cb_edit_copy );
+ gtk_widget_set_sensitive( o->button_copy, FALSE );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuPaste ) {
+ o->button_paste = self_add_toolbar_item
+ ( o, GTK_STOCK_PASTE, self_cb_edit_paste );
+ gtk_widget_set_sensitive( o->button_paste, FALSE );
+ }
+ } else {
+ o->button_cut = NULL;
+ o->button_copy = NULL;
+ o->button_paste = NULL;
+ }
+ if ( menus & MaemoMenuPlay ) {
+ if ( menu_structure->play_menu & MaemoPlayMenuPlay )
+ o->button_play = self_add_toolbar_item
+ (o, GTK_STOCK_MEDIA_PLAY, self_cb_play_play );
+ if ( menu_structure->play_menu & MaemoPlayMenuStop )
+ o->button_stop = self_add_toolbar_item
+ (o, GTK_STOCK_MEDIA_STOP, self_cb_play_stop );
+ if ( menu_structure->play_menu & MaemoPlayMenuPrevious )
+ o->button_prev = self_add_toolbar_item
+ (o, GTK_STOCK_MEDIA_PREVIOUS,
+ self_cb_play_previous );
+ if ( menu_structure->play_menu & MaemoPlayMenuNext )
+ o->button_next = self_add_toolbar_item
+ (o, GTK_STOCK_MEDIA_NEXT, self_cb_play_next );
+ } else {
+ o->button_play = NULL;
+ o->button_stop = NULL;
+ o->button_prev = NULL;
+ o->button_next = NULL;
+ o->button_mute = NULL;
+ }
+ self_add_toolbar_item( o, GTK_STOCK_ZOOM_FIT, (gpointer)
+ self_cb_view_full_screen );
+ self_add_toolbar_item( o, GTK_STOCK_HELP, (gpointer) self_cb_help );
+
+ /* Add toolbar to the Hildon window. */
+ hildon_window_add_toolbar( o->window, o->toolbar );
+
+ gtk_widget_show_all( GTK_WIDGET( o->toolbar ) );
+ gtk_widget_show_all( GTK_WIDGET( o->window ) );
+ }
+
+ /*
+ * Adds a menu item to the given menu.
+ */
+ private GtkWidget *
+ add_menu_item( MaemoProgram *self, GtkMenu *menu, gchar *label, gpointer cb )
+ {
+ GtkWidget *widget;
+
+ if ( label == NULL )
+ widget = gtk_separator_menu_item_new();
+ else {
+ widget = gtk_menu_item_new_with_label( label );
+ g_assert( widget != NULL );
+ g_signal_connect( G_OBJECT( widget ), "activate",
+ G_CALLBACK( cb ), self );
+ }
+ gtk_widget_show( widget );
+ gtk_menu_append( menu, widget );
+
+ return widget;
+ }
+
+ /*
+ * Create the application menu structure based on the flags given in 'menus'
+ * argument.
+ */
+ private void
+ create_menu(MaemoProgram *o, MaemoMenuStructure *menu_structure)
+ {
+ MaemoSubMenuMask menus;
+ o->main_menu = GTK_MENU( gtk_menu_new() );
+
+ if ( menu_structure == NULL ) {
+ menus = MaemoMenuStandard;
+ } else {
+ menus = menu_structure->submenus;
+ }
+
+ if ( menus & MaemoMenuFile ) {
+ GtkWidget *widget;
+
+ /* Create 'File' Submenu. */
+ o->file_menu = GTK_MENU( gtk_menu_new() );
+ if ( menu_structure->file_menu & MaemoFileMenuNew )
+ self_add_menu_item( o, o->file_menu, _("New"),
+ self_cb_file_open );
+ if ( menu_structure->file_menu & MaemoFileMenuOpen )
+ self_add_menu_item( o, o->file_menu, _("Open..."),
+ self_cb_file_open );
+ if ( menu_structure->file_menu & MaemoFileMenuSave )
+ self_add_menu_item( o, o->file_menu, _("Save"),
+ self_cb_file_save );
+ if ( menu_structure->file_menu & MaemoFileMenuSaveAs )
+ self_add_menu_item( o, o->file_menu, _("Save As..."),
+ self_cb_file_save_as );
+ if ( menu_structure->first_submenu_name == NULL )
+ widget = gtk_menu_item_new_with_label( _("File") );
+ else
+ widget = gtk_menu_item_new_with_label
+ ( menu_structure->first_submenu_name );
+ gtk_menu_append( o->main_menu, widget );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( widget ),
+ GTK_WIDGET( o->file_menu ) );
+ } else
+ o->file_menu = NULL;
+ if ( menus & MaemoMenuEdit ) {
+ GtkWidget *widget;
+
+ /* Create 'Edit' Submenu. */
+ o->edit_menu = GTK_MENU( gtk_menu_new() );
+ if ( menu_structure->edit_menu & MaemoEditMenuUndo ) {
+ o->widget_undo = self_add_menu_item
+ ( o, o->edit_menu, _("Undo"),
+ self_cb_edit_undo );
+ gtk_widget_set_sensitive( o->widget_undo, FALSE );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuRedo ) {
+ o->widget_redo = self_add_menu_item
+ ( o, o->edit_menu, _("Redo"),
+ self_cb_edit_redo );
+ gtk_widget_set_sensitive( o->widget_redo, FALSE );
+ self_add_menu_item( o, o->edit_menu, NULL, NULL );
+ }
+ if ( menu_structure->edit_menu & MaemoEditMenuCut )
+ o->widget_cut = self_add_menu_item
+ ( o, o->edit_menu, _("Cut"),
+ self_cb_edit_cut );
+ if ( menu_structure->edit_menu & MaemoEditMenuCopy )
+ o->widget_copy = self_add_menu_item
+ ( o, o->edit_menu, _("Copy"),
+ self_cb_edit_copy );
+ if ( menu_structure->edit_menu & MaemoEditMenuPaste )
+ o->widget_paste = self_add_menu_item
+ ( o, o->edit_menu, _("Paste"), self_cb_edit_paste );
+ if ( menu_structure->edit_menu & MaemoEditMenuSelectAll )
+ o->widget_select_all = self_add_menu_item
+ ( o, o->edit_menu, _("Select All"),
+ self_cb_edit_select_all );
+ widget = gtk_menu_item_new_with_label( _("Edit") );
+ gtk_menu_append( o->main_menu, widget );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( widget ),
+ GTK_WIDGET( o->edit_menu ) );
+
+ /* Set insensitive until text_buffer is set. */
+ gtk_widget_set_sensitive( o->widget_cut, FALSE );
+ gtk_widget_set_sensitive( o->widget_copy, FALSE );
+ gtk_widget_set_sensitive( o->widget_paste, FALSE );
+ gtk_widget_set_sensitive( o->widget_select_all, FALSE );
+ } else {
+ o->edit_menu = NULL;
+ o->widget_undo = NULL;
+ o->widget_redo = NULL;
+ o->widget_cut = NULL;
+ o->widget_copy = NULL;
+ o->widget_paste = NULL;
+ o->widget_select_all = NULL;
+ }
+ if ( menus & MaemoMenuView ) {
+ GtkWidget *widget;
+
+ /* Create 'View' Submenu. */
+ o->view_menu = GTK_MENU( gtk_menu_new() );
+ self_add_menu_item( o, o->view_menu, _("Full Screen"),
+ self_cb_view_full_screen );
+ widget = gtk_menu_item_new_with_label( _("View") );
+ gtk_menu_append( o->main_menu, widget );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( widget ),
+ GTK_WIDGET( o->view_menu ) );
+ } else {
+ /* Otherwise, just add full screen menu item to main menu. */
+ self_add_menu_item( o, o->main_menu, _("Full Screen"),
+ self_cb_view_full_screen );
+ o->view_menu = NULL;
+ }
+ if ( menus & MaemoMenuPlay ) {
+ GtkWidget *widget;
+
+ /* Create 'Play' Submenu. */
+ o->play_menu = GTK_MENU( gtk_menu_new() );
+ if ( menu_structure->play_menu & MaemoPlayMenuPlay )
+ o->widget_play = self_add_menu_item
+ ( o, o->play_menu, _("Play"),
+ self_cb_play_play );
+ if ( menu_structure->play_menu & MaemoPlayMenuStop ) {
+ o->widget_stop = self_add_menu_item
+ ( o, o->play_menu, _("Stop"),
+ self_cb_play_stop );
+ self_add_menu_item( o, o->play_menu, NULL, NULL );
+ }
+ if ( menu_structure->play_menu & MaemoPlayMenuPrevious )
+ o->widget_prev = self_add_menu_item
+ ( o, o->play_menu, _("Previous"),
+ self_cb_play_previous );
+ if ( menu_structure->play_menu & MaemoPlayMenuNext ) {
+ o->widget_next = self_add_menu_item
+ ( o, o->play_menu, _("Next"),
+ self_cb_play_next );
+ self_add_menu_item( o, o->play_menu, NULL, NULL );
+ }
+ if ( menu_structure->play_menu & MaemoPlayMenuMute )
+ o->widget_mute = self_add_menu_item
+ ( o, o->play_menu, _("Mute"),
+ self_cb_play_mute );
+ widget = gtk_menu_item_new_with_label( _("Playback") );
+ gtk_menu_append( o->main_menu, widget );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( widget ),
+ GTK_WIDGET( o->play_menu ) );
+ } else {
+ o->widget_play = NULL;
+ o->widget_stop = NULL;
+ o->widget_prev = NULL;
+ o->widget_next = NULL;
+ o->widget_mute = NULL;
+ }
+ if ( menus & MaemoMenuTools ) {
+ GtkWidget *widget;
+
+ /* Create 'Tools' Submenu. */
+ o->tools_menu = GTK_MENU( gtk_menu_new() );
+ if ( menu_structure->tools_menu & MaemoToolsMenuSettings )
+ self_add_menu_item( o, o->tools_menu,
+ _("Settings..."),
+ self_cb_tools_settings );
+ self_add_menu_item( o, o->tools_menu, NULL, NULL );
+ self_add_menu_item( o, o->tools_menu, _("About"),
+ self_cb_about );
+ self_add_menu_item( o, o->tools_menu, _("Help"),
+ self_cb_help );
+ self_add_menu_item( o, o->tools_menu, _("Close"),
+ self_cb_close );
+ widget = gtk_menu_item_new_with_label( _("Tools") );
+ gtk_menu_append( o->main_menu, widget );
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( widget ),
+ GTK_WIDGET( o->tools_menu ) );
+ } else {
+ /* Otherwise, add these into the main level menu. */
+ self_add_menu_item( o, o->main_menu, NULL, NULL );
+ self_add_menu_item( o, o->main_menu, _("About"),
+ self_cb_about );
+ self_add_menu_item( o, o->main_menu, _("Help"),
+ self_cb_help );
+ self_add_menu_item( o, o->main_menu, _("Close"),
+ self_cb_close );
+ o->tools_menu = NULL;
+ }
+ }
+
+ /*
+ * Set all about related pointers to NULL initially.
+ */
+ private void
+ initialize_about_content(MaemoProgram *program)
+ {
+ program->about_copyright = NULL;
+ program->about_comments = NULL;
+ program->about_license = NULL;
+ program->about_website = NULL;
+ program->about_website_label = NULL;
+ program->about_authors = NULL;
+ program->about_artists = NULL;
+ program->about_documenters = NULL;
+ program->about_translators = NULL;
+ program->about_logo = NULL;
+ }
+
+ /*
+ *------------------------------------------------------------------------
+ * Public functions.
+ */
+
+ /**
+ * maemo_program_new:
+ * Creates a new program object. By creating a maemo program you will
+ * initilize Gtk+, create the HildonProgram and HildonWindow objects,
+ * load GConf settings for the application, initialize libOSSO and
+ * gettext, set up the pixmap directory and the clipboard, and create
+ * the main menu with at least the standard items and the application
+ * toolbar having at least the standard buttons (the exact menu and
+ * toolbar items to be created can be specified with the @menus masking
+ * argument).
+ *
+ *
+ * @application_name: name of the application.
+ * @service_name: name of the DBUS service of the application.
+ * This must match what is defined in the .service file.
+ * @help_topic_id: identifier for the help content.
+ * @argc: command line argument count from the main function.
+ * @argv: command line argument vector from the main function.
+ * @menus: mask to specify what standard submenus (and toolbar
+ * buttons) are to be created.
+ * Returns: A newly allocated MaemoProgram object.
+ */
+ public MaemoProgram *
+ new (gchar *application_name, gchar *service_name,
+ gchar *help_topic_id, int argc, char *argv[],
+ MaemoMenuStructure *menu_structure)
+ {
+ MaemoProgram *o = (MaemoProgram *) GET_NEW;
+
+
+ /* Store the application name. */
+ o->app_name = g_strdup( application_name );
+
+ /* Store the help topic id. */
+ o->help_topic_id = g_strdup( help_topic_id );
+
+ /* Run the standard initializations. */
+ self_initialize( o, service_name, argc, argv );
+
+ /* Create the default menu. */
+ self_create_menu( o, menu_structure );
+
+ /* Set up the main window. */
+ self_set_window(o, HILDON_WINDOW(hildon_window_new()), o->main_menu );
+
+ /* Create the default toolbar. */
+ self_create_toolbar( o, menu_structure );
+
+ self_initialize_about_content( o );
+
+ return o;
+ }
+
+ /**
+ * maemo_program_set_about:
+ * Sets the about dialog copyright, license and comments texts as well as
+ * the logo to be shown. Logo should contain the path to the bitmap file.
+ *
+ * @copyright: the copyright holder.
+ * @license: the license text.
+ * @comments: the short description of the application.
+ * @logo_path: file path to the logo file.
+ * Returns: (void)
+ */
+ public void
+ set_about(self, gchar *copyright, gchar *license, gchar *comments,
+ gchar *logo_path)
+ {
+ g_free( self->about_copyright );
+ self->about_copyright = g_strdup( copyright );
+ g_free( self->about_comments );
+ self->about_comments = g_strdup( comments );
+ g_free( self->about_license );
+ self->about_license = g_strdup( license );
+ g_free( self->about_logo );
+ self->about_logo = g_strdup( logo_path );
+ }
+
+ /**
+ * maemo_program_set_about_website:
+ * Sets the website link and the label to be shown in the About dialog.
+ *
+ * @website: website link for the about dialog.
+ * @website_label: website label to be shown.
+ * Returns: (void)
+ */
+ public void
+ set_about_website(self, gchar *website, gchar *website_label)
+ {
+ g_free( self->about_website );
+ self->about_website = g_strdup( website );
+ g_free( self->about_website_label );
+ self->about_website_label = g_strdup( website_label );
+ }
+
+ /**
+ * maemo_program_set_about_credits:
+ * Sets the names of the authors, artists, documenters and translators
+ * for the About dialog.
+ *
+ * @auth: names of the authors.
+ * @art: names of the artists.
+ * @docs: names of the documenters.
+ * @transl: names of the translators.
+ * Returns: (void)
+ */
+ public void
+ set_about_credits(self, gchar *auth, gchar *art, gchar *docs, gchar *transl)
+ {
+ g_free( self->about_authors );
+ self->about_authors = g_strdup( auth );
+ g_free( self->about_artists );
+ self->about_artists = g_strdup( art );
+ g_free( self->about_documenters );
+ self->about_documenters = g_strdup( docs );
+ g_free( self->about_translators );
+ self->about_translators = g_strdup( transl );
+ }
+
+ /**
+ * maemo_program_set_zoom_range:
+ * Sets the zooming level range from a vector of percentage numbers.
+ * The vector is given as integers and must be 0 terminated. The
+ * zooming levels have to be in increasing order. Resets the zooming
+ * level to 100% if it is not already it. zoom_level_changed signal
+ * will be emitted.
+ *
+ * gint levels[] = { 50, 80, 100, 120, 150, 200, 0 };
+ * maemo_program_set_zoom_range( program, levels );
+ */
+ public gboolean
+ set_zoom_range(self, gint *zoom_levels)
+ {
+ int i, has_100 = FALSE;
+
+ if ( zoom_levels == NULL )
+ return TRUE;
+
+ /* Check that the given zoom levels are valid ones. */
+ for ( i = 0; zoom_levels[i]; i++ ) {
+ if ( i > 0 ) {
+ if ( zoom_levels[i] <= zoom_levels[i - 1] )
+ return TRUE;
+ }
+ if ( zoom_levels[i] == 100 )
+ has_100 = TRUE;
+ }
+ if ( has_100 )
+ return TRUE;
+
+ self->min_zoom_level = zoom_levels[ 0 ];
+ self->max_zoom_level = zoom_levels[ i - 1 ];
+ self->zoom_level_range = g_new0( gint, i + 1 );
+ for ( i = 0; zoom_levels[i]; i++ ) {
+ self->zoom_level_range[i] = zoom_levels[i];
+ }
+ if ( self->zoom_level != 100 ) {
+ self->zoom_level = 100;
+ self_zoom_level_changed( self, self );
+ }
+
+ return FALSE;
+ }
+
+ /**
+ * maemo_program_main:
+ * Enters the main loop of the program.
+ */
+ public void
+ main (self)
+ {
+ gtk_main();
+ }
+
+ /**
+ * maemo_program_set_text_buffer:
+ * Sets the text buffer widget to which the clipboard handling operations
+ * (edit->copy, edit->paste etc.) are connected with.
+ */
+ public gboolean
+ set_text_buffer(self, GtkTextBuffer *buffer )
+ {
+ if ( self->widget_cut == NULL )
+ return TRUE;
+
+ self->buffer = buffer;
+ if ( buffer != NULL ) {
+ /* Set insensitive until text_buffer is set. */
+ gtk_widget_set_sensitive( self->widget_cut, TRUE );
+ gtk_widget_set_sensitive( self->widget_copy, TRUE );
+ gtk_widget_set_sensitive( self->widget_paste, TRUE );
+ gtk_widget_set_sensitive( self->widget_select_all, TRUE );
+
+ gtk_widget_set_sensitive( self->button_cut, TRUE );
+ gtk_widget_set_sensitive( self->button_copy, TRUE );
+ gtk_widget_set_sensitive( self->button_paste, TRUE );
+ } else {
+ /* Set insensitive until text_buffer is set. */
+ gtk_widget_set_sensitive( self->widget_cut, FALSE );
+ gtk_widget_set_sensitive( self->widget_copy, FALSE );
+ gtk_widget_set_sensitive( self->widget_paste, FALSE );
+ gtk_widget_set_sensitive( self->widget_select_all, FALSE );
+
+ gtk_widget_set_sensitive( self->button_cut, FALSE );
+ gtk_widget_set_sensitive( self->button_copy, FALSE );
+ gtk_widget_set_sensitive( self->button_paste, FALSE );
+ }
+
+ return FALSE;
+ }
+}
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.gob
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,637 @@
+/* Generated by GOB (v2.0.14) (do not edit directly) */
+
+
+
+#define MAEMO_PROGRAM_VERSION "0.9.2"
+
+/*
+ * Copyright (c) 2007-2008 Nokia Corporation.
+ *
+ * Version: 0.9.2 (Dec 28th, 2007)
+ *
+ * Contact: Jukka-Pekka Iivonen (jukka-pekka.iivonen<at>nokia.com)
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "maemo-version.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <gtk/gtk.h>
+
+#if HAVE_MAEMO_SCIROCCO || HAVE_MAEMO_BORA
+ #include <hildon-widgets/hildon-program.h>
+ #include <hildon-widgets/hildon-window.h>
+ #include <hildon-widgets/hildon-banner.h>
+ #include <osso-helplib.h>
+ #include <gdk/gdkkeysyms.h>
+#else
+ #include <hildon/hildon-program.h>
+ #include <hildon/hildon-window.h>
+ #include <hildon/hildon-banner.h>
+ #include <hildon/hildon-help.h>
+#endif
+
+#include <libosso.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
+/* I18N etc. */
+#include "support.h"
+
+#include "maemo.h"
+
+
+#include <glib.h>
+#include <glib-object.h>
+#ifndef __MAEMO_PROGRAM_H__
+#define __MAEMO_PROGRAM_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/*
+ * Type checking and casting macros
+ */
+#define MAEMO_TYPE_PROGRAM (maemo_program_get_type())
+#define MAEMO_PROGRAM(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), maemo_program_get_type(), MaemoProgram)
+#define MAEMO_PROGRAM_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), maemo_program_get_type(), MaemoProgram const)
+#define MAEMO_PROGRAM_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), maemo_program_get_type(), MaemoProgramClass)
+#define MAEMO_IS_PROGRAM(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), maemo_program_get_type ())
+
+#define MAEMO_PROGRAM_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), maemo_program_get_type(), MaemoProgramClass)
+
+/*
+ * Main object structure
+ */
+#ifndef __TYPEDEF_MAEMO_PROGRAM__
+#define __TYPEDEF_MAEMO_PROGRAM__
+typedef struct _MaemoProgram MaemoProgram;
+#endif
+struct _MaemoProgram {
+ GObject __parent__;
+ /*< public >*/
+ osso_context_t * osso_context;
+ osso_devmode_t device_mode;
+ gchar * app_name;
+ gint zoom_level;
+ gint max_zoom_level;
+ gint min_zoom_level;
+ gint * zoom_level_range;
+ gboolean full_screen_mode;
+ gchar * about_copyright;
+ gchar * about_comments;
+ gchar * about_license;
+ gchar * about_website;
+ gchar * about_website_label;
+ gchar * about_authors;
+ gchar * about_artists;
+ gchar * about_documenters;
+ gchar * about_translators;
+ gchar * about_logo;
+ gchar * help_topic_id;
+ HildonProgram * program;
+ HildonWindow * window;
+ GtkMenu * main_menu;
+ GtkMenu * file_menu;
+ GtkMenu * edit_menu;
+ GtkMenu * view_menu;
+ GtkMenu * tools_menu;
+ GtkMenu * play_menu;
+ GtkWidget * widget_cut;
+ GtkWidget * widget_copy;
+ GtkWidget * widget_paste;
+ GtkWidget * widget_select_all;
+ GtkWidget * widget_play;
+ GtkWidget * widget_stop;
+ GtkWidget * widget_mute;
+ GtkWidget * widget_next;
+ GtkWidget * widget_prev;
+ GtkWidget * widget_undo;
+ GtkWidget * widget_redo;
+ GtkWidget * button_cut;
+ GtkWidget * button_copy;
+ GtkWidget * button_paste;
+ GtkWidget * button_play;
+ GtkWidget * button_stop;
+ GtkWidget * button_mute;
+ GtkWidget * button_next;
+ GtkWidget * button_prev;
+ GtkWidget * button_undo;
+ GtkWidget * button_redo;
+ GtkToolbar * toolbar;
+ GConfClient * gc_client;
+ GtkTextBuffer * buffer;
+ GtkClipboard * clipboard;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _MaemoProgramClass MaemoProgramClass;
+struct _MaemoProgramClass {
+ GObjectClass __parent__;
+ /*signal*/void (* file_new) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* file_open) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* file_save) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* file_save_as) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* edit_undo) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* edit_redo) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* edit_cut) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* edit_copy) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* edit_paste) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* edit_select_all) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* view_full_screen) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* play) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* play_stop) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* play_previous) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* play_next) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* mute) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* tools_settings) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* close) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* zoom_level_changed) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* max_zoom_level_reached) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* min_zoom_level_reached) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_zoom_in) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_zoom_out) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_full_screen) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_up) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_down) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_left) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_right) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_select) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_close) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_menu) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_home) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_power) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* hw_key_other) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* state_shutdown) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* state_memory_low) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* state_save_unsaved_data) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* state_system_inactivity) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* state_normal_mode) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* state_flight_mode) (MaemoProgram * self, gpointer data);
+ /*signal*/void (* state_other) (MaemoProgram * self, gpointer data);
+};
+
+
+/*
+ * Public methods
+ */
+GType maemo_program_get_type (void);
+gchar * maemo_program_get_name (MaemoProgram * self);
+void maemo_program_set_name (MaemoProgram * self,
+ gchar * val);
+GObject * maemo_program_get_window (MaemoProgram * self);
+GObject * maemo_program_get_menu (MaemoProgram * self);
+void maemo_program_set_menu (MaemoProgram * self,
+ GObject * val);
+GObject * maemo_program_get_file_menu (MaemoProgram * self);
+void maemo_program_set_file_menu (MaemoProgram * self,
+ GObject * val);
+GObject * maemo_program_get_edit_menu (MaemoProgram * self);
+void maemo_program_set_edit_menu (MaemoProgram * self,
+ GObject * val);
+GObject * maemo_program_get_view_menu (MaemoProgram * self);
+void maemo_program_set_view_menu (MaemoProgram * self,
+ GObject * val);
+GObject * maemo_program_get_tools_menu (MaemoProgram * self);
+void maemo_program_set_tools_menu (MaemoProgram * self,
+ GObject * val);
+GObject * maemo_program_get_play_menu (MaemoProgram * self);
+void maemo_program_set_play_menu (MaemoProgram * self,
+ GObject * val);
+GObject * maemo_program_get_toolbar (MaemoProgram * self);
+void maemo_program_file_new (MaemoProgram * self,
+ gpointer data);
+void maemo_program_file_open (MaemoProgram * self,
+ gpointer data);
+void maemo_program_file_save (MaemoProgram * self,
+ gpointer data);
+void maemo_program_file_save_as (MaemoProgram * self,
+ gpointer data);
+void maemo_program_edit_undo (MaemoProgram * self,
+ gpointer data);
+void maemo_program_edit_redo (MaemoProgram * self,
+ gpointer data);
+void maemo_program_edit_cut (MaemoProgram * self,
+ gpointer data);
+void maemo_program_edit_copy (MaemoProgram * self,
+ gpointer data);
+void maemo_program_edit_paste (MaemoProgram * self,
+ gpointer data);
+void maemo_program_edit_select_all (MaemoProgram * self,
+ gpointer data);
+void maemo_program_view_full_screen (MaemoProgram * self,
+ gpointer data);
+void maemo_program_play (MaemoProgram * self,
+ gpointer data);
+void maemo_program_play_stop (MaemoProgram * self,
+ gpointer data);
+void maemo_program_play_previous (MaemoProgram * self,
+ gpointer data);
+void maemo_program_play_next (MaemoProgram * self,
+ gpointer data);
+void maemo_program_mute (MaemoProgram * self,
+ gpointer data);
+void maemo_program_tools_settings (MaemoProgram * self,
+ gpointer data);
+void maemo_program_close (MaemoProgram * self,
+ gpointer data);
+void maemo_program_zoom_level_changed (MaemoProgram * self,
+ gpointer data);
+void maemo_program_max_zoom_level_reached (MaemoProgram * self,
+ gpointer data);
+void maemo_program_min_zoom_level_reached (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_zoom_in (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_zoom_out (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_full_screen (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_up (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_down (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_left (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_right (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_select (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_close (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_menu (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_home (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_power (MaemoProgram * self,
+ gpointer data);
+void maemo_program_hw_key_other (MaemoProgram * self,
+ gpointer data);
+void maemo_program_state_shutdown (MaemoProgram * self,
+ gpointer data);
+void maemo_program_state_memory_low (MaemoProgram * self,
+ gpointer data);
+void maemo_program_state_save_unsaved_data (MaemoProgram * self,
+ gpointer data);
+void maemo_program_state_system_inactivity (MaemoProgram * self,
+ gpointer data);
+void maemo_program_state_normal_mode (MaemoProgram * self,
+ gpointer data);
+void maemo_program_state_flight_mode (MaemoProgram * self,
+ gpointer data);
+void maemo_program_state_other (MaemoProgram * self,
+ gpointer data);
+MaemoProgram * maemo_program_new (gchar * application_name,
+ gchar * service_name,
+ gchar * help_topic_id,
+ int argc,
+ char * argv[],
+ MaemoMenuStructure * menu_structure);
+void maemo_program_set_about (MaemoProgram * self,
+ gchar * copyright,
+ gchar * license,
+ gchar * comments,
+ gchar * logo_path);
+void maemo_program_set_about_website (MaemoProgram * self,
+ gchar * website,
+ gchar * website_label);
+void maemo_program_set_about_credits (MaemoProgram * self,
+ gchar * auth,
+ gchar * art,
+ gchar * docs,
+ gchar * transl);
+gboolean maemo_program_set_zoom_range (MaemoProgram * self,
+ gint * zoom_levels);
+void maemo_program_main (MaemoProgram * self);
+gboolean maemo_program_set_text_buffer (MaemoProgram * self,
+ GtkTextBuffer * buffer);
+
+/*
+ * Signal connection wrapper macros
+ */
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#define maemo_program_connect__file_new(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_new",(GCallback) __extension__ ({void (* ___file_new) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_new; }), (data))
+#define maemo_program_connect_after__file_new(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_new",(GCallback) __extension__ ({void (* ___file_new) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_new; }), (data))
+#define maemo_program_connect_data__file_new(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_new",(GCallback) __extension__ ({void (* ___file_new) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_new; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__file_open(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_open",(GCallback) __extension__ ({void (* ___file_open) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_open; }), (data))
+#define maemo_program_connect_after__file_open(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_open",(GCallback) __extension__ ({void (* ___file_open) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_open; }), (data))
+#define maemo_program_connect_data__file_open(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_open",(GCallback) __extension__ ({void (* ___file_open) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_open; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__file_save(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_save",(GCallback) __extension__ ({void (* ___file_save) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_save; }), (data))
+#define maemo_program_connect_after__file_save(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_save",(GCallback) __extension__ ({void (* ___file_save) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_save; }), (data))
+#define maemo_program_connect_data__file_save(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_save",(GCallback) __extension__ ({void (* ___file_save) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_save; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__file_save_as(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_save_as",(GCallback) __extension__ ({void (* ___file_save_as) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_save_as; }), (data))
+#define maemo_program_connect_after__file_save_as(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_save_as",(GCallback) __extension__ ({void (* ___file_save_as) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_save_as; }), (data))
+#define maemo_program_connect_data__file_save_as(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"file_save_as",(GCallback) __extension__ ({void (* ___file_save_as) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___file_save_as; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__edit_undo(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_undo",(GCallback) __extension__ ({void (* ___edit_undo) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_undo; }), (data))
+#define maemo_program_connect_after__edit_undo(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_undo",(GCallback) __extension__ ({void (* ___edit_undo) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_undo; }), (data))
+#define maemo_program_connect_data__edit_undo(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_undo",(GCallback) __extension__ ({void (* ___edit_undo) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_undo; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__edit_redo(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_redo",(GCallback) __extension__ ({void (* ___edit_redo) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_redo; }), (data))
+#define maemo_program_connect_after__edit_redo(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_redo",(GCallback) __extension__ ({void (* ___edit_redo) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_redo; }), (data))
+#define maemo_program_connect_data__edit_redo(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_redo",(GCallback) __extension__ ({void (* ___edit_redo) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_redo; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__edit_cut(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_cut",(GCallback) __extension__ ({void (* ___edit_cut) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_cut; }), (data))
+#define maemo_program_connect_after__edit_cut(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_cut",(GCallback) __extension__ ({void (* ___edit_cut) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_cut; }), (data))
+#define maemo_program_connect_data__edit_cut(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_cut",(GCallback) __extension__ ({void (* ___edit_cut) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_cut; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__edit_copy(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_copy",(GCallback) __extension__ ({void (* ___edit_copy) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_copy; }), (data))
+#define maemo_program_connect_after__edit_copy(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_copy",(GCallback) __extension__ ({void (* ___edit_copy) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_copy; }), (data))
+#define maemo_program_connect_data__edit_copy(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_copy",(GCallback) __extension__ ({void (* ___edit_copy) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_copy; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__edit_paste(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_paste",(GCallback) __extension__ ({void (* ___edit_paste) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_paste; }), (data))
+#define maemo_program_connect_after__edit_paste(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_paste",(GCallback) __extension__ ({void (* ___edit_paste) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_paste; }), (data))
+#define maemo_program_connect_data__edit_paste(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_paste",(GCallback) __extension__ ({void (* ___edit_paste) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_paste; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__edit_select_all(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_select_all",(GCallback) __extension__ ({void (* ___edit_select_all) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_select_all; }), (data))
+#define maemo_program_connect_after__edit_select_all(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_select_all",(GCallback) __extension__ ({void (* ___edit_select_all) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_select_all; }), (data))
+#define maemo_program_connect_data__edit_select_all(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"edit_select_all",(GCallback) __extension__ ({void (* ___edit_select_all) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___edit_select_all; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__view_full_screen(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"view_full_screen",(GCallback) __extension__ ({void (* ___view_full_screen) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___view_full_screen; }), (data))
+#define maemo_program_connect_after__view_full_screen(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"view_full_screen",(GCallback) __extension__ ({void (* ___view_full_screen) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___view_full_screen; }), (data))
+#define maemo_program_connect_data__view_full_screen(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"view_full_screen",(GCallback) __extension__ ({void (* ___view_full_screen) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___view_full_screen; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__play(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play",(GCallback) __extension__ ({void (* ___play) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play; }), (data))
+#define maemo_program_connect_after__play(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play",(GCallback) __extension__ ({void (* ___play) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play; }), (data))
+#define maemo_program_connect_data__play(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play",(GCallback) __extension__ ({void (* ___play) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__play_stop(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play_stop",(GCallback) __extension__ ({void (* ___play_stop) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play_stop; }), (data))
+#define maemo_program_connect_after__play_stop(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play_stop",(GCallback) __extension__ ({void (* ___play_stop) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play_stop; }), (data))
+#define maemo_program_connect_data__play_stop(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play_stop",(GCallback) __extension__ ({void (* ___play_stop) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play_stop; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__play_previous(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play_previous",(GCallback) __extension__ ({void (* ___play_previous) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play_previous; }), (data))
+#define maemo_program_connect_after__play_previous(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play_previous",(GCallback) __extension__ ({void (* ___play_previous) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play_previous; }), (data))
+#define maemo_program_connect_data__play_previous(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play_previous",(GCallback) __extension__ ({void (* ___play_previous) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play_previous; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__play_next(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play_next",(GCallback) __extension__ ({void (* ___play_next) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play_next; }), (data))
+#define maemo_program_connect_after__play_next(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play_next",(GCallback) __extension__ ({void (* ___play_next) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play_next; }), (data))
+#define maemo_program_connect_data__play_next(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"play_next",(GCallback) __extension__ ({void (* ___play_next) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___play_next; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__mute(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"mute",(GCallback) __extension__ ({void (* ___mute) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___mute; }), (data))
+#define maemo_program_connect_after__mute(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"mute",(GCallback) __extension__ ({void (* ___mute) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___mute; }), (data))
+#define maemo_program_connect_data__mute(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"mute",(GCallback) __extension__ ({void (* ___mute) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___mute; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__tools_settings(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"tools_settings",(GCallback) __extension__ ({void (* ___tools_settings) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___tools_settings; }), (data))
+#define maemo_program_connect_after__tools_settings(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"tools_settings",(GCallback) __extension__ ({void (* ___tools_settings) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___tools_settings; }), (data))
+#define maemo_program_connect_data__tools_settings(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"tools_settings",(GCallback) __extension__ ({void (* ___tools_settings) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___tools_settings; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__close(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"close",(GCallback) __extension__ ({void (* ___close) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___close; }), (data))
+#define maemo_program_connect_after__close(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"close",(GCallback) __extension__ ({void (* ___close) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___close; }), (data))
+#define maemo_program_connect_data__close(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"close",(GCallback) __extension__ ({void (* ___close) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___close; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__zoom_level_changed(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"zoom_level_changed",(GCallback) __extension__ ({void (* ___zoom_level_changed) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___zoom_level_changed; }), (data))
+#define maemo_program_connect_after__zoom_level_changed(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"zoom_level_changed",(GCallback) __extension__ ({void (* ___zoom_level_changed) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___zoom_level_changed; }), (data))
+#define maemo_program_connect_data__zoom_level_changed(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"zoom_level_changed",(GCallback) __extension__ ({void (* ___zoom_level_changed) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___zoom_level_changed; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__max_zoom_level_reached(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"max_zoom_level_reached",(GCallback) __extension__ ({void (* ___max_zoom_level_reached) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___max_zoom_level_reached; }), (data))
+#define maemo_program_connect_after__max_zoom_level_reached(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"max_zoom_level_reached",(GCallback) __extension__ ({void (* ___max_zoom_level_reached) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___max_zoom_level_reached; }), (data))
+#define maemo_program_connect_data__max_zoom_level_reached(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"max_zoom_level_reached",(GCallback) __extension__ ({void (* ___max_zoom_level_reached) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___max_zoom_level_reached; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__min_zoom_level_reached(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"min_zoom_level_reached",(GCallback) __extension__ ({void (* ___min_zoom_level_reached) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___min_zoom_level_reached; }), (data))
+#define maemo_program_connect_after__min_zoom_level_reached(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"min_zoom_level_reached",(GCallback) __extension__ ({void (* ___min_zoom_level_reached) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___min_zoom_level_reached; }), (data))
+#define maemo_program_connect_data__min_zoom_level_reached(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"min_zoom_level_reached",(GCallback) __extension__ ({void (* ___min_zoom_level_reached) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___min_zoom_level_reached; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_zoom_in(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_zoom_in",(GCallback) __extension__ ({void (* ___hw_key_zoom_in) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_zoom_in; }), (data))
+#define maemo_program_connect_after__hw_key_zoom_in(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_zoom_in",(GCallback) __extension__ ({void (* ___hw_key_zoom_in) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_zoom_in; }), (data))
+#define maemo_program_connect_data__hw_key_zoom_in(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_zoom_in",(GCallback) __extension__ ({void (* ___hw_key_zoom_in) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_zoom_in; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_zoom_out(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_zoom_out",(GCallback) __extension__ ({void (* ___hw_key_zoom_out) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_zoom_out; }), (data))
+#define maemo_program_connect_after__hw_key_zoom_out(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_zoom_out",(GCallback) __extension__ ({void (* ___hw_key_zoom_out) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_zoom_out; }), (data))
+#define maemo_program_connect_data__hw_key_zoom_out(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_zoom_out",(GCallback) __extension__ ({void (* ___hw_key_zoom_out) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_zoom_out; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_full_screen(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_full_screen",(GCallback) __extension__ ({void (* ___hw_key_full_screen) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_full_screen; }), (data))
+#define maemo_program_connect_after__hw_key_full_screen(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_full_screen",(GCallback) __extension__ ({void (* ___hw_key_full_screen) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_full_screen; }), (data))
+#define maemo_program_connect_data__hw_key_full_screen(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_full_screen",(GCallback) __extension__ ({void (* ___hw_key_full_screen) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_full_screen; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_up(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_up",(GCallback) __extension__ ({void (* ___hw_key_up) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_up; }), (data))
+#define maemo_program_connect_after__hw_key_up(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_up",(GCallback) __extension__ ({void (* ___hw_key_up) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_up; }), (data))
+#define maemo_program_connect_data__hw_key_up(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_up",(GCallback) __extension__ ({void (* ___hw_key_up) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_up; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_down(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_down",(GCallback) __extension__ ({void (* ___hw_key_down) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_down; }), (data))
+#define maemo_program_connect_after__hw_key_down(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_down",(GCallback) __extension__ ({void (* ___hw_key_down) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_down; }), (data))
+#define maemo_program_connect_data__hw_key_down(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_down",(GCallback) __extension__ ({void (* ___hw_key_down) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_down; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_left(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_left",(GCallback) __extension__ ({void (* ___hw_key_left) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_left; }), (data))
+#define maemo_program_connect_after__hw_key_left(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_left",(GCallback) __extension__ ({void (* ___hw_key_left) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_left; }), (data))
+#define maemo_program_connect_data__hw_key_left(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_left",(GCallback) __extension__ ({void (* ___hw_key_left) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_left; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_right(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_right",(GCallback) __extension__ ({void (* ___hw_key_right) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_right; }), (data))
+#define maemo_program_connect_after__hw_key_right(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_right",(GCallback) __extension__ ({void (* ___hw_key_right) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_right; }), (data))
+#define maemo_program_connect_data__hw_key_right(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_right",(GCallback) __extension__ ({void (* ___hw_key_right) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_right; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_select(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_select",(GCallback) __extension__ ({void (* ___hw_key_select) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_select; }), (data))
+#define maemo_program_connect_after__hw_key_select(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_select",(GCallback) __extension__ ({void (* ___hw_key_select) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_select; }), (data))
+#define maemo_program_connect_data__hw_key_select(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_select",(GCallback) __extension__ ({void (* ___hw_key_select) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_select; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_close(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_close",(GCallback) __extension__ ({void (* ___hw_key_close) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_close; }), (data))
+#define maemo_program_connect_after__hw_key_close(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_close",(GCallback) __extension__ ({void (* ___hw_key_close) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_close; }), (data))
+#define maemo_program_connect_data__hw_key_close(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_close",(GCallback) __extension__ ({void (* ___hw_key_close) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_close; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_menu(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_menu",(GCallback) __extension__ ({void (* ___hw_key_menu) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_menu; }), (data))
+#define maemo_program_connect_after__hw_key_menu(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_menu",(GCallback) __extension__ ({void (* ___hw_key_menu) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_menu; }), (data))
+#define maemo_program_connect_data__hw_key_menu(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_menu",(GCallback) __extension__ ({void (* ___hw_key_menu) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_menu; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_home(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_home",(GCallback) __extension__ ({void (* ___hw_key_home) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_home; }), (data))
+#define maemo_program_connect_after__hw_key_home(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_home",(GCallback) __extension__ ({void (* ___hw_key_home) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_home; }), (data))
+#define maemo_program_connect_data__hw_key_home(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_home",(GCallback) __extension__ ({void (* ___hw_key_home) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_home; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_power(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_power",(GCallback) __extension__ ({void (* ___hw_key_power) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_power; }), (data))
+#define maemo_program_connect_after__hw_key_power(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_power",(GCallback) __extension__ ({void (* ___hw_key_power) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_power; }), (data))
+#define maemo_program_connect_data__hw_key_power(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_power",(GCallback) __extension__ ({void (* ___hw_key_power) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_power; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_other(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_other",(GCallback) __extension__ ({void (* ___hw_key_other) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_other; }), (data))
+#define maemo_program_connect_after__hw_key_other(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_other",(GCallback) __extension__ ({void (* ___hw_key_other) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_other; }), (data))
+#define maemo_program_connect_data__hw_key_other(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"hw_key_other",(GCallback) __extension__ ({void (* ___hw_key_other) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___hw_key_other; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__state_shutdown(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_shutdown",(GCallback) __extension__ ({void (* ___state_shutdown) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_shutdown; }), (data))
+#define maemo_program_connect_after__state_shutdown(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_shutdown",(GCallback) __extension__ ({void (* ___state_shutdown) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_shutdown; }), (data))
+#define maemo_program_connect_data__state_shutdown(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_shutdown",(GCallback) __extension__ ({void (* ___state_shutdown) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_shutdown; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__state_memory_low(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_memory_low",(GCallback) __extension__ ({void (* ___state_memory_low) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_memory_low; }), (data))
+#define maemo_program_connect_after__state_memory_low(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_memory_low",(GCallback) __extension__ ({void (* ___state_memory_low) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_memory_low; }), (data))
+#define maemo_program_connect_data__state_memory_low(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_memory_low",(GCallback) __extension__ ({void (* ___state_memory_low) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_memory_low; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__state_save_unsaved_data(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_save_unsaved_data",(GCallback) __extension__ ({void (* ___state_save_unsaved_data) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_save_unsaved_data; }), (data))
+#define maemo_program_connect_after__state_save_unsaved_data(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_save_unsaved_data",(GCallback) __extension__ ({void (* ___state_save_unsaved_data) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_save_unsaved_data; }), (data))
+#define maemo_program_connect_data__state_save_unsaved_data(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_save_unsaved_data",(GCallback) __extension__ ({void (* ___state_save_unsaved_data) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_save_unsaved_data; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__state_system_inactivity(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_system_inactivity",(GCallback) __extension__ ({void (* ___state_system_inactivity) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_system_inactivity; }), (data))
+#define maemo_program_connect_after__state_system_inactivity(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_system_inactivity",(GCallback) __extension__ ({void (* ___state_system_inactivity) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_system_inactivity; }), (data))
+#define maemo_program_connect_data__state_system_inactivity(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_system_inactivity",(GCallback) __extension__ ({void (* ___state_system_inactivity) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_system_inactivity; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__state_normal_mode(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_normal_mode",(GCallback) __extension__ ({void (* ___state_normal_mode) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_normal_mode; }), (data))
+#define maemo_program_connect_after__state_normal_mode(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_normal_mode",(GCallback) __extension__ ({void (* ___state_normal_mode) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_normal_mode; }), (data))
+#define maemo_program_connect_data__state_normal_mode(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_normal_mode",(GCallback) __extension__ ({void (* ___state_normal_mode) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_normal_mode; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__state_flight_mode(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_flight_mode",(GCallback) __extension__ ({void (* ___state_flight_mode) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_flight_mode; }), (data))
+#define maemo_program_connect_after__state_flight_mode(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_flight_mode",(GCallback) __extension__ ({void (* ___state_flight_mode) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_flight_mode; }), (data))
+#define maemo_program_connect_data__state_flight_mode(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_flight_mode",(GCallback) __extension__ ({void (* ___state_flight_mode) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_flight_mode; }), (data), (destroy_data), (GConnectFlags)(flags))
+#define maemo_program_connect__state_other(object,func,data) g_signal_connect(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_other",(GCallback) __extension__ ({void (* ___state_other) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_other; }), (data))
+#define maemo_program_connect_after__state_other(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_other",(GCallback) __extension__ ({void (* ___state_other) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_other; }), (data))
+#define maemo_program_connect_data__state_other(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(__extension__ ({MaemoProgram *___object = (object); ___object; })),"state_other",(GCallback) __extension__ ({void (* ___state_other) (MaemoProgram * ___fake___self, gpointer ___fake___data, gpointer ___data ) = (func); ___state_other; }), (data), (destroy_data), (GConnectFlags)(flags))
+#else /* __GNUC__ && !__STRICT_ANSI__ */
+#define maemo_program_connect__file_new(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"file_new",(GCallback)(func),(data))
+#define maemo_program_connect_after__file_new(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"file_new",(GCallback)(func),(data))
+#define maemo_program_connect_data__file_new(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"file_new",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__file_open(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"file_open",(GCallback)(func),(data))
+#define maemo_program_connect_after__file_open(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"file_open",(GCallback)(func),(data))
+#define maemo_program_connect_data__file_open(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"file_open",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__file_save(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"file_save",(GCallback)(func),(data))
+#define maemo_program_connect_after__file_save(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"file_save",(GCallback)(func),(data))
+#define maemo_program_connect_data__file_save(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"file_save",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__file_save_as(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"file_save_as",(GCallback)(func),(data))
+#define maemo_program_connect_after__file_save_as(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"file_save_as",(GCallback)(func),(data))
+#define maemo_program_connect_data__file_save_as(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"file_save_as",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__edit_undo(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"edit_undo",(GCallback)(func),(data))
+#define maemo_program_connect_after__edit_undo(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"edit_undo",(GCallback)(func),(data))
+#define maemo_program_connect_data__edit_undo(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"edit_undo",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__edit_redo(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"edit_redo",(GCallback)(func),(data))
+#define maemo_program_connect_after__edit_redo(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"edit_redo",(GCallback)(func),(data))
+#define maemo_program_connect_data__edit_redo(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"edit_redo",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__edit_cut(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"edit_cut",(GCallback)(func),(data))
+#define maemo_program_connect_after__edit_cut(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"edit_cut",(GCallback)(func),(data))
+#define maemo_program_connect_data__edit_cut(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"edit_cut",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__edit_copy(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"edit_copy",(GCallback)(func),(data))
+#define maemo_program_connect_after__edit_copy(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"edit_copy",(GCallback)(func),(data))
+#define maemo_program_connect_data__edit_copy(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"edit_copy",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__edit_paste(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"edit_paste",(GCallback)(func),(data))
+#define maemo_program_connect_after__edit_paste(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"edit_paste",(GCallback)(func),(data))
+#define maemo_program_connect_data__edit_paste(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"edit_paste",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__edit_select_all(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"edit_select_all",(GCallback)(func),(data))
+#define maemo_program_connect_after__edit_select_all(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"edit_select_all",(GCallback)(func),(data))
+#define maemo_program_connect_data__edit_select_all(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"edit_select_all",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__view_full_screen(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"view_full_screen",(GCallback)(func),(data))
+#define maemo_program_connect_after__view_full_screen(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"view_full_screen",(GCallback)(func),(data))
+#define maemo_program_connect_data__view_full_screen(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"view_full_screen",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__play(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"play",(GCallback)(func),(data))
+#define maemo_program_connect_after__play(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"play",(GCallback)(func),(data))
+#define maemo_program_connect_data__play(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"play",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__play_stop(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"play_stop",(GCallback)(func),(data))
+#define maemo_program_connect_after__play_stop(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"play_stop",(GCallback)(func),(data))
+#define maemo_program_connect_data__play_stop(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"play_stop",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__play_previous(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"play_previous",(GCallback)(func),(data))
+#define maemo_program_connect_after__play_previous(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"play_previous",(GCallback)(func),(data))
+#define maemo_program_connect_data__play_previous(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"play_previous",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__play_next(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"play_next",(GCallback)(func),(data))
+#define maemo_program_connect_after__play_next(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"play_next",(GCallback)(func),(data))
+#define maemo_program_connect_data__play_next(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"play_next",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__mute(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"mute",(GCallback)(func),(data))
+#define maemo_program_connect_after__mute(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"mute",(GCallback)(func),(data))
+#define maemo_program_connect_data__mute(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"mute",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__tools_settings(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"tools_settings",(GCallback)(func),(data))
+#define maemo_program_connect_after__tools_settings(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"tools_settings",(GCallback)(func),(data))
+#define maemo_program_connect_data__tools_settings(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"tools_settings",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__close(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"close",(GCallback)(func),(data))
+#define maemo_program_connect_after__close(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"close",(GCallback)(func),(data))
+#define maemo_program_connect_data__close(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"close",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__zoom_level_changed(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"zoom_level_changed",(GCallback)(func),(data))
+#define maemo_program_connect_after__zoom_level_changed(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"zoom_level_changed",(GCallback)(func),(data))
+#define maemo_program_connect_data__zoom_level_changed(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"zoom_level_changed",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__max_zoom_level_reached(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"max_zoom_level_reached",(GCallback)(func),(data))
+#define maemo_program_connect_after__max_zoom_level_reached(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"max_zoom_level_reached",(GCallback)(func),(data))
+#define maemo_program_connect_data__max_zoom_level_reached(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"max_zoom_level_reached",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__min_zoom_level_reached(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"min_zoom_level_reached",(GCallback)(func),(data))
+#define maemo_program_connect_after__min_zoom_level_reached(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"min_zoom_level_reached",(GCallback)(func),(data))
+#define maemo_program_connect_data__min_zoom_level_reached(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"min_zoom_level_reached",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_zoom_in(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_zoom_in",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_zoom_in(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_zoom_in",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_zoom_in(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_zoom_in",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_zoom_out(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_zoom_out",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_zoom_out(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_zoom_out",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_zoom_out(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_zoom_out",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_full_screen(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_full_screen",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_full_screen(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_full_screen",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_full_screen(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_full_screen",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_up(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_up",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_up(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_up",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_up(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_up",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_down(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_down",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_down(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_down",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_down(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_down",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_left(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_left",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_left(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_left",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_left(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_left",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_right(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_right",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_right(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_right",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_right(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_right",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_select(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_select",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_select(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_select",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_select(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_select",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_close(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_close",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_close(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_close",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_close(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_close",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_menu(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_menu",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_menu(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_menu",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_menu(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_menu",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_home(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_home",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_home(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_home",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_home(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_home",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_power(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_power",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_power(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_power",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_power(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_power",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__hw_key_other(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"hw_key_other",(GCallback)(func),(data))
+#define maemo_program_connect_after__hw_key_other(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"hw_key_other",(GCallback)(func),(data))
+#define maemo_program_connect_data__hw_key_other(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"hw_key_other",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__state_shutdown(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"state_shutdown",(GCallback)(func),(data))
+#define maemo_program_connect_after__state_shutdown(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"state_shutdown",(GCallback)(func),(data))
+#define maemo_program_connect_data__state_shutdown(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"state_shutdown",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__state_memory_low(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"state_memory_low",(GCallback)(func),(data))
+#define maemo_program_connect_after__state_memory_low(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"state_memory_low",(GCallback)(func),(data))
+#define maemo_program_connect_data__state_memory_low(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"state_memory_low",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__state_save_unsaved_data(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"state_save_unsaved_data",(GCallback)(func),(data))
+#define maemo_program_connect_after__state_save_unsaved_data(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"state_save_unsaved_data",(GCallback)(func),(data))
+#define maemo_program_connect_data__state_save_unsaved_data(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"state_save_unsaved_data",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__state_system_inactivity(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"state_system_inactivity",(GCallback)(func),(data))
+#define maemo_program_connect_after__state_system_inactivity(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"state_system_inactivity",(GCallback)(func),(data))
+#define maemo_program_connect_data__state_system_inactivity(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"state_system_inactivity",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__state_normal_mode(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"state_normal_mode",(GCallback)(func),(data))
+#define maemo_program_connect_after__state_normal_mode(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"state_normal_mode",(GCallback)(func),(data))
+#define maemo_program_connect_data__state_normal_mode(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"state_normal_mode",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__state_flight_mode(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"state_flight_mode",(GCallback)(func),(data))
+#define maemo_program_connect_after__state_flight_mode(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"state_flight_mode",(GCallback)(func),(data))
+#define maemo_program_connect_data__state_flight_mode(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"state_flight_mode",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#define maemo_program_connect__state_other(object,func,data) g_signal_connect(MAEMO_PROGRAM(object),"state_other",(GCallback)(func),(data))
+#define maemo_program_connect_after__state_other(object,func,data) g_signal_connect_after(MAEMO_PROGRAM(object),"state_other",(GCallback)(func),(data))
+#define maemo_program_connect_data__state_other(object,func,data,destroy_data,flags) g_signal_connect_data(MAEMO_PROGRAM(object),"state_other",(GCallback)(func),(data),(destroy_data),(GConnectFlags)(flags))
+#endif /* __GNUC__ && !__STRICT_ANSI__ */
+
+
+/*
+ * Argument wrapping macros
+ */
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#define MAEMO_PROGRAM_PROP_NAME(arg) "name", __extension__ ({gchar *z = (arg); z;})
+#define MAEMO_PROGRAM_GET_PROP_NAME(arg) "name", __extension__ ({gchar **z = (arg); z;})
+#define MAEMO_PROGRAM_GET_PROP_WINDOW(arg) "window", __extension__ ({GObject **z = (arg); z;})
+#define MAEMO_PROGRAM_PROP_MENU(arg) "menu", __extension__ ({GObject *z = (arg); z;})
+#define MAEMO_PROGRAM_GET_PROP_MENU(arg) "menu", __extension__ ({GObject **z = (arg); z;})
+#define MAEMO_PROGRAM_PROP_FILE_MENU(arg) "file_menu", __extension__ ({GObject *z = (arg); z;})
+#define MAEMO_PROGRAM_GET_PROP_FILE_MENU(arg) "file_menu", __extension__ ({GObject **z = (arg); z;})
+#define MAEMO_PROGRAM_PROP_EDIT_MENU(arg) "edit_menu", __extension__ ({GObject *z = (arg); z;})
+#define MAEMO_PROGRAM_GET_PROP_EDIT_MENU(arg) "edit_menu", __extension__ ({GObject **z = (arg); z;})
+#define MAEMO_PROGRAM_PROP_VIEW_MENU(arg) "view_menu", __extension__ ({GObject *z = (arg); z;})
+#define MAEMO_PROGRAM_GET_PROP_VIEW_MENU(arg) "view_menu", __extension__ ({GObject **z = (arg); z;})
+#define MAEMO_PROGRAM_PROP_TOOLS_MENU(arg) "tools_menu", __extension__ ({GObject *z = (arg); z;})
+#define MAEMO_PROGRAM_GET_PROP_TOOLS_MENU(arg) "tools_menu", __extension__ ({GObject **z = (arg); z;})
+#define MAEMO_PROGRAM_PROP_PLAY_MENU(arg) "play_menu", __extension__ ({GObject *z = (arg); z;})
+#define MAEMO_PROGRAM_GET_PROP_PLAY_MENU(arg) "play_menu", __extension__ ({GObject **z = (arg); z;})
+#define MAEMO_PROGRAM_GET_PROP_TOOLBAR(arg) "toolbar", __extension__ ({GObject **z = (arg); z;})
+#else /* __GNUC__ && !__STRICT_ANSI__ */
+#define MAEMO_PROGRAM_PROP_NAME(arg) "name",(gchar *)(arg)
+#define MAEMO_PROGRAM_GET_PROP_NAME(arg) "name",(gchar **)(arg)
+#define MAEMO_PROGRAM_GET_PROP_WINDOW(arg) "window",(GObject **)(arg)
+#define MAEMO_PROGRAM_PROP_MENU(arg) "menu",(GObject *)(arg)
+#define MAEMO_PROGRAM_GET_PROP_MENU(arg) "menu",(GObject **)(arg)
+#define MAEMO_PROGRAM_PROP_FILE_MENU(arg) "file_menu",(GObject *)(arg)
+#define MAEMO_PROGRAM_GET_PROP_FILE_MENU(arg) "file_menu",(GObject **)(arg)
+#define MAEMO_PROGRAM_PROP_EDIT_MENU(arg) "edit_menu",(GObject *)(arg)
+#define MAEMO_PROGRAM_GET_PROP_EDIT_MENU(arg) "edit_menu",(GObject **)(arg)
+#define MAEMO_PROGRAM_PROP_VIEW_MENU(arg) "view_menu",(GObject *)(arg)
+#define MAEMO_PROGRAM_GET_PROP_VIEW_MENU(arg) "view_menu",(GObject **)(arg)
+#define MAEMO_PROGRAM_PROP_TOOLS_MENU(arg) "tools_menu",(GObject *)(arg)
+#define MAEMO_PROGRAM_GET_PROP_TOOLS_MENU(arg) "tools_menu",(GObject **)(arg)
+#define MAEMO_PROGRAM_PROP_PLAY_MENU(arg) "play_menu",(GObject *)(arg)
+#define MAEMO_PROGRAM_GET_PROP_PLAY_MENU(arg) "play_menu",(GObject **)(arg)
+#define MAEMO_PROGRAM_GET_PROP_TOOLBAR(arg) "toolbar",(GObject **)(arg)
+#endif /* __GNUC__ && !__STRICT_ANSI__ */
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-program.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-project.glade
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-project.glade (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-project.glade 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkWindow" id="window">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">window</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="default_width">500</property>
+ <property name="default_height">400</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+
+ <child>
+ <placeholder/>
+ </child>
+</widget>
+
+</glade-interface>
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo-project.glade
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,95 @@
+#ifndef _MAEMO_H
+#define _MAEMO_H
+
+#include "maemo-version.h"
+#include <gtk/gtk.h>
+
+#if HAVE_MAEMO_SCIROCCO
+ #include <hildon-widgets/hildon-program.h>
+#elif HAVE_MAEMO_BORA
+ #include <hildon-widgets/hildon-program.h>
+#else
+ #include <hildon/hildon-program.h>
+#endif
+
+#include <libosso.h>
+#include <signal.h>
+#include <string.h>
+
+
+typedef enum {
+ MaemoProgramEventFunctionKeyPress,
+ MaemoProgramEventSystemState,
+ MaemoProgramEventOther
+} MaemoProgramEventType;
+
+typedef enum {
+ MaemoMenuStandard = 0,
+ MaemoMenuFile = 1,
+ MaemoMenuEdit = 2,
+ MaemoMenuView = 4,
+ MaemoMenuTools = 8,
+ MaemoMenuPlay = 16
+} MaemoSubMenuMask;
+
+typedef enum {
+ MaemoFileMenuEmpty = 0,
+ MaemoFileMenuNew = 1,
+ MaemoFileMenuOpen = 2,
+ MaemoFileMenuSave = 4,
+ MaemoFileMenuSaveAs = 8,
+ MaemoFileMenuClose = 16,
+ MaemoFileMenuAll = 31
+} MaemoFileMenuMask;
+
+typedef enum {
+ MaemoEditMenuEmpty = 0,
+ MaemoEditMenuUndo = 1,
+ MaemoEditMenuRedo = 2,
+ MaemoEditMenuCut = 4,
+ MaemoEditMenuCopy = 8,
+ MaemoEditMenuPaste = 16,
+ MaemoEditMenuSelectAll = 32,
+ MaemoEditMenuAll = 63
+} MaemoEditMenuMask;
+
+typedef enum {
+ MaemoViewMenuEmpty = 0,
+ MaemoViewMenuZoom = 1,
+ MaemoViewMenuShowToolbar = 2,
+ MaemoViewMenuAll = 3
+} MaemoViewMenuMask;
+
+typedef enum {
+ MaemoToolsMenuEmpty = 0,
+ MaemoToolsMenuClear = 1,
+ MaemoToolsMenuSettings = 2,
+ MaemoToolsMenuAll = 3
+} MaemoToolsMenuMask;
+
+typedef enum {
+ MaemoPlayMenuEmpty = 0,
+ MaemoPlayMenuPlay = 1,
+ MaemoPlayMenuStop = 2,
+ MaemoPlayMenuMute = 4,
+ MaemoPlayMenuPrevious = 8,
+ MaemoPlayMenuNext = 16,
+ MaemoPlayMenuAll = 31
+} MaemoPlayMenuMask;
+
+typedef struct {
+ gchar *first_submenu_name;
+ MaemoSubMenuMask submenus;
+
+ MaemoFileMenuMask file_menu;
+ MaemoEditMenuMask edit_menu;
+ MaemoViewMenuMask view_menu;
+ MaemoToolsMenuMask tools_menu;
+ MaemoPlayMenuMask play_menu;
+} MaemoMenuStructure;
+
+
+#include "maemo-program.h"
+
+#endif /* _MAEMO_H */
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/maemo.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/main.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/main.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/main.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,72 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * $(projectName)
+ *
+ * main.c
+ * Copyright (C) $(year) $(author) <$(email)>
+ *
+ * main.c is free software.
+ *
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * main.c is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with main.c. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "maemo.h"
+#include "interface.h"
+#include "support.h"
+#include "callbacks.h"
+
+
+/*
+ * The main function.
+ */
+int
+main(int argc, char *argv[])
+{
+ MaemoProgram *program;
+
+ const gchar *application_name = "$(projectName)";
+ const gchar *service_name = "com.nokia.$(projectName)";
+ const gchar *help_id = "osso_$(projectName)_Content";
+
+ const gchar *copyright = "Copyright (C) $(year) $(author)";
+ const gchar *description = "$(description)";
+ const gchar *url = "$(url)";
+ const gchar *web = "$(website)";
+ const gchar *license = "$(license)";
+
+
+ g_type_init();
+ g_thread_init( NULL );
+
+ program = maemo_program_new( application_name, service_name,
+ help_id, argc, argv, NULL );
+ maemo_program_set_about( program, copyright, license, description, NULL );
+ maemo_program_set_about_website( program, url, web );
+
+ /* Bind signals for the application user interface. */
+ bind_standard_callbacks( program, NULL );
+
+ /* Go to the main loop. */
+ maemo_program_main( program );
+
+ return 0;
+}
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/main.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/support.c
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/support.c (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/support.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,144 @@
+/*
+ * DO NOT EDIT THIS FILE - it is generated by Glade.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <gtk/gtk.h>
+
+#include "support.h"
+
+GtkWidget*
+lookup_widget (GtkWidget *widget,
+ const gchar *widget_name)
+{
+ GtkWidget *parent, *found_widget;
+
+ for (;;)
+ {
+ if (GTK_IS_MENU (widget))
+ parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
+ else
+ parent = widget->parent;
+ if (!parent)
+ parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
+ if (parent == NULL)
+ break;
+ widget = parent;
+ }
+
+ found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
+ widget_name);
+ if (!found_widget)
+ g_warning ("Widget not found: %s", widget_name);
+ return found_widget;
+}
+
+static GList *pixmaps_directories = NULL;
+
+/* Use this function to set the directory containing installed pixmaps. */
+void
+add_pixmap_directory (const gchar *directory)
+{
+ pixmaps_directories = g_list_prepend (pixmaps_directories,
+ g_strdup (directory));
+}
+
+/* This is an internally used function to find pixmap files. */
+static gchar*
+find_pixmap_file (const gchar *filename)
+{
+ GList *elem;
+
+ /* We step through each of the pixmaps directory to find it. */
+ elem = pixmaps_directories;
+ while (elem)
+ {
+ gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
+ G_DIR_SEPARATOR_S, filename);
+ if (g_file_test (pathname, G_FILE_TEST_EXISTS))
+ return pathname;
+ g_free (pathname);
+ elem = elem->next;
+ }
+ return NULL;
+}
+
+/* This is an internally used function to create pixmaps. */
+GtkWidget*
+create_pixmap (GtkWidget *widget,
+ const gchar *filename)
+{
+ gchar *pathname = NULL;
+ GtkWidget *pixmap;
+
+ if (!filename || !filename[0])
+ return gtk_image_new ();
+
+ pathname = find_pixmap_file (filename);
+
+ if (!pathname)
+ {
+ g_warning (_("Couldn't find pixmap file: %s"), filename);
+ return gtk_image_new ();
+ }
+
+ pixmap = gtk_image_new_from_file (pathname);
+ g_free (pathname);
+ return pixmap;
+}
+
+/* This is an internally used function to create pixmaps. */
+GdkPixbuf*
+create_pixbuf (const gchar *filename)
+{
+ gchar *pathname = NULL;
+ GdkPixbuf *pixbuf;
+ GError *error = NULL;
+
+ if (!filename || !filename[0])
+ return NULL;
+
+ pathname = find_pixmap_file (filename);
+
+ if (!pathname)
+ {
+ g_warning (_("Couldn't find pixmap file: %s"), filename);
+ return NULL;
+ }
+
+ pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
+ if (!pixbuf)
+ {
+ fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
+ pathname, error->message);
+ g_error_free (error);
+ }
+ g_free (pathname);
+ return pixbuf;
+}
+
+/* This is used to set ATK action descriptions. */
+void
+glade_set_atk_action_description (AtkAction *action,
+ const gchar *action_name,
+ const gchar *description)
+{
+ gint n_actions, i;
+
+ n_actions = atk_action_get_n_actions (action);
+ for (i = 0; i < n_actions; i++)
+ {
+ if (!strcmp (atk_action_get_name (action, i), action_name))
+ atk_action_set_description (action, i, description);
+ }
+}
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/support.c
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/support.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/support.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/support.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,69 @@
+/*
+ * DO NOT EDIT THIS FILE - it is generated by Glade.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+
+/*
+ * Standard gettext macros.
+ */
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# undef _
+# define _(String) dgettext (PACKAGE, String)
+# define Q_(String) g_strip_context ((String), gettext (String))
+# ifdef gettext_noop
+# define N_(String) gettext_noop (String)
+# else
+# define N_(String) (String)
+# endif
+#else
+# define textdomain(String) (String)
+# define gettext(String) (String)
+# define dgettext(Domain,Message) (Message)
+# define dcgettext(Domain,Message,Type) (Message)
+# define bindtextdomain(Domain,Directory) (Domain)
+# define _(String) (String)
+# define Q_(String) g_strip_context ((String), (String))
+# define N_(String) (String)
+#endif
+
+
+/*
+ * Public Functions.
+ */
+
+/*
+ * This function returns a widget in a component created by Glade.
+ * Call it with the toplevel widget in the component (i.e. a window/dialog),
+ * or alternatively any widget in the component, and the name of the widget
+ * you want returned.
+ */
+GtkWidget* lookup_widget (GtkWidget *widget,
+ const gchar *widget_name);
+
+
+/* Use this function to set the directory containing installed pixmaps. */
+void add_pixmap_directory (const gchar *directory);
+
+
+/*
+ * Private Functions.
+ */
+
+/* This is used to create the pixmaps used in the interface. */
+GtkWidget* create_pixmap (GtkWidget *widget,
+ const gchar *filename);
+
+/* This is used to create the pixbufs used in the interface. */
+GdkPixbuf* create_pixbuf (const gchar *filename);
+
+/* This is used to set ATK action descriptions. */
+void glade_set_atk_action_description (AtkAction *action,
+ const gchar *action_name,
+ const gchar *description);
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/src/support.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+#Template Default Values
+MaemoProject.Ctemplate.label=Maemo Glade Project
+MaemoProject.Ctemplate.description=Maemo project generated by Glade (from Anjuta Maemo Plugin).\n\n\
+NOTE: this application requires the 'doctools' devkit in your scratchbox target. \n\n\
+If you get the error:\n\n\
+\tconfigure: error: Your intltool is too old. You need intltool 0.23 or later.\n\n\
+when configuring, then for scratchbox 1, invoke a command like:\n\n\
+\tsb-conf setup CHINOOK_ARMEL --force --cputransp=/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2 \
+--compiler=cs2005q3.2-glibc2.5-arm --devkits=perl:debian-etch:maemo3-tools:cputransp:doctools\n\n\
+(or establish a similar configuration via sb-menu), then invoke "Build Application > Generate Configure" and rebuild.
+MaemoProject.basics.label=Basic Settings
+MaemoProject.basics.description=Basic properties of a project
+MaemoProject.author.label=Author
+MaemoProject.author.description=Name of the author
+MaemoProject.email.label=Author E-mail
+MaemoProject.email.description=E-mail of the author
+MaemoProject.license.label=Copyright notice
+MaemoProject.license.description=Your copyright notice
+MaemoProject.license.default=Your copyright notice
+MaemoProject.version.label=Version
+MaemoProject.version.description=Version of application
+MaemoProject.version.default=0.1
+MaemoProject.description.label=Description
+MaemoProject.description.description=Description of project, seen in About
+MaemoProject.url.label=URL
+MaemoProject.url.description=URL for your website
+MaemoProject.website.label=Website
+MaemoProject.website.description=Human-readable website name
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Nokia" revision="1.0" author="Nokia Corporation"
+ copyright="Copyright (c) 2008 Nokia Corporation. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="MaemoProject" label="%MaemoProject.Ctemplate.label" description="%MaemoProject.Ctemplate.description"
+ help="help.html">
+ <property-group id="basics" label="%MaemoProject.basics.label" description="%MaemoProject.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%MaemoProject.author.label"
+ description="%MaemoProject.author.description"
+ type="input"
+ pattern=".*"
+ default="Me"
+ hidden="false"
+ persist="true"/>
+ <property id="email"
+ label="%MaemoProject.email.label"
+ description="%MaemoProject.email.description"
+ type="input"
+ pattern=".*"
+ default="me at foo.bar"
+ hidden="false"
+ persist="true"/>
+ <property id="description"
+ label="%MaemoProject.description.label"
+ description="%MaemoProject.description.description"
+ type="input"
+ pattern=".*"
+ default="[project description]"
+ hidden="false"
+ persist="true"/>
+ <property id="url"
+ label="%MaemoProject.url.label"
+ description="%MaemoProject.url.description"
+ type="input"
+ pattern=".*"
+ default="http://www.foo.bar"
+ hidden="false"
+ persist="true"/>
+ <property id="website"
+ label="%MaemoProject.website.label"
+ description="%MaemoProject.website.description"
+ type="input"
+ pattern=".*"
+ default="foo.bar"
+ hidden="false"
+ persist="true"/>
+ <property id="license"
+ label="%MaemoProject.license.label"
+ description="%MaemoProject.license.description"
+ type="input"
+ pattern=".*"
+ default="[your distribution license]"
+ hidden="false"
+ persist="true"/>
+
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="AUTHORS"/>
+ <simple name="target" value="AUTHORS"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="autogen.sh"/>
+ <simple name="target" value="autogen.sh"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="ChangeLog"/>
+ <simple name="target" value="ChangeLog"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="configure.ac"/>
+ <simple name="target" value="configure.ac"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="maemogen.sh"/>
+ <simple name="target" value="maemogen.sh"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="Makefile.am"/>
+ <simple name="target" value="Makefile.am"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="NEWS"/>
+ <simple name="target" value="NEWS"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="README"/>
+ <simple name="target" value="README"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="data/maemo-project_help.xml"/>
+ <simple name="target" value="data/$(projectName)_help.xml"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="data/maemo-project.desktop"/>
+ <simple name="target" value="data/$(projectName).desktop"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="data/maemo-project.service"/>
+ <simple name="target" value="data/$(projectName).service"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/changelog"/>
+ <simple name="target" value="debian/changelog"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/control"/>
+ <simple name="target" value="debian/control"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="debian/rules"/>
+ <simple name="target" value="debian/rules"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="po/ChangeLog"/>
+ <simple name="target" value="po/ChangeLog"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="po/Makefile.in.in"/>
+ <simple name="target" value="po/Makefile.in.in"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="po/POTFILES.in"/>
+ <simple name="target" value="po/POTFILES.in"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/callbacks.c"/>
+ <simple name="target" value="src/callbacks.c"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/callbacks.h"/>
+ <simple name="target" value="src/callbacks.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/interface.h"/>
+ <simple name="target" value="src/interface.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/maemo.h"/>
+ <simple name="target" value="src/maemo.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/maemo-program.c"/>
+ <simple name="target" value="src/maemo-program.c"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/maemo-program.gob"/>
+ <simple name="target" value="src/maemo-program.gob"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/maemo-program.h"/>
+ <simple name="target" value="src/maemo-program.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/maemo-project.glade"/>
+ <simple name="target" value="src/$(projectName).glade"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/main.c"/>
+ <simple name="target" value="src/main.c"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/Makefile.am"/>
+ <simple name="target" value="src/Makefile.am"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/support.c"/>
+ <simple name="target" value="src/support.c"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/support.h"/>
+ <simple name="target" value="src/support.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildon-application-framework-debug" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="gtk+-2.0" />
+ <element value="dbus-1" />
+ <element value="gconf-2.0" />
+ <element value="gthread-2.0" />
+ <element value="hildon-1" />
+ <element value="hildon-help" />
+ <element value="libosso" />
+ <element value="cairo" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.RunScript">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="commandArguments">
+ <element value="./maemogen.sh" />
+ </simple-array>
+ </process>
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/MaemoProject/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/COPYING.LESSER
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/COPYING.LESSER (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/COPYING.LESSER
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3 @@
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = src
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/autogen.sh
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/autogen.sh (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/autogen.sh 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -x
+glib-gettextize --copy --force
+libtoolize --copy --automake
+intltoolize --copy --force --automake
+
+aclocal-1.8
+autoconf
+autoheader
+automake-1.8 --add-missing --copy --foreign
+./configure --enable-maintainer-mode
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/autogen.sh
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/configure.ac
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/configure.ac (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/configure.ac 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+AC_INIT(socket_example, 0.1)
+AC_PREREQ(2.59)
+
+AM_INIT_AUTOMAKE([1.7.9])
+AC_CONFIG_HEADERS([config.h])
+
+AC_GNU_SOURCE
+AC_CANONICAL_HOST
+AM_MAINTAINER_MODE
+
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_CXX
+
+AC_CONFIG_FILES([Makefile
+ src/Makefile])
+
+PKG_CHECK_MODULES(LIBHILDONMM, hildonmm >= 0.9.6)
+AC_SUBST(LIBHILDONMM_CFLAGS)
+AC_SUBST(LIBHILDONMM_LIBS)
+
+AC_OUTPUT
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/configure.ac
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/Makefile.am
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/Makefile.am (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/Makefile.am 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+AUTOMAKE_OPTIONS = foreign
+
+bin_PROGRAMS = client server
+
+client_SOURCES = main-client.cpp \
+ client.cpp \
+ client.h
+
+client_LDADD = $(LIBHILDONMM_LIBS)
+client_CXXFLAGS = $(LIBHILDONMM_CFLAGS)
+
+server_SOURCES = main-server.cpp \
+ server.cpp \
+ server.h
+
+server_LDADD = $(LIBHILDONMM_LIBS)
+server_CXXFLAGS = $(LIBHILDONMM_CFLAGS)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/Makefile.am
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/client.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/client.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/client.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : client.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : Socket Example
+ ============================================================================
+ */
+
+#include <netdb.h>
+
+#include "client.h"
+
+/* Print exception & error messages */
+static void show_exception(Gtk::Window *window, std::auto_ptr<Glib::Error> ex)
+{
+ Gtk::MessageDialog dialog(*window, ex->what(), false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+}
+
+static void show_error(Gtk::Window *window, Glib::ustring message)
+{
+ Gtk::MessageDialog dialog(*window, message, false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+}
+
+/* Class constructor */
+Client::Client() :
+ m_item_exit("Exit"),
+ m_item_connection_setup("Connection setup"),
+ m_item_disconnect("Disconnect from server"),
+ m_label_address("Enter server address:"),
+ m_label_message("Enter message to send:"),
+ m_label_port("Enter server port:"),
+ m_button_connect("Connect to server"),
+ m_button_send("Send message")
+{
+ /* Callback handlers */
+ m_item_exit.signal_activate().connect( sigc::mem_fun(*this,
+ &Client::on_menu_quit));
+ m_item_connection_setup.signal_activate().connect( sigc::mem_fun(*this,
+ &Client::on_menu_connection_setup));
+ m_item_disconnect.signal_activate().connect( sigc::mem_fun(*this,
+ &Client::on_menu_disconnect));
+ m_button_connect.signal_clicked().connect(sigc::mem_fun(*this,
+ &Client::on_button_connect_clicked));
+ m_button_send.signal_clicked().connect(sigc::mem_fun(*this,
+ &Client::on_button_send_clicked));
+
+ /* Add items to the menu */
+ m_main.append(m_item_connection_setup);
+ m_main.append(m_item_disconnect);
+ m_main.append(m_item_exit);
+
+ /* Attach the menu object to the application */
+ set_menu(m_main);
+
+ /* Add the m_frame_box to window: */
+ add(m_frame_box);
+
+ /* Set up entries */
+ m_entry_address.set_text("127.0.0.1");
+ m_entry_message.set_text("Hello World!");
+ m_entry_port.set_text("12345");
+
+ /* Add widgets to their respective boxes */
+ m_connect_box.pack_start(m_label_address, Gtk::PACK_SHRINK);
+ m_connect_box.pack_start(m_entry_address, Gtk::PACK_SHRINK);
+ m_connect_box.pack_start(m_label_port, Gtk::PACK_SHRINK);
+ m_connect_box.pack_start(m_entry_port, Gtk::PACK_SHRINK);
+ m_connect_box.pack_start(m_button_connect, Gtk::PACK_SHRINK);
+
+ m_message_box.pack_start(m_label_message, Gtk::PACK_SHRINK);
+ m_message_box.pack_start(m_entry_message, Gtk::PACK_SHRINK);
+ m_message_box.pack_start(m_button_send, Gtk::PACK_SHRINK);
+
+ m_frame_box.pack_start(m_connect_box, Gtk::PACK_SHRINK);
+ m_frame_box.pack_start(m_message_box, Gtk::PACK_EXPAND_WIDGET);
+
+ /* Set up widgets initial appeareance */
+ m_item_disconnect.hide();
+ m_connect_box.hide();
+ m_message_box.hide();
+ m_frame_box.show();
+}
+
+/* Class destructor */
+Client::~Client()
+{
+}
+
+/* Menu option "Exit" is selected */
+void Client::on_menu_quit()
+{
+ hide();
+}
+
+/* Menu option "Connection setup" is selected */
+void Client::on_menu_connection_setup()
+{
+ m_item_connection_setup.hide();
+ m_connect_box.show_all();
+ m_message_box.hide();
+}
+
+/* Menu option "Disconnect from server" is selected */
+void Client::on_menu_disconnect()
+{
+ m_item_connection_setup.show();
+ m_item_disconnect.hide();
+ m_message_box.hide();
+
+ /* Close IOChannel */
+ m_channel->close(true, m_ex);
+ if (m_ex.get()) {
+ show_exception(this, m_ex);
+ } else {
+ /* Close socket descriptor */
+ close(m_socket);
+ }
+}
+
+/* Creates a socket and associates it with an I/O channel */
+bool Client::create_connection()
+{
+ hostent *host_info; // Server info
+ sockaddr_in address; // Socket address
+
+ /* Get host address */
+ host_info = gethostbyname(m_entry_address.get_text().c_str());
+ if (host_info == NULL) {
+ show_error(this, "Server address incorrect!");
+ return false;
+ } else {
+ /* Create TCP (streamed) network socket */
+ m_socket = socket(AF_INET, SOCK_STREAM, 0);
+ if (socket < 0) {
+ show_error(this, "Can't create socket!");
+ return false;
+ } else {
+ /* Set socket address properties */
+ address.sin_family = AF_INET;
+ memcpy((char *) &address.sin_addr.s_addr,
+ host_info->h_addr_list[0], host_info->h_length);
+ address.sin_port = htons(atoi(m_entry_port.get_text().c_str()));
+
+ /* Connect socket to remote server */
+ if (connect(m_socket, (struct sockaddr *) &address,
+ sizeof(address)) < 0) {
+ show_error(this, "Can't connect to server!");
+ return false;
+ } else {
+ /* Creates I/O channel from socket descriptor */
+ m_channel = Glib::IOChannel::create_from_fd(m_socket);
+
+ /* Set I/O channel to be non-block */
+ m_channel->set_flags(Glib::IO_FLAG_NONBLOCK, m_ex);
+ if (m_ex.get()) {
+ show_exception(this, m_ex);
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+ }
+}
+
+/* Button "Connect to server" gets clicked */
+void Client::on_button_connect_clicked()
+{
+ bool connection = Client::create_connection();
+ if (connection) {
+ m_item_disconnect.show();
+ m_connect_box.hide();
+ m_message_box.show_all();
+ }
+}
+
+/* Button "Send message" gets clicked */
+void Client::on_button_send_clicked()
+{
+ /* Entry message goes to message string */
+ Glib::ustring message = m_entry_message.get_text();
+
+ /* Write the message on IOChannel */
+ m_channel->write(message, m_ex);
+ if (m_ex.get()) {
+ show_exception(this, m_ex);
+ } else {
+ /* Flush write buffer on IOChannel */
+ m_channel->flush(m_ex);
+ if (m_ex.get()) {
+ show_exception(this, m_ex);
+ } else {
+ Hildon::Note sent_note(Hildon::NOTE_TYPE_INFORMATION_THEME,
+ "Message sent!");
+ sent_note.run();
+ }
+ }
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/client.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/client.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/client.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/client.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : client.h
+ Author : $(author)
+ Version : $(version)
+ Description : Socket Example
+ ============================================================================
+ */
+
+#ifndef CLIENT_H
+#define CLIENT_H
+
+#include <gtkmm.h>
+#include <hildonmm.h>
+
+#include <netinet/in.h>
+
+class Client : public Hildon::Window
+{
+public:
+ Client();
+ virtual ~Client();
+
+protected:
+ /* Signal handlers */
+ virtual void on_menu_quit();
+ virtual void on_menu_connection_setup();
+ virtual void on_menu_disconnect();
+ virtual void on_button_connect_clicked();
+ virtual void on_button_send_clicked();
+ virtual bool create_connection();
+
+ /* Socket descriptor */
+ int m_socket;
+
+ /* I/O Channel */
+ Glib::RefPtr<Glib::IOChannel> m_channel;
+
+ /* Exception error */
+ std::auto_ptr<Glib::Error> m_ex;
+
+ /* Menu object */
+ Gtk::Menu m_main;
+
+ /* The menu items */
+ Gtk::MenuItem m_item_exit, m_item_connection_setup, m_item_disconnect;
+
+ /* Window boxes */
+ Gtk::VBox m_frame_box, m_connect_box, m_message_box;
+
+ /* Labels and entries for server address, port and message */
+ Gtk::Label m_label_address, m_label_port, m_label_message;
+ Gtk::Entry m_entry_address, m_entry_port, m_entry_message;
+
+ /* "Connect to server" and "Send" buttons */
+ Gtk::Button m_button_connect, m_button_send;
+};
+
+#endif /* CLIENT_H */
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/client.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/main-client.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/main-client.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/main-client.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : main-client.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : Socket Example
+ ============================================================================
+ */
+
+#include <iostream>
+#include "client.h"
+
+int main(int argc, char *argv[])
+{
+ /* Initialize gtkmm and checks the arguments passed to your application */
+ Gtk::Main main_loop(&argc, &argv);
+
+ /* Initialize the hildomm libraries */
+ Hildon::init();
+
+ /* Initialize libosso environment */
+ osso_context_t* osso_context = osso_initialize("client_socket_example", "1.0.0", TRUE, 0);
+ if(!osso_context)
+ std::cerr << "osso_initialize() failed." << std::endl;
+
+ /* Set the application name */
+ Glib::set_application_name("Client Socket Example");
+
+ /* Create an object for the main Window and attach it to the program */
+ Client window;
+ Hildon::Program::get_instance()->add_window(window);
+
+ /* Begin the main application */
+ main_loop.run(window);
+
+ /* Clean the libosso environment */
+ osso_deinitialize(osso_context);
+
+ return 0;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/main-client.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/main-server.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/main-server.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/main-server.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : main-server.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : Socket Example
+ ============================================================================
+ */
+
+#include <iostream>
+#include "server.h"
+
+int main(int argc, char *argv[])
+{
+ /* Initialize gtkmm and checks the arguments passed to your application */
+ Gtk::Main main_loop(&argc, &argv);
+
+ /* Initialize the hildomm libraries */
+ Hildon::init();
+
+ /* Initialize libosso environment */
+ osso_context_t* osso_context = osso_initialize("server_socket_example", "1.0.0", TRUE, 0);
+ if(!osso_context)
+ std::cerr << "osso_initialize() failed." << std::endl;
+
+ /* Set the application name */
+ Glib::set_application_name("Server Socket Example");
+
+ /* Create an object for the main Window and attach it to the program */
+ Server window;
+ Hildon::Program::get_instance()->add_window(window);
+
+ /* Begin the main application */
+ main_loop.run(window);
+
+ /* Clean the libosso environment */
+ osso_deinitialize(osso_context);
+
+ return 0;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/main-server.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-client.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-client.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-client.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow-client.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : Socket Example
+ ============================================================================
+ */
+
+#include "mywindow-client.h"
+
+/* Class constructor */
+MyWindow::MyWindow() :
+ m_item_exit("Exit"),
+ m_item_connect("Connect to server"),
+ m_label_message("Enter the message to send:"),
+ m_button_send("Send")
+{
+ /* Attach the callback function to signal handler */
+ m_item_exit.signal_activate().connect( sigc::mem_fun(*this,
+ &MyWindow::on_menu_quit));
+ m_item_connect.signal_activate().connect( sigc::mem_fun(*this,
+ &MyWindow::on_menu_connect));
+
+ /* Add items to the menu */
+ m_main.append(m_item_connect);
+ m_main.append(m_item_exit);
+ m_main.show_all();
+
+ /* Attach the menu object to the application */
+ set_menu(m_main);
+
+ /* Add the m_frame_box to window: */
+ add(m_frame_box);
+
+ /* Make all menu widgets visible */
+ show_all();
+}
+
+/* Class destructor */
+MyWindow::~MyWindow()
+{
+}
+
+/* Callback function for menu exit */
+void MyWindow::on_menu_quit()
+{
+ /* Close the window */
+ hide();
+}
+
+void MyWindow::on_menu_connect()
+{
+ /* "Send" button signal handler */
+ m_button_send.signal_clicked().connect(sigc::mem_fun(*this,
+ &MyWindow::on_button_send_clicked));
+
+ /* Inserts default text inside entry box */
+ m_entry_message.set_text("Hello World!");
+
+ /* Add more items to the window */
+ m_frame_box.pack_start(m_label_message);
+ m_frame_box.pack_start(m_entry_message);
+ m_frame_box.pack_start(m_button_send);
+ m_frame_box.show_all();
+}
+
+void MyWindow::on_button_send_clicked()
+{
+ int mysocket; // Socket descriptor
+ struct sockaddr_un server_address; // Socket options (family, path)
+ Glib::ustring buffer; // Socket buffer
+
+ /* Create UNIX socket with streamed connection */
+ mysocket = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (socket < 0) {
+ Gtk::MessageDialog dialog(*this, "Can't create socket!",
+ false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+ exit(1);
+ }
+
+ /* Set socket parameters & connect */
+ server_address.sun_family = AF_UNIX; // UNIX socket
+ strcpy(server_address.sun_path, SOCKET_PATH); // Socket path
+ if (connect(mysocket, (struct sockaddr *) &server_address,
+ sizeof(server_address)) < 0) {
+ Gtk::MessageDialog dialog(*this, "Can't connect to server!",
+ false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+ exit(1);
+ }
+
+ /* buffer receives entry message */
+ buffer = m_entry_message.get_text();
+
+ /* Send buffered message through socket */
+ if (send(mysocket, buffer.c_str(), buffer.length() + 1 , 0) < 0) {
+ Gtk::MessageDialog dialog(*this, "Can't send data!",
+ false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+ close(mysocket);
+ exit(1);
+ } else {
+ Hildon::Note sent_note(Hildon::NOTE_TYPE_INFORMATION,
+ "Message sent!");
+ sent_note.run();
+ hide();
+ }
+
+ /* Close socket descriptor */
+ close(mysocket);
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-client.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-client.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-client.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-client.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow-client.h
+ Author : $(author)
+ Version : $(version)
+ Description : Socket Example
+ ============================================================================
+ */
+
+#ifndef MYWINDOW_H
+#define MYWINDOW_H
+
+#include <gtkmm.h>
+#include <hildonmm.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/un.h>
+
+#define MSG_SIZE 100
+#define SOCKET_PATH "/tmp/unix-socket"
+
+class MyWindow : public Hildon::Window
+{
+public:
+ MyWindow();
+ virtual ~MyWindow();
+
+protected:
+ /* Signal handlers */
+ virtual void on_menu_quit();
+ virtual void on_menu_connect();
+ virtual void on_button_send_clicked();
+
+ /* Menu object */
+ Gtk::Menu m_main;
+
+ /* The menu items */
+ Gtk::MenuItem m_item_exit;
+ Gtk::MenuItem m_item_connect;
+
+ /* Main box */
+ Gtk::VBox m_frame_box;
+
+ /* Post connect widgets */
+ Gtk::Label m_label_message;
+ Gtk::Entry m_entry_message;
+ Gtk::Button m_button_send;
+};
+
+#endif /* MYWINDOW_H */
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-server.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-server.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-server.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow-server.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : Socket Example
+ ============================================================================
+ */
+
+#include "mywindow-server.h"
+
+/* Class constructor */
+MyWindow::MyWindow() :
+ m_item_exit("Exit"),
+ m_item_init_server("Initialize server")
+{
+ /* Attach the callback function to signal handler */
+ m_item_exit.signal_activate().connect( sigc::mem_fun(*this,
+ &MyWindow::on_menu_quit));
+ m_item_init_server.signal_activate().connect( sigc::mem_fun(*this,
+ &MyWindow::on_menu_init_server));
+
+ /* Add items to the menu */
+ m_main.append(m_item_init_server);
+ m_main.append(m_item_exit);
+ m_main.show_all();
+
+ /* Attach the menu object to the application */
+ set_menu(m_main);
+
+ /* Add the m_frame_box to window: */
+ add(m_frame_box);
+
+ /* Set label text and insert it to m_frame_box */
+ m_label.set_label("Select \"Initialize Server\" from the menu above!");
+ m_frame_box.pack_start(m_label);
+
+ /* Make all menu widgets visible */
+ show_all();
+}
+
+/* Class destructor */
+MyWindow::~MyWindow()
+{
+}
+
+/* Callback function for menu exit */
+void MyWindow::on_menu_quit()
+{
+ /* Close the window */
+ hide();
+}
+
+void MyWindow::on_menu_init_server()
+{
+ int listenSocket, connectSocket;
+// Glib::RefPtr<Glib::IOChannel> connectSocket; // TODO
+ socklen_t clientSocketLength; // TODO
+ struct sockaddr_un clientAddress, serverAddress; // TODO
+ Glib::ustring line; // TODO
+// Glib::signal_io().connect( sigc::mem_fun(*this, &MyWindow::on_io_callback), this -> iochannel, Glib::IO_IN);
+
+ /* TODO */
+ listenSocket = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (listenSocket < 0) {
+ Gtk::MessageDialog dialog(*this, "Can't create listen socket!",
+ false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+ exit(1);
+ }
+
+ /* TODO */
+ serverAddress.sun_family = AF_UNIX;
+ strcpy(serverAddress.sun_path, SOCKET_PATH);
+ if (bind(listenSocket, (struct sockaddr *) &serverAddress,
+ sizeof(serverAddress)) < 0) {
+ Gtk::MessageDialog dialog(*this, "Can't bind socket!",
+ false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+ exit(1);
+ }
+
+ /* TODO */
+ listen(listenSocket, 5);
+
+ /* TODO */
+ m_label.set_label("Waiting for UNIX socket connection...");
+// connectSocket = Glib::IOChannel::create_from_fd(listenSocket);
+
+ /* TODO */
+ clientSocketLength = sizeof(clientAddress);
+ connectSocket = accept(listenSocket, (struct sockaddr *) &clientAddress,
+ &clientSocketLength);
+ if (connectSocket < 0) {
+ Gtk::MessageDialog dialog(*this, "Can't accept connection!",
+ false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+ std::remove(SOCKET_PATH);
+ exit(1);
+ }
+
+ /* TODO */
+ Hildon::Banner::show_information(*this, "Client connected!");
+
+ /* TODO */
+ if (recv(connectSocket, (void *)line.c_str(), line.length(), 0) < 0) {
+ Gtk::MessageDialog dialog(*this, "Can't receive data!",
+ false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+ std::remove(SOCKET_PATH);
+ exit(1);
+ } else {
+ Hildon::Note received_note(Hildon::NOTE_TYPE_INFORMATION, line);
+ received_note.run();
+ }
+
+ /* TODO */
+ close(listenSocket);
+ close(connectSocket);
+
+ /* TODO */
+ std::remove(SOCKET_PATH);
+ hide();
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-server.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-server.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-server.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/mywindow-server.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : mywindow-server.h
+ Author : $(author)
+ Version : $(version)
+ Description : Socket Example
+ ============================================================================
+ */
+
+#ifndef MYWINDOW_H
+#define MYWINDOW_H
+
+#include <gtkmm.h>
+#include <hildonmm.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/un.h>
+#include <iostream>
+
+#define MSG_SIZE 100
+#define SOCKET_PATH "/tmp/unix-socket"
+
+class MyWindow : public Hildon::Window
+{
+public:
+ MyWindow();
+ virtual ~MyWindow();
+
+protected:
+ /* Signal handlers */
+ virtual void on_menu_quit();
+ virtual void on_menu_init_server();
+ virtual bool on_io_callback(Glib::IOCondition condition);
+
+ /* Menu object */
+ Gtk::Menu m_main;
+
+ /* The menu items */
+ Gtk::MenuItem m_item_exit;
+ Gtk::MenuItem m_item_init_server;
+
+ /* Main box */
+ Gtk::VBox m_frame_box;
+
+ /* TODO */
+ Gtk::Label m_label;
+};
+
+#endif /* MYWINDOW_H */
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/server.cpp
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/server.cpp (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/server.cpp 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,289 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : server.cpp
+ Author : $(author)
+ Version : $(version)
+ Description : Socket Example
+ ============================================================================
+ */
+
+#include "server.h"
+
+/* Print exception & error messages */
+static void show_exception(Gtk::Window *window, std::auto_ptr<Glib::Error> ex)
+{
+ Gtk::MessageDialog dialog(*window, ex->what(), false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+}
+
+static void show_error(Gtk::Window *window, Glib::ustring message)
+{
+ Gtk::MessageDialog dialog(*window, message, false, Gtk::MESSAGE_ERROR);
+ dialog.set_title("Error");
+ dialog.run();
+}
+
+/* Class constructor */
+Server::Server() :
+ m_item_exit("Exit"),
+ m_item_setup_server("Server setup"),
+ m_item_stop_server("Stop server"),
+ m_button_start("Start server")
+{
+ /* Callback handlers */
+ m_item_exit.signal_activate().connect( sigc::mem_fun(*this,
+ &Server::on_menu_quit));
+ m_item_setup_server.signal_activate().connect( sigc::mem_fun(*this,
+ &Server::on_menu_setup_server));
+ m_item_stop_server.signal_activate().connect( sigc::mem_fun(*this,
+ &Server::on_menu_stop_server));
+ m_button_start.signal_clicked().connect(sigc::mem_fun(*this,
+ &Server::on_button_start_clicked));
+
+ /* Add items to the menu */
+ m_main.append(m_item_setup_server);
+ m_main.append(m_item_stop_server);
+ m_main.append(m_item_exit);
+
+ /* Attach the menu object to the application */
+ set_menu(m_main);
+
+ /* Add the m_frame_box to window: */
+ add(m_frame_box);
+
+ /* Insert TextView into a scrolled window */
+ m_scrolled_window.add(m_text_view);
+
+ /* Create TextBuffer */
+ buffer = Gtk::TextBuffer::create();
+
+ /* TextView now has a TextBuffer */
+ m_text_view.set_buffer(buffer);
+
+ /* Scroll bars appears only when needed */
+ m_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+
+ /* Set up entries */
+ m_entry_port.set_text("12345");
+
+ /* Add widgets to their respective boxes */
+ m_port_box.pack_start(m_entry_port, Gtk::PACK_EXPAND_WIDGET);
+ m_port_box.pack_start(m_button_start, Gtk::PACK_SHRINK);
+
+ m_frame_box.pack_start(m_label, Gtk::PACK_SHRINK);
+ m_frame_box.pack_start(m_port_box, Gtk::PACK_SHRINK);
+ m_frame_box.pack_start(m_scrolled_window, Gtk::PACK_EXPAND_WIDGET);
+
+ /* Set up widgets initial appeareance */
+ m_item_stop_server.hide();
+ m_label.hide();
+ m_port_box.hide();
+ m_scrolled_window.hide();
+ m_frame_box.show();
+}
+
+/* Class destructor */
+Server::~Server()
+{
+}
+
+/* Menu option "Exit" is selected */
+void Server::on_menu_quit()
+{
+ hide();
+}
+
+/* Menu option "Setup server" is selected */
+void Server::on_menu_setup_server()
+{
+ m_item_setup_server.hide();
+ m_label.show();
+ m_port_box.show_all();
+
+ m_label.set_label("Enter server port (between 1500~65000):");
+}
+
+/* Menu option "Stop server" is selected */
+void Server::on_menu_stop_server()
+{
+ m_item_setup_server.show();
+ m_item_stop_server.hide();
+ m_label.hide();
+ m_port_box.hide();
+ m_scrolled_window.hide();
+
+ /* Close listen I/O channel */
+ m_listen_ch->close(true, m_ex);
+ if (m_ex.get()) {
+ show_exception(this, m_ex);
+ } else {
+ /* Close listen socket descriptor */
+ close(m_listen_sock);
+ }
+
+ /* Try to close connection I/O channel */
+ m_conn_ch->close(true, m_ex);
+ if (m_ex.get()) {
+ show_exception(this, m_ex);
+ } else {
+ close(m_conn_sock);
+ }
+}
+
+/* Creates a listen socket and associates it with an I/O channel */
+bool Server::create_listen_connection()
+{
+ /* Create TCP (streamed) network socket */
+ m_listen_sock = socket(AF_INET, SOCK_STREAM, 0);
+ if (m_listen_sock < 0) {
+ show_error(this, "Can't create listen socket!");
+ return false;
+ } else {
+ /* Set socket address properties */
+ m_server_address.sin_family = AF_INET;
+ m_server_address.sin_addr.s_addr = htonl(INADDR_ANY);
+ m_server_address.sin_port = htons(atoi(m_entry_port.get_text().c_str()));
+
+ /* Bind socket with server address */
+ if (bind(m_listen_sock, (struct sockaddr *) &m_server_address,
+ sizeof(m_server_address)) < 0) {
+ show_error(this, "Can't bind socket!");
+ return false;
+ } else {
+ /* Listen for only 1 connection */
+ if (listen(m_listen_sock, 1) != 0) {
+ show_error(this, "Can't listen from socket!");
+ return false;
+ } else {
+ /* Creates a IOChannel from socket descriptor */
+ m_listen_ch = Glib::IOChannel::create_from_fd(m_listen_sock);
+
+ /* Set listen channl to be non-blocking */
+ m_listen_ch->set_flags((m_listen_ch->get_flags() |
+ Glib::IO_FLAG_NONBLOCK), m_ex);
+ if (m_ex.get()) {
+ show_exception(this, m_ex);
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+ }
+}
+
+/* Button "Start server" gets clicked */
+void Server::on_button_start_clicked()
+{
+ bool connection = Server::create_listen_connection();
+ if (connection) {
+ m_item_setup_server.hide();
+ m_item_stop_server.show();
+ m_port_box.hide();
+ m_scrolled_window.hide();
+
+ /* Set label text and insert it to m_frame_box */
+ m_label.set_label("Waiting for TCP socket connection...");
+
+ /* I/O signal callback */
+ Glib::signal_io().connect( sigc::mem_fun(*this,
+ &Server::on_new_connection), m_listen_ch,
+ Glib::IO_IN);
+ }
+}
+
+bool Server::on_new_connection(Glib::IOCondition io_condition)
+{
+ if (io_condition & Glib::IO_IN) {
+ /* Socket length */
+ socklen_t sock_length = sizeof(m_listen_sock);
+
+ /* Accept a socket connection from remote client */
+ m_conn_sock = accept(m_listen_sock, (struct sockaddr *)
+ &m_server_address, &sock_length);
+
+ if (m_conn_sock < 0) {
+ show_error(this, "Can't accept from socket!");
+ return false;
+ } else {
+ /* Create an IOChannel from socket descriptor */
+ m_conn_ch = Glib::IOChannel::create_from_fd(m_conn_sock);
+
+ /* Set connection channel to be non-blocking */
+ m_conn_ch->set_flags((m_conn_ch->get_flags() |
+ Glib::IO_FLAG_NONBLOCK), m_ex);
+ if (m_ex.get()) {
+ show_exception(this, m_ex);
+ return false;
+ } else {
+ m_scrolled_window.show_all();
+
+ /* I/O signal callback */
+ Glib::signal_io().connect(sigc::mem_fun(*this,
+ &Server::on_io_callback), m_conn_ch,
+ Glib::IO_IN | Glib::IO_HUP);
+ }
+ }
+ }
+
+ return true;
+}
+
+bool Server::on_io_callback(Glib::IOCondition io_condition)
+{
+ bool close_channel = false;
+
+ /* Connection Hang up */
+ if (io_condition & Glib::IO_HUP)
+ close_channel = true;
+
+ /* I/O channel is ready to receive input */
+ if (io_condition & Glib::IO_IN) {
+ Glib::ustring message; // Message read from I/O channel
+
+ /* Read message from I/O channel */
+ if ((m_conn_ch->read(message, 100, m_ex) & Glib::IO_STATUS_EOF) != 0) {
+ close_channel = true;
+ } else {
+ if (m_ex.get()) {
+ show_exception(this, m_ex);
+ close_channel = true;
+ } else {
+ m_label.set_label("Message(s) received:");
+
+ /* Insert line content into buffer */
+ buffer->insert_at_cursor(message.append("\n"));
+ }
+ }
+ }
+
+ if (close_channel) {
+ /* Close connection I/O channel */
+ m_conn_ch->close(true, m_ex);
+ if (m_ex.get()) {
+ show_exception(this, m_ex);
+ } else {
+ /* Close connection socket descriptor */
+ close(m_conn_sock);
+ return false;
+ }
+ } else return true;
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/server.cpp
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/server.h
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/server.h (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/server.h 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : server.h
+ Author : $(author)
+ Version : $(version)
+ Description : Socket Example
+ ============================================================================
+ */
+
+#ifndef SERVER_H
+#define SERVER_H
+
+#include <gtkmm.h>
+#include <hildonmm.h>
+
+#include <netinet/in.h>
+
+class Server : public Hildon::Window
+{
+public:
+ Server();
+ virtual ~Server();
+
+protected:
+ /* Signal handlers */
+ virtual void on_menu_quit();
+ virtual void on_menu_setup_server();
+ virtual void on_menu_stop_server();
+ virtual void on_button_start_clicked();
+ virtual bool on_new_connection(Glib::IOCondition condition);
+ virtual bool on_io_callback(Glib::IOCondition condition);
+ virtual bool create_listen_connection();
+
+ /* Socket descriptors */
+ int m_listen_sock, m_conn_sock;
+
+ /* I/O channels */
+ Glib::RefPtr<Glib::IOChannel> m_listen_ch, m_conn_ch;
+
+ /* Server address */
+ sockaddr_in m_server_address;
+
+ /* Exception error */
+ std::auto_ptr<Glib::Error> m_ex;
+
+ /* Menu object */
+ Gtk::Menu m_main;
+
+ /* The menu items */
+ Gtk::MenuItem m_item_exit, m_item_setup_server, m_item_stop_server;
+
+ /* Main box & port box */
+ Gtk::VBox m_frame_box;
+ Gtk::HBox m_port_box;
+
+ /* Application window label */
+ Gtk::Label m_label;
+
+ /* Server port widgets */
+ Gtk::Entry m_entry_port;
+ Gtk::Button m_button_start;
+
+ Gtk::ScrolledWindow m_scrolled_window; // Scrolled window
+ Gtk::TextView m_text_view; // Text view -> Scrolled window
+ Glib::RefPtr<Gtk::TextBuffer> buffer; // Text view needs a text buffer!
+};
+
+#endif /* SERVER_H */
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/src/server.h
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,13 @@
+#Template Default Values
+SocketExample.Ctemplate.label=Maemo C++ Socket Example Project
+SocketExample.Ctemplate.description=An example of use of BSD sockets in C++. \
+This provides two programs, a server and a client, which can communicate with each other over sockets.\n\n\
+This project requires the maemomm packages. \
+Please see\n\n\thttp://maemo.org/development/documentation/programming_languages/\n\nfor details.
+SocketExample.basics.label=Basic Settings
+SocketExample.basics.description=Basic properties of a project
+SocketExample.author.label=Author
+SocketExample.author.description=Name of the author
+SocketExample.version.label=Version
+SocketExample.version.description=Your application version
+SocketExample.version.default=0.1
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="INdT"
+ copyright="Copyright (c) 2007-2008 INdT. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="CppSocketExampleProject" label="%SocketExample.Ctemplate.label" description="%SocketExample.Ctemplate.description"
+ help="help.html">
+
+ <property-group id="basics" label="%SocketExample.basics.label" description="%SocketExample.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%SocketExample.author.label"
+ description="%SocketExample.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="version"
+ label="%SocketExample.version.label"
+ description="%SocketExample.version.description"
+ type="input"
+ pattern=".*"
+ default="%SocketExample.version.default"
+ hidden="false"
+ persist="true"/>
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="path" value="src"/>
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING.LESSER"/>
+ <simple name="target" value="COPYING.LESSER"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="configure.ac"/>
+ <simple name="target" value="configure.ac"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="autogen.sh"/>
+ <simple name="target" value="autogen.sh"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="Makefile.am"/>
+ <simple name="target" value="Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/client.cpp"/>
+ <simple name="target" value="src/client.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/client.h"/>
+ <simple name="target" value="src/client.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/main-client.cpp"/>
+ <simple name="target" value="src/main-client.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/main-server.cpp"/>
+ <simple name="target" value="src/main-server.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/Makefile.am"/>
+ <simple name="target" value="src/Makefile.am"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow-client.cpp"/>
+ <simple name="target" value="src/mywindow-client.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow-client.h"/>
+ <simple name="target" value="src/mywindow-client.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow-server.cpp"/>
+ <simple name="target" value="src/mywindow-server.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/mywindow-server.h"/>
+ <simple name="target" value="src/mywindow-server.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/server.cpp"/>
+ <simple name="target" value="src/server.cpp"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ <element>
+ <simple name="source" value="src/server.h"/>
+ <simple name="target" value="src/server.h"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddProjectSourceFolders">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="paths">
+ <element>
+ <simple name="path" value="src"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="maemo-cplusplus-env" />
+ </simple-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.AddPkgConfigIndexerInfo">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="hildonmm" />
+ </simple-array>
+ </process>
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.cpp.templates/templates/SocketExample/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/.project
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/.project (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.maemosdk.python.templates</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/META-INF/MANIFEST.MF
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/META-INF/MANIFEST.MF (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Maemo SDK Python Templates Plug-in
+Bundle-SymbolicName: org.maemo.esbox.maemosdk.python.templates;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Vendor: INdT / Nokia
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/build.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/build.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+bin.includes = META-INF/,\
+ templates/,\
+ plugin.xml,\
+ plugin.properties
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/plugin.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/plugin.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/plugin.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,3 @@
+Category.Hildon = Hildon
+Category.Simple = Simple
+
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/plugin.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/plugin.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.maemo.esbox.project.core.esbox_templates">
+ <template
+ category="Hildon"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern=".*"
+ id="org.maemo.esbox.python.project.ui.pythonHildonHelloWorld"
+ location="templates/PythonHildonHelloWorld/template.xml"
+ projectNature="org.maemo.esbox.python.project.core.ESboxPythonNature"
+ projectType="org.maemo.esbox.python.project.core.projectType.python">
+ </template>
+ <template
+ category="Simple"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.maemo"
+ filterPattern=".*"
+ id="org.maemo.esbox.python.project.ui.emptyProject"
+ location="templates/EmptyProject/template.xml"
+ projectNature="org.maemo.esbox.python.project.core.ESboxPythonNature"
+ projectType="org.maemo.esbox.python.project.core.projectType.python">
+ </template>
+ </extension>
+
+</plugin>
+
\ No newline at end of file
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/EmptyProject/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/EmptyProject/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/EmptyProject/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
+ copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="EmptyProject" label="Empty Project" description="An empty project template"
+ help="help.html">
+
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="maemo-python-env" />
+ </simple-array>
+ </process>
+
+</template>
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/EmptyProject/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/COPYING
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/COPYING (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/COPYING
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/COPYING.LESSER
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/COPYING.LESSER (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/COPYING.LESSER
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/src/hello_world.py
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/src/hello_world.py (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/src/hello_world.py 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,52 @@
+#!/usr/bin/env python2.5
+
+#
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# ============================================================================
+# Name : hello_world.py
+# Author : $(author)
+# Version : $(version)
+# Description : Python Hildon Hello World
+# ============================================================================
+
+
+import gtk
+import hildon
+
+class HelloWorldApp(hildon.Program):
+ def __init__(self):
+ hildon.Program.__init__(self)
+
+ self.window = hildon.Window()
+ self.window.connect("delete_event", self.quit)
+ self.add_window(self.window)
+
+ label = gtk.Label("$(message)")
+ self.window.add(label)
+ label.show()
+
+ def quit(self, *args):
+ print "Goodbye world!"
+ gtk.main_quit()
+
+ def run(self):
+ self.window.show_all()
+ gtk.main()
+
+if __name__ == "__main__":
+ app = HelloWorldApp()
+ app.run()
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/src/hello_world.py
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/template.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/template.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/template.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,13 @@
+#Template Default Values
+PythonHildonHelloWorld.Ctemplate.label=Maemo Python Hildon Hello World Project
+PythonHildonHelloWorld.Ctemplate.description=A Python Hildon Hello World Project. \n\nThis project requires the hildon python packages. If needed, add this repository to /etc/apt/sources.list:\n\n\tdeb http://repository.maemo.org/extras chinook free non-free\n\nand invoke 'apt-get update ; apt-get install python2.5 python2.5-hildon'
+PythonHildonHelloWorld.basics.label=Basic Settings
+PythonHildonHelloWorld.basics.description=Basic properties of a project
+PythonHildonHelloWorld.author.label=Author
+PythonHildonHelloWorld.author.description=Name of the author
+PythonHildonHelloWorld.version.label=Version
+PythonHildonHelloWorld.version.description=Your application version
+PythonHildonHelloWorld.version.default=0.1
+PythonHildonHelloWorld.message.default=Hello World!!!
+PythonHildonHelloWorld.message.description=Your hello world greeting message
+PythonHildonHelloWorld.message.label=Hello world greeting
\ No newline at end of file
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/template.properties
___________________________________________________________________
Name: svn:eol-style
+ LF
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/template.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/template.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/template.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
+ copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+ id="PythonHildonHelloWorldProject" label="%PythonHildonHelloWorld.Ctemplate.label" description="%PythonHildonHelloWorld.Ctemplate.description"
+ help="help.html">
+
+ <property-group id="basics" label="%PythonHildonHelloWorld.basics.label" description="%PythonHildonHelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
+ <property id="author"
+ label="%PythonHildonHelloWorld.author.label"
+ description="%PythonHildonHelloWorld.author.description"
+ type="input"
+ pattern=".*"
+ default=""
+ hidden="false"
+ persist="true"/>
+ <property id="version"
+ label="%PythonHildonHelloWorld.version.label"
+ description="%PythonHildonHelloWorld.version.description"
+ type="input"
+ pattern=".*"
+ default="%PythonHildonHelloWorld.version.default"
+ hidden="false"
+ persist="true"/>
+ <property id="message"
+ label="%PythonHildonHelloWorld.message.label"
+ description="%PythonHildonHelloWorld.message.description"
+ type="input"
+ pattern=".*"
+ default="%PythonHildonHelloWorld.message.default"
+ hidden="false"
+ persist="true"/>
+ </property-group>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="COPYING"/>
+ <simple name="target" value="COPYING"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="COPYING.LESSER"/>
+ <simple name="target" value="COPYING.LESSER"/>
+ <simple name="replaceable" value="false"/>
+ </element>
+ <element>
+ <simple name="source" value="src/hello_world.py"/>
+ <simple name="target" value="src/hello_world.py"/>
+ <simple name="replaceable" value="true"/>
+ </element>
+ </complex-array>
+ </process>
+
+ <process type="org.maemo.esbox.cpp.project.ui.ValidateAndInstallPackages">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple-array name="packages">
+ <element value="maemo-python-env" />
+ </simple-array>
+ </process>
+
+</template>
+
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.python.templates/templates/PythonHildonHelloWorld/template.xml
___________________________________________________________________
Name: svn:eol-style
+ LF
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.tests
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.classpath
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.classpath (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.project
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.project (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.maemosdk.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:59:25 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Scratchbox Feature Tests Plug-in
+Bundle-SymbolicName: org.maemo.esbox.maemosdk.tests
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.maemosdk.tests.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.core.tests;bundle-version="1.5.0",
+ org.maemo.esbox.maemosdk.core;bundle-version="1.5.0",
+ org.maemo.esbox.maemosdk.ui;bundle-version="1.5.0",
+ org.junit4;bundle-version="4.3.1",
+ org.maemo.esbox.cpp.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.eclipse.cdt.core;bundle-version="5.0.1",
+ org.eclipse.cdt.make.core;bundle-version="5.0.1",
+ org.eclipse.cdt.ui;bundle-version="5.0.1",
+ org.maemo.esbox.cpp.project.ui;bundle-version="1.5.0",
+ org.maemo.esbox.analysis;bundle-version="1.5.0",
+ org.maemo.esbox.ssh;bundle-version="1.5.0",
+ org.maemo.esbox.launch;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/build.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/build.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/maemosdk/tests/Activator.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/maemosdk/tests/Activator.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/internal/maemosdk/tests/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,50 @@
+package org.maemo.esbox.internal.maemosdk.tests;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.maemosdk.tests";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestOProfileValgrindSupport.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestOProfileValgrindSupport.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestOProfileValgrindSupport.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.tests;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.maemo.esbox.analysis.adapters.IOProfileSupportAdapter;
+import org.maemo.esbox.analysis.adapters.IValgrindSupportAdapter;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.api.ssh.DeviceSSHLinuxMachine;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKFacade;
+import org.maemo.esbox.ssh.SSHConfiguration;
+
+
+/**
+ * Test that the OProfile and Valgrind adapter support is wired up properly.
+ * @author eswartz
+ *
+ */
+public class TestOProfileValgrindSupport {
+ @Test
+ public void testSbox() throws Exception {
+
+ ISDKTarget armelTarget = null;
+
+ for (ISDKTarget sdkTarget : ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets()) {
+ IOProfileSupportAdapter oprofileSupport = (IOProfileSupportAdapter) sdkTarget.getAdapter(IOProfileSupportAdapter.class);
+ IValgrindSupportAdapter valgrindSupportAdapter = (IValgrindSupportAdapter) sdkTarget.getAdapter(IValgrindSupportAdapter.class);
+ if (sdkTarget.getPlatform().getName().toLowerCase().matches("chinook|diablo|fremantle")) {
+ assertNotNull(sdkTarget.getName(), oprofileSupport);
+ assertNotNull(sdkTarget.getName(), valgrindSupportAdapter);
+
+ IMachine machine = sdkTarget.getSDK().getMachine();
+ if (sdkTarget.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL)) {
+ armelTarget = sdkTarget;
+ assertNotNull(oprofileSupport.validateSupport(machine)); // not a device
+ assertNotNull(valgrindSupportAdapter.validateSupport(machine)); // no ARMEL port of valgrind known
+ } else if (sdkTarget.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_X86)) {
+ assertNotNull(oprofileSupport.validateSupport(machine)); // not a device
+ assertNull(valgrindSupportAdapter.validateSupport(machine));
+ }
+ }
+ }
+
+ if (armelTarget != null) {
+ SSHConfiguration sshConfig = new SSHConfiguration();
+ IMachine machine = new DeviceSSHLinuxMachine("foo", sshConfig, null);
+
+ IOProfileSupportAdapter oprofileSupport = (IOProfileSupportAdapter) armelTarget.getAdapter(IOProfileSupportAdapter.class);
+ IValgrindSupportAdapter valgrindSupportAdapter = (IValgrindSupportAdapter) armelTarget.getAdapter(IValgrindSupportAdapter.class);
+
+ assertNotNull(oprofileSupport);
+ assertNotNull(valgrindSupportAdapter);
+
+ assertNotNull(valgrindSupportAdapter.validateSupport(machine)); // no ARMEL port of valgrind known
+ assertNull(oprofileSupport.validateSupport(machine)); // device launch
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestProcessLauncher.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestProcessLauncher.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestProcessLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,443 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.provider.FileInfo;
+import org.eclipse.core.runtime.*;
+import org.junit.Test;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.env.*;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineRegistry;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.core.tests.core.BaseTest;
+import org.maemo.esbox.internal.api.core.sdk.HostSDK;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.util.*;
+
+/**
+ * Test the generic IProcessLauncher interface.
+ * This test is extended by SDK-specific tests which override
+ * #getSDKs() to test these basic tests on different SDKs.
+ * @author eswartz
+ *
+ */
+public class TestProcessLauncher extends BaseTest {
+
+ // we assume this runs only on Linux
+ private static String STOCK_SCRIPT_NAME = "/tmp/foo.sh";
+ private static final int MAX_TARGETS = 2;
+ private Process theProcess;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected List<ISDK> getSDKs() throws ESboxException {
+ ArrayList<ISDK> sdks = new ArrayList<ISDK>();
+ for (IMachine machine : MachineRegistry.getInstance().getBuildMachines()) {
+ if (machine.getOS().equals(Platform.OS_LINUX))
+ sdks.add(new HostSDK(machine, "1.0.0", machine.getName()));
+ }
+ return sdks;
+ }
+
+ protected interface IRunner {
+ void run(ISDKTarget target) throws Exception;
+ }
+
+ protected void runOverTargets(IRunner runner) throws Exception {
+ boolean any = false;
+ for (ISDK sdk : getSDKs()) {
+ int count = MAX_TARGETS;
+ ISDKTarget[] targets = sdk.getSDKTargets();
+ for (ISDKTarget target : targets) {
+ if (target.getName().contains("libtool"))
+ continue;
+ if (!validateMachine(target.getSDK().getMachine()))
+ continue;
+ if (--count < 0)
+ break;
+ any = true;
+ runner.run(target);
+ }
+ }
+ assertTrue("No SDK targets found", any);
+
+ }
+
+ /** Make sure env vars are actually passed appropriately */
+ @Test
+ public void testEnvVars() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+
+ String cmdText = "echo $CC $LDFLAGS =$SPACEY= \"$LAST\"";
+ Properties envVars = new Properties();
+ envVars.put("CC", "gcc");
+ envVars.put("LDFLAGS", "-lm");
+ envVars.put("SPACEY", "-a -b larry's -d"); // the ' should not cause a problem
+ envVars.put("LAST", "*"); // this should not be expanded
+ IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+ target, null, cmdText, envVars);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ int exit = processLauncher.waitAndRead(out, err);
+ assertEquals(target.getName() + ": " + err.toString(), 0, exit); // some targets can't handle export $@
+ assertEquals("", err.toString());
+ assertStdTextEquals("gcc -lm =-a -b larry's -d= *\n", out.toString());
+ }
+
+ });
+ }
+
+ /** Make sure env vars are not lost entirely */
+ @Test
+ public void testEnvVars2() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+
+ String cmdText = "echo $PATH";
+ IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+ target, null, cmdText, null);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ int exit = processLauncher.waitAndRead(out, err);
+ assertEquals(0, exit);
+
+ assertEquals("", err.toString());
+ assertTrue(out.toString().contains(":"));
+ }
+
+ });
+ }
+ /** Test launching and consuming output */
+ @Test
+ public void testStreamParsing() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ String cmdText = "echo stdout1 ; echo stderr1 1>&2 ; "
+ + "echo stdout2 ; echo stderr2 1>&2 ; "
+ + "echo stdout3 ; echo stderr3 1>&2 ; "
+ + "echo stdout4 ; echo stderr4 1>&2 ; " + "";
+ IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+ target, null, cmdText, null);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ int exit = processLauncher.waitAndRead(out, err);
+ assertEquals(0, exit);
+
+ assertStdTextEquals("stderr1\nstderr2\nstderr3\nstderr4\n", err
+ .toString());
+ assertStdTextEquals("stdout1\nstdout2\nstdout3\nstdout4\n", out
+ .toString());
+
+ }
+ });
+ }
+
+ /** Make sure the stream I/O works */
+ @Test
+ public void testStreamHandling2() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ String cmdText = "sed s/from/to/g";
+
+ IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+ target, null, cmdText, null);
+
+ theProcess.getOutputStream().write("this is from home\nwhere is it from?\n".getBytes());
+ theProcess.getOutputStream().close();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ int exit = processLauncher.waitAndRead(out, err);
+ assertEquals(0, exit);
+
+ // some sdks don't have sed
+ if (!err.toString().contains("command not found")) {
+ assertEquals("", err.toString());
+ assertStdTextEquals("this is to home\nwhere is it to?\n", out.toString());
+ }
+
+ }
+ });
+
+ }
+ /**
+ * @param target SDK target to use
+ * @param cwd target-relative CWD or null
+ * @param cmdText text to copy into script
+ * @param envVars environment variables
+ * @param pty pty or null
+ * @return new process launcher
+ */
+ IProcessLauncher createAndLaunchStockProcessForScript(
+ ISDKTarget target, IPath cwd, String cmdText, Properties envVars)
+ throws Exception {
+ IProcessLauncherFactory processLauncherFactory = target
+ .getProcessLauncherFactory();
+
+ return createAndLaunchStockProcessForScript(
+ processLauncherFactory,
+ target, cwd, cmdText,
+ envVars);
+ }
+
+ IProcessLauncher createAndLaunchStockProcessForScript(IProcessLauncherFactory processLauncherFactory,
+ ISDKTarget target, IPath cwd, String cmdText, Properties envVars)
+ throws Exception {
+ createStockScript(target, cmdText);
+
+ // System.out.println(cmdline);
+ List<String> cmdLine = CommandLineArguments.createFromCommandLine(STOCK_SCRIPT_NAME);
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ processLauncherFactory, cwd,
+ CommandLineArguments.wrapScriptCommandLineForShell(cmdLine),
+ envVars);
+ // System.out.println(processLauncher.getLaunchCommandArguments().toCommandLine());
+
+ theProcess = processLauncher.createProcess();
+ return processLauncher;
+ }
+
+ private void createStockScript(ISDKTarget target, String cmdText)
+ throws Exception {
+
+ IFileStore fileStore = target.getMachineFileSystemAccess().getFileStore(new Path(STOCK_SCRIPT_NAME));
+ OutputStream fos = fileStore.openOutputStream(
+ EFS.NONE, new NullProgressMonitor());
+ fos.write(("#!/bin/sh\n" + cmdText).getBytes());
+ fos.close();
+
+ FileInfo info = new FileInfo(fileStore.getName());
+ info.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, true);
+ fileStore.putInfo(info, EFS.SET_ATTRIBUTES, null);
+ }
+
+ /** Test launching and failing */
+ @Test
+ public void testFailure() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ IProcessLauncherFactory processLauncherFactory = target
+ .getProcessLauncherFactory();
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, "/non/existent/program -i -c -e");
+
+ // depending on the level of SDK, we may either get an exception
+ // or a process which fails
+ try {
+ Process process = processLauncher.createProcess();
+ processLauncher.waitAndRead(new ByteArrayOutputStream(),
+ new ByteArrayOutputStream());
+ int exit = process.exitValue();
+ assertTrue(exit != 0);
+ } catch (ESboxException e) {
+ // expected
+ }
+ }
+ });
+ }
+
+ /** Test launching and succeeding with a bad exit code */
+ @Test
+ public void testNonZeroExit() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ IProcessLauncherFactory processLauncherFactory = target
+ .getProcessLauncherFactory();
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, "false");
+
+ Process process = processLauncher.createProcess();
+ processLauncher.waitAndRead(new ByteArrayOutputStream(),
+ new ByteArrayOutputStream());
+ int exit = process.exitValue();
+ assertEquals(1, exit);
+ }
+ });
+ }
+
+ /** Make sure the cwd is actually passed appropriately */
+ @Test
+ public void testCWD() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ String cmdText = "pwd";
+
+ IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+ target, new Path("/usr/games"), cmdText, null);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ int exit = processLauncher.waitAndRead(out, err);
+ assertEquals(0, exit);
+
+ assertStdTextEquals("", err.toString());
+ assertEquals(target.getName(), "/usr/games", out.toString().trim());
+
+ }
+ });
+ }
+
+ /** Make sure the PTY variant works */
+ @Test
+ public void testPTY() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ String cmdText = "sed s/from/to/g";
+
+ IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+ target, null, cmdText, null);
+
+ theProcess.getOutputStream().write("this is from home\nwhere is it from?\n".getBytes());
+ theProcess.getOutputStream().close();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ int exit = processLauncher.waitAndRead(out, err);
+ assertEquals(0, exit);
+
+ // some sdks don't have sed
+ if (!err.toString().contains("command not found")) {
+ assertStdTextEquals("", err.toString());
+ assertStdTextEquals("this is to home\nwhere is it to?", out.toString().trim());
+ }
+
+ }
+ });
+
+ }
+
+ /** Test that the Esbox environment variables are passed properly */
+ @Test
+ public void testEnvironmentDefaults() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ // the local host launcher does not pass ESbox variables.
+ if (!(target instanceof IScratchboxSDKTarget))
+ return;
+
+ IEnvironmentVariableBlock envBlockOrig = new EnvironmentVariableBlock();
+ IEnvironmentVariableBlock envBlock = EnvironmentVariableManager.getInstance().getGlobalEnvironmentBlock();
+ envBlock.copyTo(envBlockOrig);
+
+ try {
+ // DISPLAY comes from the .bashrc in scratchbox or from the X11 environment
+ envBlock.clear();
+
+ // set ESbox variables
+ envBlock.define("ESBOXONLY", "fromesbox_original");
+ envBlock.define("ESBOXOVERRIDE", "fromesbox_original");
+ envBlock.define("DISPLAY", "esbox:3");
+
+ // construct an environment that consists of overrides of the standard environment
+ IProcessLauncherFactory factory = target.getProcessLauncherFactory();
+ Properties envVars = factory.getStandardEnvironment();
+
+ assertTrue(envVars.containsKey("ESBOXONLY"));
+ assertTrue(envVars.containsKey("ESBOXOVERRIDE"));
+ assertTrue(envVars.containsKey("DISPLAY"));
+
+ envVars.put("ESBOXOVERRIDE", "launch_override");
+ envVars.put("PASSEDIN", "launch_passedin");
+
+ String cmdText = "echo $DISPLAY,$ESBOXONLY,$ESBOXOVERRIDE,$PASSEDIN\necho $USER\n";
+ IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+ factory, target, null, cmdText, envVars);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ int exit = processLauncher.waitAndRead(out, err);
+ assertEquals(0, exit);
+
+ assertStdTextEquals("", err.toString());
+ String[] lines = out.toString().trim().split("\r\n|\n");
+ assertEquals("esbox:3,fromesbox_original,launch_override,launch_passedin", lines[0]);
+ assertEquals(2, lines.length);
+ assertTrue(lines.length > 0);
+
+ //////////
+
+ // construct an environment that consists of a clean environment
+ envVars = new Properties();
+ envVars.put("ESBOXOVERRIDE", "launch_override");
+ envVars.put("PASSEDIN", "launch_passedin");
+
+ cmdText = "echo $ESBOXONLY,$ESBOXOVERRIDE,$PASSEDIN";
+ processLauncher = createAndLaunchStockProcessForScript(
+ target, null, cmdText, envVars);
+
+ out = new ByteArrayOutputStream();
+ err = new ByteArrayOutputStream();
+ exit = processLauncher.waitAndRead(out, err);
+ assertEquals(0, exit);
+
+ assertEquals("", err.toString());
+ assertStdTextEquals(",launch_override,launch_passedin\n", out.toString());
+ } finally {
+ envBlockOrig.copyTo(EnvironmentVariableManager.getInstance().getGlobalEnvironmentBlock());
+ }
+ }
+ });
+ }
+
+ /**
+ * If a process is launched with a different PATH, we must ensure to wrap the
+ * command in a shell, or else PATH won't be used.
+ * @throws Exception
+ */
+ public void testLaunchWithAlternatePATH() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ createStockScript(target, "echo hello\n");
+
+ // make an overridden environment that has the script directory in its PATH
+ Properties env = target.getProcessLauncherFactory().getStandardEnvironment();
+ env.put("PATH", env.get("PATH") + ":" + new Path(STOCK_SCRIPT_NAME).removeLastSegments(1));
+
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(
+ target.getProcessLauncherFactory(),
+ null,
+ CommandLineArguments.createFromCommandLine(new Path(STOCK_SCRIPT_NAME).lastSegment()),
+ env);
+
+ processLauncher.createProcess();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ int exit = processLauncher.waitAndRead(out, err);
+ assertEquals(0, exit);
+
+ assertStdTextEquals("hello\n", out.toString());
+ }
+ });
+ }
+}
\ No newline at end of file
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestRunStandalone.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestRunStandalone.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestRunStandalone.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.tests;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.maemo.esbox.core.process.ProcessLauncherParameters;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.launch.adapters.IRunStandaloneAdapter;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKFacade;
+
+
+/**
+ * Test that the "run standalone" support is wired up properly.
+ * @author eswartz
+ *
+ */
+public class TestRunStandalone {
+ @Test
+ public void testSbox() throws Exception {
+ for (ISDKTarget sdkTarget : ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets()) {
+ IRunStandaloneAdapter support = (IRunStandaloneAdapter) sdkTarget.getAdapter(IRunStandaloneAdapter.class);
+ if (sdkTarget.getPlatform().getName().toLowerCase().matches("chinook|diablo|fremantle")) {
+ assertNotNull(sdkTarget.getName(), support);
+ } else {
+ continue;
+ }
+ assertEquals(true, support.getDefault());
+ assertNotNull(support.getLabelText());
+ assertNotNull(support.getTooltipText());
+
+ ProcessLauncherParameters params = new ProcessLauncherParameters();
+ params.getCommandLine().add("ls");
+
+ support.updateLaunch(params, false);
+ assertEquals(1, params.getCommandLine().size());
+ assertEquals("ls", params.getCommandLine().get(0));
+
+ support.updateLaunch(params, true);
+ assertEquals(2, params.getCommandLine().size());
+ assertEquals("run-standalone.sh", params.getCommandLine().get(0));
+ assertEquals("ls", params.getCommandLine().get(1));
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1ProcessLauncher.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1ProcessLauncher.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1ProcessLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests;
+
+import org.eclipse.core.runtime.*;
+import org.junit.Test;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.maemosdk.core.sdk.providers.Scratchbox1SDKProvider;
+
+import java.io.ByteArrayOutputStream;
+import java.util.*;
+
+/**
+ * If SB1 is installed, make sure its SDKs and targets are properly detected,
+ * and that it launches processes in the expected way
+ *
+ * @author eswartz
+ *
+ */
+public class TestSB1ProcessLauncher extends TestProcessLauncher {
+ ISDKProvider sb1Provider;
+ private static List<ISDK> sdks;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ SDKFactory factory = SDKFactory.getInstance();
+
+ List<ISDKProvider> providers = factory.getSDKProviders();
+ assertNotNull(providers);
+
+ // don't worry if we don't find an SB1 installation
+ // on this host (this is mostly a manual test)
+ for (ISDKProvider provider : providers) {
+ if (provider instanceof Scratchbox1SDKProvider) {
+ sb1Provider = provider;
+ break;
+ }
+ }
+
+ if (sb1Provider == null && !Platform.isRunning()) {
+ // in case of standalone test
+ sb1Provider = new Scratchbox1SDKProvider();
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected List<ISDK> getSDKs() throws ESboxException {
+ if (sdks == null) {
+ if (sb1Provider == null)
+ sdks = Collections.EMPTY_LIST;
+ else
+ sdks = sb1Provider.createSDKs();
+ }
+ return sdks;
+ }
+
+ /** Make sure commands are assembled appropriately */
+ @Test
+ public void testSB1ProcessLauncherAssembly() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ IProcessLauncherFactory processLauncherFactory = target
+ .getProcessLauncherFactory();
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, "ls");
+ List<String> args = processLauncher.getLaunchCommandArguments();
+ assertNotNull(args);
+
+ // be sure no variables are left unexpanded
+ assertFalse(CommandLineArguments.toCommandLine(args).contains("${"));
+
+ // assume the pattern is still /scratchbox/login -d ...
+ // ".../run.sh ... \".... <command>\""
+ // (basically verifying the command is wrapped)
+ assertEquals("/scratchbox/login", args.get(0));
+ String last = args.get(args.size() - 1);
+ // System.out.println(last);
+ assertTrue(last
+ .matches("\\Q./run.sh /\\E\\s+\\S+=\\S+\\s+\\Q\\\"ls \\\"\\E"));
+ }
+ });
+ }
+
+ /** Make sure arguments appear to be passed appropriately */
+ @Test
+ public void testSB1ProcessLauncherArguments() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ IProcessLauncherFactory processLauncherFactory = target
+ .getProcessLauncherFactory();
+ Properties envVars = new Properties();
+ envVars.put("CC", "gcc");
+ envVars.put("LDFLAGS", "-lm");
+ envVars.put("SPACEY", "a b c");
+ envVars.put("WILD", "*");
+ IPath tempPath = new Path("/tmp");
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory,
+ tempPath,
+ "./configure", CommandLineArguments.createFromVarArgs(
+ "--enable-maintainer-mode",
+ "--disable-gtk"), envVars);
+
+ // the env vars are encoded into run.sh, not passed outside the
+ // process
+ Properties launchEnvironment = processLauncher
+ .getLaunchEnvironment();
+ assertNull(launchEnvironment);
+
+ List<String> args = processLauncher.getLaunchCommandArguments();
+ assertNotNull(args);
+
+ // be sure no variables are left unexpanded
+ assertFalse(CommandLineArguments.toCommandLine(args).contains("${"));
+
+ // assume the pattern is still /scratchbox/login -d ...
+ // ".../run.sh ... \".... <command>\""
+ // (basically verifying the command is wrapped)
+ assertEquals("/scratchbox/login", args.get(0));
+ String last = args.get(args.size() - 1);
+ // System.out.println(last);
+ assertEquals(
+ "./run.sh " + tempPath.toPortableString() + " \\\"CC=gcc,LDFLAGS=-lm,SPACEY=a b c,WILD=*\\\" \\\"./configure --enable-maintainer-mode --disable-gtk\\\"",
+ last);
+
+ }
+ });
+ }
+
+
+ /** Test that the Esbox environment variables are passed properly.
+ * DISPLAY is defined on the user account */
+ @Test
+ public void testEnvironmentDefaultsSb1() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ // DISPLAY comes from the .bashrc in scratchbox or from the X11 environment
+
+ // construct an environment that consists of a clean environment
+ Properties envVars = new Properties();
+
+ envVars.put("DISPLAY", ":2");
+ envVars.put("ESBOXOVERRIDE", "launch_override");
+ envVars.put("PASSEDIN", "launch_passedin");
+
+ String cmdText = "echo $DISPLAY,$ESBOXONLY,$ESBOXOVERRIDE,$PASSEDIN";
+ IProcessLauncher processLauncher = createAndLaunchStockProcessForScript(
+ target, null, cmdText, envVars);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ int exit = processLauncher.waitAndRead(out, err);
+ assertEquals(0, exit);
+
+ assertEquals("", err.toString());
+ assertEquals(":2,,launch_override,launch_passedin", out.toString().trim());
+
+ }
+ });
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1SDKProvider.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1SDKProvider.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB1SDKProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.*;
+import org.junit.Test;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.ILocalMachine;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.core.tests.core.BaseTest;
+import org.maemo.esbox.internal.maemosdk.core.sdk.providers.Scratchbox1SDKProvider;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+import java.util.List;
+
+/**
+ * If SB1 is installed, make sure its SDKs and targets
+ * are properly detected, and that it launches processes
+ * in the expected way
+ * @author eswartz
+ *
+ */
+public class TestSB1SDKProvider extends BaseTest {
+ private ISDKProvider sb1Provider;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ SDKFactory factory = SDKFactory.getInstance();
+
+ List<ISDKProvider> providers = factory.getSDKProviders();
+ assertNotNull(providers);
+
+ // don't worry if we don't find an SB1 installation
+ // on this host (this is mostly a manual test)
+ for (ISDKProvider provider : providers) {
+ if (provider instanceof Scratchbox1SDKProvider) {
+ sb1Provider = provider;
+ break;
+ }
+ }
+
+ if (sb1Provider == null && !Platform.isRunning()) {
+ // in case of standalone test
+ sb1Provider = new Scratchbox1SDKProvider();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+
+ }
+
+ @Test
+ public void testSB1SDKProvider() throws Exception {
+ if (sb1Provider == null)
+ return;
+
+ List<ISDK> sdks = sb1Provider.createSDKs();
+ assertNotNull(sdks);
+
+ for (ISDK sdk : sdks) {
+ // the name mentions the scratchbox name and version
+ assertEquals("Scratchbox 1", sdk.getName());
+ assertTrue(sdk.getVersion().matches("1\\.0\\.\\d+"));
+ IPath root = sdk.getSDKRoot();
+ assertTrue(sdk.getMachineFileSystemAccess().getFileStore(root).fetchInfo().exists());
+ assertTrue(root.toPortableString().startsWith("/scratchbox/"));
+ }
+ }
+
+ @Test
+ public void testSB1SDKTargets() throws Exception {
+ if (sb1Provider == null)
+ return;
+
+ List<ISDK> sdks = sb1Provider.createSDKs();
+ for (ISDK sdk : sdks) {
+ ISDKTarget[] targets = sdk.getSDKTargets();
+ // for this test, we need to have something to test
+ assertTrue(targets.length > 0);
+ for (ISDKTarget target : targets) {
+ _testSDKTarget(target);
+ _testSDKTargetFileConvs(target);
+ _testSDKTargetFileAccess(target);
+ }
+ }
+ }
+
+ private void _testSDKTarget(ISDKTarget target) {
+ System.out.println("found target: " + target);
+
+ assertNotNull(target.getSDK());
+ assertSame(target, target.getSDK().findSDKTarget(target.getName()));
+ assertNotNull(target.getName());
+ assertNotNull(target.getProcessLauncherFactory());
+ assertNotNull(target.getPlatform());
+ assertNotNull(target.getArchitecture());
+
+ }
+
+ private void _testSDKTargetFileConvs(ISDKTarget target) {
+ // make sure root makes sense
+ assertEquals(target.getSDK().getSDKRoot(), target.getSDKRoot());
+ assertTrue(target.getSDK().getSDKRoot().isPrefixOf(target.getSDKRoot()));
+ assertTrue(target.getSDKRoot().toString(), target.getMachineFileSystemAccess().getFileStore(
+ target.getSDKRoot()).fetchInfo().exists());
+
+
+ // test some conversions
+ IPath sbPath, hostPath;
+
+ // all of these paths may appear at different places inside scratchbox
+ String[] tests = {
+ "/tmp",
+ "/usr",
+ "/usr/include",
+ "/usr/lib",
+ "/bin",
+ "/bin/sh",
+ "/sbin",
+ "/usr/include/fcntl.h"
+ };
+ for (String test : tests) {
+ sbPath = new Path(test);
+ hostPath = null;
+
+ // ignore bogus target installed on my system -- no underscore in name
+ if (target.getName().contains("_")) {
+ // make sure the path can be converted to somewhere on the machine
+ // (no guarantee we can see it on the host machine)
+ IFileStore store = target.getTargetFileSystemAccess().getFileStore(sbPath);
+ assertTrue(target + " @" + sbPath.toString(), store.fetchInfo().exists());
+
+ // if we happen to be running locally, verify sanity
+ if (target.getSDK().getMachine() instanceof ILocalMachine) {
+ try {
+ hostPath = target.convertTargetToHostPath(sbPath);
+ assertTrue(hostPath.toFile().toString(),
+ target.getTargetFileSystemAccess().getFileStore(hostPath).fetchInfo().exists());
+ // there's no guarantee of being able to convert back, but
+ // at least don't throw
+ //assertEquals(sbPath, target.convertHostToTargetPath(hostPath));
+ target.convertHostToTargetPath(hostPath);
+ } catch (ESboxException e) {
+ fail(e.getMessage());
+ }
+ }
+ }
+ }
+
+ }
+
+ private void _testSDKTargetFileAccess(ISDKTarget target) {
+ IFileStore sbRoot = target.getTargetFileSystemAccess().getFileStore(target.getSDKRoot());
+ assertTrue(sbRoot.fetchInfo().exists());
+
+ // these tests only make sense if running the scratchbox machine
+
+ // be sure we don't get an empty path here
+ IPath sbPath = null;
+ IPath hostPath;
+ try {
+ sbPath = target.convertHostToTargetPath(target.getSDKRoot());
+ assertEquals(new Path("/"), sbPath);
+
+ // guaranteed NOT to be an SB1 path
+ hostPath = new Path("/");
+ try {
+ sbPath = target.convertHostToTargetPath(hostPath);
+ fail();
+ } catch (ESboxException e) {
+ }
+
+ IPath rootstrapPath = ((IScratchboxSDKTarget) target).getRootstrapPath();
+ if (target.getName().toLowerCase().contains("chinook40"))
+ assertNotNull(rootstrapPath);
+ if (rootstrapPath != null) {
+ System.out.println(" rootstrap path is -> " + rootstrapPath);
+ IFileStore store = target.getTargetFileSystemAccess().getFileStore(rootstrapPath);
+ assertTrue(store.fetchInfo().exists());
+ assertTrue(store.getChild("/lib").fetchInfo().exists());
+ }
+ } catch (ESboxException e) {
+ // just handle it
+ }
+
+ }
+
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB2ProcessLauncher.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB2ProcessLauncher.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB2ProcessLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests;
+
+import org.eclipse.core.runtime.Platform;
+import org.junit.Test;
+import org.maemo.esbox.core.*;
+
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.maemosdk.core.sdk.providers.Scratchbox2SDKProvider;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * If SB1 is installed, make sure its SDKs and targets are properly detected,
+ * and that it launches processes in the expected way
+ *
+ * @author eswartz
+ *
+ */
+public class TestSB2ProcessLauncher extends TestProcessLauncher {
+ ISDKProvider sb2Provider;
+ private static List<ISDK> sdks;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ CorePlugin.getDefault().getPreferenceStore().setValue(
+ ESboxPreferenceConstants.LOG_COMMANDS.toString(), true);
+
+ SDKFactory factory = SDKFactory.getInstance();
+
+ List<ISDKProvider> providers = factory.getSDKProviders();
+ assertNotNull(providers);
+
+ // don't worry if we don't find an SB1 installation
+ // on this host (this is mostly a manual test)
+ for (ISDKProvider provider : providers) {
+ if (provider instanceof Scratchbox2SDKProvider) {
+ sb2Provider = provider;
+ break;
+ }
+ }
+
+ if (sb2Provider == null && !Platform.isRunning()) {
+ // in case of standalone test
+ sb2Provider = new Scratchbox2SDKProvider();
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected List<ISDK> getSDKs() throws ESboxException {
+ if (sdks == null) {
+ if (sb2Provider == null)
+ sdks = Collections.EMPTY_LIST;
+ else
+ sdks = sb2Provider.createSDKs();
+ }
+ return sdks;
+ }
+
+ /** Make sure commands are assembled appropriately */
+ @Test
+ public void testSB2ProcessLauncherAssembly() throws Exception {
+ runOverTargets(new IRunner() {
+
+ public void run(ISDKTarget target) throws Exception {
+ IProcessLauncherFactory processLauncherFactory = target
+ .getProcessLauncherFactory();
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, "ls");
+ List<String> args = processLauncher.getLaunchCommandArguments();
+ assertNotNull(args);
+
+ // be sure no variables are left unexpanded
+ assertFalse(CommandLineArguments.toCommandLine(args).contains("${"));
+
+ // assume the pattern is still sb2 -e -t ...
+ assertEquals("sb2", args.get(0));
+ assertTrue(args.contains("-t"));
+ assertTrue(args.contains("-e") || args.contains("-m"));
+ }
+ });
+ }
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB2SDKProvider.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB2SDKProvider.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/TestSB2SDKProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.*;
+import org.junit.Test;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.ILocalMachine;
+import org.maemo.esbox.core.sdk.*;
+import org.maemo.esbox.internal.maemosdk.core.sdk.providers.Scratchbox2SDKProvider;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * If SB2 is installed, make sure its SDKs and targets
+ * are properly detected, and that it launches processes
+ * in the expected way
+ * @author eswartz
+ *
+ */
+public class TestSB2SDKProvider extends TestCase {
+ private ISDKProvider sb2Provider;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ SDKFactory factory = SDKFactory.getInstance();
+
+ List<ISDKProvider> providers = factory.getSDKProviders();
+ assertNotNull(providers);
+
+ // don't worry if we don't find an SB1 installation
+ // on this host (this is mostly a manual test)
+ for (ISDKProvider provider : providers) {
+ if (provider instanceof Scratchbox2SDKProvider) {
+ sb2Provider = provider;
+ break;
+ }
+ }
+
+ if (sb2Provider == null && !Platform.isRunning()) {
+ // in case of standalone test
+ sb2Provider = new Scratchbox2SDKProvider();
+ }
+
+ }
+
+ @Test
+ public void testSB2SDKProvider() throws Exception {
+ if (sb2Provider == null)
+ return;
+
+ List<ISDK> sdks = sb2Provider.createSDKs();
+ assertNotNull(sdks);
+
+ for (ISDK sdk : sdks) {
+ // the name mentions the scratchbox name and version
+ assertEquals("Scratchbox 2", sdk.getName());
+ assertTrue(sdk.getVersion().matches("1\\.99\\..*"));
+ IPath root = sdk.getSDKRoot();
+ assertTrue(sdk.getMachineFileSystemAccess().getFileStore(root).fetchInfo().exists());
+ assertTrue(root.toPortableString().equals("/"));
+ }
+ }
+
+ @Test
+ public void testSB2SDKTargets() throws Exception {
+ if (sb2Provider == null)
+ return;
+
+ List<ISDK> sdks = sb2Provider.createSDKs();
+ for (ISDK sdk : sdks) {
+ ISDKTarget[] targets = sdk.getSDKTargets();
+ // for this test, we need to have something to test
+ if (targets.length > 0) {
+ for (ISDKTarget target : targets) {
+ _testSDKTarget(target);
+ }
+ }
+ }
+ }
+
+ private void _testSDKTarget(ISDKTarget target) {
+ System.out.println("found sb2 target: " + target);
+
+ assertNotNull(target.getSDK());
+ assertSame(target, target.getSDK().findSDKTarget(target.getName()));
+ assertNotNull(target.getName());
+ assertNotNull(target.getProcessLauncherFactory());
+ assertNotNull(target.getPlatform());
+ assertNotNull(target.getArchitecture());
+
+ // make sure root makes sense
+ assertEquals(target.getSDK().getSDKRoot(), target.getSDKRoot());
+ assertTrue(target.getSDK().getSDKRoot().isPrefixOf(target.getSDKRoot()));
+ assertTrue(target.getTargetFileSystemAccess().getFileStore(target.getSDKRoot()).fetchInfo().exists());
+
+
+ // test some conversions
+ IPath sbPath = new Path("/usr/include");
+ IFileStore hostFile = null;
+ hostFile = target.getTargetFileSystemAccess().getFileStore(sbPath);
+ assertTrue(hostFile.toString(), hostFile.fetchInfo().exists());
+
+ // be sure we don't get an empty path here
+ IFileStore sbRoot = null;
+ sbRoot = target.getSDK().getMachineFileSystemAccess().getFileStore(target.getSDKRoot());
+ assertTrue(sbRoot.fetchInfo().exists());
+
+ // these tests only work on machine
+ IPath hostPath = new Path("/");
+ if (target.getSDK().getMachine() instanceof ILocalMachine) {
+ try {
+ sbPath = target.convertHostToTargetPath(hostPath);
+ } catch (ESboxException e) {
+ fail(e.toString());
+ }
+ assertEquals(hostPath, sbPath);
+ }
+
+ // make sure we can find the non-host version
+ IPath libPath = new Path("/lib");
+ hostPath = target.getMachineToSDKTargetFileSystemMapping().convertTargetToHostPath(libPath);
+ if (hostPath.equals(libPath))
+ failNotEquals("expected unique sb2 path from " + target, hostPath, libPath);
+
+ // verify new parser
+ IPath etcPath = new Path("/etc");
+ hostPath = target.getMachineToSDKTargetFileSystemMapping().convertTargetToHostPath(etcPath);
+ assertNotNull(hostPath);
+ assertTrue(hostPath.toString(),
+ new Path("/opt/maemo/dists/etch/etc").equals(hostPath)
+ || etcPath.equals(hostPath));
+
+ IPath rootstrapPath = ((IScratchboxSDKTarget) target).getRootstrapPath();
+ if (target.getName().contains("chinook40"))
+ assertNotNull(rootstrapPath);
+ if (rootstrapPath != null) {
+ System.out.println(target + " root is -> " + rootstrapPath);
+ IFileStore store = target.getTargetFileSystemAccess().getFileStore(rootstrapPath);
+ assertTrue(store.fetchInfo().exists());
+ assertTrue(store.getChild("lib").fetchInfo().exists());
+ }
+
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/BaseTest.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/BaseTest.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/BaseTest.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.junit.Before;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+
+import junit.framework.TestCase;
+
+/**
+ * Base test for the ICommand tests
+ * @author eswartz
+ *
+ */
+public abstract class BaseTest extends TestCase {
+
+ protected IScratchbox1SDK sb1Sdk;
+ protected ICommandAbstractor sb1Command;
+ protected IScratchbox2SDK sb2Sdk;
+ protected ICommandAbstractor sb2Command;
+ protected ICommandAbstractor sb2ArmelTargetCommand;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ this.sb1Sdk = ScratchboxSDKFacade.getInstance().getScratchbox1SDK();
+ this.sb1Command = ScratchboxFacade.getInstance().getCommandAbstractor(sb1Sdk);
+ this.sb2Sdk = ScratchboxSDKFacade.getInstance().getScratchbox2SDK();
+ this.sb2Command = ScratchboxFacade.getInstance().getCommandAbstractor(sb2Sdk);
+ if (sb2Sdk != null) {
+ for (ISDKTarget target : sb2Sdk.getSDKTargets()) {
+ if (target.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL) &&
+ !target.getName().contains("minimal")) {
+ this.sb2ArmelTargetCommand = ScratchboxFacade.getInstance().getCommandAbstractor(target);
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Get a command abstractor that will not actually execute code.
+ * @param target if non-null, use an SB2 mock process launcher, else use a host mock process launcher
+ * @return ICommandAbstractor
+ */
+ protected MockCommandAbstractor getSb2MockCommandAbstractor(final ISDKTarget target) {
+ return new MockCommandAbstractor(sb2Command, target);
+
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockCommandAbstractor.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockCommandAbstractor.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockCommandAbstractor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.core.process.HostProcessLauncherFactory;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.internal.maemosdk.core.sdk.Scratchbox2ProcessLauncherFactory;
+
+import java.util.List;
+
+public class MockCommandAbstractor implements ICommandAbstractor {
+ private final ISDKTarget target;
+ private final ICommandAbstractor wrapped;
+ private MockProcessLauncherFactory lastLauncherFactory;
+
+ public MockCommandAbstractor(ICommandAbstractor wrapped, ISDKTarget target) {
+ this.wrapped = wrapped;
+ this.target = target;
+ }
+
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return wrapped.getPreferenceValue(key);
+ }
+
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ if (target != null)
+ lastLauncherFactory = new MockProcessLauncherFactory(new Scratchbox2ProcessLauncherFactory(
+ target, ESboxPreferenceConstants.SB2_MAPPING_MODE, false));
+ else
+ lastLauncherFactory = new MockProcessLauncherFactory(new HostProcessLauncherFactory());
+ return lastLauncherFactory;
+ }
+
+ public List<String> getLastCommandLine() {
+ return lastLauncherFactory.getLastCommandLine();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.command.ICommandAbstractor#getFileSystemAccess()
+ */
+ public IFileSystemAccess getFileSystemAccess() {
+ return target.getTargetFileSystemAccess();
+ }
+}
\ No newline at end of file
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncher.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncher.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncher.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.IStreamLineMonitor;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * This process launcher does not actually launch anything but allows
+ * access to the generated arguments and environment.
+ * @author eswartz
+ *
+ */
+public class MockProcessLauncher implements IProcessLauncher {
+
+ private final IProcessLauncher wrapped;
+
+ public MockProcessLauncher(IProcessLauncher launcher) {
+ this.wrapped = launcher;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#createProcess()
+ */
+ public Process createProcess() throws ESboxException {
+ return new Process() {
+
+ @Override
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int exitValue() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public InputStream getErrorStream() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getInputStream() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public OutputStream getOutputStream() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int waitFor() throws InterruptedException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ };
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#getLaunchCommandArguments()
+ */
+ public List<String> getLaunchCommandArguments() {
+ return wrapped.getLaunchCommandArguments();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#getLaunchEnvironment()
+ */
+ public Properties getLaunchEnvironment() {
+ return wrapped.getLaunchEnvironment();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#getLaunchCurrentWorkingDirectory()
+ */
+ public IPath getLaunchCurrentWorkingDirectory() {
+ return wrapped.getLaunchCurrentWorkingDirectory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#isUsePTY()
+ */
+ public boolean isUsePTY() {
+ return wrapped.isUsePTY();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#usePTY(boolean)
+ */
+ public void usePTY(boolean flag) {
+ wrapped.usePTY(flag);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#redirectToConsole(org.eclipse.ui.console.MessageConsole, org.maemo.esbox.core.sdk.ISDKTarget)
+ */
+ public MessageConsole redirectToConsole(MessageConsole console) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#redirectToConsole(org.eclipse.ui.console.MessageConsole, org.maemo.esbox.core.sdk.ISDKTarget, org.maemo.esbox.core.IStreamLineMonitor)
+ */
+ public MessageConsole redirectToConsole(MessageConsole console,
+ IStreamLineMonitor monitor) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#redirectToConsole(boolean, org.maemo.esbox.core.sdk.ISDKTarget, java.lang.String)
+ */
+ public MessageConsole redirectToConsole(boolean brandNew,
+ ISDKTarget sdkTarget, String consoleName) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#redirectToConsole(boolean, org.maemo.esbox.core.sdk.ISDKTarget, java.lang.String, org.maemo.esbox.core.IStreamLineMonitor)
+ */
+ public MessageConsole redirectToConsole(boolean brandNew,
+ ISDKTarget sdkTarget, String consoleName, IStreamLineMonitor monitor) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#waitAndRead(java.io.OutputStream, java.io.OutputStream)
+ */
+ public int waitAndRead(OutputStream out, OutputStream err) {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#waitAndRead(java.io.OutputStream, java.io.OutputStream, boolean)
+ */
+ public int waitAndRead(OutputStream out, OutputStream err,
+ boolean showCommand) {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#waitAndRead(java.io.OutputStream, java.io.OutputStream, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public int waitAndRead(OutputStream output, OutputStream err,
+ IProgressMonitor monitor) {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncher#waitAndRead(java.io.OutputStream, java.io.OutputStream, org.eclipse.core.runtime.IProgressMonitor, boolean)
+ */
+ public int waitAndRead(OutputStream output, OutputStream err,
+ IProgressMonitor monitor, boolean showCommand) {
+ return 0;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncherFactory.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncherFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/MockProcessLauncherFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * This factory creates process launchers that do not actually execute anything
+ * but allow for testing the generated command line through the process launcher.
+ * @author eswartz
+ *
+ */
+public class MockProcessLauncherFactory implements IProcessLauncherFactory {
+
+ private IProcessLauncherFactory wrapped;
+ private IProcessLauncher lastProcessLauncher;
+
+ public MockProcessLauncherFactory(IProcessLauncherFactory wrapped) {
+ this.wrapped = wrapped;
+ }
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncherFactory#createProcessLaunchHandler(org.eclipse.core.runtime.IPath, java.util.List, java.util.Properties, org.eclipse.cdt.utils.pty.PTY)
+ */
+ public IProcessLauncher createProcessLaunchHandler(IPath workingDirectory,
+ List<String> commandLine, Properties environment) {
+ lastProcessLauncher = wrapped.createProcessLaunchHandler(workingDirectory, commandLine, environment);
+ return new MockProcessLauncher(lastProcessLauncher);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.IProcessLauncherFactory#getStandardEnvironment()
+ */
+ public Properties getStandardEnvironment() {
+ return wrapped.getStandardEnvironment();
+ }
+ public List<String> getLastCommandLine() {
+ return lastProcessLauncher.getLaunchCommandArguments();
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestCreateTargetCommand extends BaseTest {
+
+
+ private class CreateTargetCommandMock extends CreateTargetCommand {
+
+ public CreateTargetCommandMock(ISDK sdk, ICommandAbstractor commandLauncher) {
+ super(sdk, commandLauncher);
+ }
+
+ @Override
+ protected String[] replaceActions(String targetName, String compiler,
+ String devkits, String cputransp) {
+ // TODO Auto-generated method stub
+ return super.replaceActions(targetName, compiler, devkits,
+ cputransp);
+ }
+
+ }
+
+ private final String TARGET_NAME = "TEST_TARGET";
+
+ public void testPerformCommand() throws ESboxException {
+ ScratchboxCommand createTargetCommand = new CreateTargetCommand(sb1Sdk, sb1Command);
+
+ List<String> param = new ArrayList<String>();
+
+ param.add(TARGET_NAME);
+ param.add("cs2005q3.2-glibc2.5-arm");
+ param.add("doctools:cputransp");
+ try {
+ createTargetCommand.performCommand(param);
+ fail("Number of args is invalid");
+ } catch (ESboxException e) {
+ // expected
+ }
+ param.add("qemu-arm-0.8.2-sb2");
+ createTargetCommand.performCommand(param);
+
+ List<String> targetsAvailable = new ListTargetsCommand(sb1Command, 1)
+ .performCommand(new ArrayList<String>());
+ assertTrue(targetsAvailable.contains(TARGET_NAME));
+
+ // remove the target created for the test
+ removeTestTarget();
+ targetsAvailable = new ListTargetsCommand(sb1Command, 1)
+ .performCommand(new ArrayList<String>());
+ assertTrue(!targetsAvailable.contains(TARGET_NAME));
+
+ param.clear();
+ param.add(TARGET_NAME);
+ param.add("");
+ param.add("debian:doctools:cputransp");
+ param.add("qemu-arm-0.8.2-sb2");
+ try {
+ createTargetCommand.performCommand(param);
+ fail("Cannot create a TARGET without a compiler.");
+ } catch (ESboxException se) {
+ // expected
+ }
+ targetsAvailable = new ListTargetsCommand(sb1Command, 1)
+ .performCommand(new ArrayList<String>());
+ assertTrue(!targetsAvailable.contains(TARGET_NAME));
+ }
+
+ private void removeTestTarget() throws ESboxException {
+ ScratchboxCommand removeCommand = new RemoveTargetCommand(sb1Sdk, sb1Command);
+ List<String> removeParam = new ArrayList<String>();
+ removeParam.add(TARGET_NAME);
+ removeCommand.performCommand(removeParam);
+ }
+
+ public void testReplaceActions() {
+ final String stringToCompareA = "sb-conf setup "
+ + TARGET_NAME
+ + " --compiler=a_compiler --devkits=devkit_a:devkit_b --cputransp=a_cputransp_method";
+ final String[] stringArrayToCompareA = new String[] { TARGET_NAME,
+ "--compiler=a_compiler", "--devkits=devkit_a:devkit_b",
+ "--cputransp=a_cputransp_method" };
+
+ CreateTargetCommandMock createCommand = new CreateTargetCommandMock(sb1Sdk, sb1Command);
+ String[] setupActionOptionsReplaced = createCommand.replaceActions(
+ TARGET_NAME, "a_compiler", "devkit_a:devkit_b",
+ "a_cputransp_method");
+
+ for (int i = 0; i < setupActionOptionsReplaced.length; i++) {
+ assertEquals(stringArrayToCompareA[i],
+ setupActionOptionsReplaced[i]);
+ }
+
+ String setupAction = sb1Sdk.getPreferenceValue(ESboxPreferenceConstants.SB1_SETUP_ACT);
+
+ String stringSetup = createCommand.replaceScratchboxConfigCommand(
+ setupAction, setupActionOptionsReplaced);
+ assertEquals(stringToCompareA, stringSetup);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestCreateTargetSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,69 @@
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.CreateTargetSb2Command;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class TestCreateTargetSb2Command extends BaseTest {
+
+ private final String TARGET_NAME = "TEST_TARGET";
+ private final String COMPILER = "/opt/maemo/tools/arm-2007q3/bin/arm-none-linux-gnueabi-gcc";
+ private final String CPUTRANSP = "sb2-qemu-arm";
+
+ public void testPerformCommand() throws ESboxException {
+ MockCommandAbstractor mockCommandAbstractor = getSb2MockCommandAbstractor(null);
+ ScratchboxCommand createTargetCommand = new CreateTargetSb2Command(sb2Sdk,
+ mockCommandAbstractor);
+
+ List<String> param = new ArrayList<String>();
+
+ param.add(TARGET_NAME);
+ param.add(COMPILER);
+ try {
+ createTargetCommand.performCommand(param);
+ fail("Number of args is invalid");
+ } catch (ESboxException e) {
+ // expected
+ }
+ param.add(CPUTRANSP);
+ createTargetCommand.performCommand(param);
+
+ List<String> lastCmdLine = mockCommandAbstractor.getLastCommandLine();
+ assertEquals("/bin/bash", lastCmdLine.get(0));
+ assertEquals("-c", lastCmdLine.get(1));
+
+ String command = lastCmdLine.get(2);
+ assertEquals("sb2-init -c " + CPUTRANSP + " " + TARGET_NAME + " " + COMPILER, command);
+ }
+
+ public void testPerformCommandNoCpuTransp() throws ESboxException {
+ MockCommandAbstractor mockCommandAbstractor = getSb2MockCommandAbstractor(null);
+ ScratchboxCommand createTargetCommand = new CreateTargetSb2Command(sb2Sdk,
+ mockCommandAbstractor);
+
+ List<String> param = new ArrayList<String>();
+
+ param.add(TARGET_NAME);
+ param.add(COMPILER);
+ try {
+ createTargetCommand.performCommand(param);
+ fail("Number of args is invalid");
+ } catch (ESboxException e) {
+ // expected
+ }
+ param.add(null);
+ createTargetCommand.performCommand(param);
+
+ List<String> lastCmdLine = mockCommandAbstractor.getLastCommandLine();
+ assertEquals("/bin/bash", lastCmdLine.get(0));
+ assertEquals("-c", lastCmdLine.get(1));
+
+ String command = lastCmdLine.get(2);
+ assertEquals("sb2-init " + TARGET_NAME + " " + COMPILER, command);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGdbQemuCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGdbQemuCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGdbQemuCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia)- initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+
+/**
+ * @author eswartz
+ */
+public class TestGdbQemuCommand extends BaseTest {
+
+ public void testQemuVersionCommand() throws ESboxException {
+ for (ISDKTarget sdkTarget : ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets()) {
+ String pattern = ScratchboxFacade.getInstance().getGdbQemuCommandPattern(sdkTarget,
+ sdkTarget.getArchitecture());
+ assertNotNull(pattern);
+ if (sdkTarget instanceof IScratchbox2SDKTarget) {
+ assertTrue(pattern.contains("${PORT}"));
+ }
+ if (sdkTarget.getArchitecture().equals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL)) {
+ assertTrue(pattern.contains("qemu-arm"));
+ if (pattern.contains("qemu-arm-0.7"))
+ assertFalse(pattern.contains("${PORT}"));
+ else if (pattern.contains("qemu-arm-0.8"))
+ assertTrue(pattern.contains("${PORT}"));
+ }
+ System.out.println("pattern of gdb-qemu for " + sdkTarget + " is " + pattern);
+ }
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGetCurrentTargetCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGetCurrentTargetCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestGetCurrentTargetCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.GetCurrentTargetCommand;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxInvalidOperationException;
+
+import java.util.ArrayList;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestGetCurrentTargetCommand extends BaseTest {
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.GetCurrentTargetCommand#performCommand(java.lang.Object)}.
+ *
+ * @throws ScratchboxInvalidOperationException
+ */
+ public void testPerformCommand() throws ESboxException {
+ GetCurrentTargetCommand getCurrentTargetCommand = new GetCurrentTargetCommand(sb1Command, sb1Sdk);
+ String currentTarget = getCurrentTargetCommand
+ .performCommand(new ArrayList<String>());
+ assertTrue(currentTarget.length() > 0);
+ assertNotNull(sb1Sdk.findSDKTarget(currentTarget));
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListCommands.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListCommands.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListCommands.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,310 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.ProcessLauncherCreator;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.*;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKFacade;
+
+import java.util.*;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestListCommands extends BaseTest {
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.ListCompilersCommand#performCommand(java.util.List)}.
+ */
+ public void testListCompilersCommand() throws ESboxException {
+ List<String> fakeParam = new ArrayList<String>();
+ fakeParam.add("param");
+
+ List<String> compilersExpected = new ArrayList<String>();
+ compilersExpected.add("host-gcc");
+ compilersExpected.add("cs2005q3.2-glibc2.5-arm");
+ compilersExpected.add("cs2005q3.2-glibc2.5-i386");
+ compilersExpected.add("cs2007q3-glibc2.5-arm");
+ compilersExpected.add("cs2007q3-glibc2.5-i386");
+
+ ListCompilersCommand listCompilersCommand = new ListCompilersCommand(sb1Command);
+ List<String> compilers = null;
+ try {
+ listCompilersCommand.performCommand(fakeParam);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // expected
+ }
+ compilers = listCompilersCommand
+ .performCommand(new ArrayList<String>());
+
+ // just make sure there is more than one devkit and that one of them looks like
+ // something we recognize
+ boolean matched = false;
+ for (String compiler : compilers) {
+ assertTrue(compiler.length() > 0);
+ if (compilersExpected.contains(compiler))
+ matched = true;
+ }
+ assertTrue(matched);
+
+ /*
+ for (int i = 0; i < compilersExpected.size(); i++) {
+ assertTrue(compilers.contains(compilersExpected.get(i)));
+ }
+ */
+
+ }
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.ListCputranspCommand#performCommand(java.util.List)}.
+ */
+ public void testListCputranspCommand() throws ESboxException {
+ List<String> fakeParam = new ArrayList<String>();
+ fakeParam.add("param");
+
+ List<String> cputranspExpected = new ArrayList<String>();
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.7.0-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.0-m2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.0-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-armeb-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-armeb-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.7.0-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-mips-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-mips-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-mipsel-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-mipsel-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.7.0-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.0-m2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.7.0-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.8.2-sb2");
+ cputranspExpected.add("/scratchbox/devkits/cputransp/bin/sbrsh");
+
+ ListCputranspCommand listCputranspCommand = new ListCputranspCommand(sb1Command);
+ List<String> cputransps = null;
+
+ try {
+ listCputranspCommand.performCommand(fakeParam);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // expected
+ }
+
+ cputransps = listCputranspCommand
+ .performCommand(new ArrayList<String>());
+
+ // just make sure there is more than one devkit and that one of them looks like
+ // something we recognize
+ boolean matched = false;
+ for (String cputransp : cputransps) {
+ assertTrue(cputransp.length() > 0);
+ if (cputranspExpected.contains(cputransp))
+ matched = true;
+ }
+ assertTrue(matched);
+ /*
+ for (int i = 0; i < cputranspExpected.size() && i < cputransp.size(); i++) {
+ assertTrue(cputransp.contains(cputranspExpected.get(i)));
+ }
+ */
+ }
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.ListDevkitsCommand#performCommand(java.util.List)}.
+ */
+ public void testListDevkitsCommand() throws ESboxException {
+ List<String> fakeParam = new ArrayList<String>();
+ fakeParam.add("param");
+
+ List<String> devkitsExpected = new ArrayList<String>();
+ devkitsExpected.add("cputransp");
+ devkitsExpected.add("debian");
+ devkitsExpected.add("debian-sarge");
+ devkitsExpected.add("doctools");
+ devkitsExpected.add("perl");
+
+ ListDevkitsCommand listDevkitsCommand = new ListDevkitsCommand(sb1Command);
+ List<String> devkits = null;
+
+ try {
+ listDevkitsCommand.performCommand(fakeParam);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // expected
+ }
+
+ devkits = listDevkitsCommand.performCommand(new ArrayList<String>());
+
+ // just make sure there is more than one devkit and that one of them looks like
+ // something we recognize
+ assertTrue(devkits.size() > 1);
+ boolean matched = false;
+ for (String devkit : devkits) {
+ assertTrue(devkit.length() > 0);
+ if (devkitsExpected.contains(devkit)) {
+ matched = true;
+ }
+ }
+ assertTrue(matched);
+ /*
+ for (int i = 0; i < devkitsExpected.size() && i < devkits.size(); i++) {
+ assertTrue(devkits.contains(devkitsExpected.get(i)));
+ }
+ */
+ }
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.ListSessionsCommand#performCommand(java.util.List)}.
+ */
+ public void testListSessionsCommand() throws Exception {
+ if (HostUtils.isWindows()) {
+ System.out.println("PTY support doesn't work, skipping test");
+ return;
+ }
+
+ List<String> fakeParam = new ArrayList<String>();
+ fakeParam.add("param");
+
+ int numberOfSessions = 0;
+
+ ListSessionsCommand listSessionsCommand = new ListSessionsCommand(sb1Command);
+ List<String> sessions = null;
+
+ try {
+ listSessionsCommand.performCommand(fakeParam);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // expected
+ }
+
+ sessions = listSessionsCommand.performCommand(new ArrayList<String>());
+
+ // make sure anything here is a pid
+ for (String pid : sessions) {
+ Integer.parseInt(pid);
+ }
+
+ numberOfSessions = sessions.size();
+
+ // launch a new session (without switching targets!)
+ ISDKTarget target = ScratchboxFacade.getInstance().getCurrentSDKTarget(ScratchboxSDKFacade.getInstance().getScratchbox1SDK());
+
+ Process process = null;
+ try {
+ // need a PTY or else the shell fails to launch
+ IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(target.getProcessLauncherFactory(), null,
+ Collections.singletonList("/bin/sh"), null);
+ launcher.usePTY(true);
+ process = launcher.createProcess();
+
+ // wait for it to really start
+ Thread.sleep(1000);
+
+ sessions = listSessionsCommand.performCommand(new ArrayList<String>());
+
+ // this either launches 1 or 2 processes
+ assertTrue(numberOfSessions < sessions.size());
+
+ // make sure anything here is a pid
+ for (String pid : sessions) {
+ Integer.parseInt(pid);
+ }
+ } finally {
+ // kill the shell (exit, then send ctrl-d)
+ process.getOutputStream().write("exit\n004\004\004\004\004\004\004\004\004".getBytes());
+ process.destroy();
+ }
+
+ }
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.ListTargetsCommand#performCommand(java.util.List)}.
+ */
+ public void testListTargetsCommand() throws ESboxException {
+ List<String> fakeParam = new ArrayList<String>();
+ fakeParam.add("param");
+
+ List<String> targetsExpected = new ArrayList<String>();
+ targetsExpected.add("SDK_ARMEL");
+ targetsExpected.add("SDK_X86");
+ targetsExpected.add("BORA_ARMEL");
+ targetsExpected.add("BORA_X86");
+ targetsExpected.add("CHINOOK_ARMEL");
+ targetsExpected.add("CHINOOK_X86");
+
+ ListTargetsCommand listTargetsCommand = new ListTargetsCommand(sb1Command, 1);
+ List<String> targets = null;
+
+ try {
+ listTargetsCommand.performCommand(fakeParam);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // expected
+ }
+
+ targets = listTargetsCommand.performCommand(new ArrayList<String>());
+
+ // just make sure there is more than one target and that one of them looks like
+ // something we recognize
+ assertTrue(targets.size() > 1);
+ boolean matched = false;
+ for (String target : targets) {
+ assertTrue(target.length() > 0);
+ if (targetsExpected.contains(target)) {
+ matched = true;
+ }
+ }
+ assertTrue(matched);
+ /*
+ for (int i = 0; i < targetsExpected.size() && i < targets.size(); i++) {
+ assertTrue(targets.contains(targetsExpected.get(i)));
+ }
+ */
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListSb2Commands.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListSb2Commands.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestListSb2Commands.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,229 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+
+import org.maemo.esbox.core.process.IProcessLauncher;
+import org.maemo.esbox.core.process.IProcessLauncherFactory;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.*;
+import org.maemo.esbox.internal.maemosdk.tests.Activator;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+
+import java.util.*;
+
+/**
+ */
+public class TestListSb2Commands extends BaseTest {
+ private final String COMPILER = "arm-none-linux-gnueabi-gcc";
+
+ public void testListCompilersCommand() throws ESboxException {
+ List<String> fakeParam = new ArrayList<String>();
+ fakeParam.add("fake");
+
+ List<String> compilersExpected = new ArrayList<String>();
+ compilersExpected.add(COMPILER);
+
+ ListCompilersSb2Command listCompilersCommand = new ListCompilersSb2Command(sb2Command);
+ List<String> compilers = null;
+ try {
+ listCompilersCommand.performCommand(fakeParam);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // expected
+ }
+ compilers = listCompilersCommand
+ .performCommand(new ArrayList<String>());
+
+ // just make sure there is more than one devkit and that one of them looks like
+ // something we recognize
+ boolean matched = false;
+ for (String compiler : compilers) {
+ assertTrue(compiler.length() > 0);
+ assertTrue(sb2Sdk.getMachineFileSystemAccess().getFileStore(new Path(compiler)).fetchInfo().exists());
+ for (String exp : compilersExpected) {
+ if (compiler.endsWith(exp)) {
+ matched = true;
+ break;
+ }
+ }
+ }
+ assertTrue(matched);
+ }
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.ListCputranspCommand#performCommand(java.util.List)}.
+ */
+ public void testListCputranspCommand() throws ESboxException {
+ List<String> fakeParam = new ArrayList<String>();
+ fakeParam.add("param");
+
+ List<String> cputranspExpected = new ArrayList<String>();
+ cputranspExpected
+ .add("sb2-qemu-arm");
+ cputranspExpected
+ .add("sbrsh");
+
+ ListCputranspSb2Command listCputranspCommand = new ListCputranspSb2Command(sb2Command);
+ List<String> cputransps = null;
+
+ try {
+ listCputranspCommand.performCommand(fakeParam);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // expected
+ }
+
+ cputransps = listCputranspCommand
+ .performCommand(new ArrayList<String>());
+
+ // just make sure there is more than one devkit and that one of them looks like
+ // something we recognize
+ boolean matched = false;
+ for (String cputransp : cputransps) {
+ assertTrue(cputransp.length() > 0);
+ assertTrue(sb2Sdk.getMachineFileSystemAccess().getFileStore(new Path(cputransp)).fetchInfo().exists());
+ for (String exp : cputranspExpected) {
+ if (cputransp.endsWith(exp)) {
+ matched = true;
+ break;
+ }
+ }
+ }
+ assertTrue(matched);
+ }
+
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.ListTargetsCommand#performCommand(java.util.List)}.
+ */
+ public void testListTargetsCommand() throws ESboxException {
+ List<String> fakeParam = new ArrayList<String>();
+ fakeParam.add("param");
+
+ List<String> targetsExpected = new ArrayList<String>();
+ targetsExpected.add("bora31_armel");
+ targetsExpected.add("chinook40_armel");
+
+ ListTargetsCommand listTargetsCommand = new ListTargetsCommand(sb2Command, 2);
+ List<String> targets = null;
+
+ try {
+ listTargetsCommand.performCommand(fakeParam);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // expected
+ }
+
+ targets = listTargetsCommand.performCommand(new ArrayList<String>());
+
+ // just make sure there is at least one target and that one of them looks like
+ // something we recognize
+ assertTrue(targets.size() > 0);
+ boolean matched = false;
+ for (String target : targets) {
+ assertTrue(target.length() > 0);
+ if (targetsExpected.contains(target)) {
+ matched = true;
+ }
+ }
+ assertTrue(matched);
+ }
+
+ public void testListAvailableRootstrapsCommand() throws ESboxException {
+ List<String> fakeParam = new ArrayList<String>();
+ fakeParam.add("param");
+
+ List<String> targetsExpected = new ArrayList<String>();
+ targetsExpected.add("bora31_armel");
+ targetsExpected.add("chinook40_armel");
+
+ ListAvailableMaemoRootstrapsSb2Command listRootstrapsCommand
+ = new ListAvailableMaemoRootstrapsSb2Command(sb2Command);
+ List<MaemoRootstrap> rootstraps = null;
+
+ try {
+ listRootstrapsCommand.performCommand(fakeParam);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // expected
+ }
+
+ Activator.getDefault().getPluginPreferences().setValue(
+ ESboxPreferenceConstants.LOG_COMMANDS.toString(), true);
+ Activator.getDefault().getPluginPreferences().setValue(
+ ESboxPreferenceConstants.LOG_COMMANDS_PATH.toString(),
+ HostUtils.getTemporaryPath().append("esbox_commands.txt").toOSString());
+ try {
+ rootstraps = listRootstrapsCommand.performCommand(new ArrayList<String>());
+ } catch (ESboxException e) {
+ // try again with proxy, manually set -- the JUnit workspace is prolly empty.
+
+ ICommandAbstractor altCommandAbstractor = new ICommandAbstractor() {
+
+ public String getPreferenceValue(ESboxPreferenceConstants key) {
+ return sb2Command.getPreferenceValue(key);
+ }
+
+ public IProcessLauncherFactory getProcessLauncherFactory() {
+ final IProcessLauncherFactory factory = sb2Command.getProcessLauncherFactory();
+ return new IProcessLauncherFactory() {
+
+ public IProcessLauncher createProcessLaunchHandler(
+ IPath workingDirectory,
+ List<String> commandLine,
+ Properties environment) {
+ return factory.createProcessLaunchHandler(workingDirectory, commandLine, environment);
+ }
+
+ public Properties getStandardEnvironment() {
+ Properties stdenv = factory.getStandardEnvironment();
+ stdenv.put("http_proxy", "http://10.241.32.11:8080");
+ return stdenv;
+ }
+
+ };
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.core.command.ICommandAbstractor#getFileSystemAccess()
+ */
+ public IFileSystemAccess getFileSystemAccess() {
+ return sb2Sdk.getMachineFileSystemAccess();
+ }
+
+ };
+
+ listRootstrapsCommand = new ListAvailableMaemoRootstrapsSb2Command(altCommandAbstractor);
+ rootstraps = listRootstrapsCommand.performCommand(new ArrayList<String>());
+ }
+
+ // just make sure there is more than one rootstrap and that one of them looks like
+ // something we recognize
+ assertTrue(rootstraps.size() > 0);
+ boolean matched = false;
+ for (MaemoRootstrap rootstrap : rootstraps) {
+ assertTrue(rootstrap.getName().length() > 0);
+ assertTrue(rootstrap.getArchitecture().length() > 0);
+ assertTrue(rootstrap.getDescription().length() > 0);
+ if (targetsExpected.contains(rootstrap.getName())) {
+ matched = true;
+ }
+ }
+ assertTrue(matched);
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestRemoveCommand extends BaseTest {
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.RemoveTargetCommand#performCommand(java.util.List)}.
+ *
+ * @throws ESboxException
+ * @throws ScratchboxInvalidOperationException
+ */
+ public void testPerformCommand() throws ESboxException {
+ final String TARGET_DOESNT_EXIST = "GHOST";
+ ScratchboxCommand removeCommand = new RemoveTargetCommand(sb1Sdk, sb1Command);
+
+ List<String> param = new ArrayList<String>();
+
+ try {
+ removeCommand.performCommand(param);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // TODO: handle exception
+ }
+
+ param.add(TARGET_DOESNT_EXIST);
+
+ try {
+ removeCommand.performCommand(param);
+ fail("The target " + TARGET_DOESNT_EXIST
+ + " does not exist. An error must be throwed.");
+ } catch (ESboxException e) {
+ // the test is OK, so far.
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRemoveSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.RemoveTargetSb2Command;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+
+import java.util.*;
+
+/**
+ */
+public class TestRemoveSb2Command extends BaseTest {
+
+ public void testPerformCommand() throws ESboxException {
+ final String TARGET_DOESNT_EXIST = "GHOST";
+ ScratchboxCommand removeCommand = new RemoveTargetSb2Command(sb2Sdk, sb2Command);
+
+ List<String> param = new ArrayList<String>();
+
+ try {
+ removeCommand.performCommand(param);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // TODO: handle exception
+ }
+
+ param.add(TARGET_DOESNT_EXIST);
+
+ try {
+ removeCommand.performCommand(param);
+ fail("The target " + TARGET_DOESNT_EXIST
+ + " does not exist. An error must be throwed.");
+ } catch (ESboxException e) {
+ // the test is OK, so far.
+ }
+ }
+
+ public void testRemoveRealTarget() {
+ final String TARGET = "REMOVEME_armel";
+
+ try {
+ ScratchboxFacade.getInstance().createTarget(sb2Sdk, TARGET,
+ ScratchboxFacade.getInstance().getCompilers(sb2Sdk).get(0), null);
+ } catch (ESboxException e) {
+ // don't worry if it fails, as it might, since installing a
+ // bogus target in sb2 often fails to initialize properly
+ }
+
+ List<String> targets = new ArrayList<String>();
+ try {
+ targets = ScratchboxFacade.getInstance().getTargets(sb2Sdk);
+ } catch (ESboxException e) {
+ // again, ignore error
+ }
+
+ if (targets.contains(TARGET)) {
+ ScratchboxCommand removeCommand = new RemoveTargetSb2Command(sb2Sdk, sb2Command);
+
+ List<String> param = Collections.singletonList(TARGET);
+ try {
+ removeCommand.performCommand(param);
+
+ ScratchboxFacade.getInstance().clearCachedData();
+ targets = ScratchboxFacade.getInstance().getTargets(sb2Sdk);
+ assertFalse(targets.contains(TARGET));
+ } catch (ESboxException e) {
+ fail(e.getMessage());
+ }
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestResetTargetCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestResetTargetCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestResetTargetCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestResetTargetCommand extends BaseTest {
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.ResetTargetCommand#performCommand(java.util.List)}.
+ */
+ public void testPerformCommand() {
+
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRootstrapCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRootstrapCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestRootstrapCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestRootstrapCommand extends BaseTest {
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.RootstrapCommand#performCommand(java.util.List)}.
+ */
+ public void testPerformCommand() {
+
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.internal.maemosdk.core.command.ICommandAbstractor;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
+
+import java.util.List;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestScratchboxCommand extends BaseTest {
+
+ /**
+ * Mock class to test ScratchboxCommand abstract class.
+ *
+ * @author Raul Fernandes Herbster - raulherbster at gmail dot com
+ */
+ class MockScratchboxCommand extends ScratchboxCommand {
+
+
+ public MockScratchboxCommand(ICommandAbstractor commandAbstractor) {
+ super(commandAbstractor, 1);
+ }
+
+ public Object performCommand(List<String> param)
+ throws ESboxException {
+ return null;
+ }
+
+ @Override
+ public int getParametersSize() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ }
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.ScratchboxCommand#replaceScratchboxCommand(java.lang.String, java.lang.String, java.lang.String[])}.
+ */
+ public void testReplaceScratchboxCommandStringStringStringArray() {
+ final String stringToCompareA = "sb-conf current";
+ String currentTargetAction = sb1Sdk.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_CURRENT_ACT);
+ ScratchboxCommand scratchboxCommandA = new MockScratchboxCommand(sb1Command);
+
+ String stringGetCurrent = scratchboxCommandA
+ .replaceScratchboxConfigCommand(currentTargetAction);
+ assertEquals(stringToCompareA, stringGetCurrent.trim());
+
+ }
+
+ /**
+ * Test method for
+ * {@link embedded.core.scratchbox.command.ScratchboxCommand#replaceScratchboxConfigCommand(java.lang.String, java.lang.String)}.
+ */
+ public void testReplaceScratchboxCommandStringString() {
+ final String stringToCompareA = "sb-conf show --compilers --devkits --cputransp";
+
+ String showAction = sb1Sdk.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SHOW_ACT);
+ String compilersShowOption = sb1Sdk.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SHOW_OPT_COMPILERS);
+ String devkitsShowOption = sb1Sdk.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SHOW_OPT_DEVKITS);
+ String cpuTranspShowOption = sb1Sdk.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_SHOW_OPT_CPU);
+ ScratchboxCommand scratchboxCommandA = new MockScratchboxCommand(sb1Command);
+
+ String stringShow = scratchboxCommandA.replaceScratchboxConfigCommand(
+ showAction, new String[] { compilersShowOption,
+ devkitsShowOption, cpuTranspShowOption });
+ assertEquals(stringToCompareA, stringShow.trim());
+
+ final String stringToCompareB = "sb-conf remove SDK_ARMEL";
+ String removeAction = sb1Sdk.getPreferenceValue(
+ ESboxPreferenceConstants.SB1_REMOVE_ACT);
+ String stringRemove = scratchboxCommandA
+ .replaceScratchboxConfigCommand(removeAction,
+ new String[] { "SDK_ARMEL" });
+ assertEquals(stringToCompareB, stringRemove);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxFacade.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxFacade.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestScratchboxFacade.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,509 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.junit.Test;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.machine.MachineRegistry;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox1SDK;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKFacade;
+
+import java.util.*;
+
+import junit.framework.TestCase;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestScratchboxFacade extends TestCase {
+
+ private IScratchbox1SDK sdk;
+ static private List<String> cachedCputransps;
+ static private List<String> cachedCompilers;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.sdk = ScratchboxSDKFacade.getInstance().getScratchbox1SDK();
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#getInstance()}.
+ */
+ @Test
+ public void testGetInstance() {
+ ScratchboxFacade facadeA = ScratchboxFacade.getInstance();
+ ScratchboxFacade facadeB = ScratchboxFacade.getInstance();
+ assertSame(facadeA, facadeB);
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#getCompilers()}.
+ *
+ * @throws ESboxException
+ */
+ @Test
+ public void testGetCompilers() throws ESboxException {
+ List<String> compilersExpected = new ArrayList<String>();
+ compilersExpected.add("host-gcc");
+ compilersExpected.add("cs2005q3.2-glibc-arm");
+ compilersExpected.add("cs2005q3.2-glibc-i386");
+ compilersExpected.add("cs2005q3.2-glibc2.5-arm");
+ compilersExpected.add("cs2005q3.2-glibc2.5-i386");
+
+ List<String> compilers = getCompilers();
+
+ // just make sure there is at least one compiler and that one of them looks like
+ // something we recognize
+ boolean matched = false;
+ for (String compiler : compilers) {
+ assertTrue(compiler.length() > 0);
+ if (compilers.contains(compiler))
+ matched = true;
+ }
+ assertTrue(matched);
+ /*
+ for (int i = 0; i < compilersExpected.size(); i++) {
+ assertTrue(compilers.contains(compilersExpected.get(i)));
+ }
+ */
+ }
+
+ /**
+ * @return
+ * @throws ESboxException
+ */
+ private List<String> getCompilers() throws ESboxException {
+ if (cachedCompilers == null)
+ cachedCompilers = ScratchboxFacade.getInstance().getCompilers(sdk);
+ List<String> compilers = cachedCompilers;
+ return compilers;
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#getCputransp()}.
+ *
+ * @throws ESboxException
+ */
+ @Test
+ public void testGetCputransp() throws ESboxException {
+ List<String> cputranspExpected = new ArrayList<String>();
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.7.0-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.0-m2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.0-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-armeb-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-armeb-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.7.0-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-i386-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-mips-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-mips-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-mipsel-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-mipsel-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.7.0-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.0-m2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-ppc-0.8.2-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.7.0-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.8.1-sb2");
+ cputranspExpected
+ .add("/scratchbox/devkits/cputransp/bin/qemu-sparc-0.8.2-sb2");
+ cputranspExpected.add("/scratchbox/devkits/cputransp/bin/sbrsh");
+
+ List<String> cputransps = getCputransps();
+
+ // just make sure there is at least one cuptransp and that one of them looks like
+ // something we recognize
+ boolean matched = false;
+ for (String cputransp : cputransps) {
+ assertTrue(cputransp.length() > 0);
+ if (cputranspExpected.contains(cputransp))
+ matched = true;
+ }
+ assertTrue(matched);
+ /*
+ for (int i = 0; i < cputranspExpected.size() && i < cputransp.size(); i++) {
+ assertTrue(cputransp.contains(cputranspExpected.get(i)));
+ }
+ */
+ }
+
+ /**
+ * @return
+ * @throws ESboxException
+ */
+ private List<String> getCputransps() throws ESboxException {
+ if (cachedCputransps == null)
+ cachedCputransps = ScratchboxFacade.getInstance().getCputransp(sdk);
+ List<String> cputransps = cachedCputransps;
+ return cputransps;
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#getDevkits()}.
+ *
+ * @throws ESboxException
+ */
+ @Test
+ public void testGetDevkits() throws ESboxException {
+ List<String> devkitsExpected = new ArrayList<String>();
+ devkitsExpected.add("cputransp");
+ devkitsExpected.add("debian");
+ devkitsExpected.add("debian-sarge");
+ devkitsExpected.add("doctools");
+ devkitsExpected.add("perl");
+
+ List<String> devkits = ScratchboxFacade.getInstance().getDevkits(sdk);
+
+ // just make sure there is at leasr one devkit and that one of them looks like
+ // something we recognize
+ assertTrue(devkits.size() > 1);
+ boolean matched = false;
+ for (String devkit : devkits) {
+ assertTrue(devkit.length() > 0);
+ if (devkitsExpected.contains(devkit)) {
+ matched = true;
+ }
+ }
+ assertTrue(matched);
+ /*
+ for (int i = 0; i < devkitsExpected.size() && i < devkits.size(); i++) {
+ assertTrue(devkits.contains(devkitsExpected.get(i)));
+ }
+ */
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#getTargets()}.
+ *
+ * @throws ESboxException
+ */
+ @Test
+ public void testGetTargets() throws ESboxException {
+ List<String> targetsExpected = new ArrayList<String>();
+ targetsExpected.add("SDK_ARMEL");
+ targetsExpected.add("SDK_X86");
+ targetsExpected.add("BORA_ARMEL");
+ targetsExpected.add("BORA_X86");
+ targetsExpected.add("CHINOOK_ARMEL");
+ targetsExpected.add("CHINOOK_X86");
+
+ List<String> targets = ScratchboxFacade.getInstance().getTargets(sdk);
+
+ // just make sure there is more than one target and that one of them looks like
+ // something we recognize
+ assertTrue(targets.size() > 1);
+ boolean matched = false;
+ for (String target : targets) {
+ assertTrue(target.length() > 0);
+ if (targetsExpected.contains(target)) {
+ matched = true;
+ }
+ }
+ assertTrue(matched);
+
+ /*
+ for (int i = 0; i < targetsExpected.size() && i < targets.size(); i++) {
+ assertTrue(targets.contains(targetsExpected.get(i)));
+ }*/
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#getSessions()}.
+ *
+ * @throws ESboxException
+ */
+ @Test
+ public void testGetSessions() throws Exception {
+ if (HostUtils.isWindows()) {
+ System.out.println("PTY support doesn't work, skipping test");
+ return;
+ }
+
+ int numberOfSessions = 0;
+
+ List<String> sessions = ScratchboxFacade.getInstance().getSessions(sdk);
+
+ // make sure anything here is a pid
+ for (String pid : sessions) {
+ Integer.parseInt(pid);
+ }
+
+ numberOfSessions = sessions.size();
+
+ // launch a new session (without switching targets!)
+ ISDKTarget target = ScratchboxFacade.getInstance().getCurrentSDKTarget(ScratchboxSDKFacade.getInstance().getScratchbox1SDK());
+ Process process = null;
+ try {
+ // need a PTY or else the shell fails to launch
+ IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(target.getProcessLauncherFactory(), null,
+ Collections.singletonList("/bin/sh"), null);
+ launcher.usePTY(true);
+ process = launcher.createProcess();
+
+ // wait for it to really start
+ Thread.sleep(1000);
+
+ sessions = ScratchboxFacade.getInstance().getSessions(sdk);
+
+ // this either launches 1 or 2 processes
+ assertTrue(numberOfSessions < sessions.size());
+
+ // make sure anything here is a pid
+ for (String pid : sessions) {
+ Integer.parseInt(pid);
+ }
+ } finally {
+ // kill the shell (exit, then send ctrl-d)
+ process.getOutputStream().write("exit\n004\004\004\004\004\004\004\004\004".getBytes());
+ process.destroy();
+ }
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#getCurrentTarget()}.
+ *
+ * @throws ESboxException
+ */
+ @Test
+ public void testGetCurrentTarget() throws ESboxException {
+ String currentTarget = ScratchboxFacade.getInstance()
+ .getCurrentTarget(sdk);
+ assertTrue(currentTarget.length() > 0);
+ assertNotNull(sdk.findSDKTarget(currentTarget));
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#createTarget(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
+ * and
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#removeTarget(java.lang.String)}.
+ *
+ * @throws ESboxException
+ */
+ @Test
+ public void testCreateAndRemoveTarget() throws ESboxException {
+ final String TARGET_NAME = "TEST_TARGET";
+
+ // pick actual compiler and cputransp
+ List<String> compilers = getCompilers();
+ String compiler = "host-gcc";
+ for (String c : compilers) {
+ if (c.matches("cs2005.*arm")) {
+ compiler = c;
+ break;
+ }
+ }
+ List<String> cputransps = getCputransps();
+ String cputransp = "sbrsh";
+ for (String c : cputransps) {
+ if (c.matches("qemu.*arm.*sb2")) {
+ cputransp = c;
+ break;
+ }
+ }
+ ScratchboxFacade.getInstance().createTarget(sdk,
+ TARGET_NAME,
+ compiler,
+ "doctools:cputransp",
+ cputransp);
+
+ List<String> targetsAvailable = ScratchboxFacade.getInstance()
+ .getTargets(sdk);
+ assertTrue(targetsAvailable.contains(TARGET_NAME));
+
+ // remove the target created for the test
+ assertTrue(ScratchboxFacade.getInstance().removeTarget(sdk, TARGET_NAME));
+
+ targetsAvailable = ScratchboxFacade.getInstance().getTargets(sdk);
+ assertTrue(!targetsAvailable.contains(TARGET_NAME));
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#selectTarget(java.lang.String)}.
+ *
+ * @throws ESboxException
+ */
+ @Test
+ public void testSelectTarget() throws ESboxException {
+ final String TARGET_DOESNT_EXIST = "GHOST";
+
+ try {
+ ScratchboxFacade.getInstance().removeTarget(sdk, TARGET_DOESNT_EXIST);
+ fail("The target " + TARGET_DOESNT_EXIST
+ + " does not exist. An error must be throwed.");
+ } catch (ESboxException e) {
+ // the test is OK, so far.
+ }
+
+ // find a known target which isn't the current one
+ List<String> targets = ScratchboxFacade.getInstance().getTargets(sdk);
+
+ String currentTarget = ScratchboxFacade.getInstance().getCurrentTarget(sdk);
+
+ String theTarget = null;
+ for (String target : targets) {
+ if (!target.equals(currentTarget)) {
+ theTarget = target;
+ break;
+ }
+ }
+
+ String lastTarget = ScratchboxFacade.getInstance().getCurrentTarget(sdk);
+ assertTrue(lastTarget != null && lastTarget.length() > 0);
+
+ assertTrue(ScratchboxFacade.getInstance().selectTarget(sdk, theTarget));
+
+ currentTarget = ScratchboxFacade.getInstance()
+ .getCurrentTarget(sdk);
+ assertEquals(theTarget, currentTarget);
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#getCurrentSbox1Version()}.
+ *
+ * @throws ESboxException
+ */
+ @Test
+ public void testGetCurrentSboxVersion() {
+ for (IMachine machine : MachineRegistry.getInstance().getBuildMachines()) {
+ String sboxVersion;
+ try {
+ sboxVersion = ScratchboxFacade.getInstance().getCurrentSbox1Version(machine);
+ assertTrue(sboxVersion.matches("1\\.0\\.\\d+"));
+ } catch (ESboxException e) {
+ System.out.println("No Scratchbox on " + machine);
+ }
+ }
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#configureSbrsh(java.lang.String, java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public void testConfigureSbrsh() {
+ // fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#addSbrshAccessList(java.lang.String, java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public void testAddSbrshAccessList() {
+ // fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#mountTarget(java.lang.String)}.
+ */
+ @Test
+ public void testMountTarget() {
+ // fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#unmountTarget(java.lang.String)}.
+ */
+ @Test
+ public void testUnmountTarget() {
+ // fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#showTarget(java.lang.String)}.
+ *
+ * @throws ESboxException
+ */
+ /*
+ @Test
+ public void testShowTarget() throws ESboxException {
+ final String TARGET_ARMEL = "SDK_ARMEL";
+
+ ScratchboxTarget target = ScratchboxFacade.getInstance().showTarget(sdk,
+ TARGET_ARMEL);
+
+ assertEquals(TARGET_ARMEL, target.getName());
+ assertEquals("cs2005q3.2-glibc-arm", target.getCompiler());
+ assertEquals("/scratchbox/devkits/cputransp/bin/qemu-arm-0.8.2-sb2",
+ target.getCputransp());
+
+ List<String> devkitsExpected = new ArrayList<String>();
+ devkitsExpected.add("perl");
+ devkitsExpected.add("maemo3-tools");
+ devkitsExpected.add("doctools");
+ devkitsExpected.add("debian-sarge");
+ devkitsExpected.add("maemo3-debian");
+ devkitsExpected.add("cputransp");
+
+ List<String> devkitsActual = target.getDevkits();
+ for (String devkit : devkitsActual) {
+ assertTrue(devkitsExpected.contains(devkit));
+ }
+ }
+ */
+
+ /**
+ * Test method for
+ * {@link org.maemo.esbox.core.scratchbox.ScratchboxFacade#execSimpleCommand(java.lang.String)}.
+ *
+ * @throws ESboxException
+ */
+ @Test
+ public void testExecSimpleCommand() throws ESboxException {
+ ISDKTarget sdkTarget = sdk.getSDKTargets()[0];
+ List<String> currentTarget = ScratchboxFacade.getInstance().execSimpleCommand(
+ sdkTarget,
+ CommandLineArguments.createFromVarArgs("sb-conf", "current"));
+ assertEquals(sdkTarget.getName(), currentTarget.get(0));
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSelectTargetCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSelectTargetCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSelectTargetCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestSelectTargetCommand extends BaseTest {
+
+ public void testPerformCommand() throws ESboxException {
+ final String TARGET_DOESNT_EXIST = "GHOST";
+
+
+ ScratchboxCommand selectCommand = new SelectTargetCommand(sb1Command, sb1Sdk);
+
+ List<String> param = new ArrayList<String>();
+
+ try {
+ selectCommand.performCommand(param);
+ fail("Invalid number of param");
+ } catch (ESboxException e) {
+ // the test is OK, so far.
+ }
+
+ param.add(TARGET_DOESNT_EXIST);
+
+ try {
+ selectCommand.performCommand(param);
+ fail("The target " + TARGET_DOESNT_EXIST
+ + " does not exist. An error must be throwed.");
+ } catch (ESboxException e) {
+ // the test is OK, so far.
+ }
+
+ // find a known target which isn't the current one
+ ListTargetsCommand listTargets = new ListTargetsCommand(sb1Command, 1);
+ param.clear();
+ List<String> targets = listTargets.performCommand(param);
+
+ GetCurrentTargetCommand currentTargetCommand = new GetCurrentTargetCommand(sb1Command, sb1Sdk);
+ String currentTarget = currentTargetCommand.performCommand(param);
+ String firstTarget = currentTarget;
+
+ String theTarget = null;
+ for (String target : targets) {
+ if (!target.equals(currentTarget)) {
+ theTarget = target;
+ break;
+ }
+ }
+
+ // switch to the other target
+ ScratchboxCommand selectTargetCommand = new SelectTargetCommand(sb1Command, sb1Sdk);
+ param.clear();
+ param.add(theTarget);
+ assertTrue((Boolean) selectTargetCommand.performCommand(param));
+
+ String lastTarget = currentTargetCommand
+ .performCommand(new ArrayList<String>());
+ assertEquals(theTarget, lastTarget);
+
+ // siwtch back to the original target
+ param.clear();
+ param.add(currentTarget);
+ assertTrue((Boolean) selectTargetCommand.performCommand(param));
+
+ currentTarget = currentTargetCommand
+ .performCommand(new ArrayList<String>());
+ assertEquals(firstTarget, currentTarget);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowPathMappingSb2Command.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowPathMappingSb2Command.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowPathMappingSb2Command.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,45 @@
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IFileSystemAccess;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ShowPathMappingSb2Command;
+
+import java.util.*;
+
+public class TestShowPathMappingSb2Command extends BaseTest {
+
+ public void testPerformCommand() throws ESboxException {
+ if (sb2ArmelTargetCommand == null)
+ return;
+
+ ShowPathMappingSb2Command showPathsCommand = new ShowPathMappingSb2Command(
+ sb2ArmelTargetCommand);
+
+ List<String> param = new ArrayList<String>();
+
+ param.add("/");
+ param.add("/var/log");
+ param.add("/usr/include");
+ param.add("/usr/lib/libc.so");
+ param.add("/home");
+
+ Map<IPath, IPath> mapping = showPathsCommand.performCommand(param);
+
+ assertNotNull(mapping);
+
+ assertEquals(param.size(), mapping.size());
+
+ IFileSystemAccess fileSystemAccess = sb2Sdk.getMachineFileSystemAccess();
+ for (Map.Entry<IPath, IPath> entry : mapping.entrySet()) {
+ if (fileSystemAccess.getFileStore(entry.getKey()).fetchInfo().exists()) {
+ assertNotNull(entry.getValue());
+ assertTrue(entry.getKey().toOSString(), param.contains(entry.getKey().toPortableString()));
+ assertTrue(entry.getValue().toString(),
+ fileSystemAccess.getFileStore(entry.getValue()).fetchInfo().exists()
+ );
+ }
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowTargetCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowTargetCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestShowTargetCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ScratchboxCommand;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.ShowTargetCommand;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxTarget;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Please, read file TESTS.txt for more instructions about test.
+ */
+public class TestShowTargetCommand extends BaseTest {
+
+ public void testPerformCommand() throws ESboxException {
+ String theTarget = sb1Sdk.getSDKTargetNames()[0];
+
+ ScratchboxCommand showTargetCommand = new ShowTargetCommand(sb1Command);
+ List<String> param = new ArrayList<String>();
+
+ ScratchboxTarget target = null;
+ try {
+ showTargetCommand.performCommand(param);
+ fail("Number of args is invalid");
+ } catch (ESboxException e) {
+ // expected
+ }
+ param.add(theTarget);
+
+ target = (ScratchboxTarget) showTargetCommand.performCommand(param);
+
+ assertEquals(theTarget, target.getName());
+ assertTrue(ScratchboxFacade.getInstance().getCompilers(sb1Sdk).contains(
+ target.getCompiler()));
+ assertTrue(ScratchboxFacade.getInstance().getCputransp(sb1Sdk).contains(
+ target.getCputransp()));
+
+ List<String> devkitsInstalled = ScratchboxFacade.getInstance().getDevkits(sb1Sdk);
+
+ List<String> devkitsActual = target.getDevkits();
+ for (String devkit : devkitsActual) {
+ assertTrue(devkitsInstalled.contains(devkit));
+ }
+
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSimpleCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSimpleCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/maemosdk/tests/commands/TestSimpleCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.tests.commands;
+
+import org.junit.Test;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.maemosdk.core.command.scratchbox.SimpleCommand;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ */
+public class TestSimpleCommand extends BaseTest {
+
+ /**
+ * Test method for {@link org.maemo.esbox.internal.core.command.scratchbox.SimpleCommand#performCommand(java.util.List)}.
+ * @throws ESboxException
+ */
+ @Test
+ public void testPerformCommand() throws ESboxException {
+ String currentTarget = ScratchboxFacade.getInstance().getCurrentTarget(sb1Sdk);
+
+ SimpleCommand simpleCommand = new SimpleCommand(sb1Command);
+ List<String> params = new ArrayList<String>();
+
+ List<String> stdoutLines = null;
+ try {
+ simpleCommand.performCommand(params);
+ fail("Invalid number of params");
+ } catch (ESboxException e) {
+
+ }
+ params.add("sb-conf");
+ params.add("current");
+
+ stdoutLines = simpleCommand.performCommand(params);
+ assertEquals(currentTarget, stdoutLines.get(0));
+ }
+
+}
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.ui
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.classpath
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.classpath (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.project
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.project (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.maemosdk.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:34:30 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Scratchbox UI Plug-in
+Bundle-SymbolicName: org.maemo.esbox.maemosdk.ui;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.maemosdk.ui.UIActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.maemosdk.core;bundle-version="1.5.0",
+ org.maemo.esbox.ui;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.eclipse.ui.ide;bundle-version="3.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/build.properties
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/build.properties (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/maemomenu_misc.gif
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/maemomenu_misc.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/restart_co.gif
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/restart_co.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/scratchbox_terminal.png
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/scratchbox_terminal.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/start_co.gif
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/start_co.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/stop_co.gif
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/stop_co.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/xservermenu_misc.gif
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/etool16/xservermenu_misc.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/obj16/maemoprj_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/icons/full/obj16/maemoprj_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/plugin.xml
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/plugin.xml (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ name="Scratchbox Targets"
+ icon="icons/full/obj16/maemoprj_obj.png"
+ class="org.maemo.esbox.maemosdk.ui.targets.wizards.NewScratchbox2TargetWizard"
+ id="org.maemo.esbox.maemosdk.ui.scratchbox.targets.wizards.NewTargetWizard">
+ </wizard>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.maemo.esbox.ui.esboxPreferencePage"
+ class="org.maemo.esbox.maemosdk.ui.preferences.Scratchbox1PreferencesPage"
+ id="org.maemo.esbox.maemosdk.ui.esboxPreferencePage.scratchbox1"
+ name="Scratchbox 1">
+ </page>
+ <page
+ category="org.maemo.esbox.ui.esboxPreferencePage"
+ class="org.maemo.esbox.maemosdk.ui.preferences.Scratchbox2PreferencesPage"
+ id="org.maemo.esbox.maemosdk.ui.esboxPreferencePage.scratchbox2"
+ name="Scratchbox 2">
+ </page>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ id="org.maemo.esbox.maemosdk.ui.toolbaraction"
+ label="Toolbar Action"
+ visible="true">
+ <menu
+ id="org.maemo.esbox.maemosdk.ui.xmenu"
+ label="X Menu">
+ <separator
+ name="esboxgroup">
+ </separator>
+ </menu>
+ <action
+ class="org.maemo.esbox.maemosdk.ui.actions.XDropdownMenuAction"
+ enablesFor="*"
+ icon="icons/full/etool16/xservermenu_misc.gif"
+ id="org.maemo.esbox.maemosdk.ui.action.xserver"
+ label="X Server"
+ state="true"
+ style="pulldown"
+ toolbarPath="esboxgroup"
+ tooltip="Start X Server">
+ </action>
+ <action
+ class="org.maemo.esbox.maemosdk.ui.actions.MaemoDropdownMenuAction"
+ enablesFor="*"
+ icon="icons/full/etool16/maemomenu_misc.gif"
+ id="org.maemo.esbox.maemosdk.ui.action.maemo"
+ label="%action.label.1"
+ state="true"
+ style="pulldown"
+ toolbarPath="esboxgroup"
+ tooltip="Start Maemo">
+ </action>
+ </actionSet>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.maemo.esbox.maemosdk.ui.popupMenu.launchShell"
+ objectClass="org.eclipse.core.resources.IResource">
+ <action
+ class="org.maemo.esbox.maemosdk.ui.actions.LaunchShellAction"
+ icon="icons/full/etool16/scratchbox_terminal.png"
+ id="org.maemo.esbox.maemosdk.ui.launchShellAction"
+ label="Launch Terminal Here"
+ tooltip="Launch a shell in the context of the current target">
+ </action>
+
+ </objectContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.ui.category.help"
+ defaultHandler="org.maemo.esbox.maemosdk.ui.actions.ValidateVirtualMachineCommand"
+ description="Validate launching and communication with ESbox virtual machine"
+ id="org.maemo.esbox.maemosdk.ui.validateVirtualMachineCommand"
+ name="Validate ESbox Virtual Machine">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:help?after=additions">
+ <command
+ commandId="org.maemo.esbox.maemosdk.ui.validateVirtualMachineCommand"
+ mnemonic="V"
+ style="push"
+ tooltip="Run to ensure that the virtual machine build host is properly configured.">
+ </command>
+ </menuContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.maemo.esbox.core.sdk.ISDK"
+ class="org.maemo.esbox.internal.maemosdk.ui.adapters.MaemoSDKInstallTargetAdapterFactory">
+ <adapter
+ type="org.maemo.esbox.core.adapters.ISDKManageTargetAdapter">
+ </adapter>
+ </factory>
+ </extension>
+
+
+</plugin>
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/UIActivator.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/UIActivator.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/UIActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,131 @@
+package org.maemo.esbox.internal.maemosdk.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.maemosdk.ui";
+
+ // The shared instance
+ private static UIActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public UIActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return UIActivator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/ESboxTargetRemover.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/ESboxTargetRemover.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/ESboxTargetRemover.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,294 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.ui.adapters;
+
+import com.nokia.cpp.internal.api.utils.core.TextUtils;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox2SDK;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+import org.maemo.esbox.project.core.*;
+import org.maemo.esbox.ui.ESboxBuildTargetUI;
+
+import java.text.MessageFormat;
+import java.util.*;
+
+/**
+ * This class handles updating projects when they depend on an SDK target we're about
+ * to delete.
+ * @author eswartz
+ *
+ */
+public class ESboxTargetRemover {
+
+ private final ISDKTarget sdkTarget;
+ private final boolean deleteRootstrap;
+ private final Shell shell;
+
+ public ESboxTargetRemover(Shell shell, ISDKTarget sdkTarget, boolean deleteRootstrap) {
+ this.shell = shell;
+ this.sdkTarget = sdkTarget;
+ this.deleteRootstrap = deleteRootstrap;
+ }
+
+ /**
+ * Remove the target selected.
+ */
+ public void run(IProgressMonitor monitor) throws ESboxException {
+ monitor.beginTask("Removing target " + sdkTarget.getName(), 3);
+ IScratchboxSDK sdk = (IScratchboxSDK) sdkTarget.getSDK();
+ String targetName = sdkTarget.getName();
+
+ // update all the projects to use another SDK Target
+ if (!updateProjectsForRemovedTarget(sdkTarget, new SubProgressMonitor(monitor, 1)))
+ return;
+ if (monitor.isCanceled())
+ return;
+
+ // remove the rootstrap
+ if (deleteRootstrap) {
+ if (sdk instanceof IScratchbox2SDK) {
+ try {
+ ScratchboxFacade.getInstance().removeRootstrap(
+ (IScratchbox2SDK) sdk, sdkTarget.getName(), true,
+ new SubProgressMonitor(monitor, 1));
+ } catch (ESboxException e) {
+ // don't worry -- it may be a bogus target or one without a rootstrap
+ UIActivator.getErrorLogger().logError("Problem removing rootstrap", e);
+ }
+ } else {
+ monitor.worked(1);
+ }
+ if (monitor.isCanceled())
+ return;
+ } else {
+ monitor.worked(1);
+ }
+
+ // and remove the target
+ ScratchboxFacade.getInstance().removeTarget(
+ sdk, targetName);
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return;
+
+
+ }
+
+ /**
+ * Ask user to reassign SDK target for any project which is using the
+ * to-be-deleted target. If user cancels or there are no other targets to
+ * use, returns false.
+ * @param monitor
+ * @param sdk
+ * @param oldTargetName target name to be removed
+ * @return true if reassigning succeeded
+ * @throws ESboxException
+ */
+ private boolean updateProjectsForRemovedTarget(ISDKTarget sdkTarget, IProgressMonitor monitor) throws ESboxException {
+ monitor.beginTask("", 10);
+ try {
+ monitor.subTask("Checking projects using build target");
+
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ Set<IESboxProjectHandle> projectsUsingTarget = new HashSet<IESboxProjectHandle>();
+ Set<IESboxProjectHandle> projectsOnlyUsingTarget = new HashSet<IESboxProjectHandle>();
+ for (IProject project : projects) {
+ if (!project.isOpen())
+ continue;
+ IESboxProjectHandle projectHandle = ProjectManager.getInstance().getProjectHandle(project);
+ if (projectHandle != null) {
+ boolean allUseTarget = true;
+ for (IESboxBuildConfiguration config : projectHandle.getBuildConfigurations()) {
+ if (config.getSDKTargetName().equals(sdkTarget.getName())) {
+ projectsUsingTarget.add(projectHandle);
+ } else {
+ allUseTarget = false;
+ }
+ }
+ if (allUseTarget) {
+ projectsOnlyUsingTarget.add(projectHandle);
+ }
+ }
+ }
+ if (projectsUsingTarget.isEmpty())
+ return true;
+ monitor.worked(1);
+
+ ISDKTarget replacement = null;
+ if (!projectsOnlyUsingTarget.isEmpty()) {
+ monitor.subTask("Selecting alternate build target");
+ replacement = selectAlternateSDKTarget(projectsOnlyUsingTarget, sdkTarget);
+ if (replacement == null)
+ return false;
+ monitor.worked(1);
+ }
+
+ monitor.subTask("Migrating build targets");
+ for (IESboxProjectHandle projectHandle : projectsUsingTarget) {
+ updateBuildConfigurations(projectHandle, sdkTarget, replacement);
+ }
+ monitor.worked(1);
+
+ monitor.subTask("Saving projects");
+ for (IESboxProjectHandle projectHandle : projectsUsingTarget) {
+ try {
+ projectHandle.save(new SubProgressMonitor(monitor, 1));
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().logAndShowError("Failed to update project", e);
+ }
+ }
+
+ // build system should handle this
+ //// target removal requires a rebuild
+ //cleanProjects(projectsUsingTarget, new SubProgressMonitor(monitor, 7));
+ } finally {
+ monitor.done();
+ }
+ return true;
+ }
+
+ /**
+ * For the given project, remove the configurations using sdkTarget.
+ * If there are no build configurations left, then add one using the replacement.
+ * @param projectHandle
+ * @param sdkTarget
+ * @param replacement
+ */
+ private void updateBuildConfigurations(IESboxProjectHandle projectHandle,
+ ISDKTarget sdkTarget, ISDKTarget replacement) {
+ IESboxBuildConfiguration lastConfig = null;
+
+ for (IESboxBuildConfiguration config : projectHandle.getBuildConfigurations()) {
+ if (config.getSDKTarget().equals(sdkTarget)) {
+ try {
+ lastConfig = config;
+ projectHandle.removeBuildConfiguration(config);
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().logAndShowError("Could not remove build configuration", e);
+ }
+ }
+ }
+ if (projectHandle.getBuildConfigurations().length == 0) {
+ // need to add one for replacement
+ ESboxBuildConfigurationParameters parameters = new ESboxBuildConfigurationParameters(replacement.getName(), replacement);
+ try {
+ /*IESboxBuildConfiguration newConfig =*/ projectHandle.createBuildConfiguration(parameters, lastConfig);
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().logAndShowError("Failed to add replacement build configuration", e);
+ }
+ }
+ }
+
+ private ISDKTarget selectAlternateSDKTarget(
+ final Set<IESboxProjectHandle> projectsOnlyUsingTarget, final ISDKTarget sdkTarget) {
+ final ISDKTarget[] replacement = { null };
+ final Dialog dialog = new Dialog(shell) {
+ private Button okButton;
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText("Replace Build Target");
+ }
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite contents = (Composite) super.createDialogArea(parent);
+ Label label = new Label(contents, SWT.NONE);
+ label.setText(MessageFormat.format(
+ "Some existing projects build only against ''{0}'':\n\n\t{1}\n\nSpecify an alternate build target:",
+ TextUtils.catenateStrings(projectsOnlyUsingTarget.toArray(), "\n\t"),
+ sdkTarget.getName()));
+ label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+
+ TreeViewer targetViewer = ESboxBuildTargetUI.createConfiguredBuildTargetViewer(contents, ESboxBuildTargetUI.DEFAULT_STYLE);
+ targetViewer.setFilters(new ViewerFilter[] {
+ new ViewerFilter() {
+
+ @Override
+ public boolean select(Viewer viewer,
+ Object parentElement, Object element) {
+ return !element.equals(sdkTarget);
+ }
+ }
+ });
+ targetViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ targetViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ Object element = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ if (element instanceof ISDKTarget) {
+ replacement[0] = (ISDKTarget) element;
+ } else {
+ replacement[0] = null;
+ }
+ if (okButton != null) {
+ okButton.setEnabled(replacement[0] != null);
+ }
+ }
+
+ });
+ targetViewer.setInput(new Object());
+ return contents;
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ okButton.setEnabled(false);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+ };
+
+ shell.getDisplay().syncExec(new Runnable() {
+
+ public void run() {
+ if (dialog.open() != IDialogConstants.OK_ID) {
+ replacement[0] = null;
+ }
+ }
+
+ });
+ return replacement[0];
+ }
+
+ /*
+ private void cleanProjects(final Set<IESboxProjectHandle> projects, IProgressMonitor monitor) {
+ // clean the target
+ monitor.beginTask("", projects.size());
+ monitor.subTask("Cleaning affected projects");
+ try {
+ for (IESboxProjectHandle projectHandle : projects) {
+ projectHandle.getProject().build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
+ monitor.worked(1);
+ }
+ } catch (CoreException e) {
+ ErrorLogger errorLogger = Activator.getErrorLogger();
+ errorLogger.logAndShowError("Error cleaning project", e);
+ } finally {
+ monitor.done();
+ }
+ }
+ */
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoSDKInstallTargetAdapterFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.ui.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public class MaemoSDKInstallTargetAdapterFactory implements IAdapterFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adapterType.equals(ISDKManageTargetAdapter.class)) {
+ if (adaptableObject instanceof IScratchbox1SDK) {
+ return new MaemoScratchbox1SDKManageTargetAdapter((IScratchbox1SDK) adaptableObject);
+ }
+ if (adaptableObject instanceof IScratchbox2SDK) {
+ return new MaemoScratchbox2SDKManageTargetAdapter((IScratchbox2SDK) adaptableObject);
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchbox1SDKManageTargetAdapter.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchbox1SDKManageTargetAdapter.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchbox1SDKManageTargetAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.ui.adapters;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox1SDK;
+import org.maemo.esbox.maemosdk.ui.targets.wizards.NewScratchbox1TargetWizard;
+
+import java.util.List;
+
+/**
+ * @author eswartz
+ *
+ */
+public class MaemoScratchbox1SDKManageTargetAdapter extends MaemoScratchboxSDKManageTargetAdapterBase
+ implements ISDKManageTargetAdapter {
+
+ private IScratchbox1SDK sdk;
+
+ /**
+ * @param adaptableObject
+ */
+ public MaemoScratchbox1SDKManageTargetAdapter(IScratchbox1SDK sdk) {
+ this.sdk = sdk;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.adapters.ISDKManageTargetAdapter#installSDKTargets(org.eclipse.swt.widgets.Shell, java.util.List)
+ */
+ public IStatus installSDKTargets(Shell shell, List<ISDKTarget> installed) {
+ NewScratchbox1TargetWizard targetWizard;
+
+ targetWizard = new NewScratchbox1TargetWizard(sdk);
+ WizardDialog dlg = new WizardDialog(
+ shell,
+ targetWizard);
+ if (dlg.open() == Dialog.OK) {
+ return Status.OK_STATUS;
+ }
+
+ return Status.CANCEL_STATUS;
+ }
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.ui.adapters;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox2SDK;
+import org.maemo.esbox.maemosdk.ui.targets.wizards.NewScratchbox2TargetWizard;
+
+import java.util.List;
+
+/**
+ * @author eswartz
+ *
+ */
+public class MaemoScratchbox2SDKManageTargetAdapter extends MaemoScratchboxSDKManageTargetAdapterBase
+ implements ISDKManageTargetAdapter {
+
+ private final IScratchbox2SDK sdk;
+
+ /**
+ * @param sdk
+ */
+ public MaemoScratchbox2SDKManageTargetAdapter(IScratchbox2SDK sdk) {
+ this.sdk = sdk;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.adapters.ISDKManageTargetAdapter#installSDKTargets(org.eclipse.swt.widgets.Shell, java.util.List)
+ */
+ public IStatus installSDKTargets(Shell shell, List<ISDKTarget> installed) {
+ NewScratchbox2TargetWizard targetWizard;
+
+ targetWizard = new NewScratchbox2TargetWizard(sdk);
+ WizardDialog dlg = new WizardDialog(
+ shell,
+ targetWizard);
+ if (dlg.open() == Dialog.OK) {
+ return Status.OK_STATUS;
+ }
+
+ return Status.CANCEL_STATUS;
+ }
+
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/adapters/MaemoScratchboxSDKManageTargetAdapterBase.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.maemosdk.ui.adapters;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.*;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.adapters.ISDKManageTargetAdapter;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+import java.util.List;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class MaemoScratchboxSDKManageTargetAdapterBase implements ISDKManageTargetAdapter {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.adapters.ISDKTargetInstallerAdapter#removeSDKTarget(org.eclipse.swt.widgets.Shell, org.maemo.esbox.core.sdk.ISDKTarget)
+ */
+ public IStatus removeSDKTarget(Shell shell, ISDKTarget selectedTarget) {
+ final boolean[] deleteRootstrap = { false };
+ boolean rootstrapUsed_ = false;
+ try {
+ // see if a rootstrap -- possibly disconnected from the target -- exists
+ List<MaemoRootstrap> rootstraps =
+ ScratchboxFacade.getInstance().getAvailableMaemoRootstraps(selectedTarget.getSDK().getMachine());
+ for (MaemoRootstrap rootstrap : rootstraps) {
+ if (rootstrap.getName().equals(selectedTarget.getName())) {
+ rootstrapUsed_ = true;
+ break;
+ }
+ }
+ } catch (ESboxException e1) {
+ UIActivator.getErrorLogger().logError("Failure scanning maemo rootstraps", e1);
+ }
+
+ final boolean rootstrapUsed = rootstrapUsed_;
+ String message;
+ if (rootstrapUsed) {
+ message = "Really delete SDK target ''{0}''?\n\n"+
+ "This will remove the entry from {1}.\n\n"+
+ "If existing projects use this target, you will be asked to select an alternate target.";
+ } else {
+ message = "Really delete SDK target ''{0}''?\n\n"+
+ "This will remove the entry from {1} and delete the rootstrap.\n\n"+
+ "If existing projects use this target, you will be asked to select an alternate target.";
+ }
+ String title = MessageFormat.format("Delete target from {0}?",
+ selectedTarget.getSDK().getDisplayName());
+
+ MessageDialog dialog = new MessageDialog(shell,
+ title,
+ null,
+ MessageFormat.format(
+ message,
+ selectedTarget.getName(),
+ selectedTarget.getSDK().getName()),
+ MessageDialog.WARNING,
+ new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL },
+ 1) {
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ if (rootstrapUsed) {
+ Label spacer = new Label(composite, SWT.NONE);
+ spacer.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+
+ final Button removeRootstrap = new Button(composite, SWT.CHECK);
+ removeRootstrap.setText("Also delete rootstrap (target filesystem)");
+ removeRootstrap.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ removeRootstrap.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ deleteRootstrap[0] = removeRootstrap.getSelection();
+ }
+ });
+ }
+ return composite;
+ }
+ };
+
+ if (dialog.open() == 0) {
+ return removeTarget(shell, selectedTarget, deleteRootstrap[0]);
+ } else {
+ return Status.CANCEL_STATUS;
+ }
+ }
+
+ protected IStatus removeTarget(final Shell shell, final ISDKTarget selectedTarget, final boolean deleteRootstrap) {
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ ESboxTargetRemover remover = new ESboxTargetRemover(shell, selectedTarget, deleteRootstrap);
+ try {
+ remover.run(monitor);
+ } catch (ESboxException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ if (e.getCause() instanceof ESboxException)
+ e = (Exception) e.getCause();
+ return UIActivator.createErrorStatus("Error removing target", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.core.adapters.ISDKManageTargetAdapter#prepareRefresh()
+ */
+ public void prepareRefresh() {
+ // this clears for both SB1 and SB2... oh well
+ ScratchboxFacade.getInstance().clearCachedData();
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/MaemoRootstrapContentLabelProvider.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/MaemoRootstrapContentLabelProvider.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/MaemoRootstrapContentLabelProvider.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.Display;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.maemosdk.core.scratchbox.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class provides installable rootstraps, descriptions, etc. from
+ * the result of 'maemo-rootstrap'.
+ * @author eswartz
+ *
+ */
+public class MaemoRootstrapContentLabelProvider extends LabelProvider implements ITreeContentProvider, ITableLabelProvider,
+ IColorProvider, IFontProvider {
+ static final int COLUMN_NAME = 0;
+ static final int COLUMN_ARCHITECTURE = 1;
+ static final int COLUMN_DESCRIPTION = 2;
+
+ public static Object NO_ROOTSTRAP = new Object();
+ public static Object LOADING_LABEL = new Object();
+
+ private boolean rootstrapsFetched;
+ // either MaemoRootstrap or NO_ROOTSTRAP
+ private List<Object> rootstraps;
+ private Thread rootstrapThread;
+ private final IMachine machine;
+
+ public MaemoRootstrapContentLabelProvider(IMachine machine) {
+ this.machine = machine;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (!rootstrapsFetched) {
+ rootstraps = new ArrayList<Object>();
+ rootstraps.add(NO_ROOTSTRAP);
+ rootstraps.add(LOADING_LABEL);
+
+ if (rootstrapThread == null) {
+ rootstrapThread = new Thread(new Runnable() {
+
+ public void run() {
+ try {
+ List<MaemoRootstrap> realRootstraps =
+ ScratchboxFacade.getInstance().getAvailableMaemoRootstraps(machine);
+ synchronized (rootstraps) {
+ rootstraps.remove(1);
+ rootstraps.addAll(realRootstraps);
+ }
+ } catch (final ESboxException e) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog.openError(null, "Rootstrap lookup failed",
+ "Error fetching rootstraps: check proxy settings?\n\n" + e.getMessage());
+ }
+
+ });
+ }
+ rootstrapsFetched = true;
+ rootstrapThread = null;
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ fireLabelProviderChanged(new LabelProviderChangedEvent(MaemoRootstrapContentLabelProvider.this));
+ }
+
+ });
+ }
+
+ });
+ rootstrapThread.start();
+ }
+ }
+ synchronized (rootstraps) {
+ return rootstraps.toArray();
+ }
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ return new Object[0];
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ viewer.refresh();
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ switch (columnIndex) {
+ case COLUMN_NAME:
+ if (element == NO_ROOTSTRAP) {
+ return "Custom target";
+ } else if (element == LOADING_LABEL) {
+ return "Loading...";
+ } else {
+ return ((MaemoRootstrap) element).getName();
+ }
+
+ case COLUMN_ARCHITECTURE:
+ if (element == NO_ROOTSTRAP || element == LOADING_LABEL) {
+ return null;
+ }
+ return ((MaemoRootstrap) element).getArchitecture();
+
+ case COLUMN_DESCRIPTION:
+ if (element == NO_ROOTSTRAP) {
+ return "User-defined name and compiler, manually installed rootstrap";
+ } else if (element == LOADING_LABEL) {
+ return null;
+ } else {
+ return ((MaemoRootstrap) element).getDescription();
+ }
+ }
+ return null;
+ }
+
+
+ public Color getBackground(Object element) {
+ return null;
+ }
+
+ public Color getForeground(Object element) {
+ if (element == LOADING_LABEL)
+ return Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
+ else
+ return null;
+ }
+
+ public Font getFont(Object element) {
+ if (element == LOADING_LABEL)
+ return JFaceResources.getFontRegistry().getItalic(
+ JFaceResources.DIALOG_FONT);
+ else
+ return null;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/LaunchShellAction.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/LaunchShellAction.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/LaunchShellAction.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.actions;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.action.IAction;
+import org.maemo.esbox.core.*;
+
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.IPreferenceProvider;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxTargetSwitcher;
+import org.maemo.esbox.project.core.ProjectManager;
+import org.maemo.esbox.ui.actions.ESboxAction;
+
+import java.util.*;
+
+/**
+ * Launch a scratchbox shell in the selected directory
+ * @author eswartz
+ *
+ */
+public class LaunchShellAction extends ESboxAction {
+
+ /**
+ *
+ */
+ public LaunchShellAction() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ IResource resource = extractSelection();
+ if (resource == null)
+ return;
+
+ IPath hostWd;
+ if (resource instanceof IContainer)
+ hostWd = resource.getLocation();
+ else
+ hostWd = resource.getParent().getLocation();
+
+ IProcessLauncherFactory hostLauncherFactory = new HostProcessLauncherFactory();
+
+ // find a terminal to launch.
+ String terminalPattern;
+
+ IProcessLauncherFactory launcherFactory;
+ IPreferenceProvider prefProvider;
+ IPath targetWd;
+ ISDKTarget sdkTarget = null;
+ try {
+ sdkTarget = ProjectManager.getInstance().getSDKTarget(resource.getProject());
+ prefProvider = sdkTarget;
+ launcherFactory = sdkTarget.getProcessLauncherFactory();
+ targetWd = sdkTarget.convertHostToTargetPath(hostWd);
+
+ // make sure we have the right target
+ ScratchboxTargetSwitcher.ensureCurrentTarget(sdkTarget);
+ } catch (ESboxException e) {
+ // not scratchbox
+ prefProvider = CorePlugin.getDefault().getCorePreferenceProvider();
+ launcherFactory = hostLauncherFactory;
+ targetWd = hostWd;
+ }
+
+ // first, construct the command line to launch a shell (in the target)
+ List<String> targetCmdLine = new ArrayList<String>();
+ targetCmdLine.add("/bin/bash");
+
+ Properties targetEnv = launcherFactory.getStandardEnvironment();
+ targetEnv.put("PWD", targetWd.toOSString());
+ if (sdkTarget != null)
+ targetEnv.put("PS1", "[" + sdkTarget.getName() + "] \\w$ ");
+
+ IProcessLauncher launchHandler = launcherFactory.createProcessLaunchHandler(targetWd, targetCmdLine, targetEnv);
+ String sandboxCmdLine = CommandLineArguments.toCommandLine(launchHandler.getLaunchCommandArguments());
+
+ terminalPattern = prefProvider.getPreferenceValue(ESboxPreferenceConstants.TERMINAL_COMMAND);
+
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+ substitutor.define("HOSTDIR", hostWd.toOSString());
+ substitutor.define("TARGETDIR", targetWd.toOSString());
+ substitutor.define("COMMAND", sandboxCmdLine);
+
+ String terminalCommand = substitutor.substitute(terminalPattern);
+
+ // don't use ESbox-enhanced environment for terminal launch
+ Properties hostEnv = EnvironmentProperties.createFromMap(System.getenv());
+ hostEnv.put("PWD", targetWd.toOSString());
+
+ IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(hostLauncherFactory,
+ hostWd,
+ CommandLineArguments.createFromCommandLine(terminalCommand),
+ hostEnv);
+ launcher.usePTY(true);
+
+ try {
+ launcher.createProcess();
+ launcher.redirectToConsole(CorePlugin.getDefault().getConsole(true, sdkTarget, "Launching terminal"));
+ } catch (ESboxException e) {
+ UIActivator.getErrorLogger().logAndShowError("Error launching terminal", e);
+ }
+
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/MaemoDropdownMenuAction.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/MaemoDropdownMenuAction.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/MaemoDropdownMenuAction.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,267 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tampere University of Technology - TUT/CS
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.ui.actions;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.*;
+import org.eclipse.ui.part.FileEditorInput;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ESboxScriptLauncher;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDKTarget;
+import org.maemo.esbox.project.core.ProjectManager;
+import org.maemo.esbox.ui.dialogs.SelectSDKTargetDialog;
+
+import java.text.MessageFormat;
+
+/**
+ * @author reijula
+ * modified by Raul Fernandes Herbster
+ * @author eswartz
+ *
+ * This is a Maemo-menu where user can handle maemo operations
+ */
+public class MaemoDropdownMenuAction implements IWorkbenchWindowPulldownDelegate{
+
+ //menu shown in eclipse toolbar
+ private Menu pulldownmenu;
+ private IProject selectedProject;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowPulldownDelegate#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ public Menu getMenu(Control parent) {
+ parent.setMenu(pulldownmenu);
+ return parent.getMenu();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ public void dispose() {
+ // does nothing
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init(IWorkbenchWindow window) {
+
+ //shell for creating menu
+ Shell parent = window.getShell();
+ //toolbar pulldownmenu ->
+ pulldownmenu = new Menu(parent);
+
+ MenuItem mi = new MenuItem(pulldownmenu, SWT.PUSH);
+ mi.setText("Start");
+ mi.setImage(UIActivator.getImageDescriptor("./icons/full/etool16/start_co.gif").createImage());
+ mi.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ Job job = new Job("Starting maemo") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ startClicked();
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
+ }
+ });
+
+ mi = new MenuItem(pulldownmenu, SWT.PUSH);
+ mi.setText("Restart");
+ mi.setImage(UIActivator.getImageDescriptor("./icons/full/etool16/restart_co.gif").createImage());
+ mi.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ Job job = new Job("Restarting maemo") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ restartClicked();
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
+ }
+ });
+
+ mi = new MenuItem(pulldownmenu, SWT.PUSH);
+ mi.setText("Stop");
+ mi.setImage(UIActivator.getImageDescriptor("./icons/full/etool16/stop_co.gif").createImage());
+ mi.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ Job job = new Job("Stopping maemo") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ stopClicked();
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
+ }
+ });
+
+ }
+
+ /**
+ * Start maemo, from sbdt.core
+ */
+ protected void startClicked() {
+ try {
+ ISDKTarget target = getSDKTarget();
+ if (target == null)
+ return;
+ ESboxScriptLauncher.getInstance().startMaemo(target);
+ } catch (ESboxException e) {
+ errorDialog("Error starting maemo", e);
+ }
+ }
+
+ /**
+ * Restart maemo, from sbdt.core
+ */
+ protected void restartClicked() {
+ try {
+ ISDKTarget target = getSDKTarget();
+ if (target == null)
+ return;
+ ESboxScriptLauncher.getInstance().restartMaemo(target);
+ } catch (ESboxException e) {
+ errorDialog("Error restarting maemo", e);
+ }
+ }
+
+ /**
+ * Stop maemo, from sbdt.core
+ */
+ protected void stopClicked() {
+ try {
+ ISDKTarget target = getSDKTarget();
+ if (target == null)
+ return;
+ ESboxScriptLauncher.getInstance().stopMaemo(target);
+ ESboxScriptLauncher.getInstance().killMaemo(target);
+ } catch (ESboxException e) {
+ errorDialog("Error stopping maemo", e);
+ }
+ }
+
+ private void errorDialog(final String string, final ESboxException e) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ Shell shell = pulldownmenu.getShell();
+ MessageDialog.openError(shell, "Maemo Error",
+ MessageFormat.format("{0}:\n\n{1}",
+ string,
+ e.getMessage()));
+ }
+
+ });
+ }
+
+ private ISDKTarget getSDKTarget() {
+
+ ISDKTarget sdkTarget = null;
+ if (selectedProject != null) {
+ try {
+ ISDKTarget theSdkTarget = ProjectManager.getInstance().getSDKTarget(selectedProject);
+ if (theSdkTarget instanceof IScratchboxSDKTarget) {
+ sdkTarget = theSdkTarget;
+ }
+ } catch (ESboxException e) {
+ }
+ }
+
+ if (sdkTarget != null)
+ return sdkTarget;
+
+ final ISDKTarget[] selected = { null };
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ selected[0] = new SelectSDKTargetDialog(pulldownmenu.getShell(),
+ "Select an SDK under which to run maemo:").selectTarget();
+ }
+
+ });
+ return selected[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ startClicked();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ // The command must adapt to the current project / editor / etc.
+ // or else we will not launch the proper version of maemo
+
+ IProject project = null;
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ Object object = ((IStructuredSelection) selection).getFirstElement();
+ if (object instanceof IResource) {
+ project = ((IResource) object).getProject();
+ } else if (object instanceof IAdaptable) {
+ project = (IProject)((IAdaptable) object).getAdapter(IProject.class);
+ }
+ } else {
+ // check for editor
+ // XXX: move to utility
+ IEditorPart part = null;
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ if (workbench != null) {
+ IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
+ if (activeWorkbenchWindow != null) {
+ IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
+ if (activePage != null) {
+ part = activePage.getActiveEditor();
+ }
+ }
+ }
+ if (part != null && part.getEditorInput() instanceof FileEditorInput) {
+ IFile file = ((FileEditorInput) part.getEditorInput()).getFile();
+ project = file.getProject();
+ }
+ }
+
+ // XXX: don't ask for ISDKTarget here since it can hang
+ this.selectedProject = null;
+ if (project != null && project.isOpen()) {
+ this.selectedProject = project;
+ }
+
+ action.setEnabled(true);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/ValidateVirtualMachineCommand.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/ValidateVirtualMachineCommand.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/ValidateVirtualMachineCommand.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,305 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.actions;
+
+import org.eclipse.core.commands.*;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.machine.*;
+
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.core.sdk.SDKFactory;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKFacade;
+
+import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ValidateVirtualMachineCommand extends AbstractHandler {
+
+ private Shell shell;
+
+ protected void fail(final String msg, final Object... param) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog.openError(getShell(), "Validation Failure", MessageFormat.format(msg, param));
+ }
+
+ });
+ }
+
+ protected void info(final String msg, final Object... param) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog.openInformation(getShell(), "Validation Information", MessageFormat.format(msg, param));
+ }
+
+ });
+ }
+ /**
+ * @return
+ */
+ protected Shell getShell() {
+ return shell;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ setupContext(event.getApplicationContext());
+
+ // find a virtual machine
+ boolean found = false;
+
+ IMachine[] machines = MachineRegistry.getInstance().getBuildMachines();
+ for (IMachine machine : machines) {
+ if (machine instanceof IVirtualMachine) {
+ runVirtualMachineTests(machine);
+ found = true;
+ }
+ }
+
+ if (!found) {
+ if (Platform.getOS().equals(Platform.OS_WIN32))
+ fail("Cannot find a registered virtual build machine -- probably a build or packaging error.");
+ else
+ info("No virtual build machines used or needed on this platform.");
+ return null;
+ }
+
+ return null;
+ }
+
+ private Object runVirtualMachineTests(IMachine machine) {
+ if (!testVirtualMachineRunning(machine))
+ return null;
+
+ if (!testProcessLaunching(machine))
+ return null;
+
+ if (!testBasicFileSystem(machine))
+ return null;
+
+ // check the shared folder
+ // XXX: the specific directories are a hack and should be accessible through IMachine API
+ IFileStore localStore = EFS.getLocalFileSystem().getStore(new Path("c:/sources/shared/__testfile.txt"));
+ IFileStore remoteStore = machine.getFileSystemAccess().getFileStore(new Path("/home/devel/shared/__testfile.txt"));
+
+ try {
+ localStore.delete(0, null);
+ } catch (CoreException e) {
+ }
+
+ // in case the filesystem is NOT shared, don't falsely detect a similar file on the VM's local filesystem
+ try {
+ remoteStore.delete(0, null);
+ remoteStore.fetchInfo();
+ } catch (CoreException e) {
+ }
+
+ OutputStream os;
+ try {
+ os = localStore.openOutputStream(EFS.OVERWRITE, null);
+ os.write("Contents\n".getBytes());
+ Policy.close(os);
+ } catch (Exception e) {
+ fail("Could not create local test file ''{0}''.\n\nThis is a serious problem.",
+ localStore);
+ return null;
+ }
+
+ // wait a little while for samba to notice, or else it looks like the file doesn't exist (:p !!!)
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ }
+ remoteStore = machine.getFileSystemAccess().getFileStore(new Path("/home/devel/shared/__testfile.txt"));
+ if (!remoteStore.fetchInfo().exists()) {
+ fail("Could not access {0} over SSH filesystem.\n\nThis file should be visible since we created it locally and this location\nis assumed to be shared at {1}.\n\nPlease log in to the machine and invoke ''sh mount_share.sh''.\n",
+ remoteStore, localStore);
+ return null;
+ }
+
+ if (!testScratchboxTargets("/home/devel/shared/__testfile.txt"))
+ return null;
+
+ try {
+ localStore.delete(0, null);
+ } catch (CoreException e) {
+ }
+
+ info("Everything seems to work!");
+ return null;
+ }
+
+ /**
+ * @param machine
+ */
+ private boolean testVirtualMachineRunning(final IMachine machine) {
+ // make sure it's running
+ final IStatus[] statuses = { null };
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ statuses[0] = MachineManager.getInstance().acquireMachine(machine, null);
+ }
+
+ });
+ } catch (InvocationTargetException e) {
+ fail(e.getMessage());
+ } catch (InterruptedException e) {
+ fail(e.getMessage());
+ }
+ IStatus status = statuses[0];
+ if (!status.isOK()) {
+ if (status.getSeverity() == IStatus.ERROR) {
+ fail("Failed to launch or revive the virtual build machine:\n{0}", status);
+ return false;
+ }
+ fail("The virtual build machine is not well, going to continue anyway...:\n{0}", status);
+ }
+ return true;
+ }
+
+ /**
+ * @param machine
+ */
+ private boolean testProcessLaunching(final IMachine machine) {
+ // check the process launcher
+ IProcessLauncherFactory processLauncherFactory = machine.getProcessLauncherFactory();
+ IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory,
+ "ls " + machine.getUserHome());
+ MessageConsole console = CorePlugin.getDefault().getConsole(true, null, "Virtual machine ~devel home directory listing");
+
+ Process process;
+ try {
+ process = processLauncher.createProcess();
+ } catch (ESboxException e) {
+ fail("Could not run ls on " + machine.getUserHome() + " directory.\nIf SSH connections to machine are failing, ensure the \nrun_linux_wait.bat script (in the plugin) has not been modified\nand that the virtual machine has booted properly:\n{0}",
+ e);
+ return false;
+ }
+ processLauncher.redirectToConsole(console);
+
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+
+ }
+
+ return true;
+ }
+
+ /**
+ * @param machine
+ */
+ private boolean testBasicFileSystem(final IMachine machine) {
+ // check the basic filesystem access
+ IFileStore store = machine.getFileSystemAccess().getFileStore(machine.getUserHome());
+ if (!store.fetchInfo().exists()) {
+ fail("Could not access ''{0}'' over SSH filesystem.\n\nThis is probably a serious problem because the home directory for this user should exist.",
+ store);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ */
+ private boolean testScratchboxTargets(String path) {
+ IFileStore remoteStore;
+ ISDKTarget[] sdkTargets = ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets();
+
+ if (sdkTargets.length == 0) {
+ info("Could not locate any scratchbox SDK targets in virtual build machine.\n\nRetrying ...");
+
+ ProgressMonitorDialog dlg2 = new ProgressMonitorDialog(getShell());
+ try {
+ dlg2.run(false, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ SDKFactory.getInstance().refresh(monitor);
+ }
+
+ });
+ } catch (Exception e) {
+ fail("Failed to refresh Scratchbox SDKS:\n{0}", e.getMessage());
+ return false;
+ }
+
+ sdkTargets = ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets();
+ if (sdkTargets.length < 4) {
+ fail("Failed to find all the expected scratchbox targets (wanted at least four)... the build machine is probably misconfigured or broken.");
+ return false;
+ }
+ }
+
+ try {
+ ScratchboxSDKFacade.getInstance().getScratchbox1SDK();
+ } catch (ScratchboxException e) {
+ fail("Found some scratchbox targets but not scratchbox 1... the build machine is probably misconfigured or broken.");
+ return false;
+ }
+
+ try {
+ ScratchboxSDKFacade.getInstance().getScratchbox2SDK();
+ } catch (ScratchboxException e) {
+ fail("Found some scratchbox targets but not scratchbox 2... the build machine is probably misconfigured or broken.");
+ return false;
+ }
+
+ // make sure we can see the shared folder in all targets
+ for (ISDKTarget target : sdkTargets) {
+ // now test the file
+ remoteStore = target.getTargetFileSystemAccess().getFileStore(new Path(path));
+ if (!remoteStore.fetchInfo().exists()) {
+ fail("Could not access {0} inside scratchbox target {1}.\n\nThis file should be visible since it is shared and accessible from the user's home.\n\nEither there is a missing 'bind' mount making this folder visible to scratchbox,\nor something else is broken.",
+ remoteStore, target);
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * @param applicationContext
+ */
+ private void setupContext(Object applicationContext) {
+ if (applicationContext instanceof IAdaptable) {
+ shell = (Shell) ((IAdaptable) applicationContext).getAdapter(Shell.class);
+ }
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/XDropdownMenuAction.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/XDropdownMenuAction.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/actions/XDropdownMenuAction.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html *
+ *
+ * Contributors:
+ * Tampere University of Technology - TUT/CS
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+/*
+ * Created on Jun 22, 2005
+ */
+package org.maemo.esbox.maemosdk.ui.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowPulldownDelegate;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ESboxScriptLauncher;
+
+import java.text.MessageFormat;
+
+/**
+ * @author reijula
+ * modified by Raul Fernandes Herbster
+ * @author eswartz
+ *
+ * This is a X-menu where user can handle X window operations
+ * such as opening and closing X server & window
+ */
+public class XDropdownMenuAction implements IWorkbenchWindowPulldownDelegate {
+
+ //menu shown in eclipse toolbar
+ private Menu pulldownmenu;
+
+ private ESboxScriptLauncher launcher;
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowPulldownDelegate#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ public Menu getMenu(Control parent) {
+ parent.setMenu(pulldownmenu);
+ return parent.getMenu();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ public void dispose() {
+ //does nothing
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init(IWorkbenchWindow window) {
+
+ //shell for creating menu
+ Shell parent = window.getShell();
+
+ launcher = ESboxScriptLauncher.getInstance();
+ //toolbar pulldownmenu ->
+ pulldownmenu = new Menu(parent);
+
+ MenuItem mi = new MenuItem(pulldownmenu, SWT.PUSH);
+ mi.setText("Start");
+ mi.setImage(UIActivator.getImageDescriptor("./icons/full/etool16/start_co.gif").createImage());
+ mi.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ startClicked();
+ }
+ });
+
+
+ mi = new MenuItem(pulldownmenu, SWT.PUSH);
+ mi.setText("Stop");
+ mi.setImage(UIActivator.getImageDescriptor("./icons/full/etool16/stop_co.gif").createImage());
+ mi.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ stopClicked();
+ }
+ });
+
+
+ }
+
+ /*
+ private ISDKTarget getSDKTarget() {
+ if (sdkTarget != null)
+ return sdkTarget;
+
+ final ISDKTarget[] selected = { null };
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ selected[0] = new SelectSDKTargetDialog(pulldownmenu.getShell(),
+ "Select an SDK under which to run X:").selectTarget();
+ }
+
+ });
+ return selected[0];
+ }
+ */
+
+ /**
+ * Start X
+ */
+ protected void startClicked() {
+ try {
+ launcher.startX();
+ } catch (ESboxException e){
+ errorDialog("Scratchbox error", e);
+ }
+
+ }
+
+ private void errorDialog(String string, ESboxException e) {
+ Shell shell = pulldownmenu.getShell();
+ MessageDialog.openError(shell, "X Error",
+ MessageFormat.format("{0}:\n\n{1}",
+ string,
+ e.getMessage()));
+ }
+
+ /**
+ * Stop X
+ */
+ protected void stopClicked() {
+ try {
+ launcher.stopX(null);
+ } catch (ESboxException e) {
+ errorDialog("Error stopping X", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ startClicked();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ /*
+ // The command works best when there is a current project / editor / etc.
+ // Else we launch the default X server (no difference right now)
+
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ IProject project = null;
+ Object object = ((IStructuredSelection) selection).getFirstElement();
+ if (object instanceof IResource) {
+ project = ((IResource) object).getProject();
+ } else if (object instanceof IAdaptable) {
+ project = (IProject)((IAdaptable) object).getAdapter(IProject.class);
+ }
+ if (project != null && project.isOpen()) {
+ try {
+ ISDKTarget theSdkTarget = ESboxProjectProperties.getInstance().getSDKTarget(project);
+ sdkTarget = theSdkTarget;
+ } catch (ESboxException e) {
+ }
+ }
+ }
+ */
+ action.setEnabled(true);
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox1PreferencesPage.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox1PreferencesPage.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox1PreferencesPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Paulo Romulo (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.preferences;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.preference.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+import org.maemo.esbox.core.machine.ILocalMachine;
+
+import org.maemo.esbox.core.sdk.SDKFactory;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxException;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+import org.maemo.esbox.maemosdk.core.sdk.ScratchboxSDKFacade;
+
+/**
+ * General preference page for scratchbox 1
+ *
+ * @author romulo
+ */
+public class Scratchbox1PreferencesPage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ /**
+ * Field for sandbox root
+ */
+ private DirectoryFieldEditor feSandboxRoot = null;
+ private StringFieldEditor feSandboxRootStr = null;
+
+ /**
+ * Field for run scratchbox commands
+ */
+ private StringFieldEditor feSboxCommands = null;
+ protected boolean sdksChanged;
+ private String origSandboxRoot;
+
+ //private StringFieldEditor feGdbQemuCommand;
+
+ /**
+ * The constructor
+ */
+ public Scratchbox1PreferencesPage() {
+ super(GRID);
+ setPreferenceStore(CorePlugin.getDefault().getPreferenceStore());
+ setDescription("Options configuring scratchbox 1");
+ origSandboxRoot = getPreferenceStore().getString(ESboxPreferenceConstants.SB1_SBOX_SANDBOX.toString());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ public void createFieldEditors() {
+ IScratchboxSDK sdk = null;
+ try {
+ sdk = ScratchboxSDKFacade.getInstance().getScratchbox1SDK();
+ } catch (ScratchboxException e) {
+ }
+ if (false && sdk != null && sdk.getMachine() instanceof ILocalMachine) {
+ feSandboxRoot = new DirectoryFieldEditor(
+ ESboxPreferenceConstants.SB1_SBOX_SANDBOX.toString(),
+ "Sandbox root directory:",
+ getFieldEditorParent());
+ addField(feSandboxRoot);
+ feSandboxRoot.getTextControl(getFieldEditorParent()).addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ sdksChanged = true;
+ }
+
+ });
+ }
+ else {
+ feSandboxRootStr = new StringFieldEditor(
+ ESboxPreferenceConstants.SB1_SBOX_SANDBOX.toString(),
+ "Sandbox root directory:",
+ getFieldEditorParent());
+ addField(feSandboxRootStr);
+ feSandboxRootStr.getTextControl(getFieldEditorParent()).addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ sdksChanged = true;
+ }
+
+ });
+ }
+
+ feSboxCommands = new StringFieldEditor(
+ ESboxPreferenceConstants.SB1_LOGIN_COMMAND.toString(),
+ "Command template:",
+ getFieldEditorParent());
+
+ feSboxCommands.getTextControl(getFieldEditorParent()).setToolTipText(
+ "This setting should only be changed if you have very specific needs, like an alternate run script.");
+
+ /*
+ feGdbQemuCommand = new StringFieldEditor(
+ ESboxPreferenceConstants.SB1_GDB_REMOTE_QEMU.toString(),
+ "GDB QEMU command template:",
+ getFieldEditorParent());
+
+ feGdbQemuCommand.getTextControl(getFieldEditorParent()).setToolTipText(
+ "This setting should only be changed if your version of qemu differs from the expected (0.8.2).");
+ */
+
+ // make this string manageable
+ int width;
+ GC gc = new GC(getFieldEditorParent().getShell());
+ width = gc.getAdvanceWidth('m') * 32;
+ gc.dispose();
+
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.widthHint = width;
+ feSboxCommands.getTextControl(getFieldEditorParent()).setLayoutData(gridData);
+
+ /*
+ gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.widthHint = width;
+ feGdbQemuCommand.getTextControl(getFieldEditorParent()).setLayoutData(gridData);
+ */
+
+ addField(feSboxCommands);
+
+ //addField(feGdbQemuCommand);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ // Nothing to do
+ }
+
+ @Override
+ public boolean performOk() {
+ boolean ret = super.performOk();
+ if (ret) {
+ if (sdksChanged) {
+ String curSandboxRoot = getPreferenceStore().getString(ESboxPreferenceConstants.SB1_SBOX_SANDBOX.toString());
+ if (!curSandboxRoot.equals(origSandboxRoot)) {
+ SDKFactory.getInstance().refresh(new NullProgressMonitor());
+ origSandboxRoot = curSandboxRoot;
+ }
+ }
+ }
+ return ret;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox2PreferencesPage.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox2PreferencesPage.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/preferences/Scratchbox2PreferencesPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.preferences;
+
+import org.eclipse.jface.preference.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.maemo.esbox.core.CorePlugin;
+import org.maemo.esbox.core.ESboxPreferenceConstants;
+
+
+/**
+ * General preference page for scratchbox 2
+ *
+ * @author eswartz
+ */
+public class Scratchbox2PreferencesPage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ /**
+ * Field for build mapping mode
+ */
+ private StringFieldEditor feSbox2BuildMappingMode = null;
+ /**
+ * Field for install mapping mode
+ */
+ private StringFieldEditor feSbox2InstallMappingMode = null;
+
+ /**
+ * Field for log level
+ */
+ private RadioGroupFieldEditor feSbox2LogLevel = null;
+
+ private StringFieldEditor feSbox2CommandLine;
+
+ /**
+ * The constructor
+ */
+ public Scratchbox2PreferencesPage() {
+ super(GRID);
+ setPreferenceStore(CorePlugin.getDefault().getPreferenceStore());
+ setDescription("Options configuring scratchbox 2");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ public void createFieldEditors() {
+
+ feSbox2BuildMappingMode = new StringFieldEditor(
+ ESboxPreferenceConstants.SB2_MAPPING_MODE.toString(),
+ "Build mapping mode:",
+ getFieldEditorParent());
+
+ feSbox2InstallMappingMode = new StringFieldEditor(
+ ESboxPreferenceConstants.SB2_INSTALL_MAPPING_MODE.toString(),
+ "Install mapping mode:",
+ getFieldEditorParent());
+
+ feSbox2LogLevel = new RadioGroupFieldEditor(
+ ESboxPreferenceConstants.SB2_LOG_LEVEL.toString(),
+ "Logging level:",
+ 1,
+ new String[][] {
+ { "none",
+ "" }, //$NON-NLS-1$
+ { "error",
+ "error" }, //$NON-NLS-1$
+ { "warning",
+ "warning" }, //$NON-NLS-1$
+ { "notice",
+ "notice" }, //$NON-NLS-1$
+ { "info",
+ "info" }, //$NON-NLS-1$
+ { "debug",
+ "debug" }, //$NON-NLS-1$
+ { "noise",
+ "noise" }, //$NON-NLS-1$
+ },
+ getFieldEditorParent());
+
+ feSbox2CommandLine = new StringFieldEditor(
+ ESboxPreferenceConstants.SB2_EXEC_COMMAND.toString(),
+ "Command template:",
+ getFieldEditorParent());
+
+ // make this string manageable
+ GC gc = new GC(getFieldEditorParent().getShell());
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.widthHint = gc.getAdvanceWidth('m') * 32;
+ gc.dispose();
+ feSbox2CommandLine.getTextControl(getFieldEditorParent()).setLayoutData(gridData);
+
+ addField(feSbox2BuildMappingMode);
+ addField(feSbox2InstallMappingMode);
+ addField(feSbox2LogLevel);
+ addField(feSbox2CommandLine);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ // Nothing to do
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/BadInstallationPage.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/BadInstallationPage.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/BadInstallationPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.ui.targets.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author eswartz
+ *
+ */
+public class BadInstallationPage extends WizardPage {
+
+ protected BadInstallationPage() {
+ super("Inapplicable Wizard");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ CLabel label = new CLabel(parent, SWT.WRAP);
+ label.setText("No scratchbox 1 or scratchbox 2 SDK installed");
+ label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ setControl(label);
+ }
+
+ @Override
+ public boolean canFlipToNextPage() {
+ return false;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/IValidatePage.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/IValidatePage.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/IValidatePage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.targets.wizards;
+/**
+ * A ValidateWizardPage must validade the information on it, so that the
+ * wizard can continue. For example, if the name of a target must be specified
+ * and the user don't do it, the wizard can't continue.
+ *
+ */
+public interface IValidatePage {
+
+ /**
+ * Performes the action related to some validation action.
+ * @return true, if the content of the page is correct; false, otherwise.
+ */
+ public boolean validatePage();
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/NewScratchbox1TargetWizard.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/NewScratchbox1TargetWizard.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/NewScratchbox1TargetWizard.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,285 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.ui.targets.wizards;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.*;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox1SDK;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox2SDK;
+import org.maemo.esbox.maemosdk.ui.targets.wizards.sbrsh.SbrshConfigurationNFSServer;
+import org.maemo.esbox.maemosdk.ui.targets.wizards.sbrsh.SbrshConfigurationTargetDevice;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+
+/**
+ * The target wizard provides a easy way to create a target
+ * for Scratchbox. As Scratchbox target configuration, the user
+ * can configure your target.
+ *
+ */
+public class NewScratchbox1TargetWizard extends Wizard implements INewWizard {
+
+ protected WizardPage targetNamePage;
+ protected WizardPage compilerNamePage;
+ protected WizardPage devkitsName;
+ protected WizardPage cpuMethodName;
+ protected WizardPage sbrshConfigTargetDevice;
+ protected WizardPage sbrshConfigNFSServer;
+ protected IProject generatedProject;
+
+ private IScratchbox1SDK sdk;
+
+ protected ISDKTarget createdTarget;
+
+ private void initialize() {
+ setNeedsProgressMonitor(true);
+ setWindowTitle("New Scratchbox 1 Target");
+ ImageDescriptor image = UIActivator.getImageDescriptor("./icons/full/wizban/newtarget_wiz.gif");
+ setDefaultPageImageDescriptor(image);
+ initPages();
+ }
+
+ /**
+ * Constructs a new target wizard for the given SDK (from the target configuration page)
+ * @param sdk
+ */
+ public NewScratchbox1TargetWizard(IScratchbox1SDK sdk) {
+ super();
+ this.sdk = sdk;
+ initialize();
+ }
+
+ /**
+ * Inicializes the content of the pages.
+ */
+ private void initPages() {
+ if (sdk != null) {
+ targetNamePage = TargetWizardPageFactory.getInstance().createNamePage(sdk);
+ addPage(targetNamePage);
+ compilerNamePage = TargetWizardPageFactory.getInstance().createCompilerPage(sdk);
+ addPage(compilerNamePage);
+ devkitsName = TargetWizardPageFactory.getInstance().createDevkitsPage((IScratchbox1SDK) sdk);
+ addPage(devkitsName);
+ cpuMethodName = TargetWizardPageFactory.getInstance().createCPUMethod(sdk);
+ addPage(cpuMethodName);
+ sbrshConfigTargetDevice = TargetWizardPageFactory.getInstance().createSbrshConfigDeviceTargetPage();
+ addPage(sbrshConfigTargetDevice);
+ sbrshConfigNFSServer = TargetWizardPageFactory.getInstance().createSbrshConfigNFSSServer();
+ addPage(sbrshConfigNFSServer);
+ } else {
+ addPage(TargetWizardPageFactory.getInstance().createBadInstallationPage());
+ }
+ }
+
+ public boolean canFinish() {
+ if (sdk == null)
+ return false;
+
+ boolean nonCustomRootstrap = true;
+ boolean cpuPage = ((TargetWizardCPUMethod) cpuMethodName).canFinish();
+ boolean configDevice = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice).canFinish();
+ boolean NFSServer = ((SbrshConfigurationNFSServer) sbrshConfigNFSServer).canFinish();
+ boolean sbrshConfigAccepted = ((TargetWizardCPUMethod) cpuMethodName).getSbrshConfigure();
+
+ if (!sbrshConfigAccepted && (nonCustomRootstrap || cpuPage) )
+ return true;
+ if (sbrshConfigAccepted && NFSServer && configDevice)
+ return true;
+
+ return false;
+ }
+
+ @Override
+ public IWizardPage getNextPage(IWizardPage page) {
+ if(page == cpuMethodName) {
+ boolean sbrshConfigAccepted = ((TargetWizardCPUMethod) cpuMethodName).getSbrshConfigure();
+ if(!sbrshConfigAccepted) // user does not want to configure sbrsh
+ return null;
+ else // user wants to configure sbrsh
+ return super.getNextPage(page);
+ }
+ return super.getNextPage(page);
+ }
+
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizard#performFinish()
+ */
+ public boolean performFinish() {
+ if (!setupTargetFromScratch())
+ return false;
+
+ boolean sbrshConfigSelected = ((TargetWizardCPUMethod) cpuMethodName).getSbrshConfigure();
+ if (sbrshConfigSelected) {
+ configureSbrshService();
+ showsDialog();
+ }
+
+ return true;
+ }
+
+ private boolean setupTargetFromScratch() {
+ String targetName;
+ // in this mode, construct a target from the user's settings
+ targetName = getTargetNameSelected();
+ String compilerName = getCompilerNameSelected();
+ String cpuMethod = getCputranspSelected();
+ try {
+ if (sdk instanceof IScratchbox1SDK) {
+ String devkits = getDevkitsSelected();
+ ScratchboxFacade.getInstance().createTarget((IScratchbox1SDK) sdk, targetName, compilerName, devkits, cpuMethod);
+ }
+ else {
+ ScratchboxFacade.getInstance().createTarget((IScratchbox2SDK) sdk, targetName, compilerName, cpuMethod);
+ }
+ createdTarget = sdk.findSDKTarget(targetName);
+ return true;
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+ errorLogger.logAndShowError("Cannot get create target " + targetName, e);
+ return false;
+ }
+ }
+
+ /**
+ * Return the name of the target to be created.
+ * @return the name of the target to be created.
+ */
+ private String getTargetNameSelected() {
+ return ((TargetWizardNamePage) targetNamePage).text.getText();
+ }
+
+ /**
+ * Return the compiler name of the target to be created.
+ * @return the compiler name of the target to be created.
+ */
+ private String getCompilerNameSelected() {
+ TableItem item = ((TargetWizardCompilerPage) compilerNamePage).table.getSelection()[0];
+ return item.getText();
+ }
+
+ /**
+ * Return the devkits selected.
+ * @return the devkits selected.
+ */
+ private String getDevkitsSelected() {
+ String devkits = "";
+ TableItem devkitsSelected[] = ((TargetWizardDevkitsPage) devkitsName).table
+ .getSelection();
+ String separator = "";
+ for (int i = 0; i < devkitsSelected.length; i++) {
+ TableItem devkit = devkitsSelected[i];
+ devkits += separator + devkit.getText();
+ separator = ":";
+ }
+ return devkits;
+ }
+
+ /**
+ * Return the cputransp name of the target to be created.
+ * @return the cputransp name of the target to be created.
+ */
+ private String getCputranspSelected() {
+ TableItem item = ((TargetWizardCPUMethod) cpuMethodName).table.getSelection()[0];
+ return item.getText();
+ }
+
+ /**
+ * Configure sbrsh service.
+ */
+ private void configureSbrshService() {
+ String targetName = getTargetNameSelected();
+ String deviceTargetAddr = ((SbrshConfigurationTargetDevice)sbrshConfigTargetDevice).getTargetDeviceAddr();
+ String nfsHostname = ((SbrshConfigurationNFSServer)sbrshConfigNFSServer).getNFSHostname();
+
+ try {
+ ScratchboxFacade.getInstance().configureSbrsh(sdk, targetName, deviceTargetAddr, nfsHostname);
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+ errorLogger.logAndShowError("Cannot configure sbrsh", e);
+ }
+ }
+
+
+ /**
+ * Add user at access list of the sbrshd running at the target device.
+ */
+ private void addUser() {
+ String deviceTargetIP = ((SbrshConfigurationTargetDevice)sbrshConfigTargetDevice).getTargetDeviceIP();
+ String username = System.getProperty("user.name");
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+
+ try {
+ String localAddr = getLocalIP();
+ ScratchboxFacade.getInstance().addSbrshAccessList(sdk, deviceTargetIP, username, localAddr);
+ } catch (ESboxException e) {
+ errorLogger.logAndShowError("Cannot add user to the access list of sbrshd at the target device", e);
+ } catch (UnknownHostException e) {
+ errorLogger.logAndShowError("Cannot get local IP address", e);
+ }
+ }
+
+ /**
+ * Shows the dialog to ask the user if s/he wants to add his/herself to the acess list of the
+ * sbrshd.
+ */
+ private void showsDialog() {
+ String deviceTargetAddr = ((SbrshConfigurationTargetDevice)sbrshConfigTargetDevice).getTargetDeviceIP();
+ String text = "Do you want to add yourself to the access list of the sbrshd running on target device? \n";
+ text += "(This requires that "+ deviceTargetAddr +" has ssh daemon running and sbrshd already installed, and that you have root access).";
+ boolean userAddedAtAccessList = MessageDialog.openQuestion(getShell(),"Scratchbox Configuration",text);
+ if(userAddedAtAccessList) {
+ addUser();
+ }
+ }
+
+ /**
+ * Get the local IP address.
+ * @return the local IP address.
+ * @throws UnknownHostException
+ */
+ private String getLocalIP() throws UnknownHostException {
+ return InetAddress.getLocalHost().getHostAddress();
+ }
+
+ /**
+ * We will accept the selection in the workbench to see if
+ * we can initialize from it.
+ * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+
+ /**
+ * Get the target created. Only valid after wizard dialog completes.
+ * @return newly created ISDKTarget or <code>null</code>
+ */
+ public ISDKTarget getCreatedTarget() {
+ return createdTarget;
+ }
+
+}
\ No newline at end of file
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/NewScratchbox2TargetWizard.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/NewScratchbox2TargetWizard.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/NewScratchbox2TargetWizard.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,356 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.maemosdk.ui.targets.wizards;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.*;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.*;
+import org.maemo.esbox.core.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
+import org.maemo.esbox.maemosdk.core.scratchbox.*;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+import org.maemo.esbox.maemosdk.ui.targets.wizards.sbrsh.SbrshConfigurationNFSServer;
+import org.maemo.esbox.maemosdk.ui.targets.wizards.sbrsh.SbrshConfigurationTargetDevice;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.text.MessageFormat;
+import java.util.List;
+
+
+/**
+ * The target wizard provides a easy way to create a target
+ * for Scratchbox. As Scratchbox target configuration, the user
+ * can configure your target.
+ *
+ */
+public class NewScratchbox2TargetWizard extends Wizard implements INewWizard {
+
+ protected WizardPage targetNamePage;
+ protected WizardPage compilerNamePage;
+ protected WizardPage cpuMethodName;
+ protected WizardPage sbrshConfigTargetDevice;
+ protected WizardPage sbrshConfigNFSServer;
+ protected IProject generatedProject;
+
+ private IScratchbox2SDK sdk;
+
+ private WizardPage maemoRootstrapPage;
+
+ protected ISDKTarget createdTarget;
+
+ private void initialize() {
+ setNeedsProgressMonitor(true);
+ setWindowTitle("New Scratchbox 2 Target");
+ ImageDescriptor image = UIActivator.getImageDescriptor("./icons/full/wizban/newtarget_wiz.gif");
+ setDefaultPageImageDescriptor(image);
+ initPages();
+ }
+
+ /**
+ * Constructs a new target wizard for the given SDK (from the target configuration page)
+ * @param sdk
+ */
+ public NewScratchbox2TargetWizard(IScratchbox2SDK sdk) {
+ super();
+ this.sdk = sdk;
+ initialize();
+ }
+
+ /**
+ * Inicializes the content of the pages.
+ */
+ private void initPages() {
+ if (sdk != null) {
+ maemoRootstrapPage = TargetWizardPageFactory.getInstance().createMaemoRootstrapPage(sdk);
+ addPage(maemoRootstrapPage);
+ targetNamePage = TargetWizardPageFactory.getInstance().createNamePage(sdk);
+ addPage(targetNamePage);
+ compilerNamePage = TargetWizardPageFactory.getInstance().createCompilerPage(sdk);
+ addPage(compilerNamePage);
+ cpuMethodName = TargetWizardPageFactory.getInstance().createCPUMethod(sdk);
+ addPage(cpuMethodName);
+ sbrshConfigTargetDevice = TargetWizardPageFactory.getInstance().createSbrshConfigDeviceTargetPage();
+ addPage(sbrshConfigTargetDevice);
+ sbrshConfigNFSServer = TargetWizardPageFactory.getInstance().createSbrshConfigNFSSServer();
+ addPage(sbrshConfigNFSServer);
+ } else {
+ addPage(TargetWizardPageFactory.getInstance().createBadInstallationPage());
+ }
+ }
+
+ public boolean canFinish() {
+ if (sdk == null)
+ return false;
+
+ boolean nonCustomRootstrap = true;
+ if (maemoRootstrapPage != null)
+ nonCustomRootstrap = ((TargetWizardRootstrapSb2Page) maemoRootstrapPage).canFinish();
+ boolean cpuPage = ((TargetWizardCPUMethod) cpuMethodName).canFinish();
+ boolean configDevice = ((SbrshConfigurationTargetDevice) sbrshConfigTargetDevice).canFinish();
+ boolean NFSServer = ((SbrshConfigurationNFSServer) sbrshConfigNFSServer).canFinish();
+ boolean sbrshConfigAccepted = ((TargetWizardCPUMethod) cpuMethodName).getSbrshConfigure();
+
+ if (!sbrshConfigAccepted && (nonCustomRootstrap || cpuPage) )
+ return true;
+ if (sbrshConfigAccepted && NFSServer && configDevice)
+ return true;
+
+ return false;
+ }
+
+ @Override
+ public IWizardPage getNextPage(IWizardPage page) {
+ if (page == maemoRootstrapPage) {
+ boolean nonCustomRootstrap = ((TargetWizardRootstrapSb2Page) maemoRootstrapPage).canFinish();
+ if (nonCustomRootstrap)
+ return null;
+ else
+ return super.getNextPage(page);
+ }
+ if(page == cpuMethodName) {
+ boolean sbrshConfigAccepted = ((TargetWizardCPUMethod) cpuMethodName).getSbrshConfigure();
+ if(!sbrshConfigAccepted) // user does not want to configure sbrsh
+ return null;
+ else // user wants to configure sbrsh
+ return super.getNextPage(page);
+ }
+ return super.getNextPage(page);
+ }
+
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizard#performFinish()
+ */
+ public boolean performFinish() {
+ if (getRootstrap() != null) {
+ if (!setupTargetFromRootstrap())
+ return false;
+ } else {
+ if (!setupTargetFromScratch())
+ return false;
+ }
+
+ boolean sbrshConfigSelected = ((TargetWizardCPUMethod) cpuMethodName).getSbrshConfigure();
+ if (sbrshConfigSelected) {
+ configureSbrshService();
+ showsDialog();
+ }
+
+ return true;
+ }
+
+ private boolean setupTargetFromScratch() {
+ String targetName;
+ // in this mode, construct a target from the user's settings
+ targetName = getTargetNameSelected();
+ String compilerName = getCompilerNameSelected();
+ String cpuMethod = getCputranspSelected();
+ try {
+ ScratchboxFacade.getInstance().createTarget(sdk, targetName, compilerName, cpuMethod);
+ createdTarget = sdk.findSDKTarget(targetName);
+ return true;
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+ errorLogger.logAndShowError("Cannot get create target " + targetName, e);
+ return false;
+ }
+ }
+
+ private boolean setupTargetFromRootstrap() {
+ String targetName;
+ // in this mode, make a predefined target from a maemo rootstrap
+ targetName = getRootstrap().getName();
+ boolean create = true;
+
+ if (true) {
+ // see if the rootstrap (not necessarily the target) already exists,
+ // and ask user, in case this will overwrite their customizations
+ try {
+ List<String> installedRootstraps =
+ ScratchboxFacade.getInstance().getInstalledMaemoRootstraps(sdk);
+ if (installedRootstraps.contains(targetName)) {
+ create = MessageDialog.openConfirm(getShell(), "Reinstall rootstrap?",
+ MessageFormat.format("The rootstrap ''{0}'' appears to be already installed, though it may be disconnected from scratchbox.\n\n"+
+ "At this time, we can't recreate a target for this rootstrap, but " +
+ "you could do it manually with 'sb2-init'.\n\n" +
+ "Do you want to overwrite the rootstrap?",
+ targetName));
+ }
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+ errorLogger.logError("Cannot detect installed rootstraps", e);
+ }
+ }
+
+ if (create) {
+ try {
+ createRootstrap(targetName, useHostTools());
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+ errorLogger.logAndShowError("Cannot get create rootstrap target " + targetName, e);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private void createRootstrap(final String targetName, final boolean useHostTools) throws ScratchboxException {
+ try {
+ getContainer().run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask("Creating rootstrap", IProgressMonitor.UNKNOWN);
+ try {
+ ScratchboxFacade.getInstance().createRootstrapTarget(
+ (IScratchbox2SDK) sdk, targetName, useHostTools, true,
+ new SubProgressMonitor(monitor, 1));
+ createdTarget = sdk.findSDKTarget(targetName);
+ } catch (ESboxException e) {
+ throw new InvocationTargetException(e);
+ }
+ monitor.done();
+ }
+
+ });
+ } catch (InvocationTargetException e) {
+ if (e.getCause() instanceof ScratchboxException)
+ throw (ScratchboxException) e.getCause();
+ else
+ throw new ScratchboxException(e);
+ } catch (InterruptedException e) {
+ throw new ScratchboxException(e);
+ }
+ }
+
+ private MaemoRootstrap getRootstrap() {
+ return ((TargetWizardRootstrapSb2Page) maemoRootstrapPage).getRootstrap();
+ }
+ private boolean useHostTools() {
+ return ((TargetWizardRootstrapSb2Page) maemoRootstrapPage).useHostTools();
+ }
+
+ /**
+ * Return the name of the target to be created.
+ * @return the name of the target to be created.
+ */
+ private String getTargetNameSelected() {
+ return ((TargetWizardNamePage) targetNamePage).text.getText();
+ }
+
+ /**
+ * Return the compiler name of the target to be created.
+ * @return the compiler name of the target to be created.
+ */
+ private String getCompilerNameSelected() {
+ TableItem item = ((TargetWizardCompilerPage) compilerNamePage).table.getSelection()[0];
+ return item.getText();
+ }
+
+ /**
+ * Return the cputransp name of the target to be created.
+ * @return the cputransp name of the target to be created.
+ */
+ private String getCputranspSelected() {
+ TableItem item = ((TargetWizardCPUMethod) cpuMethodName).table.getSelection()[0];
+ return item.getText();
+ }
+
+ /**
+ * Configure sbrsh service.
+ */
+ private void configureSbrshService() {
+ String targetName = getTargetNameSelected();
+ String deviceTargetAddr = ((SbrshConfigurationTargetDevice)sbrshConfigTargetDevice).getTargetDeviceAddr();
+ String nfsHostname = ((SbrshConfigurationNFSServer)sbrshConfigNFSServer).getNFSHostname();
+
+ try {
+ ScratchboxFacade.getInstance().configureSbrsh(sdk, targetName, deviceTargetAddr, nfsHostname);
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+ errorLogger.logAndShowError("Cannot configure sbrsh", e);
+ }
+ }
+
+
+ /**
+ * Add user at access list of the sbrshd running at the target device.
+ */
+ private void addUser() {
+ String deviceTargetIP = ((SbrshConfigurationTargetDevice)sbrshConfigTargetDevice).getTargetDeviceIP();
+ String username = System.getProperty("user.name");
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+
+ try {
+ String localAddr = getLocalIP();
+ ScratchboxFacade.getInstance().addSbrshAccessList(sdk, deviceTargetIP, username, localAddr);
+ } catch (ESboxException e) {
+ errorLogger.logAndShowError("Cannot add user to the access list of sbrshd at the target device", e);
+ } catch (UnknownHostException e) {
+ errorLogger.logAndShowError("Cannot get local IP address", e);
+ }
+ }
+
+ /**
+ * Shows the dialog to ask the user if s/he wants to add his/herself to the acess list of the
+ * sbrshd.
+ */
+ private void showsDialog() {
+ String deviceTargetAddr = ((SbrshConfigurationTargetDevice)sbrshConfigTargetDevice).getTargetDeviceIP();
+ String text = "Do you want to add yourself to the access list of the sbrshd running on target device? \n";
+ text += "(This requires that "+ deviceTargetAddr +" has ssh daemon running and sbrshd already installed, and that you have root access).";
+ boolean userAddedAtAccessList = MessageDialog.openQuestion(getShell(),"Scratchbox Configuration",text);
+ if(userAddedAtAccessList) {
+ addUser();
+ }
+ }
+
+ /**
+ * Get the local IP address.
+ * @return the local IP address.
+ * @throws UnknownHostException
+ */
+ private String getLocalIP() throws UnknownHostException {
+ return InetAddress.getLocalHost().getHostAddress();
+ }
+
+ /**
+ * We will accept the selection in the workbench to see if
+ * we can initialize from it.
+ * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+
+ /**
+ * Get the target created. Only valid after wizard dialog completes.
+ * @return newly created ISDKTarget or <code>null</code>
+ */
+ public ISDKTarget getCreatedTarget() {
+ return createdTarget;
+ }
+
+}
\ No newline at end of file
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetListener.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetListener.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetListener.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.targets.wizards;
+
+import java.util.EventListener;
+
+/**
+ * Listener interested in some modification on targets.
+ */
+public interface TargetListener extends EventListener {
+
+ /**
+ * Notifies whenever a new target is added by the user.
+ */
+ public void targetAdded();
+
+ /**
+ * Notifies whenever a target is removed.
+ */
+ public void targetRemoved();
+
+ /**
+ * Notifies whenever a target is choosen.
+ * @param name the name of the target choosen.
+ */
+ public void targetChoosen(String name);
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardCPUMethod.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardCPUMethod.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardCPUMethod.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.targets.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+
+import java.util.List;
+
+/**
+ * This pages shows the CPU-transparency method that the user can choose for his/her
+ * target. The CPU-transparency method provides a way so that the user can execute the
+ * executable.
+ *
+ */
+public class TargetWizardCPUMethod extends WizardPage implements IValidatePage {
+
+ protected Table table;
+ private boolean sbrshConfigure;
+ private IScratchboxSDK sdk;
+
+ private static final String SBRSH = "sbrsh";
+
+ /**
+ * Creates a NewTargetWizardCPUMethod
+ */
+ protected TargetWizardCPUMethod(IScratchboxSDK sdk) {
+ super("CPU-Transparency Method");
+ setTitle("CPU-Transparency Method");
+ setDescription("Select CPU-transparency method");
+ setPageComplete(false);
+ this.sdk = sdk;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+ Label label = new Label(composite,SWT.LEFT);
+ label.setText("CPU-Transparency Methods"); //$NON-NLS-1$
+
+ table = new Table(composite, SWT.MULTI| SWT.BORDER | SWT.V_SCROLL);
+ table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ table.setLinesVisible(true);
+ //table.setSize(50, 50);
+ table.setHeaderVisible(false);
+ table.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ for(TableItem item: table.getSelection())
+ setSbrshConfigure(item.getText().endsWith(TargetWizardCPUMethod.SBRSH));
+ validatePage();
+ }
+ });
+
+ inicializeTable();
+ table.redraw();
+ setControl(composite);
+ }
+
+
+ private void setSbrshConfigure(boolean value) {
+ sbrshConfigure = value;
+ }
+
+ public boolean getSbrshConfigure() {
+ return sbrshConfigure;
+ }
+
+ public boolean canFinish() {
+ return isPageComplete();
+ }
+
+ /**
+ * Inicializes the contents of the table.
+ */
+ private void inicializeTable() {
+ List<String> targetMethod = null;
+ try {
+ targetMethod = ScratchboxFacade.getInstance().getCputransp(sdk);
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+ errorLogger.logAndShowError("Cannot get list of CPU-Transparency Method", e);
+ return;
+ }
+
+ TableItem item = null;
+ for (String cputransp : targetMethod) {
+ item = new TableItem(table,SWT.NONE);
+ item.setText(cputransp);
+ }
+ }
+
+
+
+ /*
+ * (non-Javadoc)
+ * @see br.edu.ufcg.dee.omapsdk.properties.target.wizard.pages.ValidateWizardPage#perfomeAction()
+ */
+ public boolean validatePage() {
+ setPageComplete(true);
+ return true;
+ }
+}
\ No newline at end of file
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardCompilerPage.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardCompilerPage.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardCompilerPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.targets.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+
+import java.util.List;
+
+/**
+ * This pages shows the compilers that the user can choose for his/her
+ * target. The compilers are disposed as a list with checkbox, so the user
+ * can select only one.
+ *
+ */
+public class TargetWizardCompilerPage extends WizardPage implements IValidatePage {
+
+ protected Table table;
+ private IScratchboxSDK sdk;
+
+ /**
+ * Constructs a NewTargetWizardCompilerPage
+ */
+ protected TargetWizardCompilerPage(IScratchboxSDK sdk) {
+ super("Compiler");
+ this.sdk = sdk;
+ setTitle("Compiler");
+ setDescription("Select compiler");
+ setPageComplete(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ Label label = new Label(composite,SWT.LEFT);
+ label.setText("Compilers");
+
+ table = new Table(composite,SWT.SINGLE | SWT.BORDER);
+ table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ table.setLinesVisible(true);
+ table.setHeaderVisible(false);
+ table.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ validatePage();
+ }
+ });
+
+ inicializeTable();
+
+ setControl(composite);
+ }
+
+ /**
+ * Inicializes the contents of the table.
+ */
+ private void inicializeTable() {
+ List<String> compilers = null;
+ try {
+ compilers = ScratchboxFacade.getInstance().getCompilers(sdk);
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+ errorLogger.logAndShowError("Cannot get list of compilers", e);
+ return;
+ }
+
+ TableItem item = null;
+ for (String compilerName : compilers) {
+ item = new TableItem(table, SWT.NONE);
+ item.setText(compilerName);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see br.edu.ufcg.dee.omapsdk.properties.target.wizard.pages.ValidateWizardPage#perfomeAction()
+ */
+ public boolean validatePage() {
+ setPageComplete(true);
+ return true;
+ }
+
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardDevkitsPage.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardDevkitsPage.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardDevkitsPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.targets.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.ErrorLogger;
+import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
+import org.maemo.esbox.maemosdk.core.scratchbox.ScratchboxFacade;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox1SDK;
+
+import java.util.List;
+
+/**
+ * This pages shows the devkits that the user can choose for his/her
+ * target.
+ *
+ */
+public class TargetWizardDevkitsPage extends WizardPage implements IValidatePage {
+
+ protected Table table;
+ private IScratchbox1SDK sdk;
+
+ /**
+ * Constructs a NewTargetWizardDevkitsPage.
+ */
+ protected TargetWizardDevkitsPage(IScratchbox1SDK sdk) {
+ super("Devkit");
+ this.sdk = sdk;
+ setTitle("Devkit");
+ setDescription("Select devkits");
+ setPageComplete(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ Label label = new Label(composite,SWT.LEFT);
+ label.setText("Devkits");
+
+ table = new Table(composite,SWT.MULTI | SWT.CHECK | SWT.BORDER);
+ table.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
+ table.setHeaderVisible(false);
+ table.setLinesVisible(true);
+ table.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ validatePage();
+ }
+ });
+
+ inicializeTable();
+
+ setControl(composite);
+ }
+
+ /**
+ * Inicializes the contents of the table.
+ */
+ private void inicializeTable() {
+ TableItem item = null;
+ List<String> devkits = null;
+ try {
+ devkits = ScratchboxFacade.getInstance().getDevkits(sdk);
+ } catch (ESboxException e) {
+ ErrorLogger errorLogger = UIActivator.getErrorLogger();
+ errorLogger.logAndShowError("Cannot get list of devkits", e);
+ return;
+ }
+ for (String devkit : devkits) {
+ item = new TableItem(table, SWT.NONE);
+ item.setText(devkit);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see br.edu.ufcg.dee.omapsdk.properties.target.wizard.pages.ValidateWizardPage#perfomeAction()
+ */
+ public boolean validatePage() {
+ TableItem[] items = table.getItems();
+ boolean noneSelected = false;
+ boolean pageOK = false;
+ //verifies if at least one option was checked.
+ for (int i = 0; i < items.length; i++) {
+ TableItem item = items[i];
+ if(item.getChecked()) {
+ pageOK = true;
+ break;
+ }
+ }
+ //verifies if the options were choosen properly.
+ for (int i = 0; i < items.length; i++) {
+ TableItem item = items[i];
+ //verifies if any item was selected.
+ if(item.getChecked()) {
+ //verifies if "none" was selected.
+ if(item.getText().equals("none")) {
+ noneSelected = true;
+ //the user cant select another devkit if "none" was selected.
+ } else {
+ pageOK = !noneSelected;
+ }
+ }
+ }
+ if(noneSelected && !pageOK) {
+ setErrorMessage("Selected corrects devkits.");
+ } else {
+ String msg = pageOK ? null : "Select at least one option";
+ setErrorMessage(msg);
+ }
+ setPageComplete(pageOK);
+ return pageOK;
+ }
+}
\ No newline at end of file
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardNamePage.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardNamePage.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardNamePage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.targets.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+
+/**
+ * The user insert the name for the target. This name must be unique.
+ */
+public class TargetWizardNamePage extends WizardPage implements IValidatePage, TargetListener {
+
+ protected Text text;
+ private IScratchboxSDK sdk;
+
+ /**
+ * Constructs a NewTargetWizardNamePage.
+ */
+ protected TargetWizardNamePage(IScratchboxSDK sdk) {
+ super("Target Name");
+ this.sdk = sdk;
+ setTitle("Target Name");
+ setDescription("Enter name for the new target");
+ this.targetAdded();
+ setPageComplete(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ Label label = new Label(composite, SWT.LEFT);
+ label.setText("Target Name:");
+
+ text = new Text(composite, SWT.BORDER);
+ text.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+
+ text.addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent event) {
+ validatePage();
+ }
+
+ public void keyReleased(KeyEvent event) {
+ validatePage();
+ }
+ });
+
+ setControl(composite);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see br.edu.ufcg.dee.omapsdk.properties.target.wizard.pages.ValidateWizardPage#perfomeAction()
+ */
+ public boolean validatePage() {
+ String value = text.getText();
+ if(value.length() >= 1) {
+ setPageComplete(true);
+ } else {
+ setPageComplete(false);
+ }
+ boolean isValid = false;
+ isValid = verifyName();
+ setPageComplete(isValid);
+ return isValid;
+ }
+
+ /**
+ * Verify if the name of the target exists previously.
+ *
+ * @return
+ * true, if the name of the target have been defined already; false, otherwise.
+ */
+ private boolean verifyName() {
+ String targetName = text.getText().trim();
+ if(sdk.findSDKTarget(targetName) != null) {
+ setErrorMessage("This target name is already defined.");
+ return false;
+ } else {
+ setErrorMessage(null);
+ return true;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see br.edu.ufcg.dee.omapsdk.properties.target.wizard.TargetWizardListener#targetAdded()
+ */
+ public void targetAdded() {
+ updateTargetList();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see dee.nokia.esbox.plugin.ui.internal.wizard.targets.TargetListener#targetRemoved()
+ */
+ public void targetRemoved() {
+ updateTargetList();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see dee.nokia.esbox.plugin.ui.internal.wizard.targets.TargetListener#targetChoosen(java.lang.String)
+ */
+ public void targetChoosen(String name) {
+ // for this wizard page, this action doesnt matter.
+ }
+
+ /**
+ * Update the list of target on Scratchbox. This process is done
+ * because the wizard needs to know the target to control the creation of
+ * new targets.
+ */
+ private void updateTargetList() {
+ sdk.refresh();
+ }
+}
\ No newline at end of file
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardPageFactory.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardPageFactory.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardPageFactory.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.targets.wizards;
+
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox1SDK;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+import org.maemo.esbox.maemosdk.ui.targets.wizards.sbrsh.SbrshConfigurationNFSServer;
+import org.maemo.esbox.maemosdk.ui.targets.wizards.sbrsh.SbrshConfigurationTargetDevice;
+
+/**
+ * Factory that creates all pages of the new target wizard.
+ *
+ */
+public class TargetWizardPageFactory {
+
+ private static TargetWizardPageFactory singleton = null;
+
+ /**
+ * Construtor
+ */
+ private TargetWizardPageFactory() {
+
+ }
+
+ /**
+ * Returns only one instance of TargetWizardPageFactory object.
+ * @return only one instance of TargetWizardPageFactory object.
+ */
+ public static TargetWizardPageFactory getInstance() {
+ if(singleton == null)
+ singleton = new TargetWizardPageFactory();
+ return singleton;
+ }
+
+ /**
+ * Creates a new name page.
+ * @return a new name page.
+ */
+ public WizardPage createNamePage(IScratchboxSDK sdk) {
+ return new TargetWizardNamePage(sdk);
+ }
+
+ /**
+ * Creates a new compiler page.
+ * @return a new compiler page.
+ */
+ public WizardPage createCompilerPage(IScratchboxSDK sdk) {
+ return new TargetWizardCompilerPage(sdk);
+ }
+
+ /**
+ * Creates a new CPU-method transparency page.
+ * @return a new CPU-method transparency page.
+ */
+ public WizardPage createCPUMethod(IScratchboxSDK sdk) {
+ return new TargetWizardCPUMethod(sdk);
+ }
+
+ /**
+ * Creates a new devkit page.
+ * @return a new devkit page.
+ */
+ public WizardPage createDevkitsPage(IScratchbox1SDK sdk) {
+ return new TargetWizardDevkitsPage(sdk);
+ }
+
+ /**
+ * Create a new page to configure sbrsh device target.
+ * @return a new page to configure sbrsh device target.
+ */
+ public WizardPage createSbrshConfigDeviceTargetPage() {
+ return new SbrshConfigurationTargetDevice();
+ }
+
+ /**
+ * Create a new page to configure sbrsh nfs server.
+ * @return a new page to configure sbrsh nfs server.
+ */
+ public WizardPage createSbrshConfigNFSSServer() {
+ return new SbrshConfigurationNFSServer();
+ }
+
+ public IWizardPage createBadInstallationPage() {
+ return new BadInstallationPage();
+ }
+
+ public WizardPage createMaemoRootstrapPage(IScratchboxSDK sdk) {
+ return new TargetWizardRootstrapSb2Page(sdk);
+ }
+}
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardRootstrapSb2Page.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardRootstrapSb2Page.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/TargetWizardRootstrapSb2Page.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.targets.wizards;
+
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.maemosdk.core.scratchbox.MaemoRootstrap;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox2SDK;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchboxSDK;
+import org.maemo.esbox.maemosdk.ui.MaemoRootstrapContentLabelProvider;
+
+/**
+ * This page allows the user to select a rootstrap (which defines the target name,
+ * compiler, devkits, and cpu method all at once) for use with sb2, or to explicitly
+ * select to configure all the aspects himself.
+ * @author eswartz
+ *
+ */
+public class TargetWizardRootstrapSb2Page extends WizardPage implements IValidatePage {
+
+ protected TreeViewer rootstrapTargetViewer;
+ protected Text text;
+ /*private*/ IScratchboxSDK sdk; // in case we use it later
+ protected Object selection;
+ private MaemoRootstrapContentLabelProvider provider;
+ private Button showExistingTargets;
+ private Button useHostTools;
+
+ /**
+ * Constructs a NewTargetWizardNamePage.
+ */
+ protected TargetWizardRootstrapSb2Page(IScratchboxSDK sdk) {
+ super("Target Name");
+ this.sdk = sdk;
+ if (!(sdk instanceof IScratchbox2SDK)) {
+ throw new IllegalArgumentException("This page only expects a scratchbox 2 SDK");
+ }
+ setTitle("Select maemo SDK+ Rootstrap");
+ setDescription("Select the maemo rootstrap to install, or manually configure a target.");
+ setPageComplete(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ Label label = new Label(composite, SWT.LEFT);
+ label.setText("Select a rootstrap:");
+
+ rootstrapTargetViewer = new TreeViewer(composite, SWT.SINGLE | SWT.BORDER);
+ rootstrapTargetViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ showExistingTargets = new Button(composite, SWT.CHECK);
+ showExistingTargets.setText("Show existing targets");
+ showExistingTargets.setSelection(false);
+ showExistingTargets.setToolTipText("If checked, rootstraps with names matching existing targets will be shown. This is the only way to reinstall a target.");
+
+ useHostTools = new Button(composite, SWT.CHECK);
+ useHostTools.setText("Use host's build tools");
+ useHostTools.setSelection(false);
+ useHostTools.setToolTipText("If checked, configure the rootstrap to use the host versions of autotools, bison, flex, docbook, etc. instead of standard versions (c.f. devkits in scratchbox 1). We recommend leaving this unchecked and invoking maemo-tools to install official build tools.");
+
+ /// setup rootstrap target tree
+
+ provider = new MaemoRootstrapContentLabelProvider(sdk.getMachine());
+ rootstrapTargetViewer.setContentProvider(provider);
+ rootstrapTargetViewer.setLabelProvider(provider);
+
+ rootstrapTargetViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ selection = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ validatePage();
+ }
+
+ });
+
+ provider.addListener(new ILabelProviderListener() {
+
+ public void labelProviderChanged(LabelProviderChangedEvent event) {
+ rootstrapTargetViewer.refresh();
+ }
+
+ });
+
+ rootstrapTargetViewer.getTree().setLinesVisible(true);
+ rootstrapTargetViewer.getTree().setHeaderVisible(true);
+
+ TreeColumn nameColumn = new TreeColumn(rootstrapTargetViewer.getTree(), SWT.LEFT);
+ nameColumn.setText("Target Name");
+ nameColumn.setWidth(200);
+ nameColumn.setResizable(true);
+
+ TreeColumn archColumn = new TreeColumn(rootstrapTargetViewer.getTree(), SWT.LEFT);
+ archColumn.setText("Architecture");
+ archColumn.setWidth(100);
+ archColumn.setResizable(true);
+
+ TreeColumn descColumn = new TreeColumn(rootstrapTargetViewer.getTree(), SWT.LEFT);
+ descColumn.setText("Description");
+ descColumn.setWidth(200);
+ descColumn.setResizable(true);
+
+
+ rootstrapTargetViewer.setInput(new Object());
+
+ rootstrapTargetViewer.setSelection(StructuredSelection.EMPTY);
+
+ showExistingTargets.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateViewerFilters();
+ }
+ });
+
+ updateViewerFilters();
+ setControl(composite);
+ }
+
+ protected void updateViewerFilters() {
+ if (!showExistingTargets.getSelection()) {
+ rootstrapTargetViewer.setFilters(new ViewerFilter[] {
+ new ViewerFilter() {
+
+ @Override
+ public boolean select(Viewer viewer,
+ Object parentElement, Object element) {
+ if (element instanceof MaemoRootstrap) {
+ MaemoRootstrap rootstrap = (MaemoRootstrap) element;
+ if (sdk.findSDKTarget(rootstrap.getName()) != null)
+ return false;
+ }
+ return true;
+ }
+
+ }
+ });
+ } else {
+ rootstrapTargetViewer.setFilters(new ViewerFilter[0]);
+ }
+
+ rootstrapTargetViewer.refresh();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see br.edu.ufcg.dee.omapsdk.properties.target.wizard.pages.ValidateWizardPage#perfomeAction()
+ */
+ public boolean validatePage() {
+ setPageComplete(selection instanceof MaemoRootstrap || selection == MaemoRootstrapContentLabelProvider.NO_ROOTSTRAP);
+ return true;
+ }
+
+ public boolean canFinish() {
+ return selection instanceof MaemoRootstrap;
+ }
+
+ public MaemoRootstrap getRootstrap() {
+ if (!(selection instanceof MaemoRootstrap))
+ return null;
+ return (MaemoRootstrap) selection;
+ }
+
+ public boolean isShowingExisting() {
+ return showExistingTargets.getSelection();
+ }
+
+ public boolean useHostTools() {
+ return useHostTools.getSelection();
+ }
+
+}
\ No newline at end of file
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/sbrsh/SbrshConfigurationNFSServer.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/sbrsh/SbrshConfigurationNFSServer.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/sbrsh/SbrshConfigurationNFSServer.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.targets.wizards.sbrsh;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.maemo.esbox.maemosdk.ui.targets.wizards.IValidatePage;
+
+/**
+ * A page for configuration of the NFS server.
+ */
+public class SbrshConfigurationNFSServer extends WizardPage implements KeyListener, IValidatePage {
+
+ private Text hostname;
+ private Text hostnameAddr;
+
+ /**
+ * Constructs a SbrshConfigurationNFSServer.
+ */
+ public SbrshConfigurationNFSServer() {
+ super("sbrsh.config.nfs.server"); //$NON-NLS-1$
+ setTitle("Sbrsh Configuration");
+ setDescription("NFS Server Configuration");
+ setPageComplete(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ Label description = new Label(composite,SWT.NONE);
+ description.setText("Enter hostname of NFS server");
+
+ hostname = new Text(composite, SWT.BORDER | SWT.LEFT);
+ hostname.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ hostname.addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent event) {
+ validatePage();
+ }
+ public void keyReleased(KeyEvent event) {
+ //validatePage();
+ }
+ });
+
+
+ Composite addressComposite = new Composite(parent,SWT.NONE);
+ addressComposite.setLayout(new GridLayout(1,false));
+
+ hostnameAddr = new Text(addressComposite, SWT.BORDER | SWT.CENTER);
+ hostnameAddr.setTextLimit(40);
+
+ GridData newdata = new GridData(GridData.FILL);
+ newdata.grabExcessHorizontalSpace = true;
+ newdata.widthHint = 100;
+
+ hostnameAddr.setLayoutData(newdata);
+ setControl(composite);
+ }
+
+ public boolean canFinish() {
+ return isPageComplete();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see br.edu.ufcg.dee.omapsdk.properties.target.wizard.pages.ValidateWizardPage#perfomeAction()
+ */
+ public boolean validatePage() {
+ setPageComplete(true);
+ return true;
+ }
+
+
+ /**
+ * Verifies the values of the insert texts.
+ */
+ private void verifyValues() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
+ */
+ public void keyPressed(KeyEvent e) {
+ verifyValues();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
+ */
+ public void keyReleased(KeyEvent e) {
+ verifyValues();
+
+ }
+
+ /**
+ * Return the NFS hostname server.
+ * @return the NFS hostname server.
+ */
+ public String getNFSHostname() {
+ return hostname.getText();
+ }
+}
+
Added: trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/sbrsh/SbrshConfigurationTargetDevice.java
===================================================================
--- trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/sbrsh/SbrshConfigurationTargetDevice.java (rev 0)
+++ trunk/maemosdk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/maemosdk/ui/targets/wizards/sbrsh/SbrshConfigurationTargetDevice.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.maemosdk.ui.targets.wizards.sbrsh;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.maemo.esbox.maemosdk.ui.targets.wizards.IValidatePage;
+
+/**
+ * A page for configuration of the device IP.
+ */
+public class SbrshConfigurationTargetDevice extends WizardPage implements KeyListener, IValidatePage {
+
+ protected Text[] targetAddress;
+ protected Text targetPortNumber;
+
+ protected final int TEXT_LIMIT_IP = 3;
+ protected final int TEXT_LIMIT_PORT = 4;
+ protected final int SIZE_ADDR = 4;
+ protected final int WIDTH_HINT = 40;
+
+ /**
+ * Constructs a SbrshConfigurationDeviceIP.
+ */
+ public SbrshConfigurationTargetDevice() {
+ super("sbrsh.config.target.device");
+ setTitle("Sbrsh Configuration");
+ setDescription("Target Device Name Configuration");
+ setPageComplete(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ Label description = new Label(composite,SWT.NONE);
+ description.setText("Enter hostname and port(optional) of the target device.");
+
+ initInputComponents(composite);
+
+ setControl(composite);
+ }
+
+ /**
+ * Init the GUI components.
+ * @param parent the parent composite.
+ */
+ protected void initInputComponents(Composite parent) {
+ Composite addressComposite = new Composite(parent,SWT.NONE);
+ addressComposite.setLayout(new GridLayout(10,false));
+
+ Label text = new Label(addressComposite, SWT.NONE);
+ text.setText("Target Device Address:");
+
+ GridData newdata;
+
+ targetAddress = new Text[SIZE_ADDR];
+ for (int i = 0; i < targetAddress.length; i++) {
+ targetAddress[i] = new Text(addressComposite, SWT.BORDER | SWT.CENTER);
+ targetAddress[i].setTextLimit(TEXT_LIMIT_IP);
+
+ newdata = new GridData(GridData.FILL);
+ newdata.grabExcessHorizontalSpace = true;
+ newdata.widthHint = WIDTH_HINT;
+
+ targetAddress[i].setLayoutData(newdata);
+ targetAddress[i].addKeyListener(this);
+ if(i < targetAddress.length - 1) {
+ Label point = new Label(addressComposite, SWT.NONE);
+ point.setText(".");
+ }
+ }
+ Label colon = new Label(addressComposite, SWT.NONE);
+ colon.setText(":");
+
+ targetPortNumber = new Text(addressComposite, SWT.BORDER | SWT.CENTER);
+ targetPortNumber.setTextLimit(TEXT_LIMIT_PORT);
+
+ newdata = new GridData(GridData.FILL);
+ newdata.grabExcessHorizontalSpace = true;
+ newdata.widthHint = WIDTH_HINT + 10;
+
+ targetPortNumber.setLayoutData(newdata);
+ targetPortNumber.addKeyListener(this);
+ }
+
+
+ public boolean canFinish() {
+ return isPageComplete();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see br.edu.ufcg.dee.omapsdk.properties.target.wizard.pages.ValidateWizardPage#perfomeAction()
+ */
+ public boolean validatePage() {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
+ */
+ public void keyPressed(KeyEvent e) {
+ verifyValues(e);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
+ */
+ public void keyReleased(KeyEvent e) {
+ verifyValues(e);
+ }
+
+ /**
+ * Verifies the values at the text.
+ * @param e the key event generated by the modification of any text.
+ */
+ private void verifyValues(KeyEvent e) {
+ String messageAddress = verifyAddress();
+ if(messageAddress == null) {
+ setErrorMessage(null);
+ setPageComplete(true);
+ } else {
+ setErrorMessage(messageAddress);
+ setPageComplete(false);
+ }
+ }
+
+ /**
+ * Verifies if the IP address inserted by the user is correct.
+ * @return true, if the IP address is correct; false, otherwise.
+ */
+ protected String verifyAddress() {
+ for (int i = 0; i < targetAddress.length; i++) {
+ try {
+ int value = Integer.parseInt(targetAddress[i].getText().trim());
+ if(value < 0 || value > 255) {
+ return "Insert a correct IP address.";
+ }
+ } catch (NumberFormatException nfe) {
+ return "Insert a correct value";
+ }
+ }
+
+ String portValue = targetPortNumber.getText().trim();
+ // value for port was inserted
+ if(!portValue.equals("")) {
+ try {
+ int value = Integer.parseInt(portValue);
+ if(value < 1 || value > 9999) {
+ return "Insert a correct value for port.";
+ }
+ } catch (NumberFormatException nfe) {
+ return "Insert a correct value";
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Return the target device IP inserted by user.
+ * @return the target device ip.
+ */
+ public String getTargetDeviceIP() {
+ final String SEPARATOR = ".";
+ String address = "";
+ String delimiter = "";
+ for (int i = 0; i < targetAddress.length; i++) {
+ address += delimiter + targetAddress[i].getText();
+ delimiter = SEPARATOR;
+ }
+ return address;
+ }
+
+ /**
+ * Return the target device address. The address has the IP and port number.
+ * @return the target device address.
+ */
+ public String getTargetDeviceAddr() {
+ String address = getTargetDeviceIP();
+ String port = getPort();
+ if(!port.equals("")) {
+ address += ":" + port;
+ }
+ return address;
+ }
+
+ /**
+ * Return the port number of the target device.
+ * @return the port number of target device.
+ */
+ public String getPort() {
+ return targetPortNumber.getText();
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/python/org.maemo.esbox.python-feature
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/python/org.maemo.esbox.python-feature/.project
===================================================================
--- trunk/python/org.maemo.esbox.python-feature/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python-feature/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.python-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python-feature/TODO.txt
===================================================================
--- trunk/python/org.maemo.esbox.python-feature/TODO.txt (rev 0)
+++ trunk/python/org.maemo.esbox.python-feature/TODO.txt 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+
+This plugin still depends on CDT! We need to make templates be independent of CDT (.core and .ui).
+
+Also, template processes should be implemented independently of CDT as well.
\ No newline at end of file
Added: trunk/python/org.maemo.esbox.python-feature/build.properties
===================================================================
--- trunk/python/org.maemo.esbox.python-feature/build.properties (rev 0)
+++ trunk/python/org.maemo.esbox.python-feature/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,4 @@
+bin.includes = feature.xml,\
+ license.html,\
+ licenses/,\
+ TODO.txt
Added: trunk/python/org.maemo.esbox.python-feature/feature.xml
===================================================================
--- trunk/python/org.maemo.esbox.python-feature/feature.xml (rev 0)
+++ trunk/python/org.maemo.esbox.python-feature/feature.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.maemo.esbox.python"
+ label="ESbox Python Support Feature"
+ version="1.5.0.qualifier"
+ provider-name="INdT / Nokia">
+
+ <description>
+ Python support for the ESbox project. This provides the Python project model, run/debug launches for local and remote targets, valgrind/oprofile launch support, and a project wizard.
+
+CURRENTLY this depends on CDT still. This will be addressed soon.
+ </description>
+
+ <copyright>
+ Copyright (c) 2007-2008 INdT, (c) 2007-2008 Nokia. All rights
+reserved.
+ </copyright>
+
+ <license url="http://www.eclipse.org/legal/epl-v10.html">
+ For legal terms, see the Eclipse Public License.
+ </license>
+
+ <url>
+ <update label="Update Site for ESbox project" url="http://esbox.garage.maemo.org/update"/>
+ </url>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.ui.ide" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.debug.ui" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.variables" version="3.2.100" match="greaterOrEqual"/>
+ <import plugin="org.python.pydev" version="0.9.7" match="greaterOrEqual"/>
+ <import plugin="org.python.pydev.core" version="0.9.7" match="greaterOrEqual"/>
+ <import plugin="org.python.pydev.debug" version="0.9.7" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.launch" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.project.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.python.project.core" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.ssh" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.python.launch" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.analysis.launch" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.expressions" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.maemo.esbox.project.ui" version="1.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.core" version="5.0.1" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.ui" version="5.0.1" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.managedbuilder.ui" version="5.0.0" match="greaterOrEqual"/>
+ </requires>
+
+ <plugin
+ id="org.maemo.esbox.python.launch"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.python.launch.analysis"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.python.project.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.maemo.esbox.python.project.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Added: trunk/python/org.maemo.esbox.python-feature/license.html
===================================================================
--- trunk/python/org.maemo.esbox.python-feature/license.html (rev 0)
+++ trunk/python/org.maemo.esbox.python-feature/license.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,22 @@
+<html>
+<head>
+<title>ESbox License</title>
+</head>
+
+<body>
+<h2>ESbox Software User Agreement</h2>
+<p>16<sup>th</sup> April, 2008</p>
+
+<h3>ESbox</h3>
+
+<p>ESbox is licensed under the terms of the <a href="licenses/epl-v10.html">Eclipse Public License v1.0</a>.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>ESbox has a set of open source templates to help the development of applications. Such templates are distributed
+under <a href="licenses/COPYING.LESSER">LGPL license.</a></p>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THIS CONTENT.</p>
+
+</body>
+</html>
Added: trunk/python/org.maemo.esbox.python-feature/licenses/COPYING
===================================================================
--- trunk/python/org.maemo.esbox.python-feature/licenses/COPYING (rev 0)
+++ trunk/python/org.maemo.esbox.python-feature/licenses/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/python/org.maemo.esbox.python-feature/licenses/COPYING.LESSER
===================================================================
--- trunk/python/org.maemo.esbox.python-feature/licenses/COPYING.LESSER (rev 0)
+++ trunk/python/org.maemo.esbox.python-feature/licenses/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/python/org.maemo.esbox.python-feature/licenses/epl-v10.html
===================================================================
--- trunk/python/org.maemo.esbox.python-feature/licenses/epl-v10.html (rev 0)
+++ trunk/python/org.maemo.esbox.python-feature/licenses/epl-v10.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ at font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+ at page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
Property changes on: trunk/python/org.maemo.esbox.python.launch
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/python/org.maemo.esbox.python.launch/.classpath
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/.classpath (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/python/org.maemo.esbox.python.launch/.project
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.python.launch</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python.launch/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:32:58 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/python/org.maemo.esbox.python.launch/META-INF/MANIFEST.MF
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/META-INF/MANIFEST.MF (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Python Launch Plug-in
+Bundle-SymbolicName: org.maemo.esbox.python.launch;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.python.launch.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui.ide;bundle-version="3.4.0",
+ org.eclipse.debug.ui;bundle-version="3.4.0",
+ org.eclipse.core.variables;bundle-version="3.2.100",
+ org.python.pydev;bundle-version="0.9.7",
+ org.python.pydev.core;bundle-version="0.9.7",
+ org.python.pydev.debug;bundle-version="0.9.7",
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.python.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.ssh;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.python.launch,
+ org.maemo.esbox.python.launch.debug,
+ org.maemo.esbox.python.launch.local,
+ org.maemo.esbox.python.launch.remote,
+ org.maemo.esbox.python.launch.ui
Added: trunk/python/org.maemo.esbox.python.launch/about.html
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/about.html (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/about.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,21 @@
+<h3>About This Content</h3>
+
+<h3>ESbox</h3>
+
+<p><a href="http://esbox.garage.maemo.org/" target="_blank">ESbox</a>
+is an Eclipse plug-in that helps programmers to develop applications for
+maemo platform on Scratchbox Apophis. It supports C/C++ and Python programming
+languages. Maemo 4.x SDKs (and later) will be supported.
+</p>
+
+<h3>License</h3>
+
+<p>See <a href="about_files/epl-v10.html">Eclipse Public License Version 1.0 ("EPL")</a>.
+</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>ESbox has a set of open source templates to help the development of applications. Such templates are distributed
+under <a href="about_files/COPYING.LESSER">LGPL license.</a></p>
+
+<address> © Copyright 2007-2008 INdT. All rights reserved. </address>
Added: trunk/python/org.maemo.esbox.python.launch/about_files/epl-v10.html
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/about_files/epl-v10.html (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/about_files/epl-v10.html 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+ at font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+ at page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
Added: trunk/python/org.maemo.esbox.python.launch/build.properties
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/build.properties (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ about.html,\
+ about_files/
Added: trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/local_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/local_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/oprofile_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/oprofile_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/remote_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/remote_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/valgrind_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/python/org.maemo.esbox.python.launch/icons/full/obj16/valgrind_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/python/org.maemo.esbox.python.launch/plugin.xml
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/plugin.xml (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ delegate="org.maemo.esbox.python.launch.local.ESboxPythonLocalRunLaunchDelegate"
+ id="esboxPythonLocalLaunchType"
+ modes="run,debug"
+ name="Python Maemo Local Application"
+ public="true">
+ </launchConfigurationType>
+ <launchConfigurationType
+ delegate="org.maemo.esbox.python.launch.remote.ESboxPythonRemoteLaunchDelegate"
+ id="esboxPythonRemoteLaunchType"
+ modes="run,debug"
+ name="Python Maemo Remote Application"
+ public="true">
+ </launchConfigurationType>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ configTypeID="esboxPythonLocalLaunchType"
+ icon="icons/full/obj16/local_obj.png"
+ id="esboxPythonLocalLaunchImage">
+ </launchConfigurationTypeImage>
+ <launchConfigurationTypeImage
+ configTypeID="esboxPythonRemoteLaunchType"
+ icon="icons/full/obj16/remote_obj.png"
+ id="esboxPythonRemoteLaunchImage">
+ </launchConfigurationTypeImage>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ class="org.maemo.esbox.python.launch.local.ESboxPythonLocalRunConfigurationTabGroup"
+ id="esboxPythonLocalRunLaunchTabGroup"
+ type="esboxPythonLocalLaunchType">
+ </launchConfigurationTabGroup>
+ <launchConfigurationTabGroup
+ class="org.maemo.esbox.python.launch.remote.EsboxPythonRemoteRunConfigurationTabGroup"
+ id="esboxPythonRemoteRunLaunchTabGroup"
+ type="esboxPythonRemoteLaunchType">
+ </launchConfigurationTabGroup>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchShortcuts">
+ <shortcut
+ class="org.maemo.esbox.python.launch.local.ESboxPythonLocalLaunchShortcut"
+ icon="icons/full/obj16/local_obj.png"
+ id="esboxPythonLocalShortcut"
+ label="Python Maemo Local Application"
+ modes="run,debug">
+ <contextualLaunch>
+ <enablement>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <and>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.python.isPyDevProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isEmulatorTarget">
+ </test>
+ <or>
+ <test
+ property="org.eclipse.debug.ui.matchesPattern"
+ value="*.py">
+ </test>
+ <test
+ property="org.eclipse.debug.ui.matchesPattern"
+ value="*.pyw">
+ </test>
+ </or>
+ </and>
+ </iterate>
+ </with>
+ </enablement>
+ <contextLabel
+ label="Python Maemo Local Application"
+ mode="run">
+ </contextLabel></contextualLaunch>
+ </shortcut>
+
+ <shortcut
+ class="org.maemo.esbox.python.launch.remote.ESboxPythonRemoteRunLaunchShortcut"
+ icon="icons/full/obj16/remote_obj.png"
+ id="esboxPythonRemoteShortcut"
+ label="Python Maemo Remote Application"
+ modes="run,debug">
+ <contextualLaunch>
+ <enablement>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <and>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.python.isPyDevProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isRemoteTarget">
+ </test>
+ <or>
+ <test
+ property="org.eclipse.debug.ui.matchesPattern"
+ value="*.py">
+ </test>
+ <test
+ property="org.eclipse.debug.ui.matchesPattern"
+ value="*.pyw">
+ </test>
+ </or>
+ </and>
+ </iterate>
+ </with>
+ </enablement>
+ <contextLabel
+ label="Python Maemo Remote Application"
+ mode="run">
+ </contextLabel></contextualLaunch>
+ </shortcut>
+ </extension>
+
+
+
+</plugin>
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/internal/python/launch/Activator.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/internal/python/launch/Activator.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/internal/python/launch/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,120 @@
+package org.maemo.esbox.internal.python.launch;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.python.launch";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/AbstractLaunchShortcut.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/AbstractLaunchShortcut.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/AbstractLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,296 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch;
+
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.ui.*;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.python.pydev.debug.core.Constants;
+import org.python.pydev.ui.NotConfiguredInterpreterException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ */
+public abstract class AbstractLaunchShortcut implements ILaunchShortcut {
+
+ protected boolean fShowDialog = false; // show configuration dialog?
+
+ /**
+ * Launch the given targets in the given build file. The targets are
+ * launched in the given mode.
+ *
+ * @param file the build file to launch
+ * @param mode the mode in which the build file should be executed
+ * @param targetAttribute the targets to launch, in the form of the launch
+ * configuration targets attribute.
+ */
+ protected void launch(IResource file, String mode, String targetAttribute) {
+ if (!verifyMode(mode)){
+ reportError("Invalid mode " + mode, null);
+ return;
+ }
+
+ ILaunchConfiguration conf = null;
+ List<ILaunchConfiguration> configurations = findExistingLaunchConfigurations(file);
+ if (configurations.isEmpty())
+ conf = createDefaultLaunchConfiguration(file);
+ else {
+ if (configurations.size() == 1) {
+ conf = (ILaunchConfiguration)configurations.get(0);
+ } else {
+ conf = chooseConfig(configurations);
+ if (conf == null)
+ // User cancelled selection
+ return;
+ }
+ }
+
+ if (conf != null) {
+ if (fShowDialog) {
+ String groupID = "";
+
+ if(mode.equals("run")) {
+ groupID = IESboxPythonLaunchConstants.ESBOX_RUN_LAUNCH_GROUP;
+ }else if (mode.equals("debug")){
+ groupID = IESboxPythonLaunchConstants.ESBOX_DEBUG_LAUNCH_GROUP;
+ }
+
+ DebugUITools.openLaunchConfigurationDialog(Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), conf, groupID, null);
+ } else {
+ DebugUITools.launch(conf, mode);
+ }
+ return;
+ }
+ fileNotFound();
+ }
+
+ public void launch(ISelection selection, String mode) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ Object object = structuredSelection.getFirstElement();
+ if (object instanceof IAdaptable) {
+
+ IFile resource = (IFile)((IAdaptable)object).getAdapter(IFile.class);
+ if (resource != null) {
+ launch(resource, mode, null);
+ return;
+ }
+
+ IFolder folder = (IFolder)((IAdaptable)object).getAdapter(IFolder.class);
+ if (folder != null) {
+ launch(folder, mode, null);
+ return;
+ }
+ }
+ }
+ fileNotFound();
+ }
+
+
+ public void launch(IEditorPart editor, String mode) {
+ //we have an editor to run
+ IEditorInput input = editor.getEditorInput();
+ IFile file = (IFile)input.getAdapter(IFile.class);
+ if (file != null) {
+ launch(file, mode, null);
+ return;
+ }
+ fileNotFound();
+ }
+ //=============================================================================================
+ // END ILaunchShortcut IMPL
+ //=============================================================================================
+
+ protected void fileNotFound() {
+ reportError("Unable to launch the file, not found??", null);
+ }
+
+ protected boolean verifyMode(String mode) {
+ boolean ok = mode.equals(ILaunchManager.RUN_MODE) || mode.equals(ILaunchManager.DEBUG_MODE);
+
+ if (!ok){
+ reportError("Unknown launch mode: " + mode, null);
+ }
+ return ok;
+ }
+
+
+ protected static void reportError(String message, Throwable throwable) {
+ if (message == null)
+ message = "Unexpected error";
+ IStatus status = null;
+ if (throwable instanceof CoreException) {
+ status = ((CoreException)throwable).getStatus();
+ } else {
+ status = new Status(IStatus.ERROR, "org.python.pydev.debug", 0, message, throwable);
+ }
+ ErrorDialog.openError(Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "ESbox esbox.python.launch error", "ESbox launch failed", status);
+ }
+
+ /**
+ * COPIED/MODIFIED from AntLaunchShortcut
+ * Returns a list of existing launch configuration for the given file.
+ */
+ protected List<ILaunchConfiguration> findExistingLaunchConfigurations(IResource file) {
+ ILaunchManager manager = org.eclipse.debug.core.DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType type = manager.getLaunchConfigurationType(getLaunchConfigurationType());
+ List<ILaunchConfiguration> validConfigs = new ArrayList<ILaunchConfiguration>();
+ if (type == null)
+ return validConfigs;
+ try {
+ ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
+ String defaultLocation = getDefaultLocation(file);
+ for (int i = 0; i < configs.length; i++) {
+ String configPath = configs[i].getAttribute(Constants.ATTR_LOCATION, "");
+ if (defaultLocation.equals(configPath))
+ validConfigs.add(configs[i]);
+ }
+ } catch (CoreException e) {
+ reportError("Unexpected error", e);
+ }
+ return validConfigs;
+ }
+
+ /**
+ * @param file
+ * @return default string for the location field
+ */
+ public static String getDefaultLocation (IResource file) {
+ return file.getRawLocation().toString();
+ }
+
+ protected ILaunchConfiguration createDefaultLaunchConfiguration(IResource resource) {
+ String projName = resource.getProject().getName();
+ return createDefaultLaunchConfiguration(resource.getProject(), getLaunchConfigurationType(), getDefaultLocation(resource), projName);
+ }
+
+ /**
+ * COPIED/MODIFIED from AntLaunchShortcut
+ * @param location
+ * @param pythonInterpreterManager
+ */
+ public ILaunchConfiguration createDefaultLaunchConfiguration(IProject project, String launchConfigurationType,
+ String location, String projName) {
+
+
+ ILaunchManager manager = org.eclipse.debug.core.DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType type = manager.getLaunchConfigurationType(launchConfigurationType);
+ if (type == null) {
+ reportError("ESbox launch configuration not found", null);
+ return null;
+ }
+
+ try {
+
+ String configName = createLaunchConfigurationName(new Path(location).lastSegment(), project);
+
+ ILaunchConfigurationWorkingCopy wc = type.newInstance(null, configName);
+ IPath projLoc = project.getRawLocation();
+ if (projLoc == null)
+ projLoc = project.getLocation();
+
+ /*
+ PythonNature pythonNature = PythonNature.getPythonNature(project);
+ if (pythonNature == null) {
+ reportError("Python nature not found", null);
+ return null;
+ }
+
+ String interpreter = PydevPlugin.getInterpreterManager(pythonNature).getDefaultInterpreter();
+ if (interpreter == null || interpreter.length() == 0)
+ interpreter = IESboxPythonLaunchConstants.ATTR_INTERPRETER_DEFAULT;
+ */
+ String interpreter = IESboxPythonLaunchConstants.ATTR_INTERPRETER_DEFAULT;
+
+ wc.setAttribute(Constants.ATTR_PROJECT,projName);
+ wc.setAttribute(Constants.ATTR_RESOURCE_TYPE, IResource.FILE);
+ wc.setAttribute(Constants.ATTR_LOCATION, location);
+ wc.setAttribute(Constants.ATTR_WORKING_DIRECTORY, location.substring(0, location.lastIndexOf('/')));
+ wc.setAttribute(Constants.ATTR_PROGRAM_ARGUMENTS, "");
+ wc.setAttribute(Constants.ATTR_VM_ARGUMENTS, "");
+ wc.setAttribute(Constants.ATTR_INTERPRETER, interpreter);
+ wc.setAttribute(IESboxPythonLaunchConstants.ATTR_PROGRAM_NAME,location);
+ wc.setAttribute(IESboxPythonLaunchConstants.ATTR_INTERPRETER, interpreter);
+ //wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,location);
+ //wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,projName);
+ wc.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
+
+ setDefaultForLaunchConfiguration(wc);
+
+ // Common Tab Arguments
+ CommonTab tab = new CommonTab();
+ tab.setDefaults(wc);
+ tab.dispose();
+ return wc.doSave();
+ } catch (NotConfiguredInterpreterException e) {
+ reportError(e.getMessage(), e);
+ throw e;
+ } catch (CoreException e) {
+ reportError(null, e);
+ return null;
+ }
+ }
+
+ /**
+ * COPIED/MODIFIED from AntLaunchShortcut
+ */
+ protected ILaunchConfiguration chooseConfig(List<ILaunchConfiguration> configs) {
+ if (configs.isEmpty()) {
+ return null;
+ }
+ ILabelProvider labelProvider = DebugUITools.newDebugModelPresentation();
+ ElementListSelectionDialog dialog= new ElementListSelectionDialog(Display.getDefault().getActiveShell(), labelProvider);
+ dialog.setElements(configs.toArray(new ILaunchConfiguration[configs.size()]));
+ dialog.setTitle("Pick a Python configuration");
+ dialog.setMessage("Choose a Python configuration to run");
+ dialog.setMultipleSelection(false);
+ int result = dialog.open();
+ labelProvider.dispose();
+ if (result == Window.OK)
+ return (ILaunchConfiguration) dialog.getFirstResult();
+ else
+ return null;
+ }
+
+ public void setShowDialog(boolean showDialog) {
+ fShowDialog = showDialog;
+ }
+
+ /**
+ * Convenience method to get the window that owns this action's Shell.
+ */
+ protected Shell getShell() {
+ return WorkbenchUtils.getActiveShell();
+ }
+
+ protected abstract String getLaunchConfigurationType();
+
+ abstract protected void setDefaultForLaunchConfiguration(ILaunchConfigurationWorkingCopy config) throws CoreException;
+
+ public abstract String createLaunchConfigurationName(String scriptFileName, IProject project) throws CoreException;
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/AbstractPythonLaunchDelegate.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/AbstractPythonLaunchDelegate.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/AbstractPythonLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
+import org.eclipse.ui.console.*;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.text.DateFormat;
+import java.text.MessageFormat;
+import java.util.Date;
+
+/**
+ *
+ */
+public abstract class AbstractPythonLaunchDelegate extends LaunchConfigurationDelegate {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public abstract void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Returns the working directory specified by the given launch
+ * configuration, or <code>null</code> if none.
+ *
+ * @deprecated Should use getWorkingDirectory()
+ * @param configuration
+ * launch configuration
+ * @return the working directory specified by the given launch
+ * configuration, or <code>null</code> if none
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public File getWorkingDir(ILaunchConfiguration configuration) throws CoreException {
+ return getWorkingDirectory(configuration);
+ }
+
+ /**
+ * Returns the working directory specified by the given launch
+ * configuration, or <code>null</code> if none.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the working directory specified by the given launch
+ * configuration, or <code>null</code> if none
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public File getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
+ return verifyWorkingDirectory(configuration);
+ }
+
+ /**
+ * Throws a core exception with an error status object built from the given
+ * message, lower level exception, and error code.
+ *
+ * @param message
+ * the status message
+ * @param exception
+ * lower level exception associated with the error, or
+ * <code>null</code> if none
+ * @param code
+ * error code
+ */
+ protected void abort(String message, Throwable exception, int code) throws CoreException {
+ MultiStatus status = new MultiStatus(getPluginID(), code, message, exception);
+ status.add(new Status(IStatus.ERROR, getPluginID(), code, exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
+ exception));
+ throw new CoreException(status);
+ }
+
+ protected void cancel(String message, int code) throws CoreException {
+ throw new CoreException(new Status(IStatus.OK, getPluginID(), code, message, null));
+ }
+
+ abstract protected String getPluginID();
+
+ /**
+ * @param config
+ * @return
+ * @throws CoreException
+ * @deprecated Use <code>verifyProgramFile</code> instead.
+ */
+ protected IFile getProgramFile(ILaunchConfiguration config) throws CoreException {
+ IProject project = verifyProject(config);
+ String fileName = PythonLaunchUtils.getProgramName(config);
+ if (fileName == null) {
+ abort("Program file not specified", null, IESboxPythonLaunchConstants.ERR_UNSPECIFIED_PROGRAM);
+ }
+
+ IFile programPath = project.getFile(fileName);
+ if (programPath == null || !programPath.exists() || !programPath.getLocation().toFile().exists()) {
+ abort("Program file does not exist",
+ new FileNotFoundException(programPath.getLocation().toPortableString() + " not found"),
+ IESboxPythonLaunchConstants.ERR_PROGRAM_NOT_EXIST);
+ }
+ return programPath;
+ }
+
+ protected IProject verifyProject(ILaunchConfiguration config) throws CoreException {
+ String name = PythonLaunchUtils.getProjectName(config);
+ if (name == null) {
+ abort("Project not specified", null, IESboxPythonLaunchConstants.ERR_UNSPECIFIED_PROJECT);
+ }
+ IProject project = PythonLaunchUtils.getProject(config);
+ if (project == null) {
+ IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ if (!proj.exists()) {
+ abort(
+ "Project " + name + " does not exist", null,
+ IESboxPythonLaunchConstants.ERR_NOT_A_ESBOX_PROJECT);
+ } else if (!proj.isOpen()) {
+ abort("Project " + name + " does is closed exist", null, //$NON-NLS-1$
+ IESboxPythonLaunchConstants.ERR_NOT_A_ESBOX_PROJECT);
+ }
+ }
+ return project;
+ }
+
+ protected IPath verifyProgramPath(ILaunchConfiguration config) throws CoreException {
+ IProject project = verifyProject(config);
+ IPath programPath = PythonLaunchUtils.getProgramPath(config);
+ if (programPath == null || programPath.isEmpty()) {
+ return null;
+ }
+ if (!programPath.isAbsolute()) {
+ IFile wsProgramPath = project.getProject().getFile(programPath);
+ programPath = wsProgramPath.getLocation();
+ }
+ if (!programPath.toFile().exists()) {
+ abort("Program file does not exist",
+ new FileNotFoundException(programPath.toPortableString() + " not found"),IESboxPythonLaunchConstants.ERR_PROGRAM_NOT_EXIST);
+ }
+ return programPath;
+ }
+
+ protected IPath verifyProgramFile(ILaunchConfiguration config) throws CoreException {
+ return getProgramFile(config).getLocation();
+ }
+
+ /**
+ * Verifies the working directory specified by the given launch
+ * configuration exists, and returns the working directory, or
+ * <code>null</code> if none is specified.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the working directory specified by the given launch
+ * configuration, or <code>null</code> if none
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public File verifyWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
+ IPath path = PythonLaunchUtils.getWorkingDirectoryPath(configuration);
+ if (path == null) {
+ // default working dir is the project if this config has a project
+ IProject cp = PythonLaunchUtils.getProject(configuration);
+ if (cp != null) {
+ IProject p = cp.getProject();
+ return p.getLocation().toFile();
+ }
+ } else {
+ if (path.isAbsolute()) {
+ File dir = new File(path.toPortableString());
+ if (dir.isDirectory()) {
+ return dir;
+ }
+ abort("Working directory does not exist",
+ new FileNotFoundException(path.toPortableString() + " not found"),
+ IESboxPythonLaunchConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
+ } else {
+ IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
+ if (res instanceof IContainer && res.exists()) {
+ return res.getLocation().toFile();
+ }
+ abort("Working directory does not exist",
+ new FileNotFoundException(path.toPortableString() + " not found"),
+ IESboxPythonLaunchConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
+ }
+ }
+ return null;
+ }
+
+ protected MessageConsole findConsole(String name) {
+ ConsolePlugin plugin = ConsolePlugin.getDefault();
+ IConsoleManager conMan = plugin.getConsoleManager();
+ IConsole[] existing = conMan.getConsoles();
+ for (int i = 0; i < existing.length; i++)
+ if (name.equals(existing[i].getName()))
+ return (MessageConsole) existing[i];
+ //no console found, so create a new one
+ MessageConsole myConsole = new MessageConsole(name, null);
+ conMan.addConsoles(new IConsole[] { myConsole });
+ return myConsole;
+ }
+
+ protected String renderProcessLabel(String commandLine) {
+ String format = "{0} ({1})"; //$NON-NLS-1$
+ String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));
+ return MessageFormat.format(format, commandLine, timestamp);
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/BasePythonLaunchParameterAccessor.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/BasePythonLaunchParameterAccessor.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/BasePythonLaunchParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 29, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch;
+
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.Properties;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.core.AbstractLaunchParameterAccessor;
+import org.python.pydev.debug.core.Constants;
+
+/**
+ * @author LWang
+ *
+ */
+public class BasePythonLaunchParameterAccessor extends
+ AbstractLaunchParameterAccessor {
+
+ /*
+ * Path of the module to debug.
+ */
+ protected IPath fProgramPath;
+
+ protected IPath fWorkingDirectory;
+
+ protected String[] fProgramArguments;
+
+ private String fInterpreter;
+
+ /**
+ * @param launchConfiguration
+ */
+ public BasePythonLaunchParameterAccessor(
+ ILaunchConfiguration launchConfiguration) {
+ super(launchConfiguration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.AbstractLaunchParameterAccessor#getPluginID()
+ */
+ @Override
+ protected String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.ILaunchParameterAccessor#getEnvironmentAsProperty()
+ */
+ public Properties getEnvironmentAsProperty() throws CoreException {
+ return ESboxLaunchUtils.getEnvironmentAsProperty(getLaunchConfiguration());
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.ILaunchParameterAccessor#getProgramArguments()
+ */
+ public String[] getProgramArguments() throws CoreException {
+ if (fProgramArguments == null) {
+ // Just call this utility.
+ fProgramArguments = PythonLaunchUtils.getArgumentsAsArray(getLaunchConfiguration());
+ }
+
+ return fProgramArguments;
+ }
+
+ public String getInterpreter() throws CoreException {
+ if (fInterpreter == null) {
+ fInterpreter = PythonLaunchUtils.getInterpreter(getLaunchConfiguration());
+ }
+
+ return fInterpreter;
+ }
+
+ public IPath getProgramPathInHostFileSystem() throws CoreException {
+ if (fProgramPath == null) {
+ IPath programPath = PythonLaunchUtils.getProgramPath(getLaunchConfiguration());;
+ if (programPath == null) {
+ String msg = MessageFormat.format(
+ "No main module is specified for the launch configuration ''{0}''.",
+ getLaunchConfiguration().getName());
+ throw newCoreException(msg);
+ }
+
+ if (!programPath.isAbsolute()) {
+ IFile wsProgramPath = getProject().getFile(programPath);
+ programPath = wsProgramPath.getLocation();
+ }
+
+ if (!programPath.toFile().exists()) {
+ String msg = MessageFormat.format(
+ "The module file ''{0}'' does not exist.", programPath.toPortableString());
+ throw newCoreException(msg);
+ }
+
+ fProgramPath = programPath;
+ }
+
+ return fProgramPath;
+ }
+
+ public IPath getProgramPathInBuildtimeFileSystem() throws CoreException {
+ return getProgramPathInHostFileSystem();
+ }
+
+ public IPath getProgramPathInRuntimeFileSystem() throws CoreException {
+ return getProgramPathInBuildtimeFileSystem();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.ILaunchParameterAccessor#getWorkingDirectory()
+ */
+ public IPath getWorkingDirectory() throws CoreException {
+ if (fWorkingDirectory == null) {
+
+ IPath path = getWorkingDirectoryFromUser();
+
+ if (path == null) {
+ path = getDefaultWorkingDirectory();
+ }
+ assert(path != null);
+
+ // some validation, which should have been done by preference tab code.
+ //
+ if (path.isAbsolute()) {
+ File dir = new File(path.toOSString());
+ if (! dir.isDirectory()) {
+ throw newCoreException(
+ MessageFormat.format("The working directory ''{0}'' is not a directory.", path.toPortableString()));
+ }
+ } else {
+ IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
+ if (res instanceof IContainer && res.exists()) {
+ path = res.getLocation();
+ }
+
+ // Relative but not found in workspace.
+ throw newCoreException(
+ MessageFormat.format("The working directory ''{0}'' is not found.", path.toPortableString()));
+ }
+
+ fWorkingDirectory = path;
+ }
+
+ return fWorkingDirectory;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.ILaunchParameterAccessor#getWorkingDirectoryFromUser()
+ */
+ public IPath getWorkingDirectoryFromUser() throws CoreException {
+ return PythonLaunchUtils.getWorkingDirectoryPath(getLaunchConfiguration());
+ }
+
+ @Override
+ protected String getProjectName(ILaunchConfiguration launchConfiguration)
+ throws CoreException {
+ // Note the Python specific attribute ID.
+ return getLaunchConfiguration().getAttribute(Constants.ATTR_PROJECT, (String)null);
+ }
+
+ public IPath getDefaultWorkingDirectory() throws CoreException {
+ // With base python launch,
+ // default working dir is the project if this config has a project
+ IPath path = null;
+ IProject p = getProject();
+ if (p != null) {
+ path = p.getLocation();
+ }
+ else {
+ String msg = MessageFormat.format(
+ "Cannot determine the default working directory for the launch"+
+ " configuration ''{0}'' as it has no project associated.", getLaunchConfiguration().getName());
+ throw newCoreException(msg);
+ }
+
+ return path;
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ESboxAbstractPythonConfigurationTabGroup.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ESboxAbstractPythonConfigurationTabGroup.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ESboxAbstractPythonConfigurationTabGroup.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.python.launch;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.python.pydev.debug.core.Constants;
+
+public abstract class ESboxAbstractPythonConfigurationTabGroup extends
+ AbstractLaunchConfigurationTabGroup {
+
+ public ESboxAbstractPythonConfigurationTabGroup() {
+ super();
+ }
+
+ /**
+ * Get the launch shortcut that can provide the default launch configuration name
+ * <p>
+ * TODO: the default name logic can be abstracted out to avoid tying the tab group and shortcut together
+ * @return
+ */
+ abstract protected AbstractLaunchShortcut getLaunchShortcut();
+
+ /**
+ * Set the launch configuration name based on the same semantics used by the launch shortcut
+ */
+ protected void initializeProgramName(ILaunchConfigurationWorkingCopy config) {
+
+ String projectName = null;
+ String programName = null;
+ try {
+ projectName = config.getAttribute(Constants.ATTR_PROJECT, (String)null);
+ programName = config.getAttribute(Constants.ATTR_LOCATION, (String)null);
+ } catch (CoreException e) {
+ }
+ if (projectName != null && programName != null) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ String name;
+ try {
+ name = getLaunchShortcut().createLaunchConfigurationName(new Path(programName).lastSegment(), project);
+ config.rename(name);
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Error initializing launch config name", e);
+ }
+ }
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ super.setDefaults(configuration);
+
+ initializeProgramName(configuration);
+ }
+
+
+}
\ No newline at end of file
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ESboxPythonAbstractLaunchDelegate.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ESboxPythonAbstractLaunchDelegate.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ESboxPythonAbstractLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,78 @@
+/******************************************************************************
+ * Copyright (c) 2007-2008 INdT
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.*;
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.python.launch.debug.PythonDebugger;
+
+import java.io.IOException;
+
+/**
+ *
+ */
+public abstract class ESboxPythonAbstractLaunchDelegate extends AbstractPythonLaunchDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.launch.AbstractCLaunchDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void launch( ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor ) throws CoreException {
+
+ ESboxLaunchUtils.logLaunchSessionStart(config);
+
+ if ( monitor == null ) {
+ monitor = new NullProgressMonitor();
+ }
+ if ( mode.equals( ILaunchManager.RUN_MODE ) ) {
+ runApplication( config, launch, monitor );
+ }
+ if ( mode.equals( ILaunchManager.DEBUG_MODE ) ) {
+ launchDebugger( config, launch, mode, monitor );
+ }
+ }
+
+ abstract protected void runApplication(ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException;
+
+ protected void launchDebugger(ILaunchConfiguration config, ILaunch launch, String mode, IProgressMonitor monitor) throws CoreException {
+ IPath exePath = super.verifyProgramPath(config);
+ IProject project = super.verifyProject(config);
+
+ PythonDebugger debugger = getDebugger();
+ try {
+ debugger.debugPython(project, exePath, mode, launch, config, monitor);
+ } catch (IOException e) {
+ throw newCoreException("Failed to debug Python application " + exePath);
+ }
+
+ }
+
+ protected CoreException newCoreException(String mesg) {
+ return new CoreException(Activator.createErrorStatus(mesg, null));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.launch.AbstractCLaunchDelegate#getPluginID()
+ */
+ @Override
+ protected String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+ /**
+ * Return the properly debugger for the launch delegate
+ *
+ * @return the debugger
+ */
+ abstract protected PythonDebugger getDebugger();
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/IESboxPythonLaunchConstants.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/IESboxPythonLaunchConstants.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/IESboxPythonLaunchConstants.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch;
+
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.maemo.esbox.launch.IESboxLaunchConfigurationConstants;
+
+
+
+/**
+ * @author Paulo Romulo - paulo at embedded dot ufcg dot com dot br
+ * raulherbster
+ */
+public interface IESboxPythonLaunchConstants extends IESboxLaunchConfigurationConstants {
+
+ // Plugin constants
+ // XXX: need to define a Python launch group for these two to make sense
+ public static final String ESBOX_DEBUG_LAUNCH_GROUP = Activator.PLUGIN_ID + ".launchGroup.debug";
+ public static final String ESBOX_RUN_LAUNCH_GROUP = Activator.PLUGIN_ID + ".launchGroup.run";
+ public static final String PROCESS_TYPE = "ESBOX.PYTHON";
+
+ public static final String JAVA_NATURE = "org.eclipse.jdt.core.javanature";
+
+ public static final String ATTR_INTERPRETER = ESBOX_LAUNCH_ID + ".ATTR_INTERPRETER";
+ public static final String ATTR_INTERPRETER_DEFAULT = "/usr/bin/python2.5";
+ public static final String ATTR_PROGRAM_NAME = ESBOX_LAUNCH_ID + ".PROGRAM_NAME";
+ public static final String ATTR_DESKTOP_APPLICATION = ESBOX_LAUNCH_ID + ".ATTR_DESKTOP_APPLICATION";
+
+ public static final String ATTR_HOST = ESBOX_LAUNCH_ID + ".HOST_ATTR";
+ public static final String ATTR_CLIENT = ESBOX_LAUNCH_ID + ".CLIENT_ATTR";
+
+ // Launch configuration types.
+ // org.maemo.esbox.launch/plugin.xml
+ //
+ public static final String CONFIG_TYPE_MAEMOLOCAL = "esboxPythonLocalLaunchType";
+ public static final String CONFIG_TYPE_MAEMOREMOTE = "esboxPythonRemoteLaunchType";
+ public static final String CONFIG_TYPE_OPROFILE = "esboxPythonOProfileLaunchType";
+ public static final String CONFIG_TYPE_VALGRIND = "esboxPythonValgrindLaunchType";
+
+ /**
+ * Status code indicating that the Eclipse runtime does not support
+ * launching a program with a working directory. This feature is only
+ * available if Eclipse is run on a 1.3 runtime or higher.
+ * <p>
+ * A status handler may be registered for this error condition, and should
+ * return a Boolean indicating whether the program should be relaunched with
+ * the default working directory.
+ * </p>
+ */
+ public static final int ERR_WORKING_DIRECTORY_NOT_SUPPORTED = 100;
+
+ /**
+ * Status code indicating the specified working directory does not exist.
+ */
+ public static final int ERR_WORKING_DIRECTORY_DOES_NOT_EXIST = 101;
+
+ /**
+ * Status code indicating a launch configuration does not specify a project
+ * when a project is required.
+ */
+ public static final int ERR_UNSPECIFIED_PROJECT = 102;
+
+ /**
+ * Status code indicating a launch configuration does not specify a vaild
+ * project.
+ */
+ public static final int ERR_NOT_A_ESBOX_PROJECT = 103;
+
+ /**
+ * Status code indicating a launch configuration does not specify a vaild
+ * program.
+ */
+ public static final int ERR_PROGRAM_NOT_EXIST = 104;
+
+ /**
+ * Status code indicating a launch configuration does not specify a program
+ * name.
+ */
+
+ public static final int ERR_UNSPECIFIED_PROGRAM = 105;
+
+ /**
+ * Status code indicating a the user did not specify a process id
+ */
+ public static final int ERR_NO_PROCESSID = 107;
+
+ /**
+ * Status code indicating a the user did not specify a path to a corefile
+ */
+ public static final int ERR_NO_COREFILE = 108;
+
+ /**
+ * Status code indicating an unexpected internal error.
+ */
+ public static final int ERR_INTERNAL_ERROR = 150;
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PydevDebugScriptCopier.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PydevDebugScriptCopier.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PydevDebugScriptCopier.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,323 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch;
+
+import org.eclipse.core.runtime.*;
+
+import java.io.*;
+import java.net.URL;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * This class handles copying the debugger scripts from pydev, making any necessary
+ * edits for our purposes (namely, supplying the mappings from host <-> target filepaths
+ * so breakpoints will work), and providing a list of converted Files.
+ * It's up to the client to move or copy those files to the actual target
+ * (scratchbox or device).
+ * <p>
+ * This implementation works with pydev 1.3.17 (so far). The file-mapping code is
+ * encoded in pydevd_vars.py.
+ * <p>
+ * NOTE: this class is intended to be reused in Pluthon. It has ugly copies of
+ * utility methods embedded here in order to avoid depending on ESbox.
+ * @author eswartz
+ *
+ */
+public class PydevDebugScriptCopier {
+
+ /** Edit this to see path mapping from the pydev scripts */
+ public static boolean DEBUG_PATH_MAPPING = false;
+
+ private static final String PYDEVD_FILE_UTILS_PY = "pydevd_file_utils.py";
+
+ private static final String PYDEVD_COMM_PY = "pydevd_comm.py";
+
+
+ private static IPath tmpPath;
+
+ private Map<IPath, IPath> localToRemotePathMappings;
+
+ /**
+ * Set the mappings of source paths which will allow the debugger to
+ * reconcile paths seen on the target (e.g. /home/user/temp/myfile.py)
+ * with those on the Eclipse host (e.g. 'c:\sources\shared\workspace\PythonProject\src\myfile.py'),
+ * and also to reconcile system python packages referenced on the target
+ * with those on the host.
+ * @param mappings
+ */
+ public void setLocalToRemotePathMappings(Map<IPath, IPath> mappings) {
+ this.localToRemotePathMappings = mappings;
+ }
+
+ /**
+ * Extract the debug files from the given location, apply edits, and place them
+ * in a temporary location where we can copy them to a target.
+ * <p>
+ * NOTE: we don't directly copy to the target (over ssh, etc.) to avoid introducing ESbox dependencies.
+ * @param scriptLocation location (in bundle, filesystem, etc.) where the debug scripts are located
+ * @return an array of files (not necessarily in the same directory!) where the copied and
+ * translated scripts have been extracted
+ */
+ public File[] extractAndModifyFiles(URL scriptLocation) throws IOException {
+ // find the scripts in the plugin, unpacking if needed
+ File hostScriptDir = getFileForURL(scriptLocation);
+
+ // get debug scripts -- don't include subdirs (CVS/SVN/project metadata during development)
+ File[] hostScriptFiles = hostScriptDir.listFiles(new FileFilter() {
+ public boolean accept(File pathname) {
+ return !pathname.isDirectory() && !pathname.getName().startsWith(".");
+ }
+ });
+
+ // make temporary copies for scripts we need to modify
+ for (int idx = 0; idx < hostScriptFiles.length; idx++) {
+ File hostScriptFile = hostScriptFiles[idx];
+ if (hostScriptFile.getName().equals(PYDEVD_FILE_UTILS_PY)) {
+ hostScriptFile = hostScriptFiles[idx] = modifyFileUtils(hostScriptFile);
+ } else if (hostScriptFile.getName().equals(PYDEVD_COMM_PY)) {
+ hostScriptFile = hostScriptFiles[idx] = modifyComm(hostScriptFile);
+ }
+ }
+
+ return hostScriptFiles;
+ }
+
+ /**
+ * This will take a URL and force its contents into the filesystem.
+ * If the plugin is not jar'ed, this is its original location.
+ * Otherwise, the platform
+ * extracts the contents to a temporary location.
+ * @param file
+ * @return full path
+ * @throws ESboxException
+ */
+ private File getFileForURL(URL url) throws IOException {
+ URL fileURL = FileLocator.toFileURL(url);
+ File file = new File(fileURL.getPath());
+ return file;
+ }
+
+ /**
+ * We modify pydevd_comm.py to provide proper error reporting on connection failed.
+ */
+ protected File modifyComm(File hostScriptFile) throws IOException {
+ String line ="(?m)except:(\\s+)print \"server timed out after 10 seconds, could not connect to \", host, \":\", str\\(port\\)";
+ String repl = "except Exception,e:$1print \"could not connect to \", host, \":\", str(port),\": \", e";
+ String text = readFile(hostScriptFile);
+ text = text.replaceAll(line, repl);
+ return writeTempFile(hostScriptFile, text);
+ }
+ /**
+ * We modify pydevd_file_utils.py by supplying an initialization for PATHS_FROM_CLIENT_TO_SERVER.
+ * @param hostScriptFile
+ * @return
+ * @throws IOException
+ */
+ protected File modifyFileUtils(File hostScriptFile) throws IOException {
+ String text = readFile(hostScriptFile);
+ text = replaceSourceMappingPaths(text);
+
+ // fix a bug where different slashinesses aren't mapped
+ String line1 = "translated = translated.replace(client_prefix, server_prefix)";
+ int idx = text.indexOf(line1);
+ if (idx >= 0) {
+ if (text.charAt(idx + line1.length()) != '.')
+ text = text.replace(line1,
+ "translated = translated.replace(client_prefix, server_prefix).replace('\\\\', '/')");
+ }
+
+
+ if (isWindows()) {
+ String line2 = "translated = translated.replace(server_prefix, client_prefix)";
+ idx = text.indexOf(line2);
+ if (idx >= 0) {
+ if (text.charAt(idx + line2.length()) != '.')
+ text = text.replace(line2,
+ "translated = translated.replace(server_prefix, client_prefix).replace('/', '\\\\')");
+ }
+ }
+
+ // remove incorrect realpath call, which just messes up path capitalization when
+ // the file is not local, and causes Eclipse to ask, for every single file,
+ // which one to use
+ text = text.replace("ret = _NormFile(translated)",
+ "ret = translated");
+
+ // debug this
+ if (DEBUG_PATH_MAPPING)
+ text = text.replace("DEBUG_CLIENT_SERVER_TRANSLATION = False",
+ "DEBUG_CLIENT_SERVER_TRANSLATION = True");
+
+ return writeTempFile(hostScriptFile, text);
+ }
+
+ /** from pydevd_file.py
+'''
+ This module provides utilities to get the absolute filenames so that we can be sure that:
+ - The case of a file will match the actual file in the filesystem (otherwise breakpoints won't be hit).
+ - Providing means for the user to make path conversions when doing a remote debugging session in
+ one machine and debugging in another.
+
+ To do that, the PATHS_FROM_CLIENT_TO_SERVER constant must be filled with the appropriate paths.
+
+ E.g.:
+ If the server has the structure
+ /user/projects/my_project/src/package/module1.py
+
+ and the client has:
+ c:\my_project\src\package\module1.py
+
+ the PATHS_FROM_CLIENT_TO_SERVER would have to be:
+ PATHS_FROM_CLIENT_TO_SERVER = [(r'c:\my_project\src', r'/user/projects/my_project/src')]
+
+ @note: DEBUG_CLIENT_SERVER_TRANSLATION can be set to True to debug the result of those translations
+
+ @note: the case of the paths is important! Note that this can be tricky to get right when one machine
+ uses a case-independent filesystem and the other uses a case-dependent filesystem (if the system being
+ debugged is case-independent, 'normcase()' should be used on the paths defined in PATHS_FROM_CLIENT_TO_SERVER).
+
+ @note: all the paths with breakpoints must be translated (otherwise they won't be found in the server)
+
+ @note: to enable remote debugging in the target machine (pydev extensions in the eclipse installation)
+ import pydevd;pydevd.settrace(host, stdoutToServer, stderrToServer, port, suspend)
+
+ see parameter docs on pydevd.py
+
+ @note: for doing a remote debugging session, all the pydevd_ files must be on the server accessible
+ through the PYTHONPATH (and the PATHS_FROM_CLIENT_TO_SERVER only needs to be set on the target
+ machine for the paths that'll actually have breakpoints).
+'''
+
+ */
+ protected String replaceSourceMappingPaths(String text) {
+ // convert paths to have the right slashiness
+ Map<String, String> pathMappings = new LinkedHashMap<String, String>();
+ for (Map.Entry<IPath, IPath> entry : localToRemotePathMappings.entrySet()) {
+ String local = entry.getKey().toOSString();
+ String remote = entry.getValue().toPortableString();
+ pathMappings.put(local, remote);
+ }
+
+ String newVariable = "PATHS_FROM_CLIENT_TO_SERVER = " + formatAsPythonList(pathMappings);
+ text = text.replace("PATHS_FROM_CLIENT_TO_SERVER = []", newVariable);
+ return text;
+ }
+
+ protected String formatAsPythonList(Map<String, String> map) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("[\n\t");
+ int origLength = builder.length();
+ for (Map.Entry<String, String> entry : map.entrySet()) {
+ if (builder.length() > origLength)
+ builder.append(",\n\t");
+ builder.append("( ");
+ builder.append(formatLiteralString(entry.getKey()));
+ builder.append(", ");
+ builder.append(formatLiteralString(entry.getValue()));
+ builder.append(" )");
+ }
+ builder.append(']');
+ return builder.toString();
+ }
+
+ private String formatLiteralString(String portableString) {
+ return "r'" + portableString + "'";
+ }
+
+ private String readFile(File hostScriptFile) throws IOException {
+ return new String(readFileContents(hostScriptFile, null));
+ }
+
+ private File writeTempFile(File hostScriptFile, String text) throws IOException {
+ File tempFile = getTemporaryPath().append(hostScriptFile.getName()).toFile();
+ FileOutputStream fos = new FileOutputStream(tempFile);
+ fos.write(text.getBytes());
+ fos.close();
+ return tempFile;
+ }
+
+ protected IPath getTemporaryPath() {
+ if (tmpPath == null) {
+ if (isWindows()) {
+ String tmp = System.getenv("TEMP");
+ if (tmp == null)
+ tmp = System.getenv("TMP");
+ if (tmp == null) {
+ tmp = "c:/temp";
+ }
+ tmpPath = new Path(tmp);
+ tmpPath.toFile().mkdirs();
+ } else {
+ tmpPath = new Path("/tmp");
+ }
+ }
+ return tmpPath;
+ }
+
+ /**
+ * @return
+ */
+ private boolean isWindows() {
+ return Platform.getOS().equals(Platform.OS_WIN32);
+ }
+
+ /**
+ * Read contents of a file into an array
+ * @param file
+ * @param encoding (null = system default)
+ * @return array of text
+ * @throws CoreException wrapping java.io.FileException
+ */
+ protected char[] readFileContents(File file, String encoding) throws IOException {
+ FileInputStream fis;
+ fis = new FileInputStream(file);
+ Reader reader;
+ if (encoding != null)
+ reader = new InputStreamReader(fis, encoding);
+ else
+ reader = new InputStreamReader(fis);
+
+ char[] buf = new char[1024];
+ StringBuffer sb = new StringBuffer();
+ int len;
+ while ((len = reader.read(buf)) > 0) {
+ sb.append(buf, 0, len);
+ }
+ reader.close();
+ return sb.toString().toCharArray();
+ }
+
+ /**
+ * Write contents of a file from an array
+ * @param file
+ * @param encoding (null = system default)
+ * @throws CoreException wrapping java.io.FileException
+ */
+ protected void writeFileContents(File file, char[] text, String encoding) throws IOException {
+ FileOutputStream fos;
+ fos = new FileOutputStream(file);
+ Writer writer;
+ if (encoding != null)
+ writer = new OutputStreamWriter(fos, encoding);
+ else
+ writer = new OutputStreamWriter(fos);
+
+ try {
+ writer.write(text, 0, text.length);
+ } finally {
+ writer.close();
+ }
+ }
+
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLaunchConfigurationData.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLaunchConfigurationData.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLaunchConfigurationData.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster
+ *******************************************************************************/
+package org.maemo.esbox.python.launch;
+
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.maemo.esbox.core.process.EnvironmentProperties;
+import org.maemo.esbox.core.sdk.ISDK;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.LaunchProtocolFactory;
+import org.maemo.esbox.launch.adapters.IRunStandaloneAdapter;
+
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * @author raulherbster
+ *
+ */
+public class PythonLaunchConfigurationData implements IESboxPythonLaunchConstants {
+
+ static public void setDefaults(ILaunchConfigurationWorkingCopy configuration, String configTypeID) {
+
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(configuration);
+ if (sdkTarget == null) // not esbox project, bail.
+ return;
+
+ IRunStandaloneAdapter runStandaloneAdapter = ESboxLaunchUtils.getRunStandaloneAdapter(sdkTarget);
+ boolean runStandaloneDefault = runStandaloneAdapter != null ? runStandaloneAdapter.getDefault() : false;
+
+ // Remember the SDK and SDKTarget in the configuration.
+ //
+ configuration.setAttribute(ATTR_SDK_NAME, getUniqueSDKName(sdkTarget.getSDK()));
+ configuration.setAttribute(ATTR_SDK_TARGET_NAME, sdkTarget.getName());
+
+ Properties defaultEnv = sdkTarget.getProcessLauncherFactory().getStandardEnvironment();
+
+ //---------- Maemo Local debug specific --------------------------------
+ //
+ if (configTypeID.equals(CONFIG_TYPE_MAEMOLOCAL) || configTypeID.equals(CONFIG_TYPE_VALGRIND)) {
+
+ configuration.setAttribute(ATTR_RUN_STANDALONE, runStandaloneDefault);
+ }
+
+ //---------- Maemo Remote and OProfile debug specific --------------------------------
+ //
+ else if (configTypeID.equals(CONFIG_TYPE_MAEMOREMOTE) || configTypeID.equals(CONFIG_TYPE_OPROFILE)) {
+
+ configuration.setAttribute(ATTR_RUN_STANDALONE, runStandaloneDefault);
+
+ // Set defaults for download method (i.e. launch protocols) related attributes.
+ LaunchProtocolFactory.getInstance().setDefaults(configuration);
+
+ // Obsolete
+ configuration.setAttribute(ATTR_COPY_BINS, COPY_BINS_DEFAULT);
+
+ //XXX: remove once we add IMachine for remote machines
+ String[] envStrs = {
+ "DISPLAY=:0.0",
+ "DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/session_bus_socket"
+ };
+ defaultEnv = EnvironmentProperties.createFromEnvp(envStrs);
+
+ }
+
+
+ // Replace native env.
+ // For our remote debug, don't pass any host env vars to device program/command.
+ // Instead, add those required by default.
+ configuration.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
+
+ configuration.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map<Object, Object>) defaultEnv);
+
+ }
+
+ public static String getUniqueSDKName(ISDK sdk) {
+ // The ISDK.getName() returns "scratchbox" for both Sbox1 and Sbox2. Thus this method.
+ //
+ return sdk.toString(); // refer to BaseSDK.toString().
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLaunchUtils.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLaunchUtils.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLaunchUtils.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.python.pydev.debug.core.Constants;
+
+/**
+ *
+ */
+public abstract class PythonLaunchUtils {
+
+ /**
+ * Expands and returns the working directory attribute of the given launch
+ * configuration. Returns <code>null</code> if a working directory is not
+ * specified. If specified, the working is verified to point to an existing
+ * directory in the local file system.
+ *
+ * @param configuration launch configuration
+ * @return an absolute path to a directory in the local file system, or
+ * <code>null</code> if unspecified
+ * @throws CoreException if unable to retrieve the associated launch
+ * configuration attribute, if unable to resolve any variables, or if the
+ * resolved location does not point to an existing directory in the local
+ * file system
+ */
+ static public IPath getWorkingDirectoryPath(ILaunchConfiguration config) throws CoreException {
+ String location = config.getAttribute(Constants.ATTR_WORKING_DIRECTORY, (String)null);
+ if (location != null) {
+ String expandedLocation = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(location);
+ if (expandedLocation.length() > 0) {
+ return new Path(expandedLocation);
+ }
+ }
+ return null;
+ }
+
+ public static IProject getProject(ILaunchConfiguration configuration) throws CoreException {
+ String projectName = getProjectName(configuration);
+ if (projectName != null) {
+ projectName = projectName.trim();
+ if (projectName.length() > 0) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project != null && project.exists()) {
+ return project;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static String getProjectName(ILaunchConfiguration configuration) throws CoreException {
+ return configuration.getAttribute(Constants.ATTR_PROJECT, (String)null);
+ }
+
+ public static String getProgramName(ILaunchConfiguration configuration) throws CoreException {
+ return configuration.getAttribute(Constants.ATTR_LOCATION, (String)null);
+ }
+
+ public static String getInterpreter(ILaunchConfiguration configuration) throws CoreException {
+ return configuration.getAttribute(IESboxPythonLaunchConstants.ATTR_INTERPRETER,
+ IESboxPythonLaunchConstants.ATTR_INTERPRETER_DEFAULT);
+ }
+
+ public static IPath getProgramPath(ILaunchConfiguration configuration) throws CoreException {
+ String path = getProgramName(configuration);
+ if (path == null) {
+ return null;
+ }
+ return new Path(path);
+ }
+
+ /**
+ * Expands and returns the arguments attribute of the given launch
+ * configuration. Returns <code>null</code> if arguments are not specified.
+ *
+ * @param configuration launch configuration
+ * @return an array of resolved arguments, or <code>null</code> if
+ * unspecified
+ * @throws CoreException if unable to retrieve the associated launch
+ * configuration attribute, or if unable to resolve any variables
+ */
+ public static String getArguments(ILaunchConfiguration configuration) throws CoreException {
+ return configuration.getAttribute(Constants.ATTR_PROGRAM_ARGUMENTS, (String) null);
+ }
+
+ /**
+ *
+ * @param configuration
+ * @return
+ * @throws CoreException
+ */
+ public static String getVMArguments(ILaunchConfiguration configuration) throws CoreException {
+ return configuration.getAttribute(Constants.ATTR_VM_ARGUMENTS, (String) null);
+ }
+
+ /**
+ *
+ * @param configuration
+ * @return
+ * @throws CoreException
+ */
+ public static String[] getVMArgumentsAsArray(ILaunchConfiguration configuration) throws CoreException {
+ String arguments = getVMArguments(configuration);
+ return parseStringIntoList(arguments);
+ }
+
+ /**
+ *
+ * @param configuration
+ * @return
+ * @throws CoreException
+ */
+ public static String[] getArgumentsAsArray(ILaunchConfiguration configuration) throws CoreException {
+ String arguments = getArguments(configuration);
+ return parseStringIntoList(arguments);
+ }
+
+ /**
+ * Parses the argument text into an array of individual
+ * strings using the space character as the delimiter.
+ * An individual argument containing spaces must have a
+ * double quote (") at the start and end. Two double
+ * quotes together is taken to mean an embedded double
+ * quote in the argument text.
+ *
+ * @param arguments the arguments as one string
+ * @return the array of arguments
+ */
+ private static String[] parseStringIntoList(String arguments) {
+ if (arguments == null || arguments.length() == 0) {
+ return new String[0];
+ }
+ String[] res= DebugPlugin.parseArguments(arguments);
+ return res;
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLocalLaunchParameterAccessor.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLocalLaunchParameterAccessor.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLocalLaunchParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 30, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.core.IESboxLaunchParameterAccessor;
+import org.maemo.esbox.launch.core.ILaunchParameterAccessor;
+
+import java.text.MessageFormat;
+
+/**
+ * Launch parameters for local launch of an ESbox Python project.
+ *
+ * @author LWang
+ *
+ */
+public class PythonLocalLaunchParameterAccessor
+ extends BasePythonLaunchParameterAccessor
+ implements IESboxLaunchParameterAccessor {
+
+ private BasePythonLaunchParameterAccessor fOriginal;
+
+ private ISDKTarget fSDKTarget = null;
+
+ protected IPath fSboxProgramPath;
+
+ protected IPath fSboxWorkingDirectory;
+
+ /**
+ * @param configuration
+ * @throws CoreException - the underlying project is not ESbox project.
+ */
+ public PythonLocalLaunchParameterAccessor(
+ ILaunchConfiguration configuration) throws CoreException {
+ super(configuration);
+
+ fOriginal = new BasePythonLaunchParameterAccessor(configuration);
+
+ fSDKTarget = ESboxLaunchUtils.getSDKTarget(configuration);
+
+ if (fSDKTarget == null) {
+ String msg = MessageFormat.format(
+ "The project for launch configuration ''{0}'' is not an ESBox project.",
+ configuration.getName());
+ throw newCoreException(msg);
+ }
+ }
+
+ public ILaunchParameterAccessor getOriginal() {
+ return fOriginal;
+ }
+
+ public ISDKTarget getSDKTarget() {
+ return fSDKTarget;
+ }
+
+ public IMachine getMachine() {
+ return fSDKTarget.getSDK().getMachine();
+ }
+
+ @Override
+ public IPath getProgramPathInBuildtimeFileSystem() throws CoreException {
+ if (fSboxProgramPath == null) {
+ IPath hostProgram = getProgramPathInHostFileSystem();
+ try {
+ fSboxProgramPath = convertToSboxPath(hostProgram);
+ } catch (ESboxException e) {
+ String msg = MessageFormat.format(
+ "The module ''{0}'' is not visible in scratchbox.",
+ hostProgram.toPortableString());
+ throw newCoreException(msg, e);
+ }
+ }
+
+ return fSboxProgramPath;
+ }
+
+ @Override
+ public IPath getProgramPathInRuntimeFileSystem() throws CoreException {
+ return getProgramPathInBuildtimeFileSystem();
+ }
+
+ @Override
+ public IPath getWorkingDirectory() throws CoreException {
+ if (fSboxWorkingDirectory == null) {
+ IPath path = getOriginal().getWorkingDirectory();
+
+ assert(path != null);
+
+ try {
+ fSboxWorkingDirectory = convertToSboxPath(path);
+ } catch (ESboxException e) {
+ String msg = MessageFormat.format(
+ "The working directory ''{0}'' is not visible in scratchbox.",
+ path.toPortableString());
+ throw newCoreException(msg);
+ }
+ }
+
+ return fSboxWorkingDirectory;
+ }
+
+ /**
+ * Convert a path in host file system to a path in Scratchbox.
+ *
+ * @param p
+ * @return
+ * @throws ESboxException
+ */
+ protected IPath convertToSboxPath(IPath p) throws ESboxException {
+ if (fSDKTarget != null && p != null && p.isAbsolute()) {
+ p = fSDKTarget.convertHostToTargetPath(p);
+ }
+
+ return p;
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLocalLaunchProxy.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLocalLaunchProxy.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonLocalLaunchProxy.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 30, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.process.ProcessRunnerParameters;
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.maemo.esbox.launch.core.AbstractLocalLaunchProxy;
+import org.maemo.esbox.launch.core.ILaunchParameterAccessor;
+import org.maemo.esbox.python.launch.debug.PythonDebugger;
+
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @author LWang
+ *
+ */
+public class PythonLocalLaunchProxy extends AbstractLocalLaunchProxy {
+
+ private PythonLocalLaunchParameterAccessor fLPA;
+
+ /**
+ * @param configuration
+ * @throws CoreException - e.g. the underlying project is not ESbox project.
+ */
+ public PythonLocalLaunchProxy(ILaunchConfiguration configuration) throws CoreException {
+ super(configuration);
+
+ fLPA = new PythonLocalLaunchParameterAccessor(configuration);
+ }
+
+ public ILaunchParameterAccessor getLaunchParameterAccessor() {
+ return fLPA;
+ }
+
+ public String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+
+ @Override
+ public ProcessRunnerParameters createProgramLauncherParameters()
+ throws CoreException {
+ ProcessRunnerParameters info = super.createProgramLauncherParameters();
+
+ List<String> cmdLine = info.getCommandLine();
+
+ String interpreter = fLPA.getInterpreter();
+
+ cmdLine.add(0, interpreter);
+
+ // This will get env for the launch config, which may or may not include
+ // standard env vars based on the user option "Append environment to native environment"
+ // in Environment Tab.
+ Properties env = info.getEnvVars();
+
+ // setup PYTHONPATH
+ PythonDebugger.augmentEnvironment(fLPA.getProject(), fLPA.getSDKTarget(), env);
+
+ return info;
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonRemoteLaunchParameterAccessor.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonRemoteLaunchParameterAccessor.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonRemoteLaunchParameterAccessor.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 30, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.maemo.esbox.launch.*;
+import org.maemo.esbox.launch.core.IRemoteLaunchParameterAccessor;
+
+import java.text.MessageFormat;
+
+/**
+ * @author LWang
+ *
+ */
+public class PythonRemoteLaunchParameterAccessor
+ extends PythonLocalLaunchParameterAccessor
+ implements IRemoteLaunchParameterAccessor {
+
+ private ILaunchProtocol fProtocol = null;
+
+ private IPath fRemoteProgramPath;
+
+ private IPath fRemoteWorkingDir;
+
+ /**
+ * @param configuration
+ * @throws CoreException
+ */
+ public PythonRemoteLaunchParameterAccessor(
+ ILaunchConfiguration configuration) throws CoreException {
+ super(configuration);
+
+ fProtocol = LaunchProtocolFactory.getInstance().getLaunchProtocol(configuration);
+ }
+
+ public ILaunchProtocol getLaunchProtocol() {
+ return fProtocol;
+ }
+
+ // Get program path on remote target.
+ @Override
+ public IPath getProgramPathInRuntimeFileSystem() throws CoreException {
+ if (fRemoteProgramPath == null) {
+ // Get exe host path first
+ IPath exeHostPath = getProgramPathInHostFileSystem();
+
+ IPath devPath = fProtocol.getFileLocationOnTarget(exeHostPath);
+ if (devPath == null) {
+ String msg = MessageFormat.format(
+ "Cannot determine location of the module ''{0}'' on the target device.\n" +
+ "Please ensure it is downloaded to the target via the Download pane.",
+ exeHostPath);
+ Activator.getErrorLogger().logError(msg, null);
+ throw newCoreException(msg);
+ }
+
+ fRemoteProgramPath = devPath;
+ }
+
+ return fRemoteProgramPath;
+ }
+
+ @Override
+ public IPath getDefaultWorkingDirectory() throws CoreException {
+ // For remote launch, the default WD is path of the module on device.
+ //
+ IPath devPath = null;
+ try {
+ devPath = getProgramPathInRuntimeFileSystem();
+ }
+ catch (CoreException e) {
+ String msg = "Cannot determine the default working directory for the program.\n"+
+ "Reason: " + e.getLocalizedMessage();
+ Activator.getErrorLogger().logError(msg, null);
+ throw newCoreException(msg);
+ }
+ assert(devPath != null);
+
+ return devPath.removeLastSegments(1);
+ }
+
+ @Override
+ public IPath getWorkingDirectory() throws CoreException {
+ if (fRemoteWorkingDir == null) {
+
+ IPath path = getWorkingDirectoryFromUser();
+
+ if (path == null) {
+ // This will throw exception if default cannot be determined.
+ path = getDefaultWorkingDirectory();
+ assert(path != null);
+ }
+
+ // user specifies a path or we have default.
+ // Now we assume it's a path on remote device/machine. So no much validation can we do until
+ // we have access to the remote file system.
+ // Now we only require the path be absolute.
+ if (! path.isAbsolute()) {
+ String msg = MessageFormat.format(
+ "The working directory ''{0}'' on remote device is not absolute.",
+ path.toPortableString());
+
+ throw newCoreException(msg);
+ }
+
+ fRemoteWorkingDir = path;
+ }
+
+ return fRemoteWorkingDir;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.debug.core.IESboxLaunchParameterAccessor#getMachine()
+ */
+ public IMachine getMachine() {
+ return getLaunchProtocol().getDeviceMachine();
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonRemoteLaunchProxy.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonRemoteLaunchProxy.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/PythonRemoteLaunchProxy.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ling Wang (Nokia) - initial version. Jul 30, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.core.process.ProcessRunnerParameters;
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.maemo.esbox.launch.core.AbstractRemoteLaunchProxy;
+import org.maemo.esbox.launch.core.ILaunchParameterAccessor;
+import org.maemo.esbox.python.launch.debug.PythonDebugger;
+
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @author LWang
+ *
+ */
+public class PythonRemoteLaunchProxy extends AbstractRemoteLaunchProxy {
+
+ private PythonRemoteLaunchParameterAccessor fLPA;
+
+ /**
+ * @param configuration
+ * @throws CoreException - e.g. the underlying project is not ESbox project.
+ */
+ public PythonRemoteLaunchProxy(ILaunchConfiguration configuration) throws CoreException {
+ super(configuration);
+
+ fLPA = new PythonRemoteLaunchParameterAccessor(configuration);
+ }
+
+ @Override
+ public ProcessRunnerParameters createProgramLauncherParameters()
+ throws CoreException {
+ /* The code here is the same as that in {@link PythonLocalLaunchProxy}.
+ */
+ ProcessRunnerParameters info = super.createProgramLauncherParameters();
+
+ List<String> cmdLine = info.getCommandLine();
+
+ String interpreter = fLPA.getInterpreter();
+
+ cmdLine.add(0, interpreter);
+
+ // This will get env for the launch config, which may or may not include
+ // standard env vars based on the user option "Append environment to native environment"
+ // in Environment Tab.
+ Properties env = info.getEnvVars();
+
+ // setup PYTHONPATH
+ PythonDebugger.augmentEnvironment(fLPA.getProject(), fLPA.getSDKTarget(), env);
+
+ return info;
+ }
+
+ public ILaunchParameterAccessor getLaunchParameterAccessor() {
+ return fLPA;
+ }
+
+ public String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonDebugger.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonDebugger.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonDebugger.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,238 @@
+/******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Paulo Romulo (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Raul Herbster (UFCG)
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch.debug;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IProcess;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.process.*;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.python.launch.*;
+import org.python.pydev.debug.core.PydevDebugPlugin;
+import org.python.pydev.debug.model.PyDebugTarget;
+import org.python.pydev.debug.model.remote.RemoteDebugger;
+import org.python.pydev.debug.ui.launching.PythonRunnerConfig;
+
+import java.io.IOException;
+import java.net.SocketTimeoutException;
+import java.util.*;
+
+/**
+ * Python debugger.
+ */
+public class ESboxPythonDebugger extends PythonDebugger {
+
+ /**
+ * Singleton pattern.
+ */
+ protected static ESboxPythonDebugger instance;
+ private ISDKTarget sdkTarget;
+
+ /**
+ * Constructor.
+ * @throws CoreException
+ */
+ private ESboxPythonDebugger() {
+ super();
+ }
+
+ /**
+ * Returns a unique instance of ESboxPythonDebugger
+ */
+ public static PythonDebugger getInstance() {
+ if (instance == null) {
+ instance = new ESboxPythonDebugger();
+ }
+ return instance;
+ }
+
+ public void debugPython(IProject project, IPath exePath, String mode, ILaunch launch, ILaunchConfiguration config_, IProgressMonitor monitor) throws CoreException, IOException {
+
+ PythonLocalLaunchParameterAccessor myLPA = new PythonLocalLaunchParameterAccessor(config_);
+
+ // This should be true.
+ assert(exePath.equals(myLPA.getProgramPathInHostFileSystem()));
+
+ sdkTarget = myLPA.getSDKTarget();
+
+ // get a working copy of the configuration where we can properly map source files
+
+ ILaunchConfigurationWorkingCopy config = config_.getWorkingCopy();
+ setupSourceLocator(launch, config, project, sdkTarget);
+
+ PythonRunnerConfig pythonConfiguration;
+ pythonConfiguration = getPythonRunnerConfig(mode, config);
+
+ Properties env = myLPA.getEnvironmentAsProperty();
+
+ // setup PYTHONPATH
+ Map<IPath, IPath> pythonPathMappings = mapPythonPath(project, sdkTarget, env);
+ augmentEnvironment(pythonPathMappings, env);
+
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 5);
+ subMonitor.beginTask("Launching python", 1);
+
+ IPath exeInSb = myLPA.getProgramPathInRuntimeFileSystem();
+
+ // Figure out mappings of sources
+ Map<IPath, IPath> localToRemotePathMappings = new LinkedHashMap<IPath, IPath>();
+ try {
+ localToRemotePathMappings.put(project.getLocation(),
+ sdkTarget.convertHostToTargetPath(project.getLocation()));
+ } catch (ESboxException e) {
+ // allow this; it's an optimization
+ }
+
+ // the main file should map, at the very least
+ localToRemotePathMappings.put(exePath, exeInSb);
+
+ // now map PYTHONPATH
+ localToRemotePathMappings.putAll(pythonPathMappings);
+
+ // Copy the debug scripts over
+ IPath debugScriptLocation;
+ try {
+ debugScriptLocation = project.getLocation().removeLastSegments(1).append(DEBUG_FILES_LOC).append("python_debug_scripts");
+ debugScriptLocation = sdkTarget.convertHostToTargetPath(debugScriptLocation);
+
+ copyDebugScripts(
+ sdkTarget.getSDK().getMachine(),
+ localToRemotePathMappings,
+ sdkTarget.getTargetFileSystemAccess(),
+ debugScriptLocation, subMonitor);
+ } catch (Exception e) {
+ throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Cannot copy debug scripts to workspace", e));
+ }
+
+ // Launch & connect to the debugger
+ RemoteDebugger debugger = new RemoteDebugger(pythonConfiguration);
+ debugger.startConnect(subMonitor);
+ subMonitor.subTask("Constructing command_line...");
+
+ List<String> cmdLine = getCommandLine(config, pythonConfiguration, exeInSb, debugScriptLocation);
+
+ IProcessLauncherFactory factory = sdkTarget.getProcessLauncherFactory();
+
+ IPath wdInSb = myLPA.getWorkingDirectory();
+
+ ProcessLauncherParameters parameters = new ProcessLauncherParameters(
+ wdInSb, cmdLine, env);
+
+ ESboxLaunchUtils.updateForRunStandalone(sdkTarget,
+ config,
+ IESboxPythonLaunchConstants.ATTR_RUN_STANDALONE,
+ parameters);
+
+ IProcessLauncher launcher = ProcessLauncherCreator.createProcessLauncher(
+ factory, parameters);
+
+ Process proc;
+ try {
+ proc = launcher.createProcess();
+ } catch (ESboxException e) {
+ throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Cannot create process", e));
+ }
+
+ IProcess process = registerWithDebugPlugin(pythonConfiguration, launch, proc);
+
+ subMonitor.subTask("Waiting for connection...");
+ try {
+ boolean userCanceled = debugger.waitForConnect(subMonitor, proc, process);
+ if (userCanceled) {
+ debugger.dispose();
+ return;
+ }
+ }
+ catch (Exception ex) {
+ process.terminate();
+ proc.destroy();
+ String message = "Unexpected error setting up the debugger";
+ if (ex instanceof SocketTimeoutException)
+ message = "Timed out after " + Float.toString(pythonConfiguration.acceptTimeout/1000) + " seconds while waiting for python script to connect.";
+ throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, message, ex));
+ }
+ subMonitor.subTask("Done");
+ // hook up debug model, and we are off & running
+ PyDebugTarget t = new PyDebugTarget(launch, process, pythonConfiguration.resource, debugger);
+ debugger.startTransmission(); // this starts reading/writing from sockets
+ t.initialize();
+ t.addConsoleInputListener();
+ }
+
+
+ protected List<String> getCommandLine(ILaunchConfiguration configuration, PythonRunnerConfig pythonConfiguration,
+ IPath exePath, IPath debugScriptLocation) throws CoreException {
+
+ String clientIP = getClientIP(sdkTarget.getSDK().getMachine());
+ String[] vmArgumentsArray = PythonLaunchUtils.getVMArgumentsAsArray(configuration);
+ String programArguments = PythonLaunchUtils.getArguments(configuration);
+
+ List<String> cmdArgs = new ArrayList<String>();
+
+ /*
+ boolean isRunStandalone = configuration.getAttribute(IESboxPythonLaunchConstants.ATTR_RUN_STANDALONE,
+ ESboxScriptLauncher.getInstance().hasRunStandaloneScript(sdkTarget));
+
+ if (isRunStandalone) {
+ cmdArgs.add(ESboxScriptLauncher.getInstance().getStandaloneScriptName(sdkTarget));
+ }
+ */
+
+ if(vmArgumentsArray != null){
+ for (int i = 0; i < vmArgumentsArray.length; i++){
+ cmdArgs.add(vmArgumentsArray[i]);
+ }
+ }
+
+ String interpreter = configuration.getAttribute(IESboxPythonLaunchConstants.ATTR_INTERPRETER,
+ IESboxPythonLaunchConstants.ATTR_INTERPRETER_DEFAULT);
+
+ IPath scriptLocationInSb = debugScriptLocation.append("pydevd.py");
+
+ cmdArgs.add(interpreter);
+ cmdArgs.add(scriptLocationInSb.toPortableString());
+ cmdArgs.add("--vm_type");
+ cmdArgs.add("python");
+ cmdArgs.add("--client");
+ cmdArgs.add(clientIP);
+ cmdArgs.add("--port");
+ cmdArgs.add(Integer.toString(pythonConfiguration.getDebugPort()));
+ cmdArgs.add("--file");
+ cmdArgs.add(exePath.toPortableString());
+
+ String runArguments[] = null;
+ if (programArguments != null) {
+ String expanded = getStringVariableManager().performStringSubstitution(programArguments);
+ runArguments = PythonRunnerConfig.parseStringIntoList(expanded);
+ }
+
+ for (int i=0; runArguments != null && i<runArguments.length; i++){
+ cmdArgs.add(runArguments[i]);
+ }
+
+ return cmdArgs;
+ }
+
+
+ public String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonRemoteDebugger.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonRemoteDebugger.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonRemoteDebugger.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.debug;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IProcess;
+import org.maemo.esbox.core.process.ProcessLauncherParameters;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.maemo.esbox.launch.*;
+import org.maemo.esbox.python.launch.*;
+import org.python.pydev.debug.core.Constants;
+import org.python.pydev.debug.core.PydevDebugPlugin;
+import org.python.pydev.debug.model.PyDebugTarget;
+import org.python.pydev.debug.model.remote.RemoteDebugger;
+import org.python.pydev.debug.ui.launching.PythonRunnerConfig;
+
+import java.io.IOException;
+import java.net.SocketTimeoutException;
+import java.util.*;
+
+/**
+ *
+ */
+public class ESboxPythonRemoteDebugger extends PythonDebugger {
+
+
+ /**
+ * Singleton pattern.
+ */
+ protected static PythonDebugger instance;
+ private ISDKTarget sdkTarget;
+ private ILaunchProtocol protocol;
+
+ /**
+ * Constructor.
+ * @throws CoreException
+ */
+ private ESboxPythonRemoteDebugger() {
+ super();
+ }
+
+ /**
+ * Returns a unique instance of ESboxPythonDebugger
+ */
+ public static PythonDebugger getInstance() {
+ if (instance == null) {
+ instance = new ESboxPythonRemoteDebugger();
+ }
+ return instance;
+ }
+
+ public void debugPython(IProject project, IPath exePath, String mode, ILaunch launch, ILaunchConfiguration config_, IProgressMonitor monitor) throws CoreException, IOException {
+
+ PythonRemoteLaunchParameterAccessor myLPA = new PythonRemoteLaunchParameterAccessor(config_);
+
+ // This should be true.
+ assert(exePath.equals(myLPA.getProgramPathInHostFileSystem()));
+
+ sdkTarget = myLPA.getSDKTarget();
+
+ ILaunchConfigurationWorkingCopy config = config_.getWorkingCopy();
+
+ protocol = myLPA.getLaunchProtocol();
+
+ // for remote debug, the working directory doesn't apply, and we don't want pydev to complain, so clear it
+ config.setAttribute(Constants.ATTR_WORKING_DIRECTORY, "/");
+
+ Properties env = myLPA.getEnvironmentAsProperty();
+
+ // setup PYTHONPATH
+ Map<IPath, IPath> pythonPathMappings = mapPythonPath(project, sdkTarget, env);
+ augmentEnvironment(pythonPathMappings, env);
+
+
+ // in remote debug, need to map source directories: only handle the project directory
+ setupSourceLocator(launch, config, project, protocol);
+
+ PythonRunnerConfig pythonConfiguration = getPythonRunnerConfig(mode, config);
+
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 5);
+
+ // Figure out mappings of sources
+ Map<IPath, IPath> localToRemotePathMappings = new LinkedHashMap<IPath, IPath>();
+
+ // Add every file copied
+ Map<IPath, List<IPath>> targetFoldersForHostFileMappings = protocol.getTargetFoldersForHostFileMappings();
+ for (Map.Entry<IPath, List<IPath>> entry : targetFoldersForHostFileMappings.entrySet()) {
+ for (IPath hostFile : entry.getValue()) {
+ localToRemotePathMappings.put(hostFile, entry.getKey().append(hostFile.lastSegment()));
+ }
+ }
+
+ // now map PYTHONPATH, assuming (if anything) that the SDK is installed in
+ // the same place on device as in scratchbox (to allow debugging system files)
+ localToRemotePathMappings.putAll(pythonPathMappings);
+
+ IPath remoteDebugScriptLocation = protocol.getDeviceMachine().getUserHome().append(DEBUG_FILES_LOC).append("python_debug_scripts");
+
+ // Copy the debug scripts over
+ copyDebugScripts(
+ sdkTarget.getSDK().getMachine(),
+ localToRemotePathMappings,
+ protocol.getDeviceMachine().getFileSystemAccess(),
+ remoteDebugScriptLocation, subMonitor);
+
+ // Launch & connect to the debugger
+ RemoteDebugger debugger = new RemoteDebugger(pythonConfiguration);
+ debugger.startConnect(subMonitor);
+ subMonitor.subTask("Constructing command line...");
+
+ List<String> remoteCmdLine = getCommandLine(config, pythonConfiguration, exePath, remoteDebugScriptLocation);
+
+ monitor.subTask("Download files");
+ IStatus status = protocol.downloadFiles(new SubProgressMonitor(monitor, 50));
+ if (!status.isOK())
+ throw new CoreException(status);
+
+ IPath cwdPathRemote = myLPA.getWorkingDirectory();
+
+ Process proc = null;
+
+ ProcessLauncherParameters parameters = new ProcessLauncherParameters(
+ cwdPathRemote, remoteCmdLine, env);
+
+ monitor.subTask("Start program");
+ try {
+ proc = protocol.invokeRemoteCommand(parameters, false);
+ } catch (Exception e) {
+ abort(e.getMessage(), e, 0);
+ }
+
+ monitor.worked(30);
+
+ IProcess process = registerWithDebugPlugin(pythonConfiguration, launch, proc);
+
+ subMonitor.subTask("Waiting for connection...");
+ try {
+ boolean userCanceled = debugger.waitForConnect(subMonitor, proc, process);
+ if (userCanceled) {
+ debugger.dispose();
+ return;
+ }
+ }
+ catch (Exception ex) {
+ process.terminate();
+ proc.destroy();
+ String message = "Unexpected error setting up the debugger";
+ if (ex instanceof SocketTimeoutException)
+ message = "Timed out after " + Float.toString(pythonConfiguration.acceptTimeout/1000) + " seconds while waiting for python script to connect.";
+ throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, message, ex));
+ }
+ subMonitor.subTask("Done");
+ // hook up debug model, and we are off & running
+ PyDebugTarget t = new PyDebugTarget(launch, process, pythonConfiguration.resource, debugger);
+ debugger.startTransmission(); // this starts reading/writing from sockets
+ t.initialize();
+ t.addConsoleInputListener();
+ }
+
+ protected List<String> getCommandLine(ILaunchConfiguration configuration, PythonRunnerConfig pythonConfiguration,
+ IPath exePath, IPath debugScriptLocation) throws CoreException {
+
+ if (protocol == null)
+ return new ArrayList<String>();
+
+ String clientIP = getClientIP(protocol.getDeviceMachine());
+ String[] vmArgumentsArray = PythonLaunchUtils.getVMArgumentsAsArray(configuration);
+ String programArguments = PythonLaunchUtils.getArguments(configuration);
+
+ List<String> cmdArgs = new ArrayList<String>();
+
+ /*
+ boolean isRunStandalone = configuration.getAttribute(IESboxPythonLaunchConstants.ATTR_RUN_STANDALONE,
+ ESboxScriptLauncher.getInstance().hasRunStandaloneScript(sdkTarget));
+
+ if (isRunStandalone) {
+ cmdArgs.add(ESboxScriptLauncher.getInstance().getStandaloneScriptName(sdkTarget));
+ }
+ */
+
+ if(vmArgumentsArray != null){
+ for (int i = 0; i < vmArgumentsArray.length; i++){
+ cmdArgs.add(vmArgumentsArray[i]);
+ }
+ }
+
+ String interpreter = configuration.getAttribute(IESboxPythonLaunchConstants.ATTR_INTERPRETER,
+ IESboxPythonLaunchConstants.ATTR_INTERPRETER_DEFAULT);
+
+ IPath remoteExePath = protocol.getFileLocationOnTarget(exePath);
+
+ IPath scriptLocation = debugScriptLocation.append("pydevd.py");
+
+ cmdArgs.add(interpreter);
+ cmdArgs.add(scriptLocation.toPortableString());
+ cmdArgs.add("--vm_type");
+ cmdArgs.add("python");
+ cmdArgs.add("--client");
+ cmdArgs.add(clientIP);
+ cmdArgs.add("--port");
+ cmdArgs.add(Integer.toString(pythonConfiguration.getDebugPort()));
+ cmdArgs.add("--file");
+ cmdArgs.add(remoteExePath.toPortableString());
+
+ String runArguments[] = null;
+ if (programArguments != null) {
+ String expanded = getStringVariableManager().performStringSubstitution(programArguments);
+ runArguments = PythonRunnerConfig.parseStringIntoList(expanded);
+ }
+
+ for (int i=0; runArguments != null && i<runArguments.length; i++){
+ cmdArgs.add(runArguments[i]);
+ }
+
+ return cmdArgs;
+ }
+
+ public String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonSourceLocator.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonSourceLocator.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonSourceLocator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch.debug;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
+import org.eclipse.debug.ui.ISourcePresentation;
+import org.eclipse.ui.IEditorInput;
+import org.python.pydev.debug.model.PySourceLocator;
+import org.python.pydev.plugin.PydevPlugin;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ESboxPythonSourceLocator extends AbstractSourceLookupDirector implements ISourcePresentation {
+
+ private PySourceLocator pythonSourceLocator;
+
+ public ESboxPythonSourceLocator() {
+ this.pythonSourceLocator = new PySourceLocator();
+
+ }
+
+
+ public void initializeParticipants() {
+ addParticipants(new ISourceLookupParticipant[] { new ESboxPythonSourceLookupParticipant() });
+ }
+
+
+ public String getEditorId(IEditorInput input, Object element) {
+ return pythonSourceLocator.getEditorId(input, element);
+ }
+
+
+ public IEditorInput getEditorInput(Object element) {
+ if (element instanceof IResource) {
+ return PydevPlugin.createEditorInput(((IResource) element).getLocation());
+ }
+ return pythonSourceLocator.getEditorInput(element);
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonSourceLookupParticipant.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonSourceLookupParticipant.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/ESboxPythonSourceLookupParticipant.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch.debug;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
+import org.python.pydev.debug.model.PyStackFrame;
+
+/**
+ * This lookup participant is essentially the same as PySourceLocator.
+ * We expect our debugger to add a MappingSourceContainer to translate from
+ * the device to the host.
+ * @author eswartz
+ *
+ */
+public class ESboxPythonSourceLookupParticipant extends AbstractSourceLookupParticipant {
+
+ public String getSourceName(Object element) throws CoreException {
+ if (element instanceof PyStackFrame) {
+
+ IPath path = ((PyStackFrame)element).getPath();
+
+ if (path != null && !path.toString().startsWith("<")){
+ return path.toPortableString();
+ }
+
+ }
+ return null;
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/PythonDebugger.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/PythonDebugger.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/debug/PythonDebugger.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,316 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.debug;
+
+import org.eclipse.core.filesystem.*;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.variables.IStringVariableManager;
+import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IProcess;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.machine.*;
+
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.maemo.esbox.launch.ESboxDebuggerStatus;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.python.launch.IESboxPythonLaunchConstants;
+import org.maemo.esbox.python.launch.PydevDebugScriptCopier;
+import org.maemo.esbox.ssh.ISSHMachine;
+import org.python.pydev.core.IInterpreterManager;
+import org.python.pydev.debug.core.Constants;
+import org.python.pydev.debug.core.PydevDebugPlugin;
+import org.python.pydev.debug.model.PySourceLocator;
+import org.python.pydev.debug.ui.launching.InvalidRunException;
+import org.python.pydev.debug.ui.launching.PythonRunnerConfig;
+import org.python.pydev.plugin.PydevPlugin;
+import org.python.pydev.plugin.nature.PythonNature;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.*;
+
+/**
+ *
+ */
+public abstract class PythonDebugger {
+
+ protected final String DEBUG_FILES_LOC = ".esbox";
+
+ /**
+ * Constructor.
+ * @throws CoreException
+ */
+ protected PythonDebugger() {
+ }
+
+ protected IStringVariableManager getStringVariableManager() {
+ return VariablesPlugin.getDefault().getStringVariableManager();
+ }
+
+
+ /**
+ * Copy the pydev debug scripts to the device, under the user's home directory.
+ * @param pythonDebugMachine the machine where python + debugger runs (this is usually
+ * a local scratchbox)
+ * @param localToRemotePathMappings mappings from host Python files to remote Python files
+ * @param fileSystemAccess accessor to write contents to remote files
+ * @param debugScriptLocation the path on the target to which to copy files
+ * @param monitor progress monitor
+ * @return the path to the debug scripts, in a target-sensible format
+ */
+ protected void copyDebugScripts(
+ IMachine pythonDebugMachine,
+ Map<IPath, IPath> localToRemotePathMappings,
+ IFileSystemAccess fileSystemAccess,
+ IPath debugScriptLocation,
+ IProgressMonitor monitor) throws CoreException {
+
+ IStatus status;
+ File[] debugFiles;
+ try {
+ // first, copy files to a temporary path and apply edits
+ URL scriptLocation = PydevDebugPlugin.getDefault().getBundle().getEntry("pysrc");
+ PydevDebugScriptCopier copier = new PydevDebugScriptCopier();
+
+ copier.setLocalToRemotePathMappings(localToRemotePathMappings);
+
+ debugFiles = copier.extractAndModifyFiles(scriptLocation);
+ } catch (IOException e) {
+ throw new CoreException(new ESboxDebuggerStatus(e));
+ }
+
+ // now, copy those files to the target
+ status = downloadDebugFilesToTarget(
+ debugFiles,
+ fileSystemAccess, debugScriptLocation,
+ monitor);
+ if (!status.isOK())
+ throw new CoreException(status);
+ }
+
+ /**
+ * Copy script files to the target over EFS.
+ * @param hostScriptFiles
+ * @param targetFileSystemAccess
+ * @param targetScriptLocation
+ * @param monitor
+ * @return
+ * @throws CoreException
+ * @throws IOException
+ * @throws ESboxException
+ */
+ private IStatus downloadDebugFilesToTarget(File[] hostScriptFiles, IFileSystemAccess targetFileSystemAccess, IPath targetScriptLocation,
+ IProgressMonitor monitor) throws CoreException {
+ Map<IPath, List<IPath>> targetPathFiles = new HashMap<IPath, List<IPath>>();
+
+ List<IPath> hostFilePaths = new ArrayList<IPath>();
+ for (File hostScriptFile : hostScriptFiles) {
+ IFileStore hostFile = EFS.getLocalFileSystem().fromLocalFile(hostScriptFile);
+ IFileInfo hostFileInfo = hostFile.fetchInfo();
+ long moddate = hostFileInfo.getLastModified();
+ IFileStore targetFile = targetFileSystemAccess.getFileStore(targetScriptLocation.append(hostScriptFile.getName()));
+ IFileInfo fileInfo = targetFile.fetchInfo();
+
+ // note: we lose precision copying between Windows and Unix filesystems,
+ // so allow up a second of drift
+ if (!fileInfo.exists() || fileInfo.getLastModified() + 999 < moddate
+ || fileInfo.getLength() != hostFileInfo.getLength()) {
+ hostFilePaths.add(new Path(hostScriptFile.getAbsolutePath()));
+ }
+ }
+
+ targetPathFiles.put(targetScriptLocation, hostFilePaths);
+
+ return ESboxLaunchUtils.downloadFiles(targetFileSystemAccess, targetPathFiles, monitor);
+ }
+
+ /**
+ * The debug plugin needs to be notified about our process.
+ * It'll then display the appropriate UI.
+ * @throws JDTNotAvailableException
+ */
+ protected static IProcess registerWithDebugPlugin(PythonRunnerConfig config, ILaunch launch, Process p) {
+ Map<String, String> processAttributes = new HashMap<String, String>();
+ processAttributes.put(IProcess.ATTR_CMDLINE, config.getCommandLineAsString());
+ return registerWithDebugPlugin(config.resource.lastSegment(), launch, p, processAttributes);
+ }
+
+ /**
+ * The debug plugin needs to be notified about our process.
+ * It'll then display the appropriate UI.
+ */
+ protected static IProcess registerWithDebugPlugin(String label, ILaunch launch, Process p, Map<String, String> processAttributes) {
+ processAttributes.put(IProcess.ATTR_PROCESS_TYPE, Constants.PROCESS_TYPE);
+ processAttributes.put(IProcess.ATTR_PROCESS_LABEL, label);
+ processAttributes.put(DebugPlugin.ATTR_CAPTURE_OUTPUT, "true");
+ return DebugPlugin.newProcess(launch,p, label, processAttributes);
+ }
+
+ protected void abort(String message, Throwable exception, int code) throws CoreException {
+ MultiStatus status = new MultiStatus(getPluginID(), code, message, exception);
+ status.add(new Status(IStatus.ERROR, getPluginID(), code, exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
+ exception));
+ throw new CoreException(status);
+ }
+
+ public abstract String getPluginID();
+
+ public abstract void debugPython(IProject project, IPath exePath, String mode, ILaunch launch, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException, IOException;
+
+ protected void setupSourceLocator(ILaunch launch, ILaunchConfiguration config, IProject project, Object converter) throws CoreException {
+ launch.setSourceLocator(new PySourceLocator());
+ /*
+ ESboxPythonSourceLocator pythonSourceLocator = new ESboxPythonSourceLocator();
+ launch.setSourceLocator(pythonSourceLocator);
+ pythonSourceLocator.initializeDefaults(config);
+
+ IPath targetPath = project.getLocation();
+ IPath hostPath;
+ try {
+ if (converter instanceof ISDKTarget)
+ hostPath = ((ISDKTarget) converter).convertHostToTargetPath(targetPath);
+ else if (converter instanceof ILaunchProtocol)
+ hostPath = ((ILaunchProtocol) converter).getFileLocationOnTarget(targetPath.addTrailingSeparator());
+ else
+ throw new IllegalStateException("Unhandled converter type");
+ ESboxLaunchUtils.addSourceMappingToDirector(hostPath, targetPath, "SDK Target Mapping", pythonSourceLocator);
+ } catch (ESboxException e3) {
+ }
+ */
+ }
+
+ /**
+ * Get the mappings from host to target for entries in PYTHONPATH. This will silently
+ * accept conversion failures, with the assumption that the same path will exist on the
+ * host and target; check for getKey()==getEntry() to verify.
+ * @param project
+ * @param interpreter
+ * @param sdkTarget
+ * @param env
+ * @return Map of host to target paths for entries in PYTHONPATH for the project
+ */
+ public static Map<IPath, IPath> mapPythonPath(IProject project, ISDKTarget sdkTarget, Properties env) {
+ PythonNature pythonNature = PythonNature.getPythonNature(project);
+ if (pythonNature == null)
+ return Collections.EMPTY_MAP;
+
+ IInterpreterManager interpreterManager = PydevPlugin.getInterpreterManager(pythonNature);
+ String interpreter = interpreterManager.getDefaultInterpreter();
+
+ Map<IPath, IPath> map = new LinkedHashMap<IPath, IPath>();
+
+ List<String> pythonPaths = pythonNature.getPythonPathNature().getCompleteProjectPythonPath(interpreter);
+
+ if (pythonPaths != null) {
+ for (String element : pythonPaths) {
+ IPath hostPath = new Path(element);
+ try {
+ IPath targetPath = sdkTarget.convertHostToTargetPath(hostPath);
+ map.put(hostPath, targetPath);
+ } catch (ESboxException e) {
+ // not inside scratchbox; hope it's visible on target!
+ map.put(hostPath, hostPath);
+ }
+ }
+ }
+
+ return map;
+ }
+
+ /**
+ * Add necessary environment variables for a python launch. Converts the python path
+ * elements to target-side locations and appends entries to PYTHONPATH.
+ * @param project
+ * @param interpreter
+ * @param sdkTarget
+ * @param env
+ */
+ public static void augmentEnvironment(Map<IPath, IPath> pythonPathMappings, Properties env) {
+ StringBuilder builder = new StringBuilder();
+ for (Map.Entry<IPath, IPath> entry : pythonPathMappings.entrySet()) {
+ if (builder.length() > 0)
+ builder.append(':');
+ builder.append(entry.getValue().toPortableString());
+ }
+
+ String pythonPath = builder.toString();
+ try {
+ env.put("PYTHONPATH", pythonPath);
+ } catch (Exception e) {
+ Activator.getErrorLogger().logError("Cannot determine PYTHONPATH", e);
+ }
+ }
+
+ /**
+ * Add necessary environment variables for a python launch. Converts the python path
+ * elements to target-side locations and appends entries to PYTHONPATH.
+ * @param project
+ * @param sdkTarget
+ * @param env
+ */
+ public static void augmentEnvironment(IProject project, ISDKTarget sdkTarget, Properties env) {
+ PythonNature pythonNature = PythonNature.getPythonNature(project);
+ if (pythonNature == null)
+ return;
+
+ Map<IPath, IPath> localToTargetMappings = mapPythonPath(project, sdkTarget, env);
+ augmentEnvironment(localToTargetMappings, env);
+ }
+
+ /**
+ * Get the IP of the client machine (Eclipse)
+ * @param sdkTarget
+ * @return addresss
+ */
+ protected String getClientIP(IMachine pythonDebugMachine) {
+ String clientIP = IESboxPythonLaunchConstants.DEFAULT_LOCAL_HOST;
+
+ if (!MachineRegistry.getInstance().getLocalMachine().equals(pythonDebugMachine)) {
+ // XXX: fix this up, need a way to know the IP of the host from a remote machine and to distinguish a device machine from a build machine
+ if (pythonDebugMachine instanceof IDeviceMachine)
+ clientIP = "192.168.2.14";
+ else if (pythonDebugMachine instanceof IBuildMachine && pythonDebugMachine instanceof ISSHMachine)
+ clientIP = "10.0.2.2";
+ }
+ return clientIP;
+ }
+
+ /**
+ * Get the python runner config
+ * @param mode
+ * @param config
+ * @param pythonConfiguration
+ * @return
+ * @throws CoreException
+ */
+ protected PythonRunnerConfig getPythonRunnerConfig(String mode,
+ ILaunchConfigurationWorkingCopy config) throws CoreException {
+ PythonRunnerConfig pythonConfiguration;
+ try {
+ // XXX: the interpreter must be converted to the default one here or else
+ // pydev tries to locate the interpreter locally, which fails on non-Linux hosts
+ // (or hosts where scratchbox has a version the host doesn't have).
+ String originalInterpreter = config.getAttribute(Constants.ATTR_INTERPRETER, "");
+ config.setAttribute(Constants.ATTR_INTERPRETER, Constants.ATTR_INTERPRETER_DEFAULT);
+
+ pythonConfiguration = new PythonRunnerConfig(config, mode, PythonRunnerConfig.RUN_REGULAR);
+
+ config.setAttribute(Constants.ATTR_INTERPRETER, originalInterpreter);
+ } catch (InvalidRunException e1) {
+ throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Cannot create Python runner config", e1));
+ }
+ return pythonConfiguration;
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalLaunchShortcut.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalLaunchShortcut.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch.local;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.maemo.esbox.python.launch.*;
+
+
+/**
+ * @author Paulo Romulo - paulo at embedded dot ufcg dot com dot br
+ *
+ */
+public class ESboxPythonLocalLaunchShortcut extends AbstractLaunchShortcut {
+
+ @Override
+ protected String getLaunchConfigurationType() {
+ return IESboxPythonLaunchConstants.CONFIG_TYPE_MAEMOLOCAL;
+ }
+
+ @Override
+ protected void setDefaultForLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy config) throws CoreException {
+
+ PythonLaunchConfigurationData.setDefaults(config, IESboxPythonLaunchConstants.CONFIG_TYPE_MAEMOLOCAL);
+ }
+
+ @Override
+ public String createLaunchConfigurationName(String binFileName,
+ IProject project) throws CoreException {
+
+ // The launch config should work independent of sdkTarget.
+ // So the config name is like: "file (project LOCAL)"
+ String format = "{0} ({1} LOCAL)";
+
+ String configName = binFileName;
+
+ configName = MessageFormat.format(format, binFileName, project.getName());
+ /*
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(project.getProject());
+
+ if (sdkTarget != null) {
+ configName = MessageFormat.format(format, project.getName(), binFileName, sdkTarget.getName());
+ }
+ */
+ return configName;
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalRunConfigurationTabGroup.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalRunConfigurationTabGroup.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalRunConfigurationTabGroup.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch.local;
+
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.RefreshTab;
+import org.maemo.esbox.python.launch.*;
+import org.maemo.esbox.python.launch.ui.ArgumentsTab;
+import org.maemo.esbox.python.launch.ui.MainModuleTab;
+
+/**
+ * @author Paulo Romulo - paulo at embedded dot ufcg dot com dot br
+ * @author Raul Ferndandes Herbster (INdT)
+ * @author Ling Wang (Nokia)
+ * @author Ed Swartz (Nokia)
+ */
+public class ESboxPythonLocalRunConfigurationTabGroup extends ESboxAbstractPythonConfigurationTabGroup {
+
+ public void createTabs(ILaunchConfigurationDialog arg0, String arg1) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new MainModuleTab(),
+ new ArgumentsTab(),
+ new RefreshTab(),
+ new EnvironmentTab(),
+ new CommonTab() };
+ setTabs(tabs);
+ }
+
+ @Override
+ protected AbstractLaunchShortcut getLaunchShortcut() {
+ return new ESboxPythonLocalLaunchShortcut();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // This delegate to all tabs in the group by default
+ super.setDefaults(configuration);
+
+ PythonLaunchConfigurationData.setDefaults(configuration, IESboxPythonLaunchConstants.CONFIG_TYPE_MAEMOLOCAL);
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalRunLaunchDelegate.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalRunLaunchDelegate.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/local/ESboxPythonLocalRunLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+
+package org.maemo.esbox.python.launch.local;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.launch.core.ILaunchProxy;
+import org.maemo.esbox.python.launch.ESboxPythonAbstractLaunchDelegate;
+import org.maemo.esbox.python.launch.PythonLocalLaunchProxy;
+import org.maemo.esbox.python.launch.debug.ESboxPythonDebugger;
+import org.maemo.esbox.python.launch.debug.PythonDebugger;
+
+/**
+ *
+ */
+public class ESboxPythonLocalRunLaunchDelegate extends ESboxPythonAbstractLaunchDelegate {
+
+ private ILaunchProxy fLaunchProxy = null;
+
+ protected ILaunchProxy createLaunchProxy(ILaunchConfiguration configuration) throws CoreException {
+ return new PythonLocalLaunchProxy(configuration);
+ }
+
+ @Override
+ public boolean preLaunchCheck(ILaunchConfiguration configuration,
+ String mode, IProgressMonitor monitor) throws CoreException {
+
+ if (!super.preLaunchCheck(configuration, mode, monitor))
+ return false;
+
+ fLaunchProxy = createLaunchProxy(configuration);
+
+ return fLaunchProxy.preLaunchCheck(mode, monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.launch.ESboxAbstractLaunchDelegate#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public boolean finalLaunchCheck(ILaunchConfiguration configuration,
+ String mode, IProgressMonitor monitor) throws CoreException {
+
+ // ask super to do common check
+ if (!super.finalLaunchCheck(configuration, mode, monitor))
+ return false;
+
+ assert(configuration.equals(fLaunchProxy.getLaunchConfiguration()));
+
+ return fLaunchProxy.finalLaunchCheck(mode, monitor);
+ }
+
+
+ @Override
+ protected void runApplication(ILaunchConfiguration config, ILaunch launch,
+ IProgressMonitor monitor) throws CoreException {
+
+ assert(config.equals(fLaunchProxy.getLaunchConfiguration()));
+
+ fLaunchProxy.runApplication(launch, monitor);
+ }
+
+ @Override
+ protected PythonDebugger getDebugger() {
+ return ESboxPythonDebugger.getInstance();
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/ESboxPythonRemoteLaunchDelegate.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/ESboxPythonRemoteLaunchDelegate.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/ESboxPythonRemoteLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.remote;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.launch.core.ILaunchProxy;
+import org.maemo.esbox.python.launch.PythonRemoteLaunchProxy;
+import org.maemo.esbox.python.launch.debug.ESboxPythonRemoteDebugger;
+import org.maemo.esbox.python.launch.debug.PythonDebugger;
+import org.maemo.esbox.python.launch.local.ESboxPythonLocalRunLaunchDelegate;
+
+/**
+ *
+ */
+public class ESboxPythonRemoteLaunchDelegate extends ESboxPythonLocalRunLaunchDelegate {
+
+ @Override
+ protected ILaunchProxy createLaunchProxy(ILaunchConfiguration configuration)
+ throws CoreException {
+ return new PythonRemoteLaunchProxy(configuration);
+ }
+
+ @Override
+ protected PythonDebugger getDebugger() {
+ return ESboxPythonRemoteDebugger.getInstance();
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/ESboxPythonRemoteRunLaunchShortcut.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/ESboxPythonRemoteRunLaunchShortcut.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/ESboxPythonRemoteRunLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.remote;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jface.window.Window;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.LaunchProtocolFactory;
+import org.maemo.esbox.launch.ui.DownloadMethodSelectionDialog;
+import org.maemo.esbox.python.launch.*;
+import org.python.pydev.debug.core.Constants;
+
+import java.text.MessageFormat;
+
+/**
+ *
+ */
+public class ESboxPythonRemoteRunLaunchShortcut extends AbstractLaunchShortcut {
+
+ String fDownloadMethod = null;
+
+ @Override
+ protected String getLaunchConfigurationType() {
+ return IESboxPythonLaunchConstants.CONFIG_TYPE_MAEMOREMOTE;
+ }
+
+ @Override
+ protected void setDefaultForLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy config) throws CoreException {
+
+ PythonLaunchConfigurationData.setDefaults(config, IESboxPythonLaunchConstants.CONFIG_TYPE_MAEMOREMOTE);
+
+ if (fDownloadMethod != null) {
+ config.setAttribute(IESboxPythonLaunchConstants.ATTR_DOWNLOAD_METHOD, fDownloadMethod);
+ // in SSH mode, directory structure is different, so don't set up a working directory
+ if (LaunchProtocolFactory.isSSHProtocol(fDownloadMethod)) {
+ config.setAttribute(Constants.ATTR_WORKING_DIRECTORY, "");
+ }
+ }
+ }
+
+ @Override
+ public String createLaunchConfigurationName(String binFileName,
+ IProject project) throws CoreException {
+
+ fDownloadMethod = chooseDownloadMethod();
+ if (fDownloadMethod == null || fDownloadMethod.length() == 0)
+ throw new CoreException(Status.CANCEL_STATUS);
+
+ // binName (projectName SDKName DownloadMethodNaem)
+ String format = "{0} ({1} {2} {3})";
+
+ String configName = binFileName;
+ ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(project.getProject());
+
+ if (sdkTarget == null)
+ return configName;
+
+ configName = MessageFormat.format(format,
+ binFileName,
+ project.getName(),
+ sdkTarget.getName(),
+ fDownloadMethod.contains("SSH") ? "SSH" : "SBRSH");
+
+ return configName;
+ }
+
+ /**
+ * Dialog asking user to choose the download method for remote debug.
+ *
+ * @return String -- download method.
+ */
+ private String chooseDownloadMethod() {
+ DownloadMethodSelectionDialog dialog = new DownloadMethodSelectionDialog(getShell());
+ if (dialog.open() == Window.OK) {
+ Object[] result = dialog.getResult();
+ if(result.length > 0) {
+ return (String)result[0];
+ }
+ }
+ return null;
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/EsboxPythonRemoteRunConfigurationTabGroup.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/EsboxPythonRemoteRunConfigurationTabGroup.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/remote/EsboxPythonRemoteRunConfigurationTabGroup.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.remote;
+
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.*;
+import org.maemo.esbox.launch.ui.ESboxDownloadTab;
+import org.maemo.esbox.python.launch.*;
+import org.maemo.esbox.python.launch.ui.ArgumentsTab;
+import org.maemo.esbox.python.launch.ui.MainModuleTab;
+
+/**
+ *
+ */
+public class EsboxPythonRemoteRunConfigurationTabGroup extends ESboxAbstractPythonConfigurationTabGroup {
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog arg0, String arg1) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new MainModuleTab(),
+ new ArgumentsTab(),
+ new RefreshTab(),
+ new EnvironmentTab(),
+ new ESboxDownloadTab(),
+ new CommonTab() };
+ setTabs(tabs);
+ }
+
+ @Override
+ protected AbstractLaunchShortcut getLaunchShortcut() {
+ return new ESboxPythonRemoteRunLaunchShortcut();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // This delegate to all tabs in the group by default
+ super.setDefaults(configuration);
+
+ PythonLaunchConfigurationData.setDefaults(configuration, IESboxPythonLaunchConstants.CONFIG_TYPE_MAEMOREMOTE);
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ui/ArgumentsTab.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ui/ArgumentsTab.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ui/ArgumentsTab.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG)
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.esbox.launch.IESboxLaunchConfigurationConstants;
+import org.maemo.esbox.python.launch.IESboxPythonLaunchConstants;
+import org.python.pydev.debug.core.Constants;
+import org.python.pydev.plugin.PydevPlugin;
+
+import java.io.File;
+
+
+/**
+ * The main Python debug setup tab.
+ *
+ * <p>Interesting functionality: InterpreterEditor will try the verify the choice of an interpreter.
+ * <p>Getting the ModifyListener to display the proper error message was tricky
+ */
+public class ArgumentsTab extends AbstractLaunchConfigurationTab {
+
+ // Widgets
+ protected Text baseDirectoryField;
+
+ protected Text programArgumentField;
+
+ protected Text interpreterField;
+
+ protected Text vmArgumentsField;
+
+ // View constant
+ public static final String DEFAULT_INTERPRETER_NAME = "Default Interpreter";
+
+ protected ModifyListener modifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validate();
+ }
+ };
+
+ private boolean isLocalLaunch;
+
+ public ArgumentsTab() {
+
+ }
+
+ protected void validate() {
+ String errorMessage = null;
+
+ setErrorMessage(null);
+ setMessage(null);
+
+ String interpreter = interpreterField.getText();
+ if (interpreter.length() == 0) {
+ errorMessage = "No python interpreter is selected.";
+ }
+
+ if (errorMessage == null) {
+ // only check for local launch
+ if (isLocalLaunch) {
+ File file = new File(baseDirectoryField.getText());
+
+ if(!file.exists()){
+ errorMessage = "The directory in the Base Directory does not exist.";
+ } else if(!file.isDirectory()){
+ errorMessage = "The directory in the Base Directory is not actually a directory.";
+ }
+ }
+ }
+
+ setErrorMessage(errorMessage);
+ updateLaunchConfigurationDialog();
+ }
+
+
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ setControl(comp);
+ GridLayout gridLayout = new GridLayout ();
+ comp.setLayout (gridLayout);
+
+ GridData data = new GridData (GridData.FILL_HORIZONTAL);
+
+ Label label2 = new Label (comp, SWT.NONE);
+ label2.setText ("Base directory:");
+ label2.setLayoutData (data);
+
+ baseDirectoryField = new Text (comp, SWT.BORDER);
+ data = new GridData ();
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalSpan = 1;
+ data.verticalSpan = 2;
+ baseDirectoryField.setLayoutData (data);
+ baseDirectoryField.addModifyListener(modifyListener);
+ baseDirectoryField.setLayoutData(data);
+
+ Label label4 = new Label (comp, SWT.NONE);
+ data = new GridData (GridData.FILL_HORIZONTAL);
+ label4.setText ("Program Arguments:");
+ label4.setLayoutData (data);
+
+ programArgumentField = new Text (comp, SWT.BORDER | SWT.MULTI);
+ data = new GridData ();
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalSpan = 1;
+ data.verticalSpan = 2;
+ programArgumentField.setLayoutData (data);
+ programArgumentField.addModifyListener(modifyListener);
+
+ Label label6 = new Label (comp, SWT.NONE);
+ label6.setText ("Interpreter:");
+ data = new GridData (GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ label6.setLayoutData (data);
+
+ interpreterField = new Text (comp, SWT.BORDER | SWT.MULTI);
+ interpreterField.setEditable(true);
+ data = new GridData ();
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = 2;
+ interpreterField.setLayoutData (data);
+ interpreterField.addModifyListener(modifyListener);
+
+ //label
+ Label l3 = new Label(comp,SWT.None);
+ l3.setText("VM arguments (for python.exe or java.exe): ");
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ l3.setLayoutData(data);
+
+ //Text of the Arguments
+ vmArgumentsField = new Text(comp, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.WRAP);
+ data = new GridData();
+ data.grabExcessHorizontalSpace = true;
+ data.grabExcessVerticalSpace = true;
+ data.horizontalAlignment = SWT.FILL;
+ data.verticalAlignment = SWT.FILL;
+ data.horizontalSpan = 2;
+ data.verticalSpan = 5;
+ vmArgumentsField.setLayoutData(data);
+ vmArgumentsField.addModifyListener(modifyListener);
+ }
+
+ /**
+ * this is the name that will appear to the user
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return "Arguments";
+ }
+
+ public void setDefaults(ILaunchConfigurationWorkingCopy arg0) {
+ //no defaults to set
+ }
+
+ /**
+ * Initializes widgets from ILaunchConfiguration
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration conf) {
+ String baseDirectory = "";
+ String interpreter = "";
+ String arguments = "";
+ String vmArguments = "";
+ String downloadMethod = "";
+
+ try {
+ baseDirectory = conf.getAttribute(Constants.ATTR_WORKING_DIRECTORY, "");
+ interpreter = conf.getAttribute(IESboxPythonLaunchConstants.ATTR_INTERPRETER, IESboxPythonLaunchConstants.ATTR_INTERPRETER_DEFAULT);
+ vmArguments = conf.getAttribute(Constants.ATTR_VM_ARGUMENTS,"");
+ arguments = conf.getAttribute(Constants.ATTR_PROGRAM_ARGUMENTS, "");
+
+ downloadMethod = conf.getAttribute(IESboxLaunchConfigurationConstants.ATTR_DOWNLOAD_METHOD, "");
+ }
+ catch (CoreException e) {
+ }
+
+ vmArgumentsField.setText(vmArguments);
+ baseDirectoryField.setText(baseDirectory);
+ programArgumentField.setText(arguments);
+ interpreterField.setText(interpreter);
+
+ isLocalLaunch = (downloadMethod.length() == 0);
+ }
+
+ /**
+ * save the values
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy conf) {
+ String value;
+
+ value = baseDirectoryField.getText().trim();
+ setAttribute(conf, Constants.ATTR_WORKING_DIRECTORY, value);
+
+ value = programArgumentField.getText().trim();
+ setAttribute(conf, Constants.ATTR_PROGRAM_ARGUMENTS, value);
+
+ value = vmArgumentsField.getText().trim();
+ setAttribute(conf, Constants.ATTR_VM_ARGUMENTS, value);
+
+ value = interpreterField.getText().trim();
+ setAttribute(conf, IESboxPythonLaunchConstants.ATTR_INTERPRETER, value);
+
+ }
+
+ /**
+ * sets attributes in the working copy
+ */
+ private void setAttribute(ILaunchConfigurationWorkingCopy conf, String name, String value) {
+ if (value == null || value.length() == 0){
+ conf.setAttribute(name, (String)null);
+ }else{
+ conf.setAttribute(name, value);
+ }
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ public Image getImage() {
+ return PydevPlugin.getImageCache().get(Constants.MAIN_ICON);
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ui/MainModuleTab.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ui/MainModuleTab.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch/src/org/maemo/esbox/python/launch/ui/MainModuleTab.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,396 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.ui;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+import org.maemo.esbox.internal.python.launch.Activator;
+import org.maemo.esbox.python.launch.IESboxPythonLaunchConstants;
+import org.maemo.esbox.python.project.core.ESboxPythonProjectNature;
+import org.python.pydev.debug.core.Constants;
+import org.python.pydev.navigator.elements.IWrappedResource;
+import org.python.pydev.plugin.PydevPlugin;
+import org.python.pydev.ui.dialogs.PythonModulePickerDialog;
+
+import java.io.File;
+
+/**
+ * Tab where user chooses project and Python module for launch
+ *
+ * <p>
+ * Also show PYTHONPATH information
+ * </p>
+ *
+ * TODO: Fix project chooser. It allows to select folders.
+ *
+ * TODO: Fix code completion job scheduling problem with this tab.
+ * Show progress dialog when ASTManager and thus PYTHONPATH information
+ * is not yet available.
+ *
+ * @author Mikko Ohtamaa
+ *
+ */
+public class MainModuleTab extends AbstractLaunchConfigurationTab {
+
+ WidgetListener widgetListener = new WidgetListener();
+
+ protected ModifyListener modifyListener = new ModifyListener() {
+ public void modifyText(final ModifyEvent _event) {
+ if(_event.getSource() == mainModuleText){
+ validate();
+ }
+ }
+ };
+
+ private Text projectText, mainModuleText;
+
+ private Button browseProjectButton, browseModuleButton;
+
+ protected Button fRunStandaloneButton;
+
+ public MainModuleTab() {
+ }
+
+ protected void validate() {
+ String errorMessage = null;
+
+ setErrorMessage(null);
+ setMessage(null);
+
+ // validate project
+ browseModuleButton.setEnabled(false);
+
+ IWorkspace w = ResourcesPlugin.getWorkspace();
+ String projectName = projectText.getText();
+ IProject project = null;
+ if (projectName.length() > 0)
+ project = w.getRoot().getProject(projectName);
+
+ if (project == null) {
+ errorMessage = "No project is specified.";
+ } else if (!project.exists()) {
+ errorMessage = "Project does not exist.";
+ } else {
+ boolean isESboxProject = ESboxPythonProjectNature.isNatureInProject(project);
+ if(!isESboxProject){
+ errorMessage = "The selected project is not an ESbox Python project.";
+ } else {
+ // valid project allows selecting a module
+ browseModuleButton.setEnabled(true);
+ }
+ }
+
+
+ // validate main module
+ if (errorMessage == null) {
+ File file = new File(mainModuleText.getText());
+ if(!file.isFile()){
+ errorMessage = "The file in the Main Module does not exist.";
+ }
+ }
+
+ setErrorMessage(errorMessage);
+ updateLaunchConfigurationDialog();
+
+ }
+
+ /**
+ * creates the widgets
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(final Composite _parent) {
+ Composite composite = new Composite(_parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout ();
+
+ super.setControl(composite);
+ gridLayout.numColumns = 1;
+ composite.setLayout(gridLayout);
+
+ this.createProjectEditor(composite);
+
+ // TODO: replace with actual script name
+ fRunStandaloneButton = createCheckButton(composite, "Run with \"run-standalone.sh\" script"); //$NON-NLS-1$
+ }
+
+ /**
+ * ok, choose project button just pressed
+ */
+ public void handleProjectButtonSelected() {
+ IProject project = this.chooseProject();
+ if (project == null) {
+ return;
+ }
+
+ projectText.setText(project.getName());
+ }
+
+ public void setDefaults(final ILaunchConfigurationWorkingCopy _configuration) {
+ Object element = getContext(_configuration);
+ //_configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
+ initializeProject(element,_configuration);
+ }
+
+ protected void initializeProject(Object element, ILaunchConfigurationWorkingCopy config) {
+ IResource resource = null;
+ if (element instanceof IWrappedResource) {
+ IWrappedResource wrappedResource = ((IWrappedResource)element);
+ resource = (IResource)wrappedResource.getActualObject();
+ } else if (element instanceof IResource) {
+ resource = (IResource)element;
+ } else {
+ return;
+ }
+ IProject project = resource.getProject();
+ String name = null;
+ if (project != null && project.exists())
+ name = project.getName();
+ //config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, name);
+ config.setAttribute(Constants.ATTR_PROJECT, name);
+
+ if (resource instanceof IFile) {
+ String fileExtension = ((IFile)resource).getFileExtension();
+ if (fileExtension.endsWith("py") || fileExtension.endsWith("pyw")) {
+ IPath pythonScriptPath = resource.getLocation();
+ String pythonScriptLocation = pythonScriptPath.toPortableString();
+ config.setAttribute(Constants.ATTR_LOCATION, pythonScriptLocation);
+ //config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, pythonScriptLocation);
+ }
+ }
+
+ }
+
+ protected Object getContext(ILaunchConfiguration config) {
+ String projectName = null;
+ IWorkbenchPage page = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ Object obj = null;
+ try {
+ //projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
+ projectName = config.getAttribute(Constants.ATTR_PROJECT, (String)null);
+ } catch (CoreException e) {
+ }
+ if (projectName != null && !projectName.equals("")) { //$NON-NLS-1$
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project != null && project.exists()) {
+ obj = project;
+ }
+ } else {
+ if (page != null) {
+ ISelection selection = page.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ if (!ss.isEmpty()) {
+ obj = ss.getFirstElement();
+ }
+ }
+ }
+ }
+ return obj;
+ }
+
+ public void initializeFrom(final ILaunchConfiguration _configuration) {
+ try {
+ String location = _configuration.getAttribute(Constants.ATTR_LOCATION, "");
+ mainModuleText.setText(location);
+ } catch(CoreException e) {
+ mainModuleText.setText("");
+ }
+
+ try {
+ projectText.setText(_configuration.getAttribute(Constants.ATTR_PROJECT, ""));
+ } catch (CoreException e) {
+ projectText.setText("");
+ }
+
+ fRunStandaloneButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ try {
+ fRunStandaloneButton.setSelection(_configuration.getAttribute(IESboxPythonLaunchConstants.ATTR_RUN_STANDALONE, true));
+ } catch (CoreException e) {
+ fRunStandaloneButton.setSelection(true);
+ }
+ }
+
+ public void performApply(final ILaunchConfigurationWorkingCopy _conf) {
+ String value;
+ value = projectText.getText().trim();
+ this.setAttribute(_conf, Constants.ATTR_PROJECT, value);
+ //this.setAttribute(_conf, ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, value);
+ this.setAttribute(_conf, Constants.ATTR_RESOURCE_TYPE, Integer.toString(IResource.FILE));
+
+ value = mainModuleText.getText().trim();
+ this.setAttribute(_conf, Constants.ATTR_LOCATION, value);
+ //this.setAttribute(_conf, ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, value);
+
+ _conf.setAttribute(IESboxPythonLaunchConstants.ATTR_RUN_STANDALONE, fRunStandaloneButton.getSelection());
+ }
+
+
+ /**
+ * the name for this tab
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return "Main";
+ }
+
+ /**
+ * make a dialog and return a project (does no validation) and may return null.
+ */
+ private IProject chooseProject() {
+ ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), null, false, "Choose the project for the run");
+ dialog.open();
+ Object[] objects = dialog.getResult();
+ if(objects != null && objects.length == 1){
+ if(objects[0] instanceof IPath){
+ IPath p = (IPath) objects[0];
+ if(p.segmentCount() > 0){
+ String string = p.segment(0);
+ IWorkspace w = ResourcesPlugin.getWorkspace();
+ return w.getRoot().getProject(string);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Creates the widgets for specifying a main type.
+ *
+ * @param parent the parent composite
+ */
+ private void createProjectEditor(final Composite parent) {
+ Font font= parent.getFont();
+ Group group= new Group(parent, SWT.NONE);
+ group.setText("Project");
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ group.setLayoutData(gd);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ group.setLayout(layout);
+ group.setFont(font);
+
+ // Project chooser
+ projectText = new Text(group, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ projectText.setLayoutData(gd);
+ projectText.setFont(font);
+ projectText.addModifyListener(widgetListener);
+
+ browseProjectButton = createPushButton(group, "Browse...", null); //$NON-NLS-1$
+ browseProjectButton.addSelectionListener(widgetListener);
+
+ // Main module group
+ group= new Group(parent, SWT.NONE);
+ group.setText("Main Module");
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ group.setLayoutData(gd);
+ layout = new GridLayout();
+ layout.numColumns = 2;
+ group.setLayout(layout);
+ group.setFont(font);
+
+ // Main module chooser
+ mainModuleText = new Text (group, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ mainModuleText.setLayoutData (gd);
+ mainModuleText.setFont(font);
+ mainModuleText.addModifyListener(modifyListener);
+
+ browseModuleButton = createPushButton(group, "Browse...", null);
+ browseModuleButton.setText("Browse");
+ browseModuleButton.setEnabled(false);
+ browseModuleButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ IProject project = getProjectFromTextWidget();
+ PythonModulePickerDialog dialog = new PythonModulePickerDialog(
+ parent.getShell(),
+ "Main Module",
+ "Choose Python module which starts execution",
+ project);
+ int result = dialog.open();
+
+ if(result == PythonModulePickerDialog.OK) {
+ Object results[] = dialog.getResult();
+ //System.out.println("Results:" + results.length);
+ if(results.length == 1) {
+ IFile file = (IFile) results[0];
+ mainModuleText.setText(file.getRawLocation().toPortableString());
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * sets attributes in the working copy
+ */
+ private void setAttribute(final ILaunchConfigurationWorkingCopy _conf, final String _name, final String _value) {
+ if (_value == null || _value.length() == 0){
+ _conf.setAttribute(_name, (String)null);
+ } else {
+ _conf.setAttribute(_name, _value);
+ }
+ }
+
+ /**
+ * @return
+ */
+ private IProject getProjectFromTextWidget() {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IResource project = workspace.getRoot().findMember(projectText.getText());
+ if(project instanceof IProject){
+ return (IProject) project;
+ }
+ return null;
+ }
+
+ @Override
+ public Image getImage() {
+ return PydevPlugin.getImageCache().get(Constants.MAIN_ICON);
+ }
+
+ /** Listener for project and browse buttons only */
+ private class WidgetListener extends SelectionAdapter implements ModifyListener, SelectionListener {
+
+ public void modifyText(final ModifyEvent _event) {
+ validate();
+ }
+
+ public void widgetSelected(final SelectionEvent _event) {
+ Object source = _event.getSource();
+ if (source == browseProjectButton) {
+ handleProjectButtonSelected();
+ }
+ validate();
+ }
+
+ }
+}
Property changes on: trunk/python/org.maemo.esbox.python.launch.analysis
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/python/org.maemo.esbox.python.launch.analysis/.classpath
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/.classpath (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/python/org.maemo.esbox.python.launch.analysis/.project
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.python.launch.analysis</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python.launch.analysis/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:33:33 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/python/org.maemo.esbox.python.launch.analysis/META-INF/MANIFEST.MF
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/META-INF/MANIFEST.MF (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Python Analysis Launch Plug-in
+Bundle-SymbolicName: org.maemo.esbox.python.launch.analysis;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.python.launch.analysis.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.python.launch;bundle-version="1.5.0",
+ org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.eclipse.debug.ui;bundle-version="3.4.0",
+ org.python.pydev.core;bundle-version="0.9.7",
+ org.python.pydev.debug;bundle-version="0.9.7",
+ org.python.pydev;bundle-version="0.9.7",
+ org.eclipse.ui.ide;bundle-version="3.4.0",
+ org.maemo.esbox.python.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.analysis.launch;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.python.launch.analysis.oprofile,
+ org.maemo.esbox.python.launch.analysis.oprofile.ui,
+ org.maemo.esbox.python.launch.analysis.valgrind
Added: trunk/python/org.maemo.esbox.python.launch.analysis/build.properties
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/build.properties (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
Added: trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/local_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/local_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/oprofile_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/oprofile_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/remote_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/remote_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/valgrind_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/python/org.maemo.esbox.python.launch.analysis/icons/full/obj16/valgrind_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/python/org.maemo.esbox.python.launch.analysis/plugin.xml
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/plugin.xml (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ delegate="org.maemo.esbox.python.launch.analysis.oprofile.OProfilePythonLaunchDelegate"
+ id="esboxPythonOProfileLaunchType"
+ modes="run"
+ name="Remote OProfile Profiler (Python)"
+ public="true">
+ </launchConfigurationType>
+ <launchConfigurationType
+ delegate="org.maemo.esbox.python.launch.analysis.valgrind.ValgrindPythonLaunchDelegate"
+ id="esboxPythonValgrindLaunchType"
+ modes="run"
+ name="Local Valgrind Profiler (Python)"
+ public="true">
+ </launchConfigurationType>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ configTypeID="esboxPythonOProfileLaunchType"
+ icon="icons/full/obj16/oprofile_obj.png"
+ id="esboxPythonOProfileLaunchTypeImage">
+ </launchConfigurationTypeImage>
+ <launchConfigurationTypeImage
+ configTypeID="esboxPythonValgrindLaunchType"
+ icon="icons/full/obj16/valgrind_obj.png"
+ id="esboxPythonValgrindLaunchTypeImage">
+ </launchConfigurationTypeImage>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ class="org.maemo.esbox.python.launch.analysis.oprofile.OProfilePythonLaunchConfigurationTabGroup"
+ id="esboxPythonOProfileLaunchTabGroup"
+ type="esboxPythonOProfileLaunchType">
+ </launchConfigurationTabGroup>
+ <launchConfigurationTabGroup
+ class="org.maemo.esbox.python.launch.analysis.valgrind.ValgrindPythonLaunchConfigurationTabGroup"
+ id="esboxPythonValgrindLaunchTabGroup"
+ type="esboxPythonValgrindLaunchType">
+ </launchConfigurationTabGroup>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchShortcuts">
+ <shortcut
+ class="org.maemo.esbox.python.launch.analysis.valgrind.ValgrindPythonLaunchShortcut"
+ icon="icons/full/obj16/valgrind_obj.png"
+ id="valgrindPythonShortcut"
+ label="Local Valgrind Profiler (Python)"
+ modes="run">
+ <contextualLaunch>
+ <enablement>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <and>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.python.isPyDevProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isEmulatorTarget">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isX86Target">
+ </test>
+ <or>
+ <test
+ property="org.eclipse.debug.ui.matchesPattern"
+ value="*.py">
+ </test>
+ <test
+ property="org.eclipse.debug.ui.matchesPattern"
+ value="*.pyw">
+ </test>
+ </or>
+ </and>
+ </iterate>
+ </with>
+ </enablement>
+ <contextLabel
+ label="Local Valgrind Profiler"
+ mode="run">
+ </contextLabel>
+ </contextualLaunch>
+ </shortcut>
+ <shortcut
+ class="org.maemo.esbox.python.launch.analysis.oprofile.OProfilePythonLaunchShortcut"
+ icon="icons/full/obj16/oprofile_obj.png"
+ id="oprofilePythonShortcut"
+ label="Remote OProfile Profiler (Python)"
+ modes="run">
+ <contextualLaunch>
+ <enablement>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <and>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.python.isPyDevProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isRemoteTarget">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.maemo.esbox.maemosdk.isARMELTarget">
+ </test>
+ <or>
+ <test
+ property="org.eclipse.debug.ui.matchesPattern"
+ value="*.py">
+ </test>
+ <test
+ property="org.eclipse.debug.ui.matchesPattern"
+ value="*.pyw">
+ </test>
+ </or>
+ </and>
+ </iterate>
+ </with>
+ </enablement>
+ <contextLabel
+ label="Remote OProfile Profiler"
+ mode="run">
+ </contextLabel>
+ </contextualLaunch>
+ </shortcut>
+ </extension>
+</plugin>
Added: trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal/python/launch/analysis/Activator.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal/python/launch/analysis/Activator.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/internal/python/launch/analysis/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,133 @@
+package org.maemo.esbox.internal.python.launch.analysis;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+import org.python.pydev.core.bundle.*;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.python.launch.analysis";
+
+ // The shared instance
+ private static Activator plugin;
+
+ private static BundleInfo info;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ public static ImageCache getImageCache(){
+ return getBundleInfo().getImageCache();
+ }
+
+ public static IBundleInfo getBundleInfo(){
+ if(info == null){
+ info = new BundleInfo(getDefault().getBundle());
+ }
+ return info;
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchConfigurationTabGroup.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchConfigurationTabGroup.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchConfigurationTabGroup.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.analysis.oprofile;
+
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.maemo.esbox.launch.ui.ESboxDownloadTab;
+import org.maemo.esbox.python.launch.*;
+import org.maemo.esbox.python.launch.ui.ArgumentsTab;
+import org.maemo.esbox.python.launch.ui.MainModuleTab;
+
+/**
+ *
+ */
+public class OProfilePythonLaunchConfigurationTabGroup extends ESboxAbstractPythonConfigurationTabGroup {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new MainModuleTab(),
+ new ArgumentsTab(),
+ new EnvironmentTab(),
+ new ESboxDownloadTab()};
+ setTabs(tabs);
+ }
+
+ @Override
+ protected AbstractLaunchShortcut getLaunchShortcut() {
+ return new OProfilePythonLaunchShortcut();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // This delegate to all tabs in the group by default
+ super.setDefaults(configuration);
+
+ PythonLaunchConfigurationData.setDefaults(configuration, IESboxPythonLaunchConstants.CONFIG_TYPE_OPROFILE);
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchDelegate.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchDelegate.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ * Ling Wang (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.analysis.oprofile;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.analysis.launch.OProfileRemoteLaunchProxy;
+import org.maemo.esbox.launch.core.ILaunchProxy;
+import org.maemo.esbox.python.launch.PythonRemoteLaunchProxy;
+import org.maemo.esbox.python.launch.remote.ESboxPythonRemoteLaunchDelegate;
+
+public class OProfilePythonLaunchDelegate extends ESboxPythonRemoteLaunchDelegate {
+
+ @Override
+ protected ILaunchProxy createLaunchProxy(ILaunchConfiguration configuration) throws CoreException {
+ ILaunchProxy appLaunchProxy = new PythonRemoteLaunchProxy(configuration);
+
+ return new OProfileRemoteLaunchProxy(configuration, appLaunchProxy);
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchShortcut.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchShortcut.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/OProfilePythonLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.analysis.oprofile;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.maemo.esbox.python.launch.*;
+
+/**
+ *
+ */
+public class OProfilePythonLaunchShortcut extends AbstractLaunchShortcut {
+
+ @Override
+ protected String getLaunchConfigurationType() {
+ return IESboxPythonLaunchConstants.CONFIG_TYPE_OPROFILE;
+ }
+
+ @Override
+ protected void setDefaultForLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy config) throws CoreException {
+ PythonLaunchConfigurationData.setDefaults(config, IESboxPythonLaunchConstants.CONFIG_TYPE_OPROFILE);
+ }
+
+ @Override
+ public String createLaunchConfigurationName(String binFileName,
+ IProject project) {
+
+ String format = "{0} {1} (OProfile)";
+
+ String configName = MessageFormat.format(format, project.getName(), binFileName);
+
+ return configName;
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/ui/OProfileMainTab.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/ui/OProfileMainTab.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/oprofile/ui/OProfileMainTab.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,331 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.analysis.oprofile.ui;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+import org.maemo.esbox.internal.python.launch.analysis.Activator;
+import org.maemo.esbox.python.launch.IESboxPythonLaunchConstants;
+import org.maemo.esbox.python.project.core.ESboxPythonProjectNature;
+import org.python.pydev.debug.core.Constants;
+import org.python.pydev.ui.dialogs.PythonModulePickerDialog;
+
+import java.io.File;
+
+/**
+ *
+ */
+public class OProfileMainTab extends AbstractLaunchConfigurationTab {
+
+ WidgetListener widgetListener = new WidgetListener();
+
+ protected ModifyListener modifyListener = new ModifyListener() {
+ public void modifyText(final ModifyEvent _event) {
+ validate();
+ }
+ };
+
+ private Text projectText, mainModuleText;
+
+ private Button browseProjectButton, browseModuleButton;
+
+ protected Button fRunStandaloneButton;
+
+ protected Button fCopyBinsButton;
+
+ public OProfileMainTab() {
+ }
+
+ protected void validate() {
+ String errorMessage = null;
+
+ setErrorMessage(null);
+ setMessage(null);
+
+ // validate project
+ browseModuleButton.setEnabled(false);
+
+ IWorkspace w = ResourcesPlugin.getWorkspace();
+ String projectName = projectText.getText();
+ IProject project = null;
+ if (projectName.length() > 0)
+ project = w.getRoot().getProject(projectName);
+
+ if (project == null) {
+ errorMessage = "No project is specified.";
+ } else if (!project.exists()) {
+ errorMessage = "Project does not exist.";
+ } else {
+ boolean isESboxProject = ESboxPythonProjectNature.isNatureInProject(project);
+ if(!isESboxProject){
+ errorMessage = "The selected project is not an ESbox Python project.";
+ } else {
+ // valid project allows selecting a module
+ browseModuleButton.setEnabled(true);
+ }
+ }
+
+
+ // validate main module
+ if (errorMessage == null) {
+ File file = new File(mainModuleText.getText());
+ if(!file.isFile()){
+ errorMessage = "The file in the Main Module does not exist.";
+ }
+ }
+
+ setErrorMessage(errorMessage);
+ updateLaunchConfigurationDialog();
+
+ }
+
+ /**
+ * creates the widgets
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite _parent) {
+ Composite composite = new Composite(_parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout ();
+
+ super.setControl(composite);
+ gridLayout.numColumns = 1;
+ composite.setLayout(gridLayout);
+
+ this.createProjectEditor(composite);
+
+ fRunStandaloneButton = createCheckButton(composite, "Run with \"run-standalone.sh\" script");
+ fCopyBinsButton = createCheckButton(composite, "Copy binary to local mount point");
+ }
+
+ /**
+ * ok, choose project button just pressed
+ */
+ public void handleProjectButtonSelected() {
+ IProject project = this.chooseProject();
+ if (project == null) {
+ return;
+ }
+
+ projectText.setText(project.getName());
+
+ validate();
+ }
+
+ public void setDefaults(final ILaunchConfigurationWorkingCopy _configuration) {
+ //Default values are being defined at the method initializeFrom.
+ }
+
+ public void initializeFrom(final ILaunchConfiguration _configuration) {
+ try {
+ String location = _configuration.getAttribute(Constants.ATTR_LOCATION, "");
+ mainModuleText.setText(location);
+ } catch(CoreException e) {
+ mainModuleText.setText("");
+ }
+
+ try {
+ projectText.setText(_configuration.getAttribute(Constants.ATTR_PROJECT, ""));
+ } catch (CoreException e) {
+ projectText.setText("");
+ }
+
+ fRunStandaloneButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ try {
+ fRunStandaloneButton.setSelection(_configuration.getAttribute(IESboxPythonLaunchConstants.ATTR_RUN_STANDALONE, true));
+ } catch (CoreException e) {
+ fRunStandaloneButton.setSelection(true);
+ }
+
+ fCopyBinsButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ try {
+ fCopyBinsButton.setSelection(_configuration.getAttribute(IESboxPythonLaunchConstants.ATTR_COPY_BINS, IESboxPythonLaunchConstants.COPY_BINS_DEFAULT));
+ } catch (CoreException e) {
+ fCopyBinsButton.setSelection(true);
+ }
+ }
+
+ public void performApply(final ILaunchConfigurationWorkingCopy _conf) {
+ String value;
+ value = projectText.getText().trim();
+ this.setAttribute(_conf, Constants.ATTR_PROJECT, value);
+
+ value = mainModuleText.getText().trim();
+ this.setAttribute(_conf, Constants.ATTR_LOCATION, value);
+
+ _conf.setAttribute(IESboxPythonLaunchConstants.ATTR_RUN_STANDALONE, fRunStandaloneButton.getSelection());
+
+ _conf.setAttribute(IESboxPythonLaunchConstants.ATTR_COPY_BINS, fCopyBinsButton.getSelection());
+ }
+
+
+ /**
+ * the name for this tab
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return "Main";
+ }
+
+ /**
+ * make a dialog and return a project (does no validation) and may return null.
+ */
+ private IProject chooseProject() {
+ ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), null, false, "Choose the project for the run");
+ dialog.open();
+ Object[] objects = dialog.getResult();
+ if(objects != null && objects.length == 1){
+ if(objects[0] instanceof IPath){
+ IPath p = (IPath) objects[0];
+ if(p.segmentCount() > 0){
+ String string = p.segment(0);
+ IWorkspace w = ResourcesPlugin.getWorkspace();
+ return w.getRoot().getProject(string);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Creates the widgets for specifying a main type.
+ *
+ * @param parent the parent composite
+ */
+ private void createProjectEditor(final Composite parent) {
+ Font font= parent.getFont();
+ Group group= new Group(parent, SWT.NONE);
+ group.setText("Project");
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ group.setLayoutData(gd);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ group.setLayout(layout);
+ group.setFont(font);
+
+ // Project chooser
+ projectText = new Text(group, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ projectText.setLayoutData(gd);
+ projectText.setFont(font);
+ projectText.addModifyListener(widgetListener);
+
+ browseProjectButton = createPushButton(group, "Browse...", null); //$NON-NLS-1$
+ browseProjectButton.addSelectionListener(widgetListener);
+
+ // Main module group
+ group= new Group(parent, SWT.NONE);
+ group.setText("Main Module");
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ group.setLayoutData(gd);
+ layout = new GridLayout();
+ layout.numColumns = 2;
+ group.setLayout(layout);
+ group.setFont(font);
+
+ // Main module chooser
+ mainModuleText = new Text (group, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ mainModuleText.setLayoutData (gd);
+ mainModuleText.setFont(font);
+ mainModuleText.addModifyListener(modifyListener);
+
+ browseModuleButton = createPushButton(group, "Browse...", null);
+ browseModuleButton.setText("Browse");
+ browseModuleButton.setEnabled(false);
+ browseModuleButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ IProject project = getProjectFromTextWidget();
+ PythonModulePickerDialog dialog = new PythonModulePickerDialog(
+ parent.getShell(),
+ "Main Module",
+ "Choose Python module which starts execution",
+ project);
+ int result = dialog.open();
+
+ if(result == PythonModulePickerDialog.OK) {
+ Object results[] = dialog.getResult();
+ System.out.println("Results:" + results.length);
+ if(results.length == 1) {
+ IFile file = (IFile) results[0];
+ mainModuleText.setText(file.getRawLocation().toPortableString());
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * sets attributes in the working copy
+ */
+ private void setAttribute(final ILaunchConfigurationWorkingCopy _conf, final String _name, final String _value) {
+ if (_value == null || _value.length() == 0){
+ _conf.setAttribute(_name, (String)null);
+ } else {
+ _conf.setAttribute(_name, _value);
+ }
+ }
+
+ /**
+ * @return
+ */
+ private IProject getProjectFromTextWidget() {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IResource project = workspace.getRoot().findMember(projectText.getText());
+ if(project instanceof IProject){
+ return (IProject) project;
+ }
+ return null;
+ }
+
+ @Override
+ public Image getImage() {
+ return Activator.getImageCache().get("icons/python.gif");
+ }
+
+ private class WidgetListener extends SelectionAdapter implements ModifyListener, SelectionListener {
+
+ public void modifyText(final ModifyEvent _event) {
+ validate();
+ }
+
+ public void widgetSelected(final SelectionEvent _event) {
+ Object source = _event.getSource();
+ if (source == browseProjectButton) {
+ handleProjectButtonSelected();
+ }else{
+ updateLaunchConfigurationDialog();
+ }
+ }
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchConfigurationTabGroup.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchConfigurationTabGroup.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchConfigurationTabGroup.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.analysis.valgrind;
+
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.maemo.esbox.python.launch.*;
+import org.maemo.esbox.python.launch.ui.ArgumentsTab;
+import org.maemo.esbox.python.launch.ui.MainModuleTab;
+
+/**
+ *
+ */
+public class ValgrindPythonLaunchConfigurationTabGroup extends ESboxAbstractPythonConfigurationTabGroup {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new MainModuleTab(),
+ new ArgumentsTab(),
+ new EnvironmentTab()};
+ setTabs(tabs);
+ }
+
+ @Override
+ protected AbstractLaunchShortcut getLaunchShortcut() {
+ return new ValgrindPythonLaunchShortcut();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ // This delegate to all tabs in the group by default
+ super.setDefaults(configuration);
+
+ PythonLaunchConfigurationData.setDefaults(configuration, IESboxPythonLaunchConstants.CONFIG_TYPE_VALGRIND);
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchDelegate.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchDelegate.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchDelegate.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT, (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Ed Swartz (Nokia)
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.analysis.valgrind;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.maemo.esbox.analysis.launch.ValgrindLocalLaunchProxy;
+import org.maemo.esbox.launch.core.ILaunchProxy;
+import org.maemo.esbox.python.launch.ESboxPythonAbstractLaunchDelegate;
+import org.maemo.esbox.python.launch.PythonLocalLaunchProxy;
+import org.maemo.esbox.python.launch.debug.PythonDebugger;
+
+/**
+ *
+ */
+public class ValgrindPythonLaunchDelegate extends ESboxPythonAbstractLaunchDelegate {
+
+ private ILaunchProxy fLaunchProxy;
+
+ protected ILaunchProxy createLaunchProxy(ILaunchConfiguration configuration) throws CoreException {
+ ILaunchProxy appLaunchProxy = new PythonLocalLaunchProxy(configuration);
+
+ return new ValgrindLocalLaunchProxy(configuration, appLaunchProxy);
+ }
+
+ @Override
+ public boolean preLaunchCheck(ILaunchConfiguration configuration,
+ String mode, IProgressMonitor monitor) throws CoreException {
+ if (!super.preLaunchCheck(configuration, mode, monitor))
+ return false;
+
+ fLaunchProxy = createLaunchProxy(configuration);
+
+ return fLaunchProxy.preLaunchCheck(mode, monitor);
+ }
+
+ @Override
+ public boolean finalLaunchCheck(ILaunchConfiguration configuration,
+ String mode, IProgressMonitor monitor) throws CoreException {
+
+ if (! super.finalLaunchCheck(configuration, mode, monitor))
+ return false;
+
+ assert(configuration.equals(fLaunchProxy.getLaunchConfiguration()));
+
+ return fLaunchProxy.finalLaunchCheck(mode, monitor);
+ }
+
+ @Override
+ protected PythonDebugger getDebugger() {
+ return null;
+ }
+
+ @Override
+ protected void runApplication(ILaunchConfiguration config, ILaunch launch,
+ IProgressMonitor monitor) throws CoreException {
+
+ assert(config.equals(fLaunchProxy.getLaunchConfiguration()));
+
+ fLaunchProxy.runApplication(launch, monitor);
+ }
+}
Added: trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchShortcut.java
===================================================================
--- trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchShortcut.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.launch.analysis/src/org/maemo/esbox/python/launch/analysis/valgrind/ValgrindPythonLaunchShortcut.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.launch.analysis.valgrind;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.maemo.esbox.python.launch.*;
+
+/**
+ *
+ */
+public class ValgrindPythonLaunchShortcut extends AbstractLaunchShortcut {
+
+ @Override
+ protected String getLaunchConfigurationType() {
+ return IESboxPythonLaunchConstants.CONFIG_TYPE_VALGRIND;
+ }
+
+ @Override
+ protected void setDefaultForLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy config) throws CoreException {
+ PythonLaunchConfigurationData.setDefaults(config, IESboxPythonLaunchConstants.CONFIG_TYPE_VALGRIND);
+ }
+
+ @Override
+ public String createLaunchConfigurationName(String binFileName,
+ IProject project) {
+
+ String format = "{0} {1} (Valgrind)";
+
+ String configName = MessageFormat.format(format, project.getName(), binFileName);
+
+ return configName;
+ }
+
+}
Property changes on: trunk/python/org.maemo.esbox.python.project.core
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/python/org.maemo.esbox.python.project.core/.classpath
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/.classpath (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/python/org.maemo.esbox.python.project.core/.project
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.python.project.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python.project.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:31:22 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/python/org.maemo.esbox.python.project.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/META-INF/MANIFEST.MF (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Python Core Plug-in
+Bundle-SymbolicName: org.maemo.esbox.python.project.core;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.python.project.core.Activator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.eclipse.core.expressions;bundle-version="3.4.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.python.pydev;bundle-version="0.9.7",
+ org.python.pydev.core;bundle-version="0.9.7"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.maemo.esbox.python.project.core
Added: trunk/python/org.maemo.esbox.python.project.core/build.properties
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/build.properties (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/python/org.maemo.esbox.python.project.core/plugin.xml
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/plugin.xml (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ id="ESboxPythonNature"
+ name="ESbox Python Project Nature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+ class="org.maemo.esbox.python.project.core.ESboxPythonProjectNature">
+ </run>
+ </runtime>
+ <requires-nature
+ id="org.python.pydev.pythonNature">
+ </requires-nature>
+ <builder
+ id="org.python.pydev.PyDevBuilder">
+ </builder>
+ </extension>
+
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester namespace="org.maemo.esbox.python"
+ properties="isPyDevProject"
+ type="org.eclipse.core.runtime.IAdaptable"
+ class="org.maemo.esbox.python.project.core.PythonPropertyTester"
+ id="org.maemo.esbox.python.PropertyTester">
+ </propertyTester>
+
+ </extension>
+ <extension
+ point="org.maemo.esbox.project.core.projectType">
+ <projectType
+ class="org.maemo.esbox.python.project.core.ESboxPythonProjectType">
+ </projectType>
+ </extension>
+
+</plugin>
Added: trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal/python/project/core/Activator.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal/python/project/core/Activator.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/internal/python/project/core/Activator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,131 @@
+package org.maemo.esbox.internal.python.project.core;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.python.project.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonBuildConfiguration.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonBuildConfiguration.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonBuildConfiguration.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.project.core;
+
+import org.maemo.esbox.core.IPersistentPropertyAccess;
+import org.maemo.esbox.project.core.ESboxBuildConfigurationBase;
+import org.maemo.esbox.project.core.ESboxBuildConfigurationParameters;
+
+/**
+ * Implementation of a build configuration for Python.
+ * @author eswartz
+ *
+ */
+public class ESboxPythonBuildConfiguration extends ESboxBuildConfigurationBase {
+ /**
+ * Create new build configuration from project creator defaults
+ * @param projectHandle
+ * @param parameters
+ */
+ public ESboxPythonBuildConfiguration(ESboxPythonProjectHandle projectHandle,
+ ESboxBuildConfigurationParameters parameters) {
+ super(projectHandle, parameters);
+ setChanged(true);
+ }
+
+ /**
+ * Create a configuration from existing configuration.
+ */
+ public ESboxPythonBuildConfiguration(ESboxPythonProjectHandle projectHandle,
+ String id, String name,
+ IPersistentPropertyAccess access) {
+ super(projectHandle, id, name, access);
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonConfigHandler.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonConfigHandler.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonConfigHandler.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.project.core;
+
+import org.maemo.esbox.project.core.ESboxConfigHandler;
+
+/**
+ * Handler for Python-based projects
+ * @author eswartz
+ *
+ */
+public class ESboxPythonConfigHandler extends ESboxConfigHandler {
+
+}
Added: trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectCreatorConverter.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectCreatorConverter.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectCreatorConverter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.project.core;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.project.core.*;
+import org.python.pydev.plugin.nature.PythonNature;
+
+/**
+ * Create build configuration Python projects or convert old ones to this format.
+ * @author eswartz
+ *
+ */
+public class ESboxPythonProjectCreatorConverter extends
+ ESboxProjectCreatorConverter {
+
+ private boolean createSourceFolder;
+
+ public ESboxPythonProjectCreatorConverter() {
+ super();
+ }
+
+ public void setCreateSourceFolder(boolean create) {
+ createSourceFolder = create;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ESboxProjectCreatorConverter#createConcreteProject(org.eclipse.core.resources.IProjectDescription, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void createConcreteProject(IProjectDescription description,
+ IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("Creating project", 3);
+
+ final String projectType = "python";
+ String projectPythonpath = null;
+
+ if (description != null) {
+ project.create(description, new SubProgressMonitor(monitor, 1000));
+
+ if (monitor.isCanceled()){
+ throw new OperationCanceledException();
+ }
+
+ project.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1000));
+
+
+ //also, after creating the project, create a default source folder and add it to the pythonpath.
+ if(createSourceFolder) {
+ IFolder folder = project.getFolder("src");
+ folder.create(true, true, monitor);
+ projectPythonpath = folder.getFullPath().toString();
+ }
+ } else {
+ // converting: remove any old natures
+
+ // remove builders (ALL OF THEM) because they will re-add the natures
+ description = project.getDescription();
+ description.setBuildSpec(new ICommand[0]);
+ project.setDescription(description, new SubProgressMonitor(monitor, 1));
+
+ OldESboxPythonProjectNature.removeESboxPythonNature(project, new SubProgressMonitor(monitor, 1));
+ }
+
+ // we should rebuild the path even if there's no source-folder (this way we will re-create the astmanager)
+ PythonNature.addNature(project, null, projectType, projectPythonpath);
+ ESboxPythonProjectNature.addESboxPythonNature(project, monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ESboxProjectCreatorConverter#createProjectHandle(org.eclipse.core.resources.IProject)
+ */
+ @Override
+ protected IESboxProjectHandle createProjectHandle(IProject project) {
+ return ProjectManager.getInstance().getProjectType(ESboxPythonProjectType.ID).createProjectHandle(project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ESboxProjectCreatorConverter#initializeConcreteProject(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void initializeConcreteProject(IProgressMonitor monitor)
+ throws CoreException {
+
+ }
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ESboxProjectCreatorConverter#initializeBeforeTemplateOperations(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void initializeBeforeTemplateOperations(IProgressMonitor monitor)
+ throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ESboxProjectCreatorConverter#finalizeAfterTemplateOperations(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void finalizeAfterTemplateOperations(IProgressMonitor monitor)
+ throws CoreException {
+
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectHandle.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectHandle.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectHandle.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.project.core;
+
+import org.eclipse.core.resources.IProject;
+import org.maemo.esbox.core.IPersistentPropertyAccess;
+import org.maemo.esbox.project.core.*;
+import org.python.pydev.plugin.nature.PythonNature;
+
+/**
+ * A Python project handle
+ * @author eswartz
+ *
+ */
+public class ESboxPythonProjectHandle extends ESboxStandaloneProjectHandleBase implements IESboxProjectHandle {
+ /*private*/ PythonNature projectNature;
+
+ public ESboxPythonProjectHandle(IProject project) {
+ super(project);
+ this.projectNature = PythonNature.getPythonNature(project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ESboxStandaloneProjectHandleBase#doCreateBuildConfiguration(org.maemo.esbox.project.core.ESboxBuildConfigurationParameters)
+ */
+ @Override
+ protected ESboxBuildConfigurationBase doCreateBuildConfiguration(
+ ESboxBuildConfigurationParameters parameters) {
+ return new ESboxPythonBuildConfiguration(this, parameters);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.ESboxStandaloneProjectHandleBase#doLoadBuildConfiguration(java.lang.String, java.lang.String, org.maemo.esbox.core.IPersistentPropertyAccess)
+ */
+ @Override
+ protected ESboxBuildConfigurationBase doLoadBuildConfiguration(String id,
+ String name, IPersistentPropertyAccess access) {
+ return new ESboxPythonBuildConfiguration(this, id, name, access);
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectNature.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectNature.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectNature.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG)
+ *******************************************************************************/
+
+package org.maemo.esbox.python.project.core;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+
+import org.maemo.esbox.internal.python.project.core.Activator;
+
+/**
+ * The new (ESbox 1.5+) Python project nature.
+ * @author eswartz
+ *
+ */
+public class ESboxPythonProjectNature implements IProjectNature {
+
+ private IProject project;
+
+ private static ESboxPythonProjectNature instance;
+
+ /*
+ * id of ESbox Python Project
+ * org.maemo.esbox.core.esboxPythonNature
+ */
+ public static final String ESBOX_PYTHON_NATURE_ID = Activator.PLUGIN_ID + ".ESboxPythonNature";
+
+ public ESboxPythonProjectNature() {}
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ESboxPythonProjectNature getDefault() {
+ return instance;
+ }
+
+ /**
+ * Adds the ESbox Python project nature to a given project.
+ * @param _project the project to add the nature.
+ * @param _monitor a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ * @throws CoreException if something goes wrong.
+ */
+ public static void addESboxPythonNature(final IProject project, final IProgressMonitor monitor) throws CoreException {
+ addNature(project, ESBOX_PYTHON_NATURE_ID, monitor);
+ }
+
+ /**
+ * Removes the ESbox Python project nature to a given project.
+ * @param project the project to add the nature.
+ * @param mon a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ * @throws CoreException if something goes wrong.
+ */
+ public static void removeESboxPythonNature(IProject project, IProgressMonitor mon) throws CoreException {
+ removeNature(project, ESBOX_PYTHON_NATURE_ID, mon);
+ }
+
+ /**
+ * Utility method for adding a nature to a project.
+ *
+ * @param project the project to add the nature
+ * @param natureId the id of the nature to assign to the project
+ * @param monitor a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ */
+ private static void addNature(IProject project, String natureId,
+ IProgressMonitor monitor) throws CoreException {
+
+ if (project == null)
+ return;
+
+ if(monitor == null)
+ monitor = new NullProgressMonitor();
+
+
+ IProjectDescription desc = project.getDescription();
+ if (desc.hasNature(natureId))
+ return;
+
+ String[] natures = desc.getNatureIds();
+ String[] newNatures = new String[natures.length + 1];
+ System.arraycopy(natures, 0, newNatures, 0, natures.length);
+ newNatures[natures.length] = ESBOX_PYTHON_NATURE_ID;
+ desc.setNatureIds(newNatures);
+ project.setDescription(desc, monitor);
+ }
+
+
+ /**
+ * Utility method for removing a project nature from a project.
+ *
+ * @param proj
+ * the project to remove the nature from
+ * @param natureId
+ * the nature id to remove
+ * @param monitor
+ * a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ */
+ private static void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
+ IProjectDescription description = project.getDescription();
+ if (!description.hasNature(natureId))
+ return;
+ String[] ids = description.getNatureIds();
+ for (int i = 0; i < ids.length; ++i) {
+ if (ids[i].equals(natureId)) {
+ String[] newIds = new String[ids.length - 1];
+ System.arraycopy(ids, 0, newIds, 0, i);
+ System.arraycopy(ids, i + 1, newIds, i, ids.length - i - 1);
+ description.setNatureIds(newIds);
+ project.setDescription(description, null);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#configure()
+ */
+ public void configure() throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#deconfigure()
+ */
+ public void deconfigure() throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#getProject()
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
+ */
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ public static boolean isNatureInProject(IProject _project) {
+ if(_project != null && _project.isOpen()){
+ try {
+ IProjectNature nature = _project.getNature(ESBOX_PYTHON_NATURE_ID);
+ if(nature instanceof ESboxPythonProjectNature){
+ return true;
+ }
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Cannot detect project nature", e);
+ }
+ }
+ return false;
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectType.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectType.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/ESboxPythonProjectType.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.project.core;
+
+import org.eclipse.core.resources.IProject;
+import org.maemo.esbox.internal.python.project.core.Activator;
+import org.maemo.esbox.project.core.IESboxProjectHandle;
+import org.maemo.esbox.project.core.IESboxProjectType;
+
+/**
+ * Implementation of projectType for Python projects.
+ * @author eswartz
+ *
+ */
+public class ESboxPythonProjectType implements IESboxProjectType {
+
+ public static final String ID = Activator.PLUGIN_ID + ".projectType.python";
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectType#getId()
+ */
+ public String getId() {
+ return ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectType#isProjectSupported(org.eclipse.core.resources.IProject)
+ */
+ public boolean isProjectSupported(IProject project) {
+ return ESboxPythonProjectNature.isNatureInProject(project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.core.IESboxProjectType#createProjectHandle(org.eclipse.core.resources.IProject)
+ */
+ public IESboxProjectHandle createProjectHandle(IProject project) {
+ return new ESboxPythonProjectHandle(project);
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/OldESboxPythonProjectNature.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/OldESboxPythonProjectNature.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/OldESboxPythonProjectNature.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (UFCG) - initial API and implementation
+ * Carolina Nogueira de Souza (UFCG) - initial API and implementation
+ * Paulo Romulo (UFCG)
+ *******************************************************************************/
+
+package org.maemo.esbox.python.project.core;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.maemo.esbox.internal.python.project.core.Activator;
+
+
+/**
+ * The old (ESbox 1.4) Python project nature.
+ * @author Raul Fernandes Herbster
+ *
+ */
+public class OldESboxPythonProjectNature implements IProjectNature {
+
+ private IProject project;
+
+ private static OldESboxPythonProjectNature instance;
+
+ public static final String ESBOX_PYTHON_NATURE_ID = "org.indt.esbox.core.esboxPythonNature";
+
+ public OldESboxPythonProjectNature() {}
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static OldESboxPythonProjectNature getDefault() {
+ return instance;
+ }
+
+ /**
+ * Adds the ESbox Python project nature to a given project.
+ * @param _project the project to add the nature.
+ * @param _monitor a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ * @throws CoreException if something goes wrong.
+ */
+ public static void addESboxPythonNature(final IProject project, final IProgressMonitor monitor) throws CoreException {
+ addNature(project, ESBOX_PYTHON_NATURE_ID, monitor);
+ }
+
+ /**
+ * Removes the ESbox Python project nature to a given project.
+ * @param project the project to add the nature.
+ * @param mon a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ * @throws CoreException if something goes wrong.
+ */
+ public static void removeESboxPythonNature(IProject project, IProgressMonitor mon) throws CoreException {
+ removeNature(project, ESBOX_PYTHON_NATURE_ID, mon);
+ }
+
+ /**
+ * Utility method for adding a nature to a project.
+ *
+ * @param project the project to add the nature
+ * @param natureId the id of the nature to assign to the project
+ * @param monitor a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ */
+ private static void addNature(IProject project, String natureId,
+ IProgressMonitor monitor) throws CoreException {
+
+ if (project == null)
+ return;
+
+ if(monitor == null)
+ monitor = new NullProgressMonitor();
+
+
+ IProjectDescription desc = project.getDescription();
+ if (desc.hasNature(natureId))
+ return;
+
+ String[] natures = desc.getNatureIds();
+ String[] newNatures = new String[natures.length + 1];
+ System.arraycopy(natures, 0, newNatures, 0, natures.length);
+ newNatures[natures.length] = ESBOX_PYTHON_NATURE_ID;
+ desc.setNatureIds(newNatures);
+ project.setDescription(desc, monitor);
+ }
+
+
+ /**
+ * Utility method for removing a project nature from a project.
+ *
+ * @param proj
+ * the project to remove the nature from
+ * @param natureId
+ * the nature id to remove
+ * @param monitor
+ * a progress monitor to indicate the duration of the operation,
+ * or <code>null</code> if progress reporting is not required.
+ */
+ private static void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
+ IProjectDescription description = project.getDescription();
+ if (!description.hasNature(natureId))
+ return;
+ String[] ids = description.getNatureIds();
+ for (int i = 0; i < ids.length; ++i) {
+ if (ids[i].equals(natureId)) {
+ String[] newIds = new String[ids.length - 1];
+ System.arraycopy(ids, 0, newIds, 0, i);
+ System.arraycopy(ids, i + 1, newIds, i, ids.length - i - 1);
+ description.setNatureIds(newIds);
+ project.setDescription(description, null);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#configure()
+ */
+ public void configure() throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#deconfigure()
+ */
+ public void deconfigure() throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#getProject()
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
+ */
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ public static boolean isNatureInProject(IProject _project) {
+ if(_project != null && _project.isOpen()){
+ try {
+ IProjectNature nature = _project.getNature(ESBOX_PYTHON_NATURE_ID);
+ if(nature instanceof OldESboxPythonProjectNature){
+ return true;
+ }
+ } catch (CoreException e) {
+ Activator.getErrorLogger().logError("Cannot detect project nature", e);
+ }
+ }
+ return false;
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/PythonPropertyTester.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/PythonPropertyTester.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.core/src/org/maemo/esbox/python/project/core/PythonPropertyTester.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,67 @@
+package org.maemo.esbox.python.project.core;
+
+import org.eclipse.core.expressions.IPropertyTester;
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.project.core.ProjectManager;
+
+/**
+ * Test properties of ESbox resources for use in UI filtering and activation
+ * <p>
+ * <li>isRemoteTarget -- tell if the current build target can be a remote target (e.g. ARM)
+ * <li>isEmulatorTarget -- tell if the current build target can be an emulator target
+ * <li>isX86Target -- tell if the current build target is an x86 target
+ * <li>isARMELTarget -- tell if the current build target is an ARMEL target
+ * <li>isPyDevProject -- tell if the current project is an ESbox Pydev project
+ * <li>isCProject -- tell if the current project is an ESbox C++ project
+ * <li>isOldESboxProject -- tell if the current project is an old-style ESbox project
+ *
+ * @author eswartz
+ *
+ */
+public class PythonPropertyTester extends PropertyTester implements
+ IPropertyTester {
+
+ protected IProject getProject(Object receiver) {
+ IResource rsrc = null;
+ if (receiver instanceof IResource) {
+ rsrc = (IResource) receiver;
+ } else if (receiver instanceof IAdaptable) {
+ rsrc = (IResource) (((IAdaptable) receiver).getAdapter(IResource.class));
+ }
+ if (rsrc == null)
+ return null;
+ return rsrc.getProject();
+ }
+
+ protected ISDKTarget getSDKTarget(IProject project) {
+ try {
+ return ProjectManager.getInstance().getProjectProperties(project).getSDKTarget();
+ } catch (ESboxException e) {
+ return null;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ public boolean test(Object receiver, String property, Object[] args,
+ Object expectedValue) {
+
+ IProject project = getProject(receiver);
+ if (project != null) {
+ if (property.equals("isPyDevProject")) {
+ return ESboxPythonProjectNature.isNatureInProject(project);
+ }
+ }
+
+
+ return false;
+ }
+
+}
Property changes on: trunk/python/org.maemo.esbox.python.project.ui
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/python/org.maemo.esbox.python.project.ui/.classpath
===================================================================
--- trunk/python/org.maemo.esbox.python.project.ui/.classpath (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.ui/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/python/org.maemo.esbox.python.project.ui/.project
===================================================================
--- trunk/python/org.maemo.esbox.python.project.ui/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.ui/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.python.project.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python.project.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/python/org.maemo.esbox.python.project.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.ui/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Mon Aug 18 10:31:59 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/python/org.maemo.esbox.python.project.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/python/org.maemo.esbox.python.project.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.ui/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Python UI Plug-in
+Bundle-SymbolicName: org.maemo.esbox.python.project.ui;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.python.project.ui.UIActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.ui;bundle-version="1.5.0",
+ org.maemo.esbox.python.project.core;bundle-version="1.5.0",
+ org.eclipse.cdt.core;bundle-version="5.0.1",
+ org.eclipse.cdt.ui;bundle-version="5.0.1",
+ org.eclipse.cdt.managedbuilder.ui;bundle-version="5.0.0",
+ org.eclipse.ui.ide;bundle-version="3.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: trunk/python/org.maemo.esbox.python.project.ui/build.properties
===================================================================
--- trunk/python/org.maemo.esbox.python.project.ui/build.properties (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.ui/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
Added: trunk/python/org.maemo.esbox.python.project.ui/icons/full/obj16/maemopythonprj_obj.png
===================================================================
(Binary files differ)
Property changes on: trunk/python/org.maemo.esbox.python.project.ui/icons/full/obj16/maemopythonprj_obj.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/python/org.maemo.esbox.python.project.ui/icons/full/wizban/newmaemoprj_wiz.png
===================================================================
(Binary files differ)
Property changes on: trunk/python/org.maemo.esbox.python.project.ui/icons/full/wizban/newmaemoprj_wiz.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/python/org.maemo.esbox.python.project.ui/plugin.xml
===================================================================
--- trunk/python/org.maemo.esbox.python.project.ui/plugin.xml (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.ui/plugin.xml 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+
+ <page
+ class="org.maemo.esbox.project.ui.ESboxBuildConfigurationsPage"
+ id="org.maemo.esbox.python.project.ui.BuildConfigurations"
+ name="ESbox Build Configurations">
+ <filter
+ name="nature"
+ value="org.maemo.esbox.python.project.core.ESboxPythonNature">
+ </filter>
+ <enabledWhen>
+ <adapt type="org.eclipse.core.resources.IProject">
+ </adapt>
+ </enabledWhen>
+ </page>
+
+ <page
+ class="org.maemo.esbox.internal.python.project.ui.ESboxOldPythonBuildTargetPropertyPage"
+ id="org.maemo.esbox.python.project.ui.esboxOldTargetPropertyPage"
+ name="ESbox Build Configurations"
+ nameFilter="*">
+ <filter
+ name="nature"
+ value="org.indt.esbox.core.esboxPythonNature">
+ </filter>
+ <enabledWhen>
+ <adapt type="org.eclipse.core.resources.IProject">
+ </adapt>
+ </enabledWhen>
+ </page>
+
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ canFinishEarly="false"
+ category="org.python.pydev.PythonCategory"
+ class="org.maemo.esbox.python.project.ui.wizards.PythonProjectWizard"
+ finalPerspective="org.python.pydev.ui.PythonPerspective"
+ preferredPerspectives="org.python.pydev.ui.PythonPerspective"
+ hasPages="true"
+ icon="icons/full/obj16/maemopythonprj_obj.png"
+ id="org.maemo.esbox.python.project.ui.wizards.ESboxPythonProjectWizard"
+ name="Python Maemo Project"
+ project="true">
+ </wizard>
+
+ </extension>
+
+</plugin>
Added: trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project/ui/ESboxOldPythonBuildTargetPropertyPage.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project/ui/ESboxOldPythonBuildTargetPropertyPage.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project/ui/ESboxOldPythonBuildTargetPropertyPage.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.python.project.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.project.core.*;
+import org.maemo.esbox.project.ui.ESboxBuildConfigurationsPage;
+import org.maemo.esbox.python.project.core.*;
+
+import java.util.List;
+
+/**
+ * The Python variant of the ESbox > Build Configurations property page
+ * will convert the project format when the user saves the settings.
+ * @author eswartz
+ *
+ */
+public class ESboxOldPythonBuildTargetPropertyPage extends
+ ESboxBuildConfigurationsPage {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.ui.ESboxBuildConfigurationsPage#getCurrentConfigurations()
+ */
+ @Override
+ protected List<IESboxBuildConfiguration> getCurrentConfigurations() {
+ // the handle will become non-null when we convert
+ if (projectHandle == null) {
+ // since this is an old project, there are no configurations
+ // or project handle, so create it now
+ try {
+ IProjectProperties projectProperties = ProjectManager.getInstance().getOldStyleProjectProperties(project);
+ projectHandle = ProjectManager.getInstance().getProjectType(ESboxPythonProjectType.ID).createProjectHandle(project);
+ ESboxBuildConfigurationParameters params =
+ new ESboxBuildConfigurationParameters(projectProperties.getSDKTarget().getName(),
+ projectProperties.getSDKTarget());
+ projectHandle.createBuildConfiguration(params);
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().logAndShowError("Failed to read old project settings", e);
+ } catch (ESboxException e) {
+ // not sure why this panel is appearing!
+ }
+ }
+ return super.getCurrentConfigurations();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.ui.ESboxBuildConfigurationsPage#addCustomUI(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected void addCustomTrailingUI(Composite control) {
+ if (ProjectManager.getInstance().getProjectHandle(project) == null) {
+ Label label = new Label(control, SWT.WRAP);
+ label.setText("This project is in an old format. It will be converted to the new format and become incompatible with older versions of ESbox if you save changes.");
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.horizontalSpan = 2;
+ label.setLayoutData(gridData);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.ui.ESboxBuildConfigurationsPage#performOk()
+ */
+ @Override
+ public boolean performOk() {
+ // convert the project by swapping the project nature
+ try {
+ OldESboxPythonProjectNature.removeESboxPythonNature(project, null);
+ ESboxPythonProjectNature.addESboxPythonNature(project, null);
+ } catch (CoreException e) {
+ UIActivator.getErrorLogger().logAndShowError("Failed to convert project to new-style Python project", e);
+ }
+
+ return super.performOk();
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project/ui/UIActivator.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project/ui/UIActivator.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/internal/python/project/ui/UIActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,145 @@
+package org.maemo.esbox.internal.python.project.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.maemo.esbox.core.ErrorLogger;
+import org.osgi.framework.BundleContext;
+
+import java.io.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.python.project.ui";
+
+ // The shared instance
+ private static UIActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public UIActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIActivator getDefault() {
+ return plugin;
+ }
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return UIActivator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ // The plugin registry
+ private static ImageRegistry imageRegistry = new ImageRegistry(Display.getDefault());
+
+ public static Image getImage(String path) {
+ ImageDescriptor descriptor = imageRegistry.getDescriptor(path);
+ if (descriptor == null) {
+ descriptor = getImageDescriptor(path);
+ imageRegistry.put(path, descriptor);
+ }
+ return imageRegistry.get(path);
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python/project/ui/wizards/PythonProjectWizard.java
===================================================================
--- trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python/project/ui/wizards/PythonProjectWizard.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.project.ui/src/org/maemo/esbox/python/project/ui/wizards/PythonProjectWizard.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.project.ui.wizards;
+
+import org.eclipse.cdt.managedbuilder.ui.wizards.CfgHolder;
+import org.eclipse.cdt.ui.templateengine.Template;
+import org.eclipse.cdt.ui.templateengine.pages.UIWizardPage;
+import org.eclipse.cdt.ui.wizards.IWizardWithMemory;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.ui.INewWizard;
+import org.maemo.esbox.internal.python.project.ui.UIActivator;
+import org.maemo.esbox.project.core.ITemplate;
+import org.maemo.esbox.project.ui.wizards.*;
+import org.maemo.esbox.python.project.core.*;
+
+import java.util.*;
+
+/**
+ * @author eswartz
+ *
+ */
+public class PythonProjectWizard extends ESboxCommonNewProjectWizard
+ implements INewWizard, IWizardWithMemory {
+ /**
+ * Constructor.
+ * Creates a wizard to new ESbox projects.
+ */
+ public PythonProjectWizard() {
+ super("New Maemo Python Project", "Create a Maemo project inside Scratchbox");
+ setProjectCreator(new ESboxPythonProjectCreatorConverter());
+ setConfigHandler(new ESboxPythonConfigHandler());
+ }
+
+ @Override
+ protected String getProjectNatureIdPattern() {
+ return ESboxPythonProjectNature.ESBOX_PYTHON_NATURE_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.ui.wizards.ESboxCommonNewProjectWizard#createTargetSelectionPage()
+ */
+ @Override
+ protected ESboxBaseProjectTargetSelectionPage createTargetSelectionPage() {
+ return new ESboxProjectMultiTargetSelectionPage(getConfigHandler());
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+ }
+
+ @Override
+ protected IWizardPage getPageFollowingTemplatePages() {
+ return null;
+ }
+
+ protected IWizardPage[] getTemplateContributedPages(ITemplate itemplate) {
+ // NOTE: CDT has a stupid bug where "getTemplateWizardPages" doesn't allow a NULL next page,
+ // so we have to manually replicate its behavior here
+
+ Template template = (Template) itemplate.getAdapter(Template.class);
+
+ Map<String, UIWizardPage> pageMap = template.getUIPages();
+ IWizardPage[] templatePages = new IWizardPage[pageMap.size()];
+ int idx = 0;
+ for (UIWizardPage page : pageMap.values()) {
+ templatePages[idx] = page;
+ if (idx == 0)
+ templatePages[idx].setPreviousPage(getPageBeforeTemplatePages());
+ idx++;
+ }
+
+ for (int i = 0; i < templatePages.length; i++) {
+ IWizardPage templatePage = templatePages[i];
+ templatePage.setImageDescriptor(UIActivator.getImageDescriptor("./icons/new_maemo_prj_wiz.gif"));
+ this.addPage(templatePage);
+ }
+ return templatePages;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.project.ui.wizards.ESboxCommonNewProjectWizard#configureTemplate(org.maemo.esbox.project.core.ITemplate)
+ */
+ @Override
+ protected void configureTemplate(ITemplate itemplate, IWizardPage[] templatePages) {
+ Template template = (Template) itemplate.getAdapter(Template.class);
+ if (template == null)
+ return;
+
+ template = initializeTemplateValues(template, templatePages);
+
+ List<Object> configs = new ArrayList<Object>();
+ CfgHolder[] cfgs = new CfgHolder[0];
+ for(int i = 0; i < cfgs.length; i++){
+ configs.add(cfgs[i].getConfiguration());
+ }
+ template.getTemplateInfo().setConfigurations(configs);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public Template initializeTemplateValues(Template template, IWizardPage[] templatePages) {
+
+ if(template != null){
+ Map valueStore = template.getValueStore();
+ for(int i=0; i < templatePages.length; i++) {
+ IWizardPage page = templatePages[i];
+ if (page instanceof UIWizardPage)
+ valueStore.putAll(((UIWizardPage)page).getPageData());
+ }
+ }
+ return template;
+ }
+
+}
Property changes on: trunk/python/org.maemo.esbox.python.tests
___________________________________________________________________
Name: svn:ignore
+ bin
Added: trunk/python/org.maemo.esbox.python.tests/.classpath
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/.classpath (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/.classpath 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/python/org.maemo.esbox.python.tests/.project
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.maemo.esbox.python.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python.tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/.settings/org.eclipse.jdt.core.prefs 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,7 @@
+#Fri Aug 22 14:41:25 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/python/org.maemo.esbox.python.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/META-INF/MANIFEST.MF (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/META-INF/MANIFEST.MF 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox Python Tests Plug-in
+Bundle-SymbolicName: org.maemo.esbox.python.tests
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.python.tests.TestActivator
+Bundle-Vendor: INdT / Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.junit4;bundle-version="4.3.1",
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.python.project.core;bundle-version="1.5.0",
+ org.maemo.esbox.core.tests;bundle-version="1.5.0",
+ org.maemo.esbox.maemosdk.core;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: trunk/python/org.maemo.esbox.python.tests/build.properties
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/build.properties (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/build.properties 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ data/
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/.cproject
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/.cproject (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/.cproject 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="org.eclipse.cdt.core.default.config.510725509">
+<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.510725509" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+<buildTargets>
+<target name="all" path="" targetID="MakeTargetBuilder">
+<buildCommand>make</buildCommand>
+<buildArguments></buildArguments>
+<buildTarget>all</buildTarget>
+<stopOnError>false</stopOnError>
+<useDefaultCommand>true</useDefaultCommand>
+<runAllBuilders>true</runAllBuilders>
+</target>
+</buildTargets>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.pathentry">
+<pathentry kind="src" path=""/>
+<pathentry kind="out" path=""/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/gtk-2.0" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/lib/gtk-2.0/include" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/atk-1.0" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/cairo" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/pango-1.0" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/glib-2.0" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/lib/glib-2.0/include" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/freetype2" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include/libpng12" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/targets/CHINOOK_ARMEL/usr/include" kind="inc" path="" system="true"/>
+<pathentry include="S:/users/devel/scratchbox/compilers/cs2005q3.2-glibc-arm/usr/include" kind="inc" path="" system="true"/>
+</storageModule>
+</cconfiguration>
+</storageModule>
+<storageModule executionEnvironment="org.indt.esbox.core.execution_environment.gtk" moduleId="org.indt.esbox.core.properties" scratchboxVersion="1" targetName="CHINOOK_ARMEL"/>
+</cproject>
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/.project
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>gtkhelloworldcproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.indt.esbox.core.esboxMakeBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>org.eclipse.cdt.core.errorOutputParser</key>
+ <value>org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.append_environment</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.arguments</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.command</key>
+ <value>make</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.auto</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.clean</key>
+ <value>clean</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.build.target.inc</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.environment</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.stopOnError</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+ <value>true</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.indt.esbox.core.ESboxNature</nature>
+ <nature>org.eclipse.cdt.make.core.cfgSupportNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/Makefile
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/Makefile (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = -Wall \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED
+
+all: .PHONY
+ echo Built
+
+clean:
+ echo Cleaned
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/src/helloworld.c
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/src/helloworld.c (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj/src/helloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : helloworld.c
+ Author : Ed
+ Version : 0.1
+ Description : Hello World GTK
+ ============================================================================
+ */
+
+#include <gtk/gtk.h>
+
+/* This is a callback function. The data arguments are ignored
+ * in this example. More on callbacks below. */
+void hello( GtkWidget *widget,
+ gpointer data )
+{
+ g_print ("Hello World\n");
+}
+
+gint delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
+ /* If you return FALSE in the "delete_event" signal handler,
+ * GTK will emit the "destroy" signal. Returning TRUE means
+ * you don't want the window to be destroyed.
+ * This is useful for popping up 'are you sure you want to quit?'
+ * type dialogs. */
+
+ g_print ("delete event occurred\n");
+
+ /* Change TRUE to FALSE and the main window will be destroyed with
+ * a "delete_event". */
+
+ return TRUE;
+}
+
+/* Another callback */
+void destroy( GtkWidget *widget,
+ gpointer data )
+{
+ gtk_main_quit ();
+}
+
+int main( int argc,
+ char *argv[] )
+{
+ /* GtkWidget is the storage type for widgets */
+ GtkWidget *window;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application. */
+ gtk_init (&argc, &argv);
+
+ /* create a new window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ /* When the window is given the "delete_event" signal (this is given
+ * by the window manager, usually by the "close" option, or on the
+ * titlebar), we ask it to call the delete_event () function
+ * as defined above. The data passed to the callback
+ * function is NULL and is ignored in the callback function. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event), NULL);
+
+ /* Here we connect the "destroy" event to a signal handler.
+ * This event occurs when we call gtk_widget_destroy() on the window,
+ * or if we return FALSE in the "delete_event" callback. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy), NULL);
+
+ /* Sets the border width of the window. */
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Creates a new button with the label "Hello World". */
+ button = gtk_button_new_with_label ("Hello World!!!");
+
+ /* When the button receives the "clicked" signal, it will call the
+ * function hello() passing it NULL as its argument. The hello()
+ * function is defined above. */
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hello), NULL);
+
+ /* This will cause the window to be destroyed by calling
+ * gtk_widget_destroy(window) when "clicked". Again, the destroy
+ * signal could come from here, or the window manager. */
+ g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ G_OBJECT (window));
+
+ /* This packs the button into the window (a gtk container). */
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ /* The final step is to display this newly created widget. */
+ gtk_widget_show (button);
+
+ /* and the window */
+ gtk_widget_show (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or
+ * mouse event). */
+ gtk_main ();
+
+ return 0;
+}
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/.cproject
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/.cproject (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/.cproject 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="org.eclipse.cdt.core.default.config.544739746">
+<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.544739746" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
+<externalSettings/>
+<extensions/>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.pathentry">
+<pathentry kind="src" path=""/>
+<pathentry kind="src" path="src"/>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+</storageModule>
+</cproject>
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/.project
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>testproj</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec/>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.indt.esbox.core.ESboxNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/Makefile
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/Makefile (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,27 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = -Wall \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED
+
+all: .PHONY
+ echo Built
+
+clean:
+ echo Cleaned
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/src/helloworld.c
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/src/helloworld.c (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/esboxproj-nometadata/src/helloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : helloworld.c
+ Author : Ed
+ Version : 0.1
+ Description : Hello World GTK
+ ============================================================================
+ */
+
+#include <gtk/gtk.h>
+
+/* This is a callback function. The data arguments are ignored
+ * in this example. More on callbacks below. */
+void hello( GtkWidget *widget,
+ gpointer data )
+{
+ g_print ("Hello World\n");
+}
+
+gint delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
+ /* If you return FALSE in the "delete_event" signal handler,
+ * GTK will emit the "destroy" signal. Returning TRUE means
+ * you don't want the window to be destroyed.
+ * This is useful for popping up 'are you sure you want to quit?'
+ * type dialogs. */
+
+ g_print ("delete event occurred\n");
+
+ /* Change TRUE to FALSE and the main window will be destroyed with
+ * a "delete_event". */
+
+ return TRUE;
+}
+
+/* Another callback */
+void destroy( GtkWidget *widget,
+ gpointer data )
+{
+ gtk_main_quit ();
+}
+
+int main( int argc,
+ char *argv[] )
+{
+ /* GtkWidget is the storage type for widgets */
+ GtkWidget *window;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application. */
+ gtk_init (&argc, &argv);
+
+ /* create a new window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ /* When the window is given the "delete_event" signal (this is given
+ * by the window manager, usually by the "close" option, or on the
+ * titlebar), we ask it to call the delete_event () function
+ * as defined above. The data passed to the callback
+ * function is NULL and is ignored in the callback function. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event), NULL);
+
+ /* Here we connect the "destroy" event to a signal handler.
+ * This event occurs when we call gtk_widget_destroy() on the window,
+ * or if we return FALSE in the "delete_event" callback. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy), NULL);
+
+ /* Sets the border width of the window. */
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Creates a new button with the label "Hello World". */
+ button = gtk_button_new_with_label ("Hello World!!!");
+
+ /* When the button receives the "clicked" signal, it will call the
+ * function hello() passing it NULL as its argument. The hello()
+ * function is defined above. */
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hello), NULL);
+
+ /* This will cause the window to be destroyed by calling
+ * gtk_widget_destroy(window) when "clicked". Again, the destroy
+ * signal could come from here, or the window manager. */
+ g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ G_OBJECT (window));
+
+ /* This packs the button into the window (a gtk container). */
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ /* The final step is to display this newly created widget. */
+ gtk_widget_show (button);
+
+ /* and the window */
+ gtk_widget_show (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or
+ * mouse event). */
+ gtk_main ();
+
+ return 0;
+}
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/.project
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>gtkhelloworldcproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures/>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/Makefile
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/Makefile (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = -Wall \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED
+
+helloworld: src/helloworld.c
+ $(CC) src/helloworld.c -g -o helloworld $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
+
+all: helloworld
+
+clean:
+ rm -f *.o helloworld
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/src/helloworld.c
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/src/helloworld.c (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxbareproj/src/helloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : helloworld.c
+ Author : Ed
+ Version : 0.1
+ Description : Hello World GTK
+ ============================================================================
+ */
+
+#include <gtk/gtk.h>
+
+/* This is a callback function. The data arguments are ignored
+ * in this example. More on callbacks below. */
+void hello( GtkWidget *widget,
+ gpointer data )
+{
+ g_print ("Hello World\n");
+}
+
+gint delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
+ /* If you return FALSE in the "delete_event" signal handler,
+ * GTK will emit the "destroy" signal. Returning TRUE means
+ * you don't want the window to be destroyed.
+ * This is useful for popping up 'are you sure you want to quit?'
+ * type dialogs. */
+
+ g_print ("delete event occurred\n");
+
+ /* Change TRUE to FALSE and the main window will be destroyed with
+ * a "delete_event". */
+
+ return TRUE;
+}
+
+/* Another callback */
+void destroy( GtkWidget *widget,
+ gpointer data )
+{
+ gtk_main_quit ();
+}
+
+int main( int argc,
+ char *argv[] )
+{
+ /* GtkWidget is the storage type for widgets */
+ GtkWidget *window;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application. */
+ gtk_init (&argc, &argv);
+
+ /* create a new window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ /* When the window is given the "delete_event" signal (this is given
+ * by the window manager, usually by the "close" option, or on the
+ * titlebar), we ask it to call the delete_event () function
+ * as defined above. The data passed to the callback
+ * function is NULL and is ignored in the callback function. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event), NULL);
+
+ /* Here we connect the "destroy" event to a signal handler.
+ * This event occurs when we call gtk_widget_destroy() on the window,
+ * or if we return FALSE in the "delete_event" callback. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy), NULL);
+
+ /* Sets the border width of the window. */
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Creates a new button with the label "Hello World". */
+ button = gtk_button_new_with_label ("Hello World!!!");
+
+ /* When the button receives the "clicked" signal, it will call the
+ * function hello() passing it NULL as its argument. The hello()
+ * function is defined above. */
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hello), NULL);
+
+ /* This will cause the window to be destroyed by calling
+ * gtk_widget_destroy(window) when "clicked". Again, the destroy
+ * signal could come from here, or the window manager. */
+ g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ G_OBJECT (window));
+
+ /* This packs the button into the window (a gtk container). */
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ /* The final step is to display this newly created widget. */
+ gtk_widget_show (button);
+
+ /* and the window */
+ gtk_widget_show (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or
+ * mouse event). */
+ gtk_main ();
+
+ return 0;
+}
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/.cproject
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/.cproject (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/.cproject 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="org.eclipse.cdt.core.default.config.544739746">
+<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.544739746" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
+<externalSettings/>
+<extensions/>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.pathentry">
+<pathentry kind="src" path=""/>
+<pathentry kind="src" path="src"/>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+</storageModule>
+</cproject>
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/.project
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>gtkhelloworldcproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ </natures>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/COPYING
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/COPYING (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/COPYING 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/COPYING.LESSER
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/COPYING.LESSER (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/COPYING.LESSER 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/Makefile
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/Makefile (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/Makefile 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,29 @@
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CC = gcc
+
+CFLAGS = -Wall \
+ -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED
+
+helloworld: src/helloworld.c
+ $(CC) src/helloworld.c -g -o helloworld $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
+
+all: helloworld
+
+clean:
+ rm -f *.o helloworld
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/src/helloworld.c
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/src/helloworld.c (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/nonesboxcdtproj/src/helloworld.c 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 INdT.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ ============================================================================
+ Name : helloworld.c
+ Author : Ed
+ Version : 0.1
+ Description : Hello World GTK
+ ============================================================================
+ */
+
+#include <gtk/gtk.h>
+
+/* This is a callback function. The data arguments are ignored
+ * in this example. More on callbacks below. */
+void hello( GtkWidget *widget,
+ gpointer data )
+{
+ g_print ("Hello World\n");
+}
+
+gint delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
+{
+ /* If you return FALSE in the "delete_event" signal handler,
+ * GTK will emit the "destroy" signal. Returning TRUE means
+ * you don't want the window to be destroyed.
+ * This is useful for popping up 'are you sure you want to quit?'
+ * type dialogs. */
+
+ g_print ("delete event occurred\n");
+
+ /* Change TRUE to FALSE and the main window will be destroyed with
+ * a "delete_event". */
+
+ return TRUE;
+}
+
+/* Another callback */
+void destroy( GtkWidget *widget,
+ gpointer data )
+{
+ gtk_main_quit ();
+}
+
+int main( int argc,
+ char *argv[] )
+{
+ /* GtkWidget is the storage type for widgets */
+ GtkWidget *window;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application. */
+ gtk_init (&argc, &argv);
+
+ /* create a new window */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ /* When the window is given the "delete_event" signal (this is given
+ * by the window manager, usually by the "close" option, or on the
+ * titlebar), we ask it to call the delete_event () function
+ * as defined above. The data passed to the callback
+ * function is NULL and is ignored in the callback function. */
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (delete_event), NULL);
+
+ /* Here we connect the "destroy" event to a signal handler.
+ * This event occurs when we call gtk_widget_destroy() on the window,
+ * or if we return FALSE in the "delete_event" callback. */
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (destroy), NULL);
+
+ /* Sets the border width of the window. */
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Creates a new button with the label "Hello World". */
+ button = gtk_button_new_with_label ("Hello World!!!");
+
+ /* When the button receives the "clicked" signal, it will call the
+ * function hello() passing it NULL as its argument. The hello()
+ * function is defined above. */
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (hello), NULL);
+
+ /* This will cause the window to be destroyed by calling
+ * gtk_widget_destroy(window) when "clicked". Again, the destroy
+ * signal could come from here, or the window manager. */
+ g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ G_OBJECT (window));
+
+ /* This packs the button into the window (a gtk container). */
+ gtk_container_add (GTK_CONTAINER (window), button);
+
+ /* The final step is to display this newly created widget. */
+ gtk_widget_show (button);
+
+ /* and the window */
+ gtk_widget_show (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or
+ * mouse event). */
+ gtk_main ();
+
+ return 0;
+}
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/.project
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Mypy</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.python.pydev.PyDevBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.python.pydev.pythonNature</nature>
+ <nature>org.indt.esbox.core.esboxPythonNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/.pydevproject
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/.pydevproject (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/.pydevproject 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse-pydev version="1.0"?>
+
+<pydev_project>
+<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
+<path>/Mypy/src</path>
+</pydev_pathproperty>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python</pydev_property>
+</pydev_project>
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/src/hello_world.py
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/src/hello_world.py (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.4/src/hello_world.py 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,52 @@
+#!/usr/bin/env python2.5
+
+#
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# ============================================================================
+# Name : hello_world.py
+# Author : Ed
+# Version : 0.1
+# Description : Python Hildon Hello World
+# ============================================================================
+
+
+import gtk
+import hildon
+
+class HelloWorldApp(hildon.Program):
+ def __init__(self):
+ hildon.Program.__init__(self)
+
+ self.window = hildon.Window()
+ self.window.connect("delete_event", self.quit)
+ self.add_window(self.window)
+
+ label = gtk.Label("Hello World!!!")
+ self.window.add(label)
+ label.show()
+
+ def quit(self, *args):
+ print "Goodbye world!"
+ gtk.main_quit()
+
+ def run(self):
+ self.window.show_all()
+ gtk.main()
+
+if __name__ == "__main__":
+ app = HelloWorldApp()
+ app.run()
\ No newline at end of file
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.esbox_settings
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.esbox_settings (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.esbox_settings 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings>
+ <configs currentConfig="Scratchbox 1~DIABLO_ARMEL">
+ <config id="Scratchbox 1~DIABLO_ARMEL" name="my target"
+ sdkName="Scratchbox 1" targetName="DIABLO_ARMEL"
+ executionEnvironment="org.maemo.esbox.maemosdk.core.execution_environment.gtk"/>
+ </configs>
+</settings>
\ No newline at end of file
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.project
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.project (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.project 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Mypy</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.python.pydev.PyDevBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.python.pydev.pythonNature</nature>
+ <nature>org.maemo.esbox.python.project.core.ESboxPythonNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.pydevproject
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.pydevproject (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/.pydevproject 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse-pydev version="1.0"?>
+
+<pydev_project>
+<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
+<path>/Mypy/src</path>
+</pydev_pathproperty>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python</pydev_property>
+</pydev_project>
Added: trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/src/hello_world.py
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/src/hello_world.py (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/data/convert/pyproj-1.5/src/hello_world.py 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,52 @@
+#!/usr/bin/env python2.5
+
+#
+# Copyright (c) 2007-2008 INdT.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# ============================================================================
+# Name : hello_world.py
+# Author : Ed
+# Version : 0.1
+# Description : Python Hildon Hello World
+# ============================================================================
+
+
+import gtk
+import hildon
+
+class HelloWorldApp(hildon.Program):
+ def __init__(self):
+ hildon.Program.__init__(self)
+
+ self.window = hildon.Window()
+ self.window.connect("delete_event", self.quit)
+ self.add_window(self.window)
+
+ label = gtk.Label("Hello World!!!")
+ self.window.add(label)
+ label.show()
+
+ def quit(self, *args):
+ print "Goodbye world!"
+ gtk.main_quit()
+
+ def run(self):
+ self.window.show_all()
+ gtk.main()
+
+if __name__ == "__main__":
+ app = HelloWorldApp()
+ app.run()
\ No newline at end of file
Added: trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/internal/python/tests/TestActivator.java
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/internal/python/tests/TestActivator.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/internal/python/tests/TestActivator.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,50 @@
+package org.maemo.esbox.internal.python.tests;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TestActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.maemo.esbox.python.tests";
+
+ // The shared instance
+ private static TestActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public TestActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static TestActivator getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectConverter.java
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectConverter.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectConverter.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.tests;
+
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.junit.*;
+import org.maemo.esbox.core.HostUtils;
+import org.maemo.esbox.core.execEnv.IExecutionEnvironment;
+import org.maemo.esbox.core.sdk.ISDKTarget;
+import org.maemo.esbox.core.tests.TestUtils;
+import org.maemo.esbox.core.tests.core.BaseTest;
+import org.maemo.esbox.internal.python.tests.TestActivator;
+import org.maemo.esbox.maemosdk.core.execEnv.GTKExecutionEnvironment;
+import org.maemo.esbox.maemosdk.core.sdk.*;
+import org.maemo.esbox.project.core.*;
+import org.maemo.esbox.python.project.core.ESboxPythonConfigHandler;
+import org.maemo.esbox.python.project.core.ESboxPythonProjectCreatorConverter;
+
+/**
+ * Test that we can convert existing projects to the new format
+ * @author eswartz
+ *
+ */
+public class TestPythonProjectConverter extends BaseTest {
+
+ private static IScratchboxSDKTarget[] sdkTargets;
+ private static ISDKTarget theSB1SDKTarget;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ // disable build automatically while creating the project
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription workspaceDesc = workspace.getDescription();
+ workspaceDesc.setAutoBuilding(false);
+ workspace.setDescription(workspaceDesc);
+
+ sdkTargets = ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets();
+ for (ISDKTarget target : sdkTargets) {
+ // TODO: check platform/target
+ if (target instanceof IScratchbox1SDKTarget
+ && target.getName().equals("CHINOOK_ARMEL")) {
+ theSB1SDKTarget = target;
+ }
+ }
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testConvertBareProject() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("testconvert1");
+
+ _testConvertProject(projectPath, "data/convert/nonesboxbareproj", false);
+ }
+ @Test
+ public void testConvertCdtProject() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("testconvert2");
+
+ _testConvertProject(projectPath, "data/convert/nonesboxcdtproj", false);
+ }
+
+ @Test
+ public void testConvertESboxProject() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("testconvert3");
+
+ _testConvertProject(projectPath, "data/convert/pyproj-1.4", true);
+ }
+
+ @Test
+ public void testConvertESboxNoMetadataProject() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("testconvert3b");
+
+ _testConvertProject(projectPath, "data/convert/esboxproj-nometadata", false);
+ }
+
+
+ @Test
+ public void testConvertProjectFail() throws Exception {
+ if (theSB1SDKTarget == null)
+ return;
+
+ // this is not visible to sbox, we assume
+ IPath projectPath = HostUtils.getTemporaryPath().append("testconvert4");
+
+ try {
+ _testConvertProject(projectPath, "data/convert/nonesboxproj", false);
+ fail("Should not have succeeded");
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+
+ protected void _testConvertProject(IPath destPath, String srcPath, boolean checkIndexerData) throws Exception {
+ ESboxPythonConfigHandler configHandler = new ESboxPythonConfigHandler();
+ configHandler.initializeSingleBuildConfiguration(theSB1SDKTarget);
+ configHandler.setExecutionEnvironment(GTKExecutionEnvironment.ID);
+
+ _testConvertProject(destPath, srcPath, configHandler, checkIndexerData);
+ }
+
+ protected void _testConvertProject(IPath destPath, String srcPath, ESboxPythonConfigHandler configHandler, boolean checkIndexerData) throws Exception {
+ // the default location will be outside scratchbox for this SDK
+
+ IProject project = TestUtils.copyAndImportProject(
+ TestActivator.PLUGIN_ID,
+ srcPath,
+ destPath.lastSegment(),
+ destPath);
+
+ try {
+ // get a creator
+ ESboxProjectCreatorConverter creator = new ESboxPythonProjectCreatorConverter();
+ creator.setup(project, configHandler);
+ assertEquals(project, creator.getProject());
+ assertTrue(project.exists());
+
+ // make sure it's not yet known
+
+ IESboxProjectHandle handle = ProjectManager.getInstance().getProjectHandle(project);
+ assertNull("should not be build config project yet", handle);
+
+ // run it
+ IWorkspaceRunnable runnable = creator.getProjectConverterRunnable();
+ assertNotNull(runnable);
+ // allow to throw to caller
+ runnable.run(new NullProgressMonitor());
+
+ // now it should be known
+ handle = ProjectManager.getInstance().getProjectHandle(project);
+ assertNotNull("should be build config project", handle);
+
+ assertEquals(1, handle.getBuildConfigurations().length);
+
+ IESboxBuildConfiguration config = handle.getBuildConfigurations()[0];
+ assertNotNull(config);
+
+ assertEquals(configHandler.getInitialTargetName(), config.getSDKTargetName());
+
+ String envId = config.getExecutionEnvironmentId();
+ assertEquals(configHandler.getExecutionEnvironment(), envId);
+
+ // verify sanity
+ assertNotNull(config.getSDKTarget());
+ IExecutionEnvironment env = config.getExecutionEnvironment();
+ assertNotNull(env);
+ } finally {
+ TestUtils.deleteProject(project);
+ TestUtils.delTree(destPath.toFile());
+ }
+ }
+
+
+}
Added: trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectProperties.java
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectProperties.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectProperties.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.python.tests;
+
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.IPath;
+import org.junit.*;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.tests.TestUtils;
+import org.maemo.esbox.core.tests.core.BaseTest;
+import org.maemo.esbox.internal.python.tests.TestActivator;
+import org.maemo.esbox.maemosdk.core.execEnv.GTKExecutionEnvironment;
+import org.maemo.esbox.maemosdk.core.sdk.IScratchbox1SDK;
+import org.maemo.esbox.project.core.IProjectProperties;
+import org.maemo.esbox.project.core.ProjectManager;
+
+/**
+ * Test the use of somewhat obsolete accessors for current project properties, and ensure
+ * we can transparently read old settings from the workspace.
+ * @author eswartz
+ *
+ */
+public class TestPythonProjectProperties extends BaseTest {
+
+ @Before
+ public void setUp() throws Exception {
+ // disable build automatically while creating the project
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription workspaceDesc = workspace.getDescription();
+ workspaceDesc.setAutoBuilding(false);
+ workspace.setDescription(workspaceDesc);
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ public void testNewPythonProjectProperties() throws Exception {
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("testimportpy");
+
+ IProject project = TestUtils.copyAndImportProject(
+ TestActivator.PLUGIN_ID,
+ "data/convert/pyproj-1.5",
+ "testimportpy",
+ projectPath);
+
+ _testNewProjectProperties(project);
+ }
+
+ /**
+ * @param project
+ */
+ private void _testNewProjectProperties(IProject project) throws Exception {
+ IProjectProperties projectProperties;
+ try {
+ projectProperties = ProjectManager.getInstance().getProjectProperties(project);
+ } catch (ESboxException e) {
+ throw e;
+ }
+ String targetName = projectProperties.getTargetName();
+ assertEquals("DIABLO_ARMEL", targetName);
+ String sboxVersion = projectProperties.getSDKName();
+ assertEquals(IScratchbox1SDK.NAME, sboxVersion);
+ String execEnv = projectProperties.getExecutionEnvironmentId();
+ assertEquals(GTKExecutionEnvironment.ID, execEnv);
+
+ // ensure we can change these
+ /*
+ projectProperties.setScratchboxVersion(project, "2");
+ sboxVersion = projectProperties.getScratchboxVersion(project);
+ assertEquals("2", sboxVersion);
+
+ projectProperties.setTargetName(project, "FOOBAR");
+ targetName = projectProperties.getTargetName(project);
+ assertEquals("FOOBAR", targetName);
+ */
+ }
+
+ /**
+ * These should fail because the project was old-style and settings were
+ * stuck in the workspace metadata.
+ * @throws Exception
+ */
+ @Test
+ public void testReadOldPythonProjectProperties() throws Exception {
+ IPath projectPath = TestUtils.getKnownSBVisibleWorkspacePath().append("testimportpy");
+
+ IProject project = TestUtils.copyAndImportProject(
+ TestActivator.PLUGIN_ID,
+ "data/convert/pyproj-1.4",
+ "testimportpy",
+ projectPath);
+
+ _testReadOldProjectProperties(project);
+
+ }
+
+ /**
+ * There will be no old properties because the workspace metadata is gone.
+ * @param project
+ */
+ private void _testReadOldProjectProperties(IProject project) {
+ IProjectProperties projectProperties;
+ try {
+ projectProperties = ProjectManager.getInstance().getOldStyleProjectProperties(project);
+ } catch (ESboxException e) {
+ fail(e.getMessage());
+ return;
+ }
+ String targetName = projectProperties.getTargetName();
+ assertNull(targetName);
+ String sboxVersion = projectProperties.getSDKName();
+ assertNull(sboxVersion);
+ String execEnv = projectProperties.getExecutionEnvironmentId();
+ assertNull(execEnv);
+
+ /*
+ // ensure we can change these
+ projectProperties.setScratchboxVersion(project, "2");
+ sboxVersion = projectProperties.getScratchboxVersion(project);
+ assertEquals("2", sboxVersion);
+
+ projectProperties.setTargetName(project, "FOOBAR");
+ targetName = projectProperties.getTargetName(project);
+ assertEquals("FOOBAR", targetName);
+ */
+ }
+
+}
Added: trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectType.java
===================================================================
--- trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectType.java (rev 0)
+++ trunk/python/org.maemo.esbox.python.tests/src/org/maemo/esbox/python/tests/TestPythonProjectType.java 2008-08-29 19:17:02 UTC (rev 767)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.python.tests;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.maemo.esbox.project.core.IESboxProjectType;
+import org.maemo.esbox.project.core.ProjectManager;
+import org.maemo.esbox.python.project.core.ESboxPythonProjectType;
+
+/**
+ * @author eswartz
+ *
+ */
+public class TestPythonProjectType {
+
+ @Test
+ public void testBasic() throws Exception {
+ IESboxProjectType projectType = ProjectManager.getInstance().getProjectType(ESboxPythonProjectType.ID);
+ assertNotNull(projectType);
+ }
+}
Deleted: trunk/tmp_test/esbox_1.5_inprogress_20080814.zip
===================================================================
(Binary files differ)
More information about the Esbox-commits
mailing list