@Override
  public boolean canHandle(ActionContext context) {
    actionContext = (ActionContextImpl) context;

    if (DetectGraphicsDevices.getInstance().getNumberGraphicsDevices()
        > DetectGraphicsDevices.MINIMUM_MONITOR_CHECK) {
      graphicsDeviceName =
          actionContext
              .getTargetHousing()
              .getHostedFrame()
              .getGraphicsConfiguration()
              .getDevice()
              .getIDstring();
      graphicsDeviceName = graphicsDeviceName.replace("\\", "");
    }

    selectedManifestations = context.getSelectedManifestations();
    if (selectedManifestations.isEmpty()) {
      // No objects selected to add to a new collections
      return false;
    }

    // Guards against attempting to put a top level object into a collection as this will result in
    // that collection becoming a child of itself. The prime example of this is the "All" entry in
    // the tree. All necessary contains everything so adding All to All would result in All being a
    // child
    for (View manifestation : selectedManifestations) {
      if (manifestation.getManifestedComponent()
          == PlatformAccess.getPlatform().getRootComponent()) {
        return false;
      }
    }

    return true;
  }
Ejemplo n.º 2
0
  @Override
  public boolean canHandle(ActionContext context) {

    if (DetectGraphicsDevices.getInstance().getNumberGraphicsDevices()
        > DetectGraphicsDevices.MINIMUM_MONITOR_CHECK) {

      if (context.getWindowManifestation() != null) {
        graphicsDeviceName = getActiveGraphicsDeviceName(context.getWindowManifestation());
      }
    }

    selectedManifestations = context.getSelectedManifestations();
    if (selectedManifestations.isEmpty()) {
      // No objects selected to add to a new Enumerator
      return false;
    }
    return true;
  }
Ejemplo n.º 3
0
 @Override
 public boolean canHandle(ActionContext context) {
   List<Panel> selectedPanels = MenuUtil.getSelectedPanels(context.getSelectedManifestations());
   setActions(
       new RadioAction[] {
         new ShowAllBordersAction(selectedPanels), new HideAllBordersAction(selectedPanels)
       });
   return true;
 }
Ejemplo n.º 4
0
  @Override
  public boolean canHandle(ActionContext context) {
    if (context.getSelectedManifestations().isEmpty()) return false;

    AbstractComponent targetComponent =
        context.getSelectedManifestations().iterator().next().getManifestedComponent();
    PolicyContext policyContext = new PolicyContext();
    policyContext.setProperty(
        PolicyContext.PropertyName.TARGET_COMPONENT.getName(), targetComponent);
    policyContext.setProperty(PolicyContext.PropertyName.ACTION.getName(), 'w');
    String compositionKey = PolicyInfo.CategoryType.COMPOSITION_POLICY_CATEGORY.getKey();

    return (context.getSelectedManifestations().size() == 1)
        && PlatformAccess.getPlatform()
            .getPolicyManager()
            .execute(compositionKey, policyContext)
            .getStatus();
  }