2011年12月11日 星期日

Eclipse Modeling Framework Technology (EMFT)

URL: http://www.eclipse.org/modeling/emft/?project=ecoretools

Ecore Tools
EEF


Book:

EMF: Eclipse Modeling Framework, 2nd Edition (2009)

http://www.informit.com/store/product.aspx?isbn=9780321331885


Acceleo:
http://www.acceleo.org

2011年9月21日 星期三

The usage of Table/TableLayout

TableLayout.register(Actor):
Save to HashMap nameToWidget.

Actor: UI component (widgets), such as Swing JTextField / Android Button.

Window extend Table and contains a TableLayout.

Window.add:
Save to HashMap widgetToCell.

What's the difference?

TableLayout.parse(FileHandle):
Parse a table info and adds the widgets and cells to the table from file.

2011年6月13日 星期一

DLTK tutorial

實作Python DLTK需要以下class與檔案:
1. Project nature
定義 content type
定義 nature
並加入以下class XML資訊:

ScriptNature :
2. ExamplePythonNature extends ScriptNature

Describer:
3. ExamplePythonContentDescriber extends ScriptContentDescriber

DLTK Language Toolkit:
4. ExamplePythonLanguageToolkit extends AbstractLanguageToolkit

DLTK UI-Language Toolkit:
5. ExamplePythonUILanguageToolkit extends AbstractDLTKUILanguageToolkit

Structure Parser:
6. ExamplePythonSourceElementParser extends AbstractSourceElementParser

Interpreter:
7. ExamplePythonInstallType extends AbstractInterpreterInstallType
8. ExamplePythonInstall extends AbstractInterpreterInstall
9. ExamplePythonInterpreterPreferencePage extends ScriptInterpreterPreferencePage

Interpreter Preference (optional):
10. ExamplePythonInterpreterPreferencePage extends ScriptInterpreterPreferencePage
11. ExamplePythonInterpretersBlock extends InterpretersBlock
11. ExampleAddPythonInterpreterDialog extends AddScriptInterpreterDialog
12. ExamplePythonInterpreterLibraryBlock extends AbstractInterpreterLibraryBlock

Editor:
13. ExamplePythonEditor extends ScriptEditor

Syntax highlighting:
14. create interfaceIExamplePythonPartitions


Editor Source configuration:

15. ExamplePythonTextTools extends ScriptTextTools (For creating SourceViewerConfiguration)
16. ExamplePythonSourceViewerConfiguration extends ScriptSourceViewerConfiguration
17. ExamplePythonContentAssistPreference extends ContentAssistPreference

Eclipse platform UI:
18. ExmplePythonUI extends AbstractUIPlugin (To hold the text tools)

Partitioning (used for highlighting) 特定 Scanner <-> Partition:
(如: code partition (for source code), commentary partition (for source code comments), string partition)
19. ExamplePythonPartitionScanner extends RuleBasedPartitionScanner
20: create interface: IPartitionTokenScanner from: ExamplePythonTextTools.getPartitionScanner()

Color constants:
21: create interface: IExamplePythonColorConstants
22. ExamplePythonUIPreferenceInitializer extends AbstractPreferenceInitializer

Keyword highlighting:
23. ExamplePythonCodeScanner extends AbstractScriptScanner (關鍵字)

Search:
24. ExamplePythonSearchPage extends ScriptSearchPage
25. ExamplePythonSearchFactory extends AbstractSearchFactory
26. ExamplePythonMatchLocationParser extends  MatchLocatorParser

Open type:
27. ExamplePythonOpenTypeAction extends OpenTypeAction

Open declaration:
28. ExamplePythonSelectionEngine implements ISelectionEngine

Simple documentation provider for comments:
29. ExamplePythonCommentDocumentationProvider implements IScriptDocumentationProvider

Code assistance:
30. ExamplePythonCompletionEngine implements ICompletionEngine

Completion:
31. ExamplePythonCompletionProposalComputer extends  ScriptCompletionProposalComputer
32. ExamplePythonCompletionProposalCollector extends ScriptCompletionProposalCollector
33. ExamplePythonCompletionProposal extends ScriptCompletionProposal
34. ExamplePythonCompletionProcessor extends ScriptCompletionProcessor

Code templates
35. ExamplePythonUniversalTemplateContextType extends ScriptTemplateContextType
36. ExamplePythonTemplateContext extends ScriptTemplateContext
37. ExamplePythonTemplateCompletionProcessor extends ScriptTemplateCompletionProcessor
38. ExamplePythonTemplateAccess extends ScriptTemplateAccess
39. ExamplePythonCodeTemplatesPreferencePage extends ScriptTemplatePreferencePage
40. ExamplePythonUILanguageToolkit2 extends ExamplePythonUILanguageToolkit (AbstractDLTKUILanguageToolkit)
41. ExampleSimplePythonSourceViewerConfiguration extends ExamplePythonSourceViewerConfiguration (SourceViewerConfiguration)

2011年6月12日 星期日

How to build a code formatter with your editor within eclipse

1. 實作 MyEditor extends SourceViewerConfiguration
2. 覆寫 MyEditor.getContentFormatter
3. 實作 MyStrategy extends ContextBasedFormattingStrategy
4. 在 plugin.xml 加入: plugin.xml
5. 新增 Action

 <extension
         point="org.eclipse.ui.actionSets">
      <actionSet
            label="MyEditor Action set"
            description="Action set description"
            visible="false"
            id="MY_PLUGIN.myActionSet">
         <action
               definitionId="*MY_PLUGIN_ACTION_NAME*"
               label="Format"
               retarget="true"
               menubarPath="org.eclipse.dltk.ui.source.menu/editGroup"
               id="MY_PLUGIN.MY_ACTION_FORMAT_ID">
         </action>
       </actionSet>
</extension>


6. 新增 Key binding
7. 新增 Command
8. MyScriptEditor implementation override method createActions(){

 super.createActions();


 action= new TextOperationAction(DLTKEditorMessages.getBundleForConstructedKeys(), "Format.", this, ISourceViewer.FORMAT);


 action.setActionDefinitionId("*MY_PLUGIN.MY_ACTION_NAME*");
 setAction("Format", action);
 markAsStateDependentAction("Format", true);
 markAsSelectionDependentAction("Format", true);


}


9. Editor context parent 必須是:
"org.eclipse.dltk.ui.scriptEditorScope"



2011年6月11日 星期六

EeePad TF101 超頻之路

目前最新 Honeycomb v3.1, TF101已經更新.

最原始版本: v8.2.3.9 (HC 3.0)
目前最新版本: v8.4.4.5 (HC 3.1)

1. 若不小心升級到v8.4.4.5, 需要先downgrade到 v8.2.3.9 (參考A參考B)
2. root
3. 安裝 CWM 復原 (Clockwork Mod)
4. 重新開機, Volume down + Power -> 使用 CWM 安裝 custom ROM (PRIME v1.x 或 PRIMORDIALv3.x) 或是 epad_TW_8239_8445-1.zip ROM
  (install zip from sdcard -> choose zip from sdcard)
5. 再度重新開機 (TF101用blob的方式更新rom,只要燒錄過任何東西,一定要重新開機後再燒下一個。不可連續接著燒下去)
5. 換成 custom 超頻核心 (Clemsyn-Blades overclocking kernel)
6. 最高可超頻 1.6 ghz (原始 1.0 ghz)

PS: 若覺該kernel不穩,想要換回來:
a. ClockworkMod 3.1.0.1-solarnz-R3 (此版本修正了備份的一些問題)
b. 原始3.1 kernel

(使用 Quadrant Advanced)
PRIME效能測試
PRIME v1.4 vs PRIMORDIALv3.1

2011年3月4日 星期五

建立AOSP (Dream/Sapphire by Gingerbread for example)

http://forum.xda-developers.com/showthread.php?t=882356


As some of you may know I've been working on a open source build for a near AOSP version of Gingerbread for the Dream/Sapphire.

Unless a better name is conceived I'll call it ezGingerbread!

The idea is to do this mostly in the open; and I'm sure this will be forked into various builds in the future. Here however we can discuss this repository; and make recommendations for maintaining a base stable, and fast install for out phones.

I'll make a new thread for initial release candidates and releases when we are ready. This thread will remain even after said releases for the ongoing development.

NOTICE this thread is to help build & develop gingerbread roms for the Dream/Sapphire platform; no binaries on this page are supported at this point in time; and no rom installation support will be provided.

Help with the build system will be provided within reason.

(FYI: if you are looking for testing binaries they are in post 2)

To Build,

The following is based off CyanogenMod wiki and explains how to build on:
Ubuntu 10.04 (Lucid) & Ubuntu 10.10a3 (Meerkat) and ideally a AMD64 compatible computer

I personally (mostly following the same instructions) use Debian squeeze and others have succeeded with 32bit systems.

Computer Setup (only if you have not made an android build environment before):

1) It is not 100% needed but highly recommended to install the Android SDK
2) Install the build packages
Originally Posted by cmwiki
Install using the package manager of your choice:

For 32-bit & 64-bit systems:

git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush

For 64-bit only systems:

g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib

Note: On Ubuntu 10.10, and variants, you need to enable the parter repository to install sun-java6-jdk:

add-apt-repository "deb http://archive.canonical.com/ maverick partner"
3) make a directory for you android work say 'mkdir ~/android'
4) download repo: 'curl http://android.git.kernel.org/repo > ~/android/repo'
5) symlink repo to somewhere on your path (Optional but will make things easier) example 'sudo ln -s ~/android/repo /usr/local/bin/repo'

if you do not add repo to the path remember to replace any calls to repo with a calling path.. in all cases below it will be '../repo'

Getting the code

6) cd into your android directory you created above: 'cd ~/android'
7) create a directory for ezGingerbread: 'mkdir ezGingerbread'
8) cd ezGingerbread
9) init the repo: 
Code:
repo init -u git://github.com/ezterry/manifest-gingerbread-DS.git -b gingerbread
it will ask for your name+gmail, answer real or fake
10) sync to download the code: 
Code:
repo sync
(go out and enjoy the day.. this will take a while)

Proprietary files

Extract the proprietary files, historically the extract_files script is used, but requires your phone to already have the rom installed, so we will use unzip_files instead.

11) download the most recent version of the nighties (usually the proprietary files don't change but sometimes we swap them):
Code:
curl http://sandbox.devnull.name/android/gingerbread/GINGERBREAD-DS-Alpha-20110129-1.zip > sapphire_update.zip
12) 'cd device/htc/sapphire/'
13) run './unzip-files.sh'
14) return to the root directory: 'cd ~/android/ezGingerbread'

Note: if you have been asked to re-build the proprietary files, either because an autogenerated make script was updated, or a change in the files: run 'rm -rf vendor;repo sync;' before re-running the above.

Building:

15) run '. build/envsetup.sh'
16) run 'lunch' and select full_sapphire-userdebug (shortcuts you will find are 'lunch full_sapphire-userdebug' or just 'lunch 3' but these may change if the target name is changed in future, the menu will always list all the options)
17) run 'make -j otapackage'
for example if you have a quad code CPU: 'make -j5 otapackage'
a dual core is 'make -j3 otapackage'

The -jN indicates the number of parallel threads make will run, but using -j5 I assure all 4 cores are at 100% utilization .. important as it can take 3-4h to build on a single core.

18) after you realize the build is done (ie fan on computer stopped working overtime) the flashable image will be:
ls out/target/product/sapphire/full_sapphire-ota-eng..zip

so 'ls -l out/target/product/sapphire/full_sapphire-ota-eng*zip'

The resulting image will be an EBI0/EBI1/2708+ anykernel installer

Updating and Rebuilding:

Usually you only need to run the following for a updated clean build:
19) run 'repo sync'
20) make clobber
21) make -j otapackage

In some cases you may wish to re-generate the proprietary files if something changed:

in that case:
* Run 'rm -rf vendor'
* Run 'repo sync'
* pick up with 'Proprietary files' section above.

Last if you are doing active development in the build tree its easy to be confused about the trees state, to restore to the clean tree:

* cd ~/android/ezGingerbread
* run: (note this will delete everything but the .repo (or other hidden) directories, be careful.
Code:
rm -rf `ls -a | grep -v "^\." `
* run 'repo sync' this will not take too long, its just extracting the files, the data has mostly been downloaded from your original sync.
* Continue with the 'Proprietary files' section above.

To Fix,

If you have a patch give me a push on github, a message here, or send me a PM I'll review it and include it if appropriate.

Known issues and status,

I'm currently tracking issues on github:
https://github.com/ezterry/manifest-...read-DS/issues