Пример #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);
              }
            });
  }
Пример #2
0
 @Override
 public void aboutToBeShown() {
   if (!activated) {
     activated = true;
     boolean isLazy =
         !(node instanceof DBNDatabaseNode) || ((DBNDatabaseNode) node).needsInitialization();
     itemControl.loadData(isLazy);
   }
 }
Пример #3
0
 @Override
 public void refreshPart(Object source, boolean force) {
   if (!activated || itemControl == null || itemControl.isDisposed()) {
     return;
   }
   // Check - do we need to load new content in editor
   // If this is DBM event then check node change type
   // UNLOAD usually means that connection was closed on connection's node is not removed but
   // is in "unloaded" state.
   // Without this check editor will try to reload it's content and thus will reopen just closed
   // connection
   // (by calling getChildren() on DBNNode)
   boolean loadNewData = true;
   if (source instanceof DBNEvent) {
     DBNEvent.NodeChange nodeChange = ((DBNEvent) source).getNodeChange();
     if (nodeChange == DBNEvent.NodeChange.UNLOAD) {
       loadNewData = false;
     }
   }
   if (loadNewData && !itemControl.isDisposed()) {
     itemControl.loadData(false);
   }
 }
Пример #4
0
 public void setFocus() {
   if (itemControl != null) {
     itemControl.setFocus();
   }
 }
Пример #5
0
 @Override
 public Viewer getNavigatorViewer() {
   return itemControl.getNavigatorViewer();
 }
Пример #6
0
 @Override
 public DBNNode getRootNode() {
   return itemControl.getRootNode();
 }
Пример #7
0
 @Override
 public boolean performSearch(SearchType searchType) {
   return itemControl.performSearch(searchType);
 }
Пример #8
0
 @Override
 public boolean isSearchEnabled() {
   return itemControl.isSearchEnabled();
 }
Пример #9
0
 @Override
 public boolean isSearchPossible() {
   return itemControl.isSearchPossible();
 }