Esempio n. 1
0
  @Override
  public void createControl(Composite parent) {
    itemControl = new ItemListControl(parent, SWT.SHEET, mainEditor.getSite(), node, metaNode);
    // itemControl.getLayout().marginHeight = 0;
    // itemControl.getLayout().marginWidth = 0;
    ProgressPageControl progressControl = null;
    if (mainEditor instanceof IProgressControlProvider) {
      progressControl = ((IProgressControlProvider) mainEditor).getProgressControl();
    }
    if (progressControl != null) {
      itemControl.substituteProgressPanel(progressControl);
    } else {
      itemControl.createProgressPanel();
    }

    parent.layout();

    // Activate items control on focus
    itemControl
        .getItemsViewer()
        .getControl()
        .addFocusListener(
            new FocusListener() {
              @Override
              public void focusGained(FocusEvent e) {
                // Update selection provider and selection
                final ISelectionProvider selectionProvider = itemControl.getSelectionProvider();
                mainEditor.getSite().setSelectionProvider(selectionProvider);
                selectionProvider.setSelection(selectionProvider.getSelection());
                itemControl.activate(true);

                // Notify owner MultiPart editor about page change
                // We need it to update search actions and other contributions provided by node
                // editor
                if (mainEditor.getSite() instanceof MultiPageEditorSite) {
                  ((MultiPageEditorSite) mainEditor.getSite())
                      .getMultiPageEditor()
                      .setActiveEditor(mainEditor);
                }
              }

              @Override
              public void focusLost(FocusEvent e) {
                itemControl.activate(false);
              }
            });
  }
Esempio n. 2
0
 public IDatabaseEditorInput getEditorInput() {
   return mainEditor.getEditorInput();
 }