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