code_editor.html 11 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]--><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="Asciidoctor 1.5.4"><meta name="keywords" content="documentation, sdk, editor"><title>jMonkeyEngine SDK: Code Editor and Palette</title><link rel="stylesheet" href="./asciidoctor.css">
  2. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  3. <link rel="stylesheet" href="./coderay-asciidoctor.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css"></head><body class="article toc2 toc-left"><div id="header"><div id="toolbar"><a href="https://github.com/jMonkeyEngine/wiki/edit/master/src/docs/asciidoc/sdk/code_editor.adoc"><i class="fa fa-pencil-square" aria-hidden="true"></i></a><a href="https://github.com/jMonkeyEngine/wiki/new/master/src/docs/asciidoc/sdk/"><i class="fa fa-plus-square" aria-hidden="true"></i></a><input dir="auto" style="position: relative; vertical-align: top;" spellcheck="false" autocomplete="off" class="searchbox__input aa-input" id="doc-search" name="search" placeholder="Search in the doc" required="required" type="search"></div><h1>jMonkeyEngine SDK: Code Editor and Palette</h1><div class="details"><span class="author" id="author"></span><br><span id="revnumber">version ,</span> <span id="revdate">2016/03/17 20:48</span></div><div id="toc" class="toc2"><div id="toctitle">Table of Contents</div><ul class="sectlevel1"><li><a href="#code-completion-and-code-generation">Code Completion and Code Generation</a></li><li><a href="#semantic-and-syntactic-coloring">Semantic and Syntactic Coloring</a></li><li><a href="#editor-hints-and-quick-fixes-a-k-a-lightbulbs">Editor Hints and Quick Fixes (a.k.a. Lightbulbs)</a></li><li><a href="#javadoc">Javadoc</a></li><li><a href="#navigating-the-jme3-source">Navigating the jME3 Source</a></li><li><a href="#palette">Palette</a></li><li><a href="#keyboard-shortcuts">Keyboard Shortcuts</a></li><li><a href="#tips-and-tricks">Tips and Tricks</a></li></ul></div></div><div id="content"><div id="preamble"><div class="sectionbody"><div class="paragraph"><p>The Source Code Editor is the central part of the jMonkeyEngine SDK. This documentation shows you how to make the most of the jMonkeyEngine SDK&#8217;s assistive features.</p></div>
  4. <div class="paragraph"><p>Note: Since the jMonkeyEngine SDK is based on the NetBeans Platform framework, you can learn about certain jMonkeyEngine SDK features by reading the corresponding NetBeans IDE tutorials (in the “see also links).</p></div></div></div>
  5. <div class="sect1"><h2 id="code-completion-and-code-generation">Code Completion and Code Generation</h2><div class="sectionbody"><div class="paragraph"><p>While typing Java code in the source code editor, you will see popups that help you to write more quickly by completing keywords, and generating code snippets. Additionally, they will let you see the javadoc for the classes you are working with.</p></div>
  6. <div class="imageblock right"><div class="content"><img src="../sdk/netbeans_code_completion.png" alt="netbeans_code_completion.png" width="" height=""></div></div>
  7. <div class="paragraph"><p><strong>Code Completion</strong></p></div>
  8. <div class="ulist"><ul><li><p>Complete keyword / method / variable: <strong>Ctrl-Space</strong><br>
  9. Alternatively you can also use <strong>Ctrl-\</strong>.</p><div class="ulist"><ul><li><p>Customize Code Completion options: Tools &gt; Options &gt; Editor &gt; Code Completion</p></li></ul></div></li><li><p>Show expected parameters of this method in a tooltip: <strong>Ctrl-P</strong></p></li><li><p>Complete any string (even non-Java) that has been used before: <strong>(Shift-)Ctrl-K</strong></p></li></ul></div>
  10. <div class="paragraph"><p><strong>Code Generation</strong></p></div>
  11. <div class="ulist"><ul><li><p>Auto-fix import statements: <strong>Ctrl-Shift-I</strong></p></li><li><p>Auto-generate getters/setters, try/catch, equals/hashCode: <strong>Alt-Insert</strong></p><div class="ulist"><ul><li><p>Customize code completion: Choose Tools &gt; Options &gt; Editor &gt; Code Completion</p></li></ul></div></li><li><p>Auto-generate common code snippets such as loops, declarations, println, by typing the <strong>template name + TabKey</strong></p><div class="ulist"><ul><li><p>Customize code templates: Choose Tools &gt; Options &gt; Editor &gt; Code Templates</p></li></ul></div></li><li><p>Rename, move, or introduce methods, fields, and variables, without breaking the project: <strong>Refactoring menu</strong></p></li></ul></div></div></div>
  12. <div class="sect1"><h2 id="semantic-and-syntactic-coloring">Semantic and Syntactic Coloring</h2><div class="sectionbody"><div class="imageblock right"><div class="content"><img src="../sdk/jmonkeyplatform-docu-5.png" alt="jmonkeyplatform-docu-5.png" width="421" height="298"></div></div>
  13. <div class="paragraph"><p>The text color in the editor gives you important hints how the compiler will interpret what you typed, even before you compiled it.</p></div>
  14. <div class="paragraph"><p>Examples:</p></div>
  15. <div class="ulist"><ul><li><p>Java keywords are <strong>blue</strong>, variables and fields are <strong>green</strong>, parameters are <strong>orange</strong>.</p></li><li><p><strike>Strikethrough</strike> means deprecated method or field.</p></li><li><p><u>Gray underline</u> means unused variable or method.</p></li><li><p>Place the caret in a method or variable and all its ocurrences are marked <strong>tan</strong>.</p></li><li><p>Place the caret in a method&#8217;s return type to highlight all exit points</p></li><li><p>and many more…</p></li></ul></div>
  16. <div class="paragraph"><p>To customize Colors and indentation:</p></div>
  17. <div class="ulist"><ul><li><p>Tools &gt; Options &gt; Editor &gt; Formatting.</p></li><li><p>Tools &gt; Options &gt; Fonts and Colors.</p></li></ul></div></div></div>
  18. <div class="sect1"><h2 id="editor-hints-and-quick-fixes-a-k-a-lightbulbs">Editor Hints and Quick Fixes (a.k.a. Lightbulbs)</h2><div class="sectionbody"><div class="paragraph"><p>Editor hints and quick fixes show as lightbulbs along the left edge of the editor. They point out warnings and errors, and often propose useful solutions!</p></div>
  19. <div class="ulist"><ul><li><p>Execute a quick fix: Place the caret in the line next to the lightbulb and press <strong>Alt-Enter</strong> (or click the lightbulb)</p><div class="ulist"><ul><li><p>Customize hints: Choose Tools &gt; Options &gt; Editor &gt; Hints.</p></li></ul></div></li></ul></div></div></div>
  20. <div class="sect1"><h2 id="javadoc">Javadoc</h2><div class="sectionbody"><div class="ulist"><ul><li><p>Place the caret above a method or a class that has no Javadoc, type</p><div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="html">/**</code></pre></div></div>
  21. <div class="paragraph"><p>and press Enter: The editor generates skeleton code for a Javadoc comment.</p></div></li><li><p>Right-click the project in the Projects window and choose Generate Javadoc.</p></li><li><p>Right-click a file and choose Tools &gt; Analyze Javadoc</p></li></ul></div>
  22. <div class="paragraph"><p>To display a javadoc popup in the editor, place the caret in a line and press <strong>Ctrl-Space</strong> (Alternatively use <strong>Ctrl-\</strong>).</p></div>
  23. <div class="ulist"><ul><li><p>If the javadoc popup doesn&#8217;t work, make certain that</p><div class="ulist"><ul><li><p>You have the Java JDK documentation installed and set up: Tools &gt; Java Platforms</p></li><li><p>You downloaded and set up javadoc for third-party libraries: Project properties &gt; Libraries &gt; Edit</p></li></ul></div></li></ul></div></div></div>
  24. <div class="sect1"><h2 id="navigating-the-jme3-source">Navigating the jME3 Source</h2><div class="sectionbody"><div class="paragraph"><p>When the JavaDoc does not deliver enough information, you can have a look at the source of every method or object of jME3 that you use. Just right-click the variable or method, select “Navigate &gt; Go to source.. and an editor will open showing you the source file of jME3.</p></div></div></div>
  25. <div class="sect1"><h2 id="palette">Palette</h2><div class="sectionbody"><div class="openblock float-group"><div class="content"><div class="imageblock right"><div class="content"><img src="../sdk/jmonkeyplatform-docu-4.png" alt="jmonkeyplatform-docu-4.png" width="421" height="298"></div></div>
  26. <div class="paragraph"><p>Choose Windows &gt; Palette to open the context-sensitive Palette. The jMonkeyEngine SDK provides you with jme3 code snippets here that you can drag and drop into your source files.</p></div>
  27. <div class="ulist"><ul><li><p>Examples: Node and Model creation code snippets.</p></li></ul></div></div></div>
  28. <div class="admonitionblock tip"><table><tr><td class="icon"><i class="fa icon-tip" title="Tip"></i></td><td class="content"><div class="paragraph"><p>Choose Tools &gt; Add to Palette… from the menu to add your own code snippets to the Palette. (not available yet in beta build)</p></div></td></tr></table></div></div></div>
  29. <div class="sect1"><h2 id="keyboard-shortcuts">Keyboard Shortcuts</h2><div class="sectionbody"><div class="paragraph"><p>Keyboard Shortcuts save you time when when you need to repeat common actions such as Build&amp;Run or navigation to files.</p></div>
  30. <div class="ulist"><ul><li><p>Go to File: <strong>Alt-Shift-O</strong></p></li><li><p>Go to Type: <strong>Ctrl-O</strong></p></li><li><p>Open in Projects / Files / Favorites window: <strong>Ctrl-Shift-1 / 2 / 3</strong></p></li><li><p>Build&amp;Run the main class of the Project: <strong>F6</strong></p></li><li><p>Run the open file: <strong>Shift-F6</strong></p></li><li><p>Switch to Editor / Projects / Files / Navigator: <strong>Ctrl-0 / 1 / 3 / 7</strong></p></li><li><p>Indent code: <strong>Ctrl-Shift-F</strong></p></li></ul></div>
  31. <div class="paragraph"><p>By default, jMonkeyEngine uses the same <a href="http://netbeans.org/project_downloads/www/shortcuts-6.5.pdf">Editor Shortcuts</a> as the NetBeans IDE, but you can also switch to an Eclipse Keymap, or create your own set.</p></div>
  32. <div class="ulist"><ul><li><p>Customize keyboard shortcuts: Tools &gt; Options &gt; Keymap</p></li></ul></div></div></div>
  33. <div class="sect1"><h2 id="tips-and-tricks">Tips and Tricks</h2><div class="sectionbody"><div class="ulist"><ul><li><p>To browse the physical file structure of your project, use the Files window: <strong>Ctrl-2</strong></p></li><li><p>To open a file that is not part of a Java project, add it to the Favorites window: <strong>Ctrl-3</strong></p></li><li><p>If you cannot find a particular menu item or option panel, use the IDE Search box in the top right! <strong>Ctrl-i</strong></p></li><li><p>If a code block, class, or javadoc is quite long and you don&#8217;t want to scroll over it, click the <strong>+/-</strong> signs to collapse (fold) the code block temporarily.</p></li><li><p>Press <strong>F1</strong> for Help</p></li></ul></div>
  34. <hr>
  35. <div class="paragraph"><p>See also</p></div>
  36. <div class="ulist"><ul><li><p><a href="http://netbeans.org/kb/docs/java/editor-codereference.html">Code Assistance</a></p></li></ul></div></div></div></div><div id="footer"><div id="footer-text">Version <br>Last updated 2018-02-04 12:04:19 +00:00</div></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script><script>docsearch({
  37. apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
  38. indexName: 'jmonkeyengine',
  39. inputSelector: '#doc-search',
  40. debug: false // Set debug to true if you want to inspect the dropdown
  41. });</script></body></html>