Exemple #1
0
  private void create(final IBranchPart sourceBranch, boolean newTopic) {
    topic = createDummyTopic(sourceBranch, newTopic);

    if (sourceBranch != null || !newTopic) {
      PartRegistry partRegistry = viewer.getPartRegistry();
      if (viewer instanceof AbstractViewer) ((AbstractViewer) viewer).setPartRegistry(null);
      BranchPart branchPart = new BranchPart();
      if (sourceBranch != null) branchPart.setOverrideBranchType(sourceBranch.getBranchType());
      branch = branchPart;
      branch.setModel(topic);
      branch.setParent(viewer.getRootPart());
      addBranchView();
      branch.addNotify();
      branch.getStatus().activate();
      removeShadow();
      if (sourceBranch != null)
        ((BranchPart) branch).setGraphicalPolicy(new DummyBranchPolicy(sourceBranch));
      if (viewer instanceof AbstractViewer) ((AbstractViewer) viewer).setPartRegistry(partRegistry);
    } else {
      IPart topicPart = viewer.findPart(topic);
      branch = MindMapUtils.findBranch(topicPart);
      branch.getFigure().setEnabled(false);
    }

    branch.refresh();
  }