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 9164871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:47:08+00:00 2026-06-17T14:47:08+00:00

I mean drawing somg simple shape like circle,rectangleFigure,and polylineConnectistrong.It seems that a LightweightSystem has

  • 0

I mean drawing somg simple shape like circle,rectangleFigure,and polylineConnectistrong.It seems that a LightweightSystem has to been constructed on a Canvas such as a Shell.And in a RCP application when I add an extension of an editor,the editor extends org.eclipse.ui.part.EditorPart by default.It has a method called createPartControl.This method has a parameter (Composite parent).

So I write the following code and it give me a Unhandled event loop exception

public void createPartControl(Composite parent) {
    Shell shell = parent.getShell();
    shell.open();
    Display display = shell.getDisplay();
    LightweightSystem lws = new LightweightSystem(shell);
    IFigure panel = new Figure();
    lws.setContents(panel);
    RectangleFigure node1 = new RectangleFigure();
    RectangleFigure node2 = new RectangleFigure();
    node1.setBackgroundColor(ColorConstants.red);
    node1.setBounds(new Rectangle(30, 30, 64, 36));
    node2.setBackgroundColor(ColorConstants.blue);
    node2.setBounds(new Rectangle(100, 100, 64, 36));
    PolylineConnection conn = new PolylineConnection();
    conn.setSourceAnchor(new ChopboxAnchor(node1));
    conn.setTargetAnchor(new ChopboxAnchor(node2));
    conn.setTargetDecoration(new PolygonDecoration());
    Label label = new Label("Midpoint");
    label.setOpaque(true);
    label.setBackgroundColor(ColorConstants.buttonLightest);
    label.setBorder(new LineBorder());
    conn.add(label, new MidpointLocator(conn, 0));
    panel.add(node1);
    panel.add(node2);
    panel.add(conn);
    while (!shell.isDisposed ()) { 
        if (!display.readAndDispatch ()) 
           display.sleep (); 
    }
}

So how to solve this problem and how to draw these figures on the editor?

  • 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-06-17T14:47:09+00:00Added an answer on June 17, 2026 at 2:47 pm

    As you want to draw inside the editor, you don’t need to create new Shell nor dispatch events from the event queue as you would do in a standalone SWT application; just create a Canvas and draw into it. This should help you:

    public void createPartControl(Composite parent) {
        Canvas canvas = new Canvas(parent, SWT.NONE);
        LightweightSystem lws = new LightweightSystem(canvas);
        IFigure panel = new Figure();
        lws.setContents(panel);
        [...]
        panel.add(node1);
        panel.add(node2);
        panel.add(conn);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any drawing libraries out there that are really simple? I literally mean
I mean something like that: class parentClass { public function method() { echo $this->prop;
I mean things like: FK1 -> 1FK2 -> 2PK Please, note that 1FK2 is
I created a custom object that has a Bitmap field. I'm drawing several of
I've never used JFreeChart before. It has been told me that it's a pretty
Suppose you have to create a simple 2D animation, like the drawing of a
I've been wondering if canvas has a limit boundary. I mean if I use
I mean something like: update table_name set field_1=if(date_add(data_field,interval 30 hour) >= now(),1,0), field_2=if(date_add(data_field,interval 30
I mean something like this: http://www.globalscaletechnologies.com/p-25-sheevaplug-dev-kit-uk.aspx My minimal hardware requirement is: Ethernet card UPDATE:
I read a couple of times now that scaling images while drawing should be

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.