A specialized Eclipse Plugin designed to provide a rich, intelligent editing experience for UML OpaqueBehavior bodies and Ecore model annotations. It is particularly well-suited for developers writing C++ behaviors intended for the MDE4CPP (Model-Driven Engineering for C++) code generation framework.
Instead of relying on basic, unformatted text boxes for defining model behaviors, this plugin injects a fully-featured, context-aware code editor directly into the Eclipse IDE.
To open the custom OpaqueBehaviour code editor:
- Intelligently queries the underlying UML/Ecore model using a
ModelDictionary. - Suggests properties, operations, and variables that actually exist in your model's context.
- Ships with built-in code templates (e.g.,
create,for,cast). - Features full Eclipse LinkedModeUI support: When a snippet is expanded, use
TABto instantly jump between variable placeholders. - Variable Mirroring: Typing into a placeholder automatically updates all matching placeholders in real-time.
- Fully Customizable: Snippets are externalized. You can add, edit, or disable snippets by modifying
~/.opaque_snippets.propertiesin your home directory.
- Custom, real-time syntax highlighter that goes beyond basic keywords.
- Visually distinguishes between Standard Types (e.g.,
std::shared_ptr), UML Model Types, Variables, Methods, Strings, and Comments. - Find and Replace: Integrated search dialog with full highlighting support for "Find All" matches across the code block.
- Code Folding: Collapse and expand code blocks (e.g., inside curly braces) to easily navigate large files, complete with a visual folding ruler.
- Line Numbers: Displays a dedicated line number ruler in the editor margin for easy code navigation.
- Bracket Matching: Highlights corresponding opening and closing brackets (
(),{},[]) to help you easily track nested code scopes. - Current Line Highlighting: Subtly highlights the active line your cursor is on for improved focus.
- Rename Symbol: Intelligently find and rename all occurrences of a variable within the behavior body (F2 or Ctrl+R).
- Fully compatible with both Eclipse Light and Dark themes.
- C++ Smart Pointers: If you type
.on a variable that the editor resolves as a C++ pointer type, it automatically transforms the keystroke into->to save you time.
- Natively supports C++ and Java language definitions, easily toggleable via a dropdown menu.
- Built-in Auto-Formatting to keep your code clean and aligned.
- Experimental Code Translation: A translation button to attempt converting behavioral code from one language to another.
- Validates the written code against the model dictionary to ensure you aren't referencing properties or types that do not exist in the UML scope.
- Error Markers appear directly in the editor gutter when validation fails or syntax errors are detected.
- Quick-Fix Code Actions: Place your cursor over a semantic validation error (e.g., undefined method) and press
Ctrl + .to view and apply "Did you mean...?" suggestions powered by an intelligent edit-distance algorithm.
- Hovering over a validation error marker provides quick diagnostic information.
- Hovering over variables and types displays rich semantic tooltips outlining their underlying model metadata.
- Hold
Ctrl(orCmdon Mac) and hover over model variables and methods to turn them into clickable hyperlinks. - Clicking a hyperlinked element will automatically select and navigate to the corresponding entity directly within the Eclipse Model Explorer!
Ctrl + Space(Cmd + Space): Trigger context-aware auto-completion and snippets.Ctrl + Z(Cmd + Z): Undo the last change.Ctrl + YorCtrl + Shift + Z(Cmd + Shift + Z): Redo the last undone change.Ctrl + F(Cmd + F): Open the Find and Replace dialog.F2orCtrl + R(Cmd + R): Rename the symbol under the cursor.Ctrl + Shift + F(Cmd + Shift + F): Auto-format the current document.Ctrl + /(Cmd + /): Toggle line comments for the selected block.Ctrl + D(Cmd + D): Delete the current line.Ctrl + Alt + Down(Cmd + Option + Down): Duplicate the current line.Ctrl + L(Cmd + L): Go to a specific line number.Ctrl + =orCtrl + +(Cmd + =): Zoom in editor text.Ctrl + -(Cmd + -): Zoom out editor text.Alt + Z(Option + Z): Toggle word wrap.Ctrl + S(Cmd + S): Quickly save the currently edited OpaqueBehaviour body.Ctrl + Click(Cmd + Click): Navigate to the underlying model element for the hovered variable/method.Ctrl + .(Cmd + .): Trigger Quick-Fix suggestions for validation errors.Ctrl + Shift + [(Cmd + Shift + [): Collapse the current code block.Ctrl + Shift + ](Cmd + Shift + ]): Expand the current code block.TAB: Instantly jump between variable placeholders when a code snippet is expanded.
To add your own custom snippets with multiple placeholders, modify the ~/.opaque_snippets.properties file (generated on first run):
multi.label=myMultiPlaceholder (Snippet)
multi.template=std::shared_ptr<${Type1}> ${item} = factory->create${Type1}(${Type2});Note: Use the ${VariableName} syntax to define placeholders. The editor will automatically handle the TAB-jumping and mirroring!



