/** @see ContentOutlinePage#createControl */
  public void createControl(Composite parent) {
    super.createControl(parent);
    ColumnViewerToolTipSupport.enableFor(getTreeViewer());

    IWorkbenchPage page = getSite().getWorkbenchWindow().getActivePage();
    if (page != null) {
      fEditor = page.getActiveEditor();
    }

    fDragAdapter = new DelegatingDragAdapter();
    fDragSource = new DragSource(getControl(), DND.DROP_COPY | DND.DROP_MOVE);
    fDropAdapter = new DelegatingDropAdapter();
    fDropTarget = new DropTarget(getControl(), DND.DROP_COPY | DND.DROP_MOVE);

    setConfiguration(getConfiguration());

    /*
     * ContentOutlinePage only implements ISelectionProvider while the
     * tree viewer implements both ISelectionProvider and
     * IPostSelectionProvider. Use an ISelectionProvider that listens to
     * post selection from the tree viewer and forward only post selection
     * to the selection service.
     */
    getTreeViewer()
        .addPostSelectionChangedListener(fSelectionProvider.getPostSelectionChangedListener());
    getTreeViewer().addSelectionChangedListener(fSelectionProvider.getSelectionChangedListener());
    if (fDoubleClickProvider == null) {
      fDoubleClickProvider = new DoubleClickProvider();
    }
    getTreeViewer().addDoubleClickListener(fDoubleClickProvider);
    getSite().setSelectionProvider(fSelectionProvider);
  }
Пример #2
0
        @Override
        public void createControl(Composite parent) {
          super.createControl(parent);
          contentOutlineViewer = getTreeViewer();
          contentOutlineViewer.addSelectionChangedListener(this);

          // Set up the tree viewer.
          //
          contentOutlineViewer.setContentProvider(
              new AdapterFactoryContentProvider(adapterFactory));
          contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
          contentOutlineViewer.setInput(editingDomain.getResourceSet());

          // Make sure our popups work.
          //
          createContextMenuFor(contentOutlineViewer);

          if (!editingDomain.getResourceSet().getResources().isEmpty()) {
            // Select the root object in the view.
            //
            contentOutlineViewer.setSelection(
                new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)),
                true);
          }
        }
  @Override
  public void createControl(Composite parent) {
    super.createControl(parent);
    viewer = getTreeViewer();
    contentProvider = new TreeNodeContentProvider();
    viewer.setContentProvider(contentProvider);
    labelProvider = new TextUMLLabelProvider();
    viewer.setLabelProvider(labelProvider);
    viewer.setComparator(new UIModelObjectViewerComparator());
    viewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);

    // tracks selections in the outline and reflects them in the editor
    viewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          public void selectionChanged(SelectionChangedEvent event) {
            TreeSelection selection = (TreeSelection) event.getSelection();
            if (!selection.isEmpty()) {
              TreeNode treeNode = (TreeNode) selection.getFirstElement();
              UIModelObject model = (UIModelObject) treeNode.getValue();
              selectInEditor(model.getToken());
            }
          }
        });

    refresh();
  }
Пример #4
0
  @Override
  public void createControl(final Composite parent) {
    super.createControl(parent);

    TreeViewer viewer = getTreeViewer();
    viewer.setContentProvider(new OutlineCP());
    viewer.setLabelProvider(new OutlineLabelProvider());
    viewer.addSelectionChangedListener(this);

    IActionBars actionBars = getSite().getActionBars();
    registerToolbarActions(actionBars);

    if (input != null) {
      viewer.setInput(input);
    }
  }
  /* (non-Javadoc)
   * Method declared on ContentOutlinePage
   */
  @Override
  public void createControl(Composite parent) {

    super.createControl(parent);

    TreeViewer viewer = getTreeViewer();
    viewer.setContentProvider(fContentProvider);
    DelegatingStyledCellLabelProvider delegatingStyledCellLabelProvider =
        new DelegatingStyledCellLabelProvider(new JsonLabelProvider());
    viewer.setLabelProvider(delegatingStyledCellLabelProvider);
    getSite().getPage().addPostSelectionListener(this);

    if (fInput != null) {
      viewer.setInput(fInput);
      fContentProvider.setInput(fInput);
    }
  }
Пример #6
0
  /**
   * Creates the control ie. creates all the stuff that matters and is visible in the outline.
   *
   * <p>Actions must be created before menus and toolbars.
   *
   * @param parent
   */
  @Override
  public void createControl(Composite parent) {
    super.createControl(parent);
    NddlContentProvider provider = editor.getNddlContentProvider();

    // initialize the tree viewers
    TreeViewer viewer = getTreeViewer();
    viewer.setContentProvider(provider);
    viewer.addFilter(new FileViewerFilter());
    viewer.setLabelProvider(new NddlLabelProvider());

    // set the selection listener
    viewer.addSelectionChangedListener(this);

    // finally set the input
    if (this.input != null) viewer.setInput(this.input);
    else provider.reload(editor.getFile());
  }
Пример #7
0
  @Override
  public void createControl(Composite parent) {
    super.createControl(parent);

    Workspace.getInstance().installResourceListener(m_listener);

    TreeViewer treeViewer = getTreeViewer();
    treeViewer.setContentProvider(new NavigatorTreeContentProvider());
    treeViewer.setLabelProvider(new Z8LabelProvider(false));
    treeViewer.addSelectionChangedListener(this);

    treeViewer.setSorter(
        new ViewerSorter() {
          @Override
          public int compare(Viewer viewer, Object e1, Object e2) {
            if (e1 == e2) return 0;

            ISource s1, s2;

            if (e1 instanceof ISource) {
              s1 = (ISource) e1;
            } else {
              return -1;
            }

            if (e2 instanceof ISource) {
              s2 = (ISource) e2;
            } else {
              return 1;
            }

            return s1.getPosition().getOffset() > s2.getPosition().getOffset() ? 1 : -1;
          }
        });

    treeViewer.addFilter(FILTER);

    if (m_compilationUnit != null) {
      treeViewer.setInput(m_compilationUnit);
    }
  }
Пример #8
0
  @Override
  public void createControl(final Composite parent) {
    super.createControl(parent);
    TreeViewer tv = getTreeViewer();
    tv.setLabelProvider(new CabalOutlineLP());
    tv.setContentProvider(new CabalOutlinePageCP());
    tv.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
    tv.addSelectionChangedListener(
        new ISelectionChangedListener() {
          public void selectionChanged(final SelectionChangedEvent event) {
            if (event.getSelection() instanceof IStructuredSelection) {
              IStructuredSelection ssel = (IStructuredSelection) event.getSelection();
              if (ssel.size() == 1) {
                editor.selectAndReveal(ssel.getFirstElement());
              }
            }
          }
        });

    tv.setInput(packageDescription);
  }
  /* (non-Javadoc)
   * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  public void createControl(Composite parent) {
    super.createControl(parent);
    TreeViewer viewer = getTreeViewer();
    viewer.setContentProvider(new MakefileContentProvider());
    viewer.setLabelProvider(new MakefileLabelProvider());
    if (fInput != null) {
      viewer.setInput(fInput);
    }

    MenuManager manager = new MenuManager("#MakefileOutlinerContext"); // $NON-NLS-1$
    manager.setRemoveAllWhenShown(true);
    manager.addMenuListener(
        new IMenuListener() {
          public void menuAboutToShow(IMenuManager m) {
            contextMenuAboutToShow(m);
          }
        });
    Control tree = viewer.getControl();
    Menu menu = manager.createContextMenu(tree);
    tree.setMenu(menu);

    viewer.addDoubleClickListener(
        new IDoubleClickListener() {
          /* (non-Javadoc)
           * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
           */
          public void doubleClick(DoubleClickEvent event) {
            if (fOpenIncludeAction != null) {
              fOpenIncludeAction.run();
            }
          }
        });

    IPageSite site = getSite();
    // FIXME: should pluginid below be MakeUIPlugin id?
    site.registerContextMenu(
        AutotoolsUIPlugin.getPluginId() + ".outline", manager, viewer); // $NON-NLS-1$
    site.setSelectionProvider(viewer);
  }
 @Override
 public void createControl(Composite parent) {
   super.createControl(parent);
 }