Пример #1
0
  public void perform() {
    Layer selectedLayer = getSelectedLayer();
    original = selectedLayer.getStyleBlackboard();
    EditorPageManager manager =
        EditorPageManager.loadManager(PrintingPlugin.getDefault(), selectedLayer);
    Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    StyleEditorDialog dialog =
        StyleEditorDialog.createDialogOn(parentShell, null, selectedLayer, manager);
    dialog.setBlockOnOpen(true);
    int returnCode = dialog.open();

    if (returnCode != Window.OK) {
      selectedLayer.setStyleBlackboard(original);
      original = null;
    }
  }
  public void refresh() {
    Layer layer = getSelectedLayer();
    IGeoResource resource = layer.getGeoResource();
    if (!resource.canResolve(FeatureSource.class)) {
      return;
    }

    StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
    oldStyle = (Style) styleBlackboard.get(SLDContent.ID);
    if (oldStyle == null) {
      oldStyle = Utilities.createDefaultPointStyle();
    }
    DuplicatingStyleVisitor dsv = new DuplicatingStyleVisitor();
    dsv.visit(oldStyle);
    style = (Style) dsv.getCopy();

    if (!isPointStyle(style)) {
      stackLayout.topControl = noFeatureLabel;
    } else {
      stackLayout.topControl = propertiesEditor.getControl();
      propertiesEditor.updateStyle(style);
    }
    mainComposite.layout();
  }
Пример #3
0
  public Command getCommand() {
    final StyleBlackboard originalStyleBlackboard = this.original;
    this.original = null;

    final Layer layer = getSelectedLayer();
    final StyleBlackboard newBlackboard = layer.getStyleBlackboard();

    return new Command() {
      @Override
      public String getLabel() {
        return "Change Style";
      }

      @Override
      public void execute() {
        layer.setStyleBlackboard(newBlackboard);
      }

      @Override
      public void undo() {
        layer.setStyleBlackboard(originalStyleBlackboard);
      }
    };
  }