Пример #1
0
  /** {@inheritDoc} */
  @Override
  public void createPartControl(final Composite parent) {
    toolBar = new ToolBar(parent, SWT.NONE);

    objectSelection = new ToolItem(toolBar, SWT.RADIO | SWT.NONE);
    objectSelection.setImage(MoreDreadUI.getDefault().getImage("/icons/SelectionModeObject.png"));
    objectSelection.setSelection(true);
    objectSelection.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            MoreDreadUI.getDefault().getSceneHolder().setSelectionMode(SelectionMode.OBJECT);
          }
        });
    faceSelection = new ToolItem(toolBar, SWT.RADIO | SWT.NONE);
    faceSelection.setImage(MoreDreadUI.getDefault().getImage("/icons/SelectionModeFace.png"));
    faceSelection.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            MoreDreadUI.getDefault().getSceneHolder().setSelectionMode(SelectionMode.FACE);
          }
        });
    faceSelection.setEnabled(false);
    edgeSelection = new ToolItem(toolBar, SWT.RADIO | SWT.NONE);
    edgeSelection.setImage(MoreDreadUI.getDefault().getImage("/icons/SelectionModeEdge.png"));
    edgeSelection.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            MoreDreadUI.getDefault().getSceneHolder().setSelectionMode(SelectionMode.EDGE);
          }
        });
    edgeSelection.setEnabled(false);
    vertexSelection = new ToolItem(toolBar, SWT.RADIO | SWT.NONE);
    vertexSelection.setImage(MoreDreadUI.getDefault().getImage("/icons/SelectionModeVertex.png"));
    vertexSelection.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            MoreDreadUI.getDefault().getSceneHolder().setSelectionMode(SelectionMode.VERTEX);
          }
        });
    vertexSelection.setEnabled(false);
    MoreDreadUI.getDefault().getSceneHolder().addSceneSelectionModeListener(this);
    MoreDreadUI.getDefault().getSceneHolder().addSceneSelectionChangeListener(this);
  }
Пример #2
0
 @Override
 public void dispose() {
   MoreDreadUI.getDefault().getSceneHolder().removeSceneSelectionModeListener(this);
   MoreDreadUI.getDefault().getSceneHolder().removeSceneSelectionChangeListener(this);
   super.dispose();
 }