コード例 #1
0
  public boolean isTrue(final ILayer object, String value) {
    isEvaluating.set(true);
    try {

      object
          .getBlackboard()
          .addListener(
              new IBlackboardListener() {
                public void blackBoardChanged(BlackboardEvent event) {
                  if (event.getKey().equals(ProjectBlackboardConstants.LAYER__DATA_QUERY)) {
                    notifyListeners(object);
                  }
                }

                public void blackBoardCleared(IBlackboard source) {
                  notifyListeners(object);
                }
              });

      final IGeoResource resource = object.findGeoResource(FeatureStore.class);
      if (resource != null && ids.add(resource.getIdentifier())) {
        CatalogPlugin.getDefault()
            .getLocalCatalog()
            .addCatalogListener(
                new ObjectPropertyCatalogListener(object, resource, isEvaluating, this));
      }

      // TODO codereview: This resolves http://jira.codehaus.org/browse/UDIG-1686
      //            final FeatureStore<?,?> store  = object.getResource(FeatureStore.class,
      // ProgressManager.instance().get());
      //            return store != null;
      boolean canResolve = resource.canResolve(FeatureStore.class);
      return canResolve;
    } catch (Exception e) {
      return false;
    } finally {
      isEvaluating.set(false);
    }
  }