コード例 #1
0
  /** configure geometry */
  private void configureGeometry() {
    GraphicalViewer viewer = getGraphicalViewer();
    viewer.setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED, true);

    IAction action = new ToggleSnapToGeometryAction(viewer);
    getActionRegistry().registerAction(action);
  }
コード例 #2
0
  /** configure key handler */
  private void configureKeyHandler() {
    GraphicalViewer viewer = getGraphicalViewer();

    keyHandler = new KeyHandler();
    //		keyHandler.put(KeyStroke.getPressed('a', 0x61, SWT.COMMAND),
    //	getActionRegistry().getAction(ActionFactory.SELECT_ALL.getId()));
    keyHandler.put(
        KeyStroke.getPressed('s', 0x61, SWT.CTRL),
        getActionRegistry().getAction(ActionFactory.SAVE.getId()));

    keyHandler.put(
        KeyStroke.getPressed('z', 0x7a, SWT.CTRL),
        getActionRegistry().getAction(ActionFactory.UNDO.getId()));
    keyHandler.put(
        KeyStroke.getPressed('z', 0x7a, SWT.CTRL | SWT.SHIFT),
        getActionRegistry().getAction(ActionFactory.REDO.getId()));
    keyHandler.put(
        KeyStroke.getPressed('a', 0x61, SWT.CTRL),
        getActionRegistry().getAction(ActionFactory.SELECT_ALL.getId()));

    keyHandler.put(
        KeyStroke.getPressed(SWT.DEL, 127, 0),
        getActionRegistry().getAction(ActionFactory.DELETE.getId()));
    keyHandler.put(
        KeyStroke.getPressed('+', SWT.KEYPAD_ADD, 0),
        getActionRegistry().getAction(GEFActionConstants.ZOOM_IN));
    keyHandler.put(
        KeyStroke.getPressed('-', SWT.KEYPAD_SUBTRACT, 0),
        getActionRegistry().getAction(GEFActionConstants.ZOOM_IN));

    viewer.setProperty(
        MouseWheelHandler.KeyGenerator.getKey(SWT.NONE), MouseWheelZoomHandler.SINGLETON);
    viewer.setKeyHandler(keyHandler);
  }
コード例 #3
0
  /** configure grid */
  private void configureGrid() {
    GraphicalViewer viewer = getGraphicalViewer();
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, true);
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, true);

    IAction action = new ToggleGridAction(viewer);
    getActionRegistry().registerAction(action);
  }