Exemple #1
0
 @Override
 public void setActive(final boolean active) {
   super.setActive(active);
   IToolContext context = getContext();
   if (active && context.getMapLayers().size() > 0) {
     String message = "Arc Tool activated, specify first point";
     StatusBar.setStatusBarMessage(context, message);
   } else {
     StatusBar.setStatusBarMessage(context, ""); // $NON-NLS-1$
   }
 }
 @Override
 public void setActive(final boolean active) {
   super.setActive(active);
   IToolContext context = getContext();
   if (active && context.getMapLayers().size() > 0) {
     String message = Messages.TrimTool_draw_line_to_trim;
     StatusBar.setStatusBarMessage(context, message);
   } else {
     StatusBar.setStatusBarMessage(context, ""); // $NON-NLS-1$
   }
 }
  /** Sets the selected layer in map has default for first layer. */
  private void selectDefaultLayer() {

    // gets the selected layer from map in the current context
    IToolContext context = getContext();
    if (context == null) return;

    ILayer selectedLayerInMap = context.getSelectedLayer();
    if (selectedLayerInMap == null) return;

    this.currentFirstLayer = selectedLayerInMap;

    this.featuresInFirstLayer =
        presentSelectedFeaturesSum(
            this.currentFirstLayer,
            this.currentFirstLayer.getFilter(),
            this.cLabelFeaturesInFirstLayer);

    changeSelectedLayer(this.currentFirstLayer, this.comboFirstLayer);

    validate();
  }
  public void run(IProgressMonitor monitor) throws Exception {
    if (command != null) {
      // indicates a redo
      command.run(monitor);
    } else {
      IToolContext context = handler.getContext();
      ILayer editLayer = handler.getEditLayer();

      EditBlackboard editBlackboard = handler.getEditBlackboard(editLayer);
      editBlackboard.startBatchingEvents();
      BlockingSelectionAnim animation = new BlockingSelectionAnim(event.x, event.y);
      AnimationUpdater.runTimer(context.getMapDisplay(), animation);
      FeatureIterator<SimpleFeature> iter = getFeatureIterator();
      try {

        if (iter.hasNext()) {
          runSelectionStrategies(monitor, iter);
        } else {
          runDeselectionStrategies(monitor);
        }

        setAndRun(monitor, command);
      } finally {
        try {
          if (iter != null) {
            iter.close();
          }
        } finally {
          if (animation != null) {
            animation.setValid(false);
            animation = null;
          }
        }
        editBlackboard.fireBatchedEvents();
      }
    }
  }