Example #1
0
 public static void layoutAllParents(Composite child) {
   Composite parent = child;
   while (parent != null && parent.getParent() instanceof Composite) {
     parent = parent.getParent();
     parent.layout();
   }
 }
Example #2
0
  /**
   * Helper method that computes the width of the client area from the parent's client area. For
   * some reason the client area itself returns a zero width size.
   *
   * @param composite the composite to use to obtain the client area's width.
   * @param widthHint the current width hint.
   * @return the width of the client area that the controls may occupy.
   */
  private int getWidth(Composite composite, int widthHint) {
    int width = widthHint;
    Rectangle rect = composite.getParent().getClientArea();
    int spacing = 0;
    if (!(composite.getParent().getLayout() instanceof PackingLayout)) {
      rect = composite.getParent().getClientArea();
      spacing += TRIM_FACTOR;
    }

    width = Math.max(width + 2 * marginWidth, rect.width - (marginWidth * 2) - spacing);
    return width;
  }
Example #3
0
  public static void dump(Composite parent, String comment) {
    System.out.println(comment);
    int i = 1;
    System.out.println("parent=" + parent.hashCode());
    check(parent);

    Composite p = parent.getParent();
    while (p != null) {
      check(p);
      p = p.getParent();
      ++i;
    }
    dump(parent, 0);
  }
 private void createMessageGroup(Composite parentComposite) {
   messageComp = new ContextMissSettingComposite(parentComposite, SWT.NULL);
   messageComp.setLayout(new GridLayout(3, false));
   messageComp.setLayoutData(new GridData(GridData.FILL_BOTH));
   messageComp.getParent().layout();
   messageComp.layout();
 }
    protected void setValidationMessage(String message) {
      icon.setVisible(message != null);
      hintText.setVisible(message != null);
      hintText.setText(StringUtil.nullAsEmpty(message));

      topControl.getParent().layout();
    }
 public void observe(nsIConsoleMessage message) {
   nsIScriptError error =
       (nsIScriptError) message.queryInterface(nsIScriptError.NS_ISCRIPTERROR_IID);
   if (error == null) {
     return;
   }
   if (browser == null || browser.isDisposed()) {
     return;
   }
   long flag = error.getFlags();
   if ((flag == nsIScriptError.errorFlag || flag == nsIScriptError.exceptionFlag)
       && error.getSourceName().equals(internalGetUrl())) {
     errorCount++;
     if (errorCount == 1) {
       String errorMessage =
           MessageFormat.format(
               Messages.getString("FirefoxBrowser.Error"),
               new Object[] {errorCount}); // $NON-NLS-1$
       errorIcon.setImage(Activator.getDefault().getImage(Activator.ERRORS_IMG_ID));
       errorLabel.setText(errorMessage);
       errorLabel.setToolTipText(
           Messages.getString("FirefoxBrowser.Errors_In_Page")); // $NON-NLS-1$
       errorIcon.setToolTipText(errorLabel.getToolTipText());
     } else {
       String errorMessage =
           MessageFormat.format(
               Messages.getString("FirefoxBrowser.Errors"),
               new Object[] {errorCount}); // $NON-NLS-1$
       errorLabel.setText(errorMessage);
     }
     errors.layout(true, true);
     errors.getParent().layout(true, true);
   }
 }
  private void checkPage() {
    try {
      upstreamConfigComponent.setUpstreamConfig(upstreamConfig);

      boolean showUpstreamConfig =
          sourceRefName.startsWith(Constants.R_HEADS)
              || sourceRefName.startsWith(Constants.R_REMOTES);
      Composite container = upstreamConfigComponent.getContainer();
      GridData gd = (GridData) container.getLayoutData();
      if (gd.exclude == showUpstreamConfig) {
        gd.exclude = !showUpstreamConfig;
        container.setVisible(showUpstreamConfig);
        container.getParent().layout(true);
        ensurePreferredHeight(getShell());
      }

      boolean basedOnLocalBranch = sourceRefName.startsWith(Constants.R_HEADS);
      if (basedOnLocalBranch && upstreamConfig != UpstreamConfig.NONE)
        setMessage(UIText.CreateBranchPage_LocalBranchWarningMessage, IMessageProvider.INFORMATION);

      if (sourceRefName.length() == 0) {
        setErrorMessage(UIText.CreateBranchPage_MissingSourceMessage);
        return;
      }
      String message = this.myValidator.isValid(nameText.getText());
      if (message != null) {
        setErrorMessage(message);
        return;
      }

      setErrorMessage(null);
    } finally {
      setPageComplete(getErrorMessage() == null && nameText.getText().length() > 0);
    }
  }
  /**
   * Refreshes the contents of the {@link #type} selection widget. If the {@link #tree} is not an
   * {@link AdaptiveTreeComposite}, then the entire {@link #typeComposite} is hidden.
   */
  private void refreshTypeWidgets() {

    // Set the default empty list of types and the default empty selection.
    List<String> types = new ArrayList<String>(1);
    ISelection selection = new StructuredSelection();

    // Get the list of adaptive types if possible.
    if (tree != null && isAdaptive) {
      // Update the available types in the type Combo widget.
      AdaptiveTreeComposite adaptiveTree = (AdaptiveTreeComposite) tree;
      types = adaptiveTree.getTypes();
      String adaptiveType = adaptiveTree.getType();
      if (adaptiveType != null) {
        selection = new StructuredSelection(adaptiveType);
      }
    }

    // Set the ComboViewer's contents to the List of type Strings.
    type.setInput(types);
    type.setSelection(selection);

    // Hide the type selection widgets if the List is empty.
    boolean hide = types.isEmpty();
    typeComposite.setVisible(!hide);
    ((GridData) typeComposite.getLayoutData()).exclude = hide;

    // Re-adjust the size of the type Composite.
    typeComposite.pack();
    typeComposite.getParent().layout();

    return;
  }
  @Override
  public void refresh() {
    if (getContextManager() == null) {
      disposeInstallMessageComp();
      disposeNatTableComp();
      if (availableLabelComp == null
          || (availableLabelComp != null && availableLabelComp.isDisposed())) {
        createContextNotAvailableGroup(this);
      }
    } else {
      if (!ContextNatTableUtils.checkIsInstallExternalJar()) {
        disposeUnAvailableContextComp();
        if (messageComp == null || (messageComp != null && messageComp.isDisposed())) {
          createMessageGroup(this);
        }
      } else {
        reInitializeUI();

        initializeContextCombo();

        checkContextGroupSource();

        // dispose the data table composite
        disposeDataTable();
        // create the data table composite
        createNatTable();

        contextTableComp.getParent().layout();
        contextTableComp.layout();
        treeTable.refresh();

        setButtonEnableState();
      }
    }
  }
  void resize() {
    Point size = comp.getSize();
    Image oldBackgroundImage = backgroundImage;
    backgroundImage = new Image(comp.getDisplay(), size.x, size.y);
    GC gc = new GC(backgroundImage);
    comp.getParent().drawBackground(gc, 0, 0, size.x, size.y, 0, 0);
    Color background = comp.getBackground();
    Color border = comp.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
    RGB backgroundRGB = background.getRGB();
    // TODO naive and hard coded, doesn't deal with high contrast, etc.
    Color gradientTop =
        new Color(
            comp.getDisplay(),
            backgroundRGB.red + 12,
            backgroundRGB.green + 10,
            backgroundRGB.blue + 10);
    int h = size.y;
    int curveStart = 0;
    int curve_width = 5;

    int[] curve =
        new int[] {
          0, h, 1, h, 2, h - 1, 3, h - 2, 3, 2, 4, 1, 5, 0,
        };
    int[] line1 = new int[curve.length + 4];
    int index = 0;
    int x = curveStart;
    line1[index++] = x + 1;
    line1[index++] = h;
    for (int i = 0; i < curve.length / 2; i++) {
      line1[index++] = x + curve[2 * i];
      line1[index++] = curve[2 * i + 1];
    }
    line1[index++] = x + curve_width;
    line1[index++] = 0;

    int[] line2 = new int[line1.length];
    index = 0;
    for (int i = 0; i < line1.length / 2; i++) {
      line2[index] = line1[index++] - 1;
      line2[index] = line1[index++];
    }

    // custom gradient
    gc.setForeground(gradientTop);
    gc.setBackground(background);
    gc.drawLine(4, 0, size.x, 0);
    gc.drawLine(3, 1, size.x, 1);
    gc.fillGradientRectangle(2, 2, size.x - 2, size.y - 3, true);
    gc.setForeground(background);
    gc.drawLine(2, size.y - 1, size.x, size.y - 1);
    gradientTop.dispose();

    gc.setForeground(border);
    gc.drawPolyline(line2);
    gc.dispose();
    comp.setBackgroundImage(backgroundImage);
    if (oldBackgroundImage != null) oldBackgroundImage.dispose();
  }
Example #11
0
  private void createPartControl_impl(Composite parent) {

    this.partControl = parent;

    Listener handler =
        new Listener() {

          @Override
          public void handleEvent(Event event) {
            switch (event.type) {
              case SWT.Show:
              case SWT.Hide:
                getDefaultPrologConsoleService()
                    .fireConsoleVisibilityChanged(PrologConsoleView.this);
                break;
              case SWT.FocusOut:
                getDefaultPrologConsoleService().fireConsoleLostFocus(PrologConsoleView.this);
            }
          }
        };
    parent.getParent().addListener(SWT.Show, handler);
    parent.getParent().addListener(SWT.Hide, handler);
    parent.getParent().addListener(SWT.FocusOut, handler);
    PrologConsolePlugin.getDefault().getPrologConsoleService().registerPrologConsole(this);
    getDefaultPrologConsoleService().fireConsoleVisibilityChanged(PrologConsoleView.this);
    PrologRuntimeUIPlugin.getDefault()
        .getPrologInterfaceService()
        .registerActivePrologInterfaceListener(this);
    GridLayout layout = new GridLayout(1, true);
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    parent.setLayout(layout);
    GridData ld = new GridData(GridData.FILL_HORIZONTAL);
    title = new Label(parent, SWT.HORIZONTAL);
    title.setLayoutData(ld);
    viewer = new ConsoleViewer(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    viewer.getControl().setEnabled(false);
    ld = new GridData(GridData.FILL_BOTH);
    viewer.getControl().setLayoutData(ld);
    createActions();
    initMenus(parent);
    initToolBars();
    getSite().setSelectionProvider(viewer);
  }
Example #12
0
  /** Moves the target control on top of the dummy control. */
  public void layout() {
    if (getTargetControl() == null) {
      return;
    }

    // Compute the unclipped bounds of the target in display coordinates
    Rectangle displayBounds = Geometry.toDisplay(control.getParent(), control.getBounds());

    // Clip the bounds of the target so that it doesn't go outside the dummy control's parent
    Rectangle clippingRegion = DragUtil.getDisplayBounds(control.getParent());
    displayBounds = displayBounds.intersection(clippingRegion);

    // Compute the bounds of the target, in the local coordinate system of its parent
    Rectangle targetBounds = Geometry.toControl(getTargetControl().getParent(), displayBounds);

    // Move the target
    getTargetControl().setBounds(targetBounds);
  }
 protected void setSize(Composite composite) {
   if (composite != null) {
     // Note: The font is set here in anticipation that the class inheriting
     //       this base class may add widgets to the dialog.   setSize
     //       is assumed to be called just before we go live.
     applyDialogFont(composite);
     Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
     composite.setSize(minSize);
     // set scrollbar composite's min size so page is expandable but
     // has scrollbars when needed
     if (composite.getParent() instanceof ScrolledComposite) {
       ScrolledComposite sc1 = (ScrolledComposite) composite.getParent();
       sc1.setMinSize(minSize);
       sc1.setExpandHorizontal(true);
       sc1.setExpandVertical(true);
     }
   }
 }
Example #14
0
        public void run() {
          if (frame < FRAMES) {
            Point size = content.getParent().getSize();
            content.getParent().setSize(size.x + dx, size.y + dy);
            frame++;
            Display.getCurrent().timerExec(INTERVAL, this);
          } else {
            // set size
            oldSize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
            content.getParent().setSize(content.getParent().computeSize(SWT.DEFAULT, SWT.DEFAULT));

            playing = false;
            if (delayDispose.peek() != null) delayDispose.poll().dispose();
            if (!adding) delayDispose.offer(moduleToBeRemoved.self);
            if (!delayAdd.isEmpty()) add(delayAdd.poll());
            else if (!delayRemove.isEmpty()) remove(delayRemove.poll());
          }
        }
 /** need force refresh here after install the external jar */
 private void reInitializeUI() {
   disposeInstallMessageComp();
   disposeUnAvailableContextComp();
   if (contextTableComp == null || (contextTableComp != null && contextTableComp.isDisposed())) {
     initializeUI();
     contextTableComp.getParent().layout();
     contextTableComp.layout();
   }
 }
  /**
   * Resizes the Section's client and updates the Property Viewer's {@link ScrolledComposite} to
   * account for GridLayouts in the client.
   */
  private void resizePropertyView() {
    // Disable re-drawing for the ScrolledComposite.
    scrollComposite.setRedraw(false);

    int verticalPadding = scrollComposite.getHorizontalBar().getSize().y;
    int horizontalPadding = scrollComposite.getVerticalBar().getSize().x;
    Rectangle clientArea = scrollComposite.getClientArea();
    Point clientAreaSize =
        new Point(clientArea.width - horizontalPadding, clientArea.height - verticalPadding);

    // Recompute the size of the first Composite in the ScrolledComposite
    // based on the width of the ScrolledComposite's client area.
    Point size = scrollCompositeClient.computeSize(clientAreaSize.x, clientAreaSize.y);

    // Update the size of the ScrolledComposite's client.
    scrollCompositeClient.setSize(size);

    // Set the minimum size at which the ScrolledComposite will start
    // drawing scroll bars. This should be the size of its client area minus
    // the spaces the scroll bars would consume.
    scrollComposite.setMinSize(clientAreaSize.x + 1, clientAreaSize.y + 1);

    // We need to call layout() so the ScrolledComposite will update.
    scrollComposite.layout();

    // Set the height hint for the Section's parent Composite. This keeps
    // the TableViewer from going beyond the bottom edge of the Properties
    // Viewer. We want to keep the add and delete buttons visible, and the
    // TableViewer already has its own scroll bars!
    Composite sectionParent = section.getParent();
    GridData gridData = (GridData) sectionParent.getLayoutData();
    GridLayout gridLayout = (GridLayout) sectionParent.getParent().getLayout();
    gridData.heightHint = sectionParent.getParent().getSize().y - gridLayout.marginTop;

    // The parent of the Section has a FillLayout. Its parent has a
    // GridLayout, but sometimes it does not update. Tell it to layout so
    // the Section's parent will update its size.
    section.getParent().getParent().layout();

    // Enable re-drawing for the ScrolledComposite.
    scrollComposite.setRedraw(true);

    return;
  }
 /** Recreate the receiver given the new side */
 private void recreate() {
   if (region != null && !region.isDisposed()) {
     Composite parent = region.getParent();
     boolean animating = animationItem.animationRunning();
     AnimationManager.getInstance().removeItem(animationItem);
     region.dispose();
     createContents(parent, workbenchWindow);
     if (animating) animationItem.animationStart();
   }
 }
 private void createContextNotAvailableGroup(Composite parentComposite) {
   availableLabelComp = new Composite(parentComposite, SWT.NULL);
   availableLabelComp.setLayout(new GridLayout());
   availableLabelComp.setLayoutData(new GridData(GridData.FILL_BOTH));
   Label contextUnAvailableLabel = new Label(availableLabelComp, SWT.NULL);
   contextUnAvailableLabel.setText(
       Messages.getString("ContextNebulaComposite.ContextsUnAvailable")); // $NON-NLS-1$
   availableLabelComp.getParent().layout();
   availableLabelComp.layout();
 }
  public void build() {
    getParent().setLayout(new FillLayout());
    Composite stack = createFrame();
    stack.setLayout(new FormLayout());

    tabBar = new Composite(stack, SWT.NONE);
    tabBar.setLayout(new FormLayout());
    tabBar.setBackgroundImage(tabInactiveBgActive);
    FormData fdTabBar = new FormData();
    tabBar.setLayoutData(fdTabBar);
    fdTabBar.top = new FormAttachment(0);
    fdTabBar.left = new FormAttachment(0);
    fdTabBar.right = new FormAttachment(100);
    fdTabBar.height = tabInactiveBgActive.getBounds().height;

    if (rightCorner != null && leftCorner != null) {
      leftCornerLabel = new Label(stack.getParent(), SWT.NONE);
      leftCornerLabel.setImage(leftCorner);
      FormData fdLeftCorner = new FormData();
      leftCornerLabel.setLayoutData(fdLeftCorner);
      fdLeftCorner.left = new FormAttachment(0, 3);
      fdLeftCorner.top = new FormAttachment(0, 7);

      rightCornerLabel = new Label(stack.getParent(), SWT.NONE);
      rightCornerLabel.setImage(rightCorner);
      FormData fdRightCorner = new FormData();
      rightCornerLabel.setLayoutData(fdRightCorner);
      fdRightCorner.right = new FormAttachment(100, -3);
      fdRightCorner.top = new FormAttachment(0, 7);
      rightCornerLabel.moveAbove(null);
      leftCornerLabel.moveAbove(null);
      labelMap.put(LEFT, leftCornerLabel);
      labelMap.put(RIGHT, rightCornerLabel);
    }

    content = new Composite(stack, SWT.NONE);
    FormData fdContent = new FormData();
    content.setLayoutData(fdContent);
    fdContent.top = new FormAttachment(tabBar);
    fdContent.left = new FormAttachment(0);
    fdContent.right = new FormAttachment(100);
    fdContent.bottom = new FormAttachment(100);
  }
 private void dealParentLayout(Composite container) {
   if (container == null) return;
   if (!(container instanceof ScrolledComposite)) {
     dealParentLayout(container.getParent());
     return;
   }
   ScrolledComposite composite = (ScrolledComposite) container;
   Composite control = (Composite) composite.getContent();
   composite.setMinSize(control.computeSize(SWT.DEFAULT, SWT.DEFAULT));
   control.layout();
 }
  public static Composite createWidgets4Property(
      Composite parent, String preID, String prefix, AbstractSection section) {
    Composite group = section.getWidgetFactory().createSection(parent, prefix, true, 4);
    ((Section) group.getParent()).setExpanded(false);

    section.createWidget4Property(group, preID + PadUtil.PADDING_TOP);
    section.createWidget4Property(group, preID + PadUtil.PADDING_BOTTOM);
    section.createWidget4Property(group, preID + PadUtil.PADDING_LEFT);
    section.createWidget4Property(group, preID + PadUtil.PADDING_RIGHT);

    return group;
  }
 private void useRemoteChanged() {
   boolean enabled = useRemote.getSelection();
   jtagDevice.setEnabled(enabled);
   ipAddress.setEnabled(enabled);
   portNumber.setEnabled(enabled);
   connection.setEnabled(enabled);
   GDBJtagDeviceContribution selectedDeviceEntry = findJtagDeviceByName(jtagDevice.getText());
   if ((selectedDeviceEntry == null) || (selectedDeviceEntry.getDevice() == null)) {
     remoteConnectParmsLayout.topControl = null;
     remoteConnectionParameters.layout();
   } else {
     IGDBJtagDevice device = selectedDeviceEntry.getDevice();
     if (device instanceof IGDBJtagConnection) {
       remoteConnectParmsLayout.topControl = remoteConnectionBox;
       remoteConnectionBox.getParent().layout();
     } else {
       remoteConnectParmsLayout.topControl = remoteTcpipBox;
       remoteTcpipBox.getParent().layout();
     }
   }
 }
 private void cleanUpButton(final IPerspectiveDescriptor perspective, final Button button) {
   buttonList.remove(button);
   perspectiveButtonMap.remove(perspective);
   buttonPerspectiveMap.remove(button);
   button.getParent().dispose();
   background.layout(true);
   Control[] children = {background};
   Composite parent = getParent();
   parent.changed(children);
   parent.layout(true);
   parent.getParent().layout(true);
 }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
   * .ExecutionEvent)
   */
  public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchPart part = HandlerUtil.getActivePart(event);
    if (part != null) {
      IWorkbenchPartSite site = part.getSite();
      if (site instanceof PartSite) {
        final MPart model = ((PartSite) site).getModel();
        Composite partContainer = (Composite) model.getWidget();
        if (partContainer != null) {
          Composite parent = partContainer.getParent();
          while (parent != null && parent instanceof Composite) {
            if (parent instanceof CTabFolder) {
              CTabFolder ctf = (CTabFolder) parent;
              final Control topRight = ctf.getTopRight();
              if (topRight instanceof Composite) {
                for (Control child : ((Composite) topRight).getChildren()) {
                  if (child instanceof ToolBar
                      && "ViewMenu".equals(child.getData())) { // $NON-NLS-1$
                    ToolBar tb = (ToolBar) child;
                    ToolItem ti = tb.getItem(0);
                    Event sevent = new Event();
                    sevent.type = SWT.Selection;
                    sevent.widget = ti;
                    ti.notifyListeners(SWT.Selection, sevent);
                  }
                }
              }
              return null;
            }
            parent = parent.getParent();
          }

          MMenu menuModel = StackRenderer.getViewMenu(model);
          if (menuModel != null) {
            showStandaloneViewMenu(event, model, menuModel, partContainer);
          }
        }
      }
    }
    return null;
  }
  @Override
  public void refresh() {
    PictogramElement pe = getSelectedPictogramElement();
    if (pe != null) {
      Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
      _interface = null;

      // the filter assured, that it is a Service or Reference
      if (bo == null) {
        _composite.showPage(_blank);
        _composite.redraw();
        return;
      }
      if (bo instanceof Contract) {
        Contract contract = (Contract) bo;
        _interface = contract.getInterface();
      }

      if (_interface != null) {
        if (_modelComposites.get(_interface) == null) {
          TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
          IInterfaceComposite composite =
              (IInterfaceComposite) InterfaceCompositeAdapter.adaptModelToComposite(_interface);
          if (composite != null) {
            ((AbstractSwitchyardComposite) composite).createContents(_composite, SWT.NONE);
            factory.adapt(((AbstractSwitchyardComposite) composite).getPanel());
            _modelComposites.put(_interface, composite);
          }
        }
        IInterfaceComposite composite = (IInterfaceComposite) _modelComposites.get(_interface);
        if (composite != null) {
          composite.setInterface(_interface);
          _composite.showPage(((AbstractSwitchyardComposite) composite).getPanel());
          Composite parent = _composite;
          // this is a hack to get it to refresh properly
          while (parent != null) {
            parent.layout(true, true);
            parent = parent.getParent();
          }
        } else {
          _composite.getParent().layout();
          _composite.showPage(_blank);
          _composite.layout(true, true);
        }
      } else {
        _composite.showPage(_blank);
        _composite.getParent().layout();
        _composite.layout(true, true);
      }
    }
  }
Example #26
0
  @Override
  public Control createControl(Composite parent) {
    SashForm sash = new SashForm(parent, SWT.HORIZONTAL);
    sash.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    Composite container = new Composite(sash, SWT.NONE);
    container.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    treeMap = new TreeMap<TaxonomyNode>(container);
    treeMap.setTreeMapLayout(new SquarifiedLayout<TaxonomyNode>(10));
    treeMap.setLabelProvider(
        new ILabelProvider<TaxonomyNode>() {
          @Override
          public String getLabel(
              ITreeModel<IRectangle<TaxonomyNode>> model, IRectangle<TaxonomyNode> rectangle) {
            return rectangle.getNode().getName();
          }
        });

    legend = new TreeMapLegend(container, treeMap, getModel(), getRenderer());

    final SecurityDetailsViewer details =
        new SecurityDetailsViewer(sash, SWT.NONE, getModel().getClient(), true);
    treeMap.addSelectionChangeListener(
        new ISelectionChangeListener<TaxonomyNode>() {
          @Override
          public void selectionChanged(
              ITreeModel<IRectangle<TaxonomyNode>> model,
              IRectangle<TaxonomyNode> rectangle,
              String label) {
            TaxonomyNode node = rectangle.getNode();
            details.setInput(node.getBackingSecurity());
          }
        });

    // layout tree map + legend
    GridLayoutFactory.fillDefaults().numColumns(1).margins(10, 10).applyTo(container);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(treeMap);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(legend);

    // layout sash
    details.getControl().pack();
    int width = details.getControl().getBounds().width;
    sash.setWeights(new int[] {parent.getParent().getParent().getBounds().width - width, width});

    treeMap.setRectangleRenderer(new ClassificationRectangleRenderer(getModel(), getRenderer()));
    treeMap.setTreeModel(new Model(getModel().getRootNode()));
    legend.setRootItem(getModel().getRootNode());

    return sash;
  }
Example #27
0
 public void disposeCompositeImage(Composite composite) {
   disposeRegion(composite);
   // background Images are special if there is no background on a given
   // composite
   // it appears that its parents background image will be given, that
   // image CANNOT
   // be disposed so we have to check for that case
   Image image = composite.getBackgroundImage();
   Image parentImage = composite.getParent().getBackgroundImage();
   if (image != null && parentImage != image) {
     composite.setBackgroundImage(null);
     image.dispose();
   }
 }
        @Override
        public void perspectiveActivated(
            final IWorkbenchPage page, final IPerspectiveDescriptor perspective) {
          addIdToStore(perspective.getId());

          Button button = createPerspectiveButton(perspective);
          cleanButtons(button);

          background.layout(true);
          Control[] children = {background};
          Composite parent = getParent();
          parent.changed(children);
          parent.layout(true);
          parent.getParent().layout(true);
        }
 protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
   CoolScrolledComposite sc = (CoolScrolledComposite) composite.getParent();
   Point size = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT);
   if (sc.content != null) {
     Point preferredSize = sc.content.computeSize(wHint, hHint, flushCache);
     Point currentSize = sc.content.getSize();
     size.x = sc.getExpandHorizontal() ? preferredSize.x : currentSize.x;
     size.y = sc.getExpandVertical() ? preferredSize.y : currentSize.y;
   }
   size.x = Math.max(size.x, sc.minWidth);
   size.y = Math.max(size.y, sc.minHeight);
   if (wHint != SWT.DEFAULT) size.x = wHint;
   if (hHint != SWT.DEFAULT) size.y = hHint;
   return size;
 }
 public void reglerTaille() {
   int nombreIt = 0;
   int chargeMax = 0;
   if (EugesElements.getChargeEstimeeMax() > EugesElements.getChargeReelleMax())
     chargeMax = EugesElements.getChargeEstimeeMax();
   else chargeMax = EugesElements.getChargeReelleMax();
   int nombreActivites = EugesElements.getActivitesRealiseesCount();
   if (EugesElements._projet != null) nombreIt = EugesElements._projet._listeIteration.size();
   if (((nombreActivites * 120 + nombreIt * 100) < parent.getParent().getSize().x)
       && (chargeMax * 20 < parent.getParent().getSize().y))
     canvas.setSize(parent.getParent().getSize().x, parent.getParent().getSize().y - 20);
   else if ((nombreActivites * 120 + nombreIt * 100) < parent.getParent().getSize().x)
     canvas.setSize(parent.getParent().getSize().x, chargeMax * 20);
   else if (chargeMax * 20 < parent.getParent().getSize().y)
     canvas.setSize(nombreActivites * 120 + nombreIt * 100, parent.getParent().getSize().y);
   else canvas.setSize(nombreActivites * 120 + nombreIt * 100, chargeMax * 20);
 }