コード例 #1
0
  @Override
  public ICustomFeature[] getCustomFeatures(ICustomContext context) {
    List<ICustomFeature> list = new ArrayList<ICustomFeature>();

    for (FeatureContainer fc : containers) {
      Object o = fc.getApplyObject(context);
      if (o != null && fc.canApplyTo(o)) {
        ICustomFeature[] cfa = fc.getCustomFeatures(this);
        if (cfa != null) {
          for (ICustomFeature cf : cfa) {
            boolean found = false;
            for (ICustomFeature cfl : list) {
              if (cfl != null && cf != null && cfl.getClass() == cf.getClass()) {
                found = true;
                break;
              }
            }
            if (!found) list.add(cf);
          }
        }
      }
    }

    return list.toArray(new ICustomFeature[list.size()]);
  }
コード例 #2
0
  @Override
  public ICustomFeature getDoubleClickFeature(IDoubleClickContext context) {
    ICustomFeature customFeature = new AcoreRenameAClassFeature(getFeatureProvider());
    // canExecute() tests especially if the context contains a AClass
    if (customFeature.canExecute(context)) {
      return customFeature;
    }

    return super.getDoubleClickFeature(context);
  }
  @Override
  public ICustomFeature getDoubleClickFeature(IDoubleClickContext context) {
    ICustomFeature customFeature =
        new AtomicDesignDirectEditComputationUnitCreateBehavior(getFeatureProvider());
    // canExecute() tests especially if the context contains a
    // ComputationUnit
    if (customFeature.canExecute(context)) {
      return customFeature;
    }

    return super.getDoubleClickFeature(context);
  }