Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7677715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:29:08+00:00 2026-05-31T17:29:08+00:00

Summary I am working on an emf-based editor. Up until now I didn’t use

  • 0

Summary
I am working on an emf-based editor. Up until now I didn’t use EMF commands, but now I want to refactor my code to use them.

Current state
I am using a tree viewer as the main part of my editor. I added all kind of Actions via the org.eclipse.ui.popupMenus extension point. These actions directly interfere with the model, adding and removing objects.

Problems
With this approach I have to manually remove every reference when deleting objects in the model which easily introduces errors. Also the undo/redo actions in the editor don’t work.

Goal
Refactor the Actions so they properly use EMF commands to modify the model.


Within the EMF documentation I found this code snippet:

  Department d = ...
  EditingDomain ed = ...
  Command cmd = RemoveCommand.create(ed, d);
  ed.getCommandStack().execute(cmd);

…which looks like the code I have to use. But I don’t know where I can get the EditingDomain from.

So these are my questions:

  • Is this the approach I want to use in my Actions?
  • Where can I get the EditingDomain from?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:29:10+00:00Added an answer on May 31, 2026 at 5:29 pm

    There is an easy way to access the current editing domain. Just add this code to the Action class.

    private EditingDomain domain;
    
    public void setActivePart(IAction action, IWorkbenchPart workbenchPart) {
        if (workbenchPart instanceof IEditingDomainProvider) {
            domain = ((IEditingDomainProvider) workbenchPart).getEditingDomain();
        }
    }
    

    The method setActivePart will automatically be called from the Eclipse framework. With this technique you should always have access to the editing domain.

    Note that this is only true if your editor is based on mostly untouched generated code. If you manage the EditingDomains yourself you should use your own methods.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basic summary: Working on a game that generates a 15x15 grid for the player
I'm working on summary on the eclipse modeling project and its various sub -
I'm looking for a good summary of best practices for working with TFS source
I'm working on a student project team building application. I'm familiar with optimization but
I have been working on this problem for a while but still no joy.
Summary: I want to see more detailed XML/SVG parsing error messages. I want to
Summary I want to write a .png file as quickly as possible, without a
We've been working with ASP.Net MVC2 based web app. We're using DataAnnotations for model
I'm working on a visual studio 2008 add-in that will generate data-access code by
Summary From a conceptual point of view, should one be working with UIViewController subclasses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.