Package org.eclipse.gef

Examples of org.eclipse.gef.EditPartViewer


          && !(part.getParent() instanceof ScalableRootEditPart)) {
        part = part.getParent();
      }
    }
    if (part != null) {
      EditPartViewer viewer = ((ScalableRootEditPart) part.getParent())
          .getViewer();
      HTMLEditor editor = ((HTMLEditor) ((DefaultEditDomain) ((IHTMLGraphicalViewer) viewer)
          .getEditDomain()).getEditorPart());
      _viewer = editor.getTextEditor().getTextViewer();
    }
View Full Code Here


  public void run() {
    ICSSStyleDeclaration styleDeclaration = (ICSSStyleDeclaration) ((ElementCSSInlineStyle) this._element)
        .getStyle();
    PreferenceManager manager = new PreferenceManager();
    EditPartViewer viewer = this._editPart.getViewer();
    Shell shell = viewer.getControl().getShell();

    CSSPropertyContext context = new CSSPropertyContext(styleDeclaration);
    StyleDialog dialog = new StyleDialog(shell, manager, _element, context);
    if (dialog.open() == Window.OK) {
      if (context.isModified()) {
View Full Code Here

    // XXX: not using updateTargetEditPartUnderMouse. Maybe should. Don't
    // want to
    // go through the request mechanism, so simple implementation for now.
   
    //to avoid 219038 and possibility of current viewer changing
    final EditPartViewer viewer = getCurrentViewer();
    final IHTMLGraphicalViewer graphicalViewer = (IHTMLGraphicalViewer)viewer;
    EditPart editPart = viewer.findObjectAtExcluding(
        getLocation(), Collections.EMPTY_LIST);
    IPositionMediator positionMediator = new InlineEditingPositionMediator(
        new ActionData(ActionData.INLINE_EDIT, null));
    ExposeHelper exposeHelper = new ExposeHelper(graphicalViewer);
    exposeHelper.adjustVertical(getCurrentInput().getMouseLocation());
View Full Code Here

  /**
   * @param part
   * @return the current viewer's status line manager or null
   */
  public static IStatusLineManager getStatusLineManager(EditPart part) {
    EditPartViewer v = part.getViewer();
    if (v instanceof IHTMLGraphicalViewer) {
      IHTMLGraphicalViewer htmlviewer = (IHTMLGraphicalViewer) v;
      IStatusLineManager m = htmlviewer.getStatusLineManager();
      if (m == null) {
        _log.info("Warn.PolicyHelper.0", (String) null); //$NON-NLS-1$
View Full Code Here

  public void run() {
    ICSSStyleDeclaration styleDeclaration = (ICSSStyleDeclaration) ((ElementCSSInlineStyle) this._element)
        .getStyle();
    PreferenceManager manager = new PreferenceManager();
    EditPartViewer viewer = this._editPart.getViewer();
    Shell shell = viewer.getControl().getShell();

    CSSPropertyContext context = new CSSPropertyContext(styleDeclaration);
    StyleDialog dialog = new StyleDialog(shell, manager, _element, context);
    if (dialog.open() == Window.OK) {
      if (context.isModified()) {
View Full Code Here

  @SuppressWarnings({ "rawtypes", "unchecked" })
  protected void performSelection() {
    if (hasSelectionOccurred())
      return;
    setFlag(FLAG_SELECTION_PERFORMED, true);
    EditPartViewer viewer = getCurrentViewer();
    List<EditPart> selectedObjects = viewer.getSelectedEditParts();

    if (getCurrentInput().isModKeyDown(SWT.MOD1)) {
      EditPart deselectPart = getDeselectPart(selectedObjects, getSourceEditPart());
      if (deselectPart != null) {
        viewer.deselect(deselectPart);
      } else {
        if (!isParentSelected(getSourceEditPart())) {
          viewer.appendSelection(getSourceEditPart());
         
          removeChildrenDuplicates(getSourceEditPart());
        }
      }
      viewer.setProperty(LAST_EDIT_PART, getSourceEditPart());
    } else if (getCurrentInput().isShiftKeyDown()) {
      EditPart fromEditPart = (EditPart)viewer.getProperty(LAST_EDIT_PART);
      if (sameNodeModel(fromEditPart, getSourceEditPart())) {
        viewer.deselectAll();
       
        EditPart toEditPart = getSourceEditPart();
        Rectangle fromRect = getRectangle(fromEditPart);
        Rectangle toRect = getRectangle(toEditPart);
        Rectangle rect = fromRect.getUnion(toRect);
       
        Collection editPartsToProcess = new HashSet();
        editPartsToProcess.addAll(EditPartUtilities.getAllChildren(getNodeEditPart(fromEditPart)));
        List<EditPart> selectedEditParts = new ArrayList<EditPart>();
        for (Iterator iterator = editPartsToProcess.iterator(); iterator.hasNext();) {
          GraphicalEditPart editPart = (GraphicalEditPart) iterator.next();
          if (editPart.isSelectable()  && FigureUtilities.isNotFullyClipped(editPart.getFigure()) && isEditPartInRect(editPart, rect)) {
            selectedEditParts.add(editPart);
          }
        }
        filterEditParts(selectedEditParts, fromEditPart, getSourceEditPart());
        for (EditPart editPart : selectedEditParts) {
          viewer.appendSelection(editPart);
        }
      } else {
        viewer.appendSelection(getSourceEditPart());

        viewer.setProperty(LAST_EDIT_PART, getSourceEditPart());
      }
    }
    else {
      viewer.select(getSourceEditPart());

      viewer.setProperty(LAST_EDIT_PART, getSourceEditPart());
    }
  }
View Full Code Here

    }
  }
 
  @SuppressWarnings("rawtypes")
  private boolean isParentSelected(EditPart sourceEditPart) {
    final EditPartViewer viewer = getCurrentViewer();
    List selectedParts = viewer.getSelectedEditParts();
    EditPart parent = sourceEditPart.getParent();
    while (parent != null) {
      if (selectedParts.contains(parent)) {
        return true;
      }
View Full Code Here

  @SuppressWarnings("unchecked")
  protected void performSelection() {
    if (hasSelectionOccurred())
      return;
    setFlag(FLAG_SELECTION_PERFORMED, true);
    EditPartViewer viewer = getCurrentViewer();
    List<EditPart> selectedObjects = viewer.getSelectedEditParts();

    if (getCurrentInput().isModKeyDown(SWT.MOD1)) {
      EditPart deselectPart = getDeselectPart(selectedObjects, getSourceEditPart());
      if (deselectPart != null) {
        viewer.deselect(deselectPart);
      } else {
        viewer.appendSelection(getSourceEditPart());
        removeChildrenDuplicates(getSourceEditPart());
      }
      viewer.setProperty(LAST_EDIT_PART, getSourceEditPart());
    } else if (getCurrentInput().isShiftKeyDown()) {
      viewer.appendSelection(getSourceEditPart());

      viewer.setProperty(LAST_EDIT_PART, getSourceEditPart());
    }
    else {
      viewer.select(getSourceEditPart());

      viewer.setProperty(LAST_EDIT_PART, getSourceEditPart());
    }
  }
View Full Code Here

    return null;
  }
 
  @SuppressWarnings("rawtypes")
  protected void removeChildrenDuplicates(EditPart sourceEditPart) {
    final EditPartViewer viewer = getCurrentViewer();
    List selectedParts = viewer.getSelectedEditParts();

    for (Object child : sourceEditPart.getChildren()) {
      EditPart childPart = (EditPart)child;
      if (selectedParts.contains(child)) {
        viewer.deselect(childPart);
      }
      removeChildrenDuplicates(childPart);
    }
  }
View Full Code Here

  /**
   * Refresh.
   */
  void refresh() {
    final EditPartViewer viewer = getViewer();
    final EditPart contents = viewer.getContents();
    if (contents != null) {
      contents.refresh();
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.gef.EditPartViewer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.