예제 #1
0
 public void showFeedback() {
   try {
     getEditPart().getRoot();
     super.showFeedback();
   } catch (Exception e) {
     // TODO: handle exception
   }
 }
예제 #2
0
  private void performDirectEdit() {
    if (manager == null)
      manager =
          new ComponentEditManager(
              this, new ComponentCellEditorLocator((HandleBounds) getFigure()));

    if (getCastedFigure().wasValidClick()) manager.show();
  }
 protected void performDirectEdit() {
   if (manager == null) {
     ILabeledFigure figure = (ILabeledFigure) getFigure();
     manager =
         new LabelDirectEditManager(
             this, TextCellEditor.class, new LabelCellEditorLocator(figure.getLabel()));
   }
   manager.show();
 }
예제 #4
0
  /*
   * Overrides super unhookListeners to set listeners attached flag This
   * method prevents unhooking listeners twice if the UI thread is blocked.
   * For example, a validation dialog may block the thread
   */
  protected void unhookListeners() {
    if (listenersAttached) {
      listenersAttached = false;
      super.unhookListeners();

      ILabelDelegate label = (ILabelDelegate) getEditPart().getAdapter(ILabelDelegate.class);
      if (label != null && textFigureListener != null) {
        ((IFigure) ((WrappingLabel) getEditPart().getFigure()).getTextFigure().getChildren().get(0))
            .removeAncestorListener(textFigureListener);
        textFigureListener = null;
      }
    }
  }
 @Override
 protected void bringDown() {
   if (actionHandler != null) {
     actionHandler.dispose();
     actionHandler = null;
   }
   if (actionBars != null) {
     restoreSavedActions(actionBars);
     actionBars.updateActionBars();
     actionBars = null;
   }
   super.bringDown();
 }
예제 #6
0
  public void show() {
    super.show();

    IFigure fig = getEditPart().getFigure();

    Control control = getCellEditor().getControl();
    this.zoomLevelFont = getZoomLevelFont(fig.getFont(), control.getDisplay());

    control.setFont(this.zoomLevelFont);

    // since the font's have been resized, we need to resize the Text
    // control...
    getLocator().relocate(getCellEditor());
  }
예제 #7
0
  protected void performDirectEdit() {
    if (manager == null) {
      ValidationEnabledGraphicalViewer viewer = (ValidationEnabledGraphicalViewer) getViewer();
      ValidationMessageHandler handler = viewer.getValidationHandler();

      TableFigure figure = (TableFigure) getFigure();
      EditableLabel nameLabel = figure.getNameLabel();
      manager =
          new ExtendedDirectEditManager(
              this,
              TextCellEditor.class,
              new LabelCellEditorLocator(nameLabel),
              nameLabel,
              new TableNameCellEditorValidator(handler));
    }
    manager.show();
  }
예제 #8
0
  protected void hookListeners() {
    super.hookListeners();

    // TODO: This gets around the problem of the cell editor not growing big
    // enough when in autosize mode because it doesn't listen to textflow
    // size changes. The superclass should be modified to not assume we want
    // to listen to the editpart's figure.
    ILabelDelegate label = (ILabelDelegate) getEditPart().getAdapter(ILabelDelegate.class);
    if (label != null && getEditPart().getFigure() instanceof WrappingLabel) {

      textFigureListener =
          new AncestorListener.Stub() {

            public void ancestorMoved(IFigure ancestor) {
              getLocator().relocate(getCellEditor());
            }
          };
      ((IFigure) ((WrappingLabel) getEditPart().getFigure()).getTextFigure().getChildren().get(0))
          .addAncestorListener(textFigureListener);
    }
  }
예제 #9
0
  /** @see org.eclipse.gef.tools.DirectEditManager#commit() */
  protected void commit() {
    Shell activeShell = Display.getCurrent().getActiveShell();
    if (activeShell != null
        && getCellEditor().getControl().getShell().equals(activeShell.getParent())) {
      Control[] children = activeShell.getChildren();
      if (children.length == 1 && children[0] instanceof Table) {
        /*
         * CONTENT ASSIST: focus is lost to the content assist pop up -
         * stay in focus
         */
        getCellEditor().getControl().setVisible(true);
        ((XtextStyledTextCellEditorEx) getCellEditor()).setDeactivationLock(true);
        return;
      }
    }

    // content assist hacks
    if (committed) {
      bringDown();
      return;
    }
    committed = true;
    super.commit();
  }
예제 #10
0
 /*
  * Sets the listeners attached flag if the cell editor exists
  */
 protected void setCellEditor(CellEditor editor) {
   super.setCellEditor(editor);
   if (editor != null) {
     listenersAttached = true;
   }
 }