Examples of LabelAction


Examples of org.rssowl.ui.internal.actions.LabelAction

    /* Retrieve Labels that all selected News contain */
    labelMenu.add(new Separator());
    Set<ILabel> selectedLabels = ModelUtils.getLabelsForAll(selection);
    for (final ILabel label : labels) {
      LabelAction labelAction = new LabelAction(label, selection);
      labelAction.setChecked(selectedLabels.contains(label));
      labelMenu.add(labelAction);
    }

    /* New Label */
    labelMenu.add(new Action(Messages.ApplicationActionBarAdvisor_NEW_LABEL) {
      @Override
      public void run() {
        LabelDialog dialog = new LabelDialog(shellProvider.getShell(), DialogMode.ADD, null);
        if (dialog.open() == IDialogConstants.OK_ID) {
          String name = dialog.getName();
          RGB color = dialog.getColor();

          ILabel newLabel = Owl.getModelFactory().createLabel(null, name);
          newLabel.setColor(OwlUI.toString(color));
          newLabel.setOrder(labels.size());
          DynamicDAO.save(newLabel);

          LabelAction labelAction = new LabelAction(newLabel, selection);
          labelAction.run();
        }
      }

      @Override
      public boolean isEnabled() {
        return !selection.isEmpty();
      }
    });

    /* Remove All Labels */
    labelMenu.add(new Separator());
    LabelAction removeAllLabels = new LabelAction(null, selection);
    removeAllLabels.setId(RemoveLabelsHandler.ID);
    removeAllLabels.setActionDefinitionId(RemoveLabelsHandler.ID);
    removeAllLabels.setEnabled(!selection.isEmpty() && !labels.isEmpty());
    labelMenu.add(removeAllLabels);
  }
View Full Code Here

Examples of org.rssowl.ui.internal.actions.LabelAction

  public Object execute(ExecutionEvent event) {
    IStructuredSelection selection = OwlUI.getActiveFeedViewSelection();

    /* Perform Action */
    if (selection != null && !selection.isEmpty()) {
      LabelAction action = new LabelAction(null, selection);
      action.run();
    }

    return null; //As per JavaDoc
  }
View Full Code Here

Examples of org.rssowl.ui.internal.actions.LabelAction

  public Object execute(ExecutionEvent event) {
    IStructuredSelection selection = OwlUI.getActiveFeedViewSelection();

    /* Perform Action */
    if (selection != null && !selection.isEmpty()) {
      LabelAction action = new LabelAction(fLabel, selection);
      action.setChecked(true);
      action.run();
    }

    return null; //As per JavaDoc
  }
View Full Code Here

Examples of org.rssowl.ui.internal.actions.LabelAction

    news2.setTitle("News 2");
    INews news3 = Owl.getModelFactory().createNews(null, feed, new Date());
    news3.setTitle("News 3");
    DynamicDAO.save(feed);

    LabelAction action = new LabelAction(label1, new StructuredSelection(new Object[] { news1, news2 }));
    action.setChecked(true);
    action.run();

    assertEquals(1, news1.getLabels().size());
    assertEquals(1, news2.getLabels().size());

    action = new LabelAction(label1, new StructuredSelection(new Object[] { news1, news2 }));
    action.run();

    assertEquals(0, news1.getLabels().size());
    assertEquals(0, news2.getLabels().size());
  }
View Full Code Here

Examples of org.rssowl.ui.internal.actions.LabelAction

    /* Retrieve Labels that all selected News contain */
    labelMenu.add(new Separator());
    Set<ILabel> selectedLabels = ModelUtils.getLabelsForAll(selection);
    for (final ILabel label : labels) {
      LabelAction labelAction = new LabelAction(label, selection);
      labelAction.setChecked(selectedLabels.contains(label));
      labelMenu.add(labelAction);
    }

    /* New Label */
    labelMenu.add(new Action(Messages.ApplicationActionBarAdvisor_NEW_LABEL) {
      @Override
      public void run() {
        LabelDialog dialog = new LabelDialog(shellProvider.getShell(), DialogMode.ADD, null);
        if (dialog.open() == IDialogConstants.OK_ID) {
          String name = dialog.getName();
          RGB color = dialog.getColor();

          ILabel newLabel = Owl.getModelFactory().createLabel(null, name);
          newLabel.setColor(OwlUI.toString(color));
          newLabel.setOrder(labels.size());
          DynamicDAO.save(newLabel);

          LabelAction labelAction = new LabelAction(newLabel, selection);
          labelAction.run();
        }
      }

      @Override
      public boolean isEnabled() {
        return !selection.isEmpty();
      }
    });

    /* Remove All Labels */
    labelMenu.add(new Separator());
    LabelAction removeAllLabels = new LabelAction(null, selection);
    removeAllLabels.setId(RemoveLabelsHandler.ID);
    removeAllLabels.setActionDefinitionId(RemoveLabelsHandler.ID);
    removeAllLabels.setEnabled(!selection.isEmpty() && !labels.isEmpty());
    labelMenu.add(removeAllLabels);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.