Beispiel #1
0
  public void add(MUFModule module) {
    if (playing) {
      delayAdd.offer(module);
      return;
    }

    // set to true
    playing = true;
    adding = true;

    // initialize module and add it
    module.create(this);
    modules.put(module.getId(), module);

    if (content.isVisible()) {
      // play a animation
      frame = 1;
      Point moduleSize = module.getPreferredSize();
      dx = Math.max(0, (moduleSize.x - oldSize.x) / FRAMES);
      dy = Math.max(0, moduleSize.y / FRAMES);
      content.pack();
      Display.getCurrent().timerExec(0, runnable);
    } else {
      oldSize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
      playing = false;
    }
  }
Beispiel #2
0
  public void remove(MUFModule module) {
    if (playing) {
      delayRemove.offer(module);
      return;
    }

    // set to true
    playing = true;
    adding = false;
    moduleToBeRemoved = module;

    // exclude from layout
    modules.remove(module.getId());
    GridData data = (GridData) module.self.getLayoutData();
    data.exclude = true;
    module.self.setLayoutData(data);
    module.self.setVisible(false);

    if (content.isVisible()) {
      // get destination size
      frame = 1;
      Point newSize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
      dx = Math.min(0, (newSize.x - oldSize.x) / FRAMES);
      dy = Math.min(0, (newSize.y - oldSize.y) / FRAMES);
      Display.getCurrent().timerExec(0, runnable);
    } else {
      oldSize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
      playing = false;
      delayDispose.offer(module.self);
    }
    module.dispose();
  }
Beispiel #3
0
  @Override
  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    // System.out.println("select change\n");
    //		if(!getSite().getPage().isPartVisible(this))			//if i am not visible ,i will not change
    //			return;
    if (!banner.isVisible()) return;
    if (selection != null) {
      treeObj = (TreeModel.TreeObject) ((IStructuredSelection) selection).getFirstElement();
      if (treeObj != null && !(treeObj instanceof TreeModel.TreeParent))
        if (treeObj.getModel() != null) {
          // update content
          Control[] children = left.getChildren();
          for (Control child : children) child.dispose();
          BasicModel bm = treeObj.getModel();

          // update screen shot thread's device
          if (bm instanceof MobileModel) {
            System.out.println("change model start");
            if (mMobileModel != null) mMobileModel.stopShot(this);

            mMobileModel = (MobileModel) bm;
            showInfo(left, mMobileModel);
            left.layout(true, true);

            mMobileModel.startShot(this);
            System.out.println("change model stop");
          }
        }
    }
  }