public void setInput(IWorkbenchPart part, ISelection selection) {
   super.setInput(part, selection);
   Assert.isTrue(selection instanceof IStructuredSelection);
   Object input = ((IStructuredSelection) selection).getFirstElement();
   Assert.isTrue(input instanceof ButtonElement);
   this.buttonElement = (ButtonElement) input;
 }
示例#2
0
 @Override
 public void setInput(IWorkbenchPart part, ISelection selection) {
   super.setInput(part, selection);
   Assert.isTrue(selection instanceof IStructuredSelection);
   Object input = ((IStructuredSelection) selection).getFirstElement();
   Assert.isTrue(input instanceof UserGroup);
   this.userGroup = (UserGroup) input;
 }
示例#3
0
 public void setInput(IWorkbenchPart part, ISelection selection) {
   super.setInput(part, selection);
   if (selection instanceof IStructuredSelection) {
     Object input = ((IStructuredSelection) selection).getFirstElement();
     if (input instanceof ElementEditPart) {
       input = ((ElementEditPart) input).getModel();
     }
     if (input instanceof ElementWrapper) {
       this.elementWrapper = (ElementWrapper) input;
     }
   }
 }
示例#4
0
 @Override
 public void setInput(IWorkbenchPart part, ISelection selection) {
   super.setInput(part, selection);
   if (test != null) {
     test.getAllLanguages().removePropertyChangeListener(this);
   }
   Assert.isTrue(selection instanceof IStructuredSelection);
   Object input = ((IStructuredSelection) selection).getFirstElement();
   Assert.isTrue(input instanceof TestEditPart);
   test = (Test) ((TestEditPart) input).getModel();
   AllLanguages langs = test.getAllLanguages();
   langs.addPropertyChangeListener(this);
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#setInput(org.eclipse.ui.IWorkbenchPart,
  *     org.eclipse.jface.viewers.ISelection)
  */
 @Override
 public void setInput(final IWorkbenchPart part, final ISelection selection) {
   super.setInput(part, selection);
   if (selection instanceof IStructuredSelection) {
     final Object input = ((IStructuredSelection) selection).getFirstElement();
     if (input instanceof DDiagramEditPart) {
       final EObject vp = ((DDiagramEditPart) input).resolveSemanticElement();
       editPart = ((DDiagramEditPart) input).getRoot();
       if (vp instanceof DDiagram) {
         setSirius((DDiagram) vp);
         this.domain = ((DDiagramEditPart) input).getEditingDomain();
       }
     }
   }
   refresh();
 }
  @Override
  public void setInput(IWorkbenchPart part, ISelection selection) {
    if (part == getPart() && selection == getSelection()) {
      return;
    }
    super.setInput(part, selection);
    if (page != null) {
      page.getControl().removeControlListener(controlListener);
      aboutToBeHidden();
      page.dispose();
      page.getControl().dispose();
      page = null;
    }
    Object first = Selections.getFirstSelection(selection);
    if (first == null) {
      return;
    }
    page = createPage(first);
    if (page != null) {
      if (page instanceof IPageBookViewPage) {
        try {
          ((IPageBookViewPage) page).init(parentPage.getSite());
        } catch (PartInitException e) {
          Activator.getDefault().getLog().log(e.getStatus());
        }
      }
      page.createControl(container);
      FormData data = new FormData();
      data.left = new FormAttachment(0, 0);
      data.right = new FormAttachment(100, 0);
      data.top = new FormAttachment(0, 0);
      data.bottom = new FormAttachment(100, 0);
      page.getControl().setLayoutData(data);

      page.getControl().addControlListener(controlListener);
    }

    container.layout(true, true);
    parentPage.resizeScrolledComposite();
  }
  /**
   * This operation sets the current input displayed in the table of properties. It also sets {@link
   * #isAdaptive} if the input is an {@link AdaptiveTreeComposite}.
   */
  @Override
  public void setInput(IWorkbenchPart part, ISelection selection) {
    // Since the tree's DataComponent will still have its properties shown,
    // continue with the default setInput() operation.
    super.setInput(part, selection);

    // Get and check the selection.
    Assert.isTrue(selection instanceof IStructuredSelection);
    Object input = ((IStructuredSelection) selection).getFirstElement();

    // Try to get the input TreeComposite from the selection.
    if (input != null && input instanceof Component) {
      IComponentVisitor visitor =
          new SelectiveComponentVisitor() {
            @Override
            public void visit(TreeComposite component) {

              // If the visited tree is new, we need to replace the
              // current tree with the new one.
              if (tree != component) {
                // If possible, unregister from the current tree.
                if (tree != null) {
                  tree.unregister(TreePropertySection.this);
                }

                // Set the reference to the new tree and register for
                // updates. We need the updates for keeping the type
                // ComboViewer updated.
                tree = component;
                tree.register(TreePropertySection.this);

                // Unset the isAdaptive flag.
                isAdaptive = false;

                logger.info(
                    "TreePropertySection message: "
                        + "Setting the input to tree "
                        + tree.getName()
                        + ".");
              }

              return;
            }

            @Override
            public void visit(AdaptiveTreeComposite component) {
              visit((TreeComposite) component);
              isAdaptive = true;
            }
          };
      ((Component) input).accept(visitor);
    }

    // Enable or disable the add button depending on whether the input is
    // valid.
    if (add != null) {
      boolean canAdd = (canAdd(tree) != null);
      add.setEnabled(canAdd);
    }

    // Try to find the associated ICEFormEditor. It will be marked as dirty
    // if the properties change.
    if (part instanceof TreeCompositeViewer) {
      editor = ((TreeCompositeViewer) part).getFormEditor();
    } else {
      editor = null;
    }

    // Refresh the type Combo widget.
    refreshTypeWidgets();

    return;
  }