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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:05:26+00:00 2026-06-03T07:05:26+00:00

So, I have 2 commands, which are identified by PLAY_COMMAND_ID and STOP_COMMAND_ID . Each

  • 0

So, I have 2 commands, which are identified by PLAY_COMMAND_ID and STOP_COMMAND_ID. Each of command have each handler, respectively playHandler and stopHandler (these are extending AbstractHandler class).

These commands are contributed to my view’s toolbar in Button style. Basically what I want is initially the PLAY_COMMAND is active but the STOP_COMMAND not. When the PLAY_COMMAND is clicked, then it will activate the STOP_COMMAND then deactivate itself(PLAY_COMMAND). And vice versa when the STOP_COMMAND clicked.

So what I do is like this. At first it works (I clicked play-button, then stop-button is activated and play-button disabled. I clicked stop-button, then play-button is active and stop-button is disabled. But when I clicked the play-button again, the play-button is still active when the stop-button is active too). So what’s wrong with my code here:

private AbstractHandler playHandler, stopHandler, pauseHandler, stepHandler;
private IHandlerActivation playActivation, stopActivation, pauseActivation, stepActivation;
private void createHandlers(){
  final IHandlerService handlerService = (IHandlerService)getSite().getService(IHandlerService.class);
    playHandler = new AbstractHandler() {

      @Override
      public Object execute(ExecutionEvent event) throws ExecutionException {
        handlerService.deactivateHandler(playActivation);
        if(stopActivation == null){
          stopActivation = handlerService.activateHandler(STOP_COMMAND_ID, stopHandler);
        } else {
          handlerService.activateHandler(stopActivation);
        }
        return null;
      }
    };

    stopHandler = new AbstractHandler() {

      @Override
      public Object execute(ExecutionEvent event) throws ExecutionException {
        handlerService.deactivateHandler(stopActivation);
        handlerService.activateHandler(playActivation);
        return null;
      }
    };  
    playActivation = handlerService.activateHandler(PLAY_COMMAND_ID, playHandler);
  }
}

The createHandlers() method is called at the end of createPartControl(Composite parent) method in my View.

  • 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-03T07:05:28+00:00Added an answer on June 3, 2026 at 7:05 am

    Okay, so here what I found. The IHandlerActivation, that is returned when calling activateHandler(IHandlerActivation) method, when it is deactivated, can’t be used again in activating the same handler. So the solution is try calling handlerService.activateHandler(commandID, playHandler) instead of calling handlerService.activateHandler(playActivation).

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

Sidebar

Related Questions

Do all git commands have a --dry-run option, or one which would indicate what
I have a C application which provides a shell for entering commands. I'm trying
So, I have a Makefile which runs different commands of how to build S/W.
I have a command which lists Weblogic instances directories on a server.I want to
I have a command which finds all the files containing a certain string on
I have the following awk command which works perfectly: awk 'BEGIN { ORS =
Say I have a command line C program which is currently executing, and I
I have an application which is built from command line (ANT) using J2ME Polish.
I have a function which sends a command over serial, then receives a response
I have a c program which I can launch at command prompt. Is it

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.