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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:23:19+00:00 2026-06-10T03:23:19+00:00

Using Eclipse and SWT I am currently trying to get a CommandContributionItem (CCI) as

  • 0

Using Eclipse and SWT I am currently trying to get a CommandContributionItem (CCI) as a Button into a ViewPart with two text fields. When I push the button my ParameterizedCommand should be called using the current text values of the text fields as parameters.

I was able to pass the initial values of the text fields to the CCI like that:

public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));

    text = new Text(parent, SWT.BORDER);
    text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    text_1 = new Text(parent, SWT.BORDER);
    text_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Map<String, String> params = new HashMap<String, String>();
    params.put("myString", text.getText());
    params.put("mySecondString", text_1.getText());

    CommandContributionItemParameter p = new CommandContributionItemParameter(getSite(),
            "commandSyso","com.voo.example.commandparameter.simple.sysoCommand",  CommandContributionItem.STYLE_PUSH);
    p.label = "My Label";
    p.parameters = params;
    CommandContributionItem item = new CommandContributionItem(p);
    item.fill(parent);
}

But it is a static one-time pass. Is there a way to update this dynamically every time the CCI is called?

  • 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-10T03:23:20+00:00Added an answer on June 10, 2026 at 3:23 am

    CommandContributionItem parameters are static in nature. You can’t modify them, only create a new instance of CommandContributionItem.

    When working with commands, implementation of IHandler should look for the current selection using the ExecutionEvent.getApplicationContext(). If it is an IEvaluationContext, the selection can be retrieved using org.eclipse.ui.handlers.HandlerUtil

    But in your example, you would need some way to supply the values of your 2 text fields to the framework, either by implementing an ISelectionProvider, an ISourceProvider (where you could provide each text field under a new name), or by having your handler check for your IViewPart and then access the information through accessors.

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

Sidebar

Related Questions

I am trying to create a Hello World SWT application using Eclipse. I follow
I am using org.eclipse.swt.widgets.Text 's type of Text field. I want to increase the
I have a dual-boot OS X / Ubuntu and am currently using separate Eclipse
Using the Eclipse SWT StyledText widget, how can you indent/un-indent a selected block of
We're running Java Swing and are using an SWT bridge to get ahold of
How do I build an SWT application using the Eclipse P2 repository and the
I'm developing an Eclipse SWT application using Eclipse. There are also some JUnit 4
Right now i've written a simple SWT application using eclipse, and I want to
I m testing a eclipse plugin using swt bot.but I cant find a way
I am using JFreeChart library to plot something in an Eclipse view and currently

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.