コード例 #1
0
  public UnlinkElementsAction() {

    setImageDescriptor(
        AbstractUIPlugin.imageDescriptorFromPlugin(FLATTT.ID_PLUGIN, "icons/link_break.png"));

    setText(FLATTT.getResourceString("actions.UnlinkElementsAction.ToolTip"));

    // We want to be notified when the active concern model changes
    ConcernModelFactory.singleton().addListener(this);

    concernModelProvider = ConcernModelFactory.singleton();

    // We want to be notified when any concerns or links are
    // changed in the active concern model
    concernModelProvider.getModel().addListener(this);
  }
コード例 #2
0
  /*
   * Refresh menu when concerns and links change
   */
  @Override
  public void modelChanged(ConcernEvent events) {
    if (events.isChangedDomainName()) return;

    if (events.isChangedActiveConcernModel()) {
      concernModelProvider.getModel().removeListener(this);
      concernModelProvider = ConcernModelFactory.singleton();

      // We want to be notified when any concerns or links are
      // changed in the active concern model
      concernModelProvider.getModel().addListener(this);
    }

    boolean hasLinkOrUnlink = false;

    for (ConcernEvent event : events) {
      if (event.isLinked() || event.isUnlinked()) {
        hasLinkOrUnlink = true;
        break;
      }
    }

    if (hasLinkOrUnlink) Display.getDefault().asyncExec(new UpdateDropDownMenusRunner(events));
  }