コード例 #1
0
 public void localeChanged() {
   if (tabViews != null && tabViews.size() > 0) {
     for (int i = 0; i < tabViews.size(); i++) {
       UISWTViewCore view = tabViews.get(i);
       if (view != null) {
         view.triggerEvent(UISWTViewEvent.TYPE_LANGUAGEUPDATE, null);
       }
     }
   }
 }
コード例 #2
0
 public void delete() {
   if (tabViews != null && tabViews.size() > 0) {
     for (int i = 0; i < tabViews.size(); i++) {
       UISWTViewCore view = tabViews.get(i);
       if (view != null) {
         view.triggerEvent(UISWTViewEvent.TYPE_DESTROY, null);
       }
     }
   }
 }
コード例 #3
0
 public void generate(IndentWriter writer) {
   writer.println("# of SubViews: " + tabViews.size());
   writer.indent();
   try {
     for (Iterator<UISWTViewCore> iter = tabViews.iterator(); iter.hasNext(); ) {
       UISWTViewCore view = iter.next();
       writer.println(view.getTitleID() + ": " + view.getFullTitle());
     }
   } finally {
     writer.exdent();
   }
 }
コード例 #4
0
  private void openView(
      final String parentID,
      final Class<? extends UISWTViewEventListener> cla,
      String id,
      final Object data,
      final boolean closeable) {
    final MultipleDocumentInterfaceSWT mdi = UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();
    if (mdi == null) {
      return;
    }

    if (id == null) {
      id = cla.getName();
      int i = id.lastIndexOf('.');
      if (i > 0) {
        id = id.substring(i + 1);
      }
    }

    UISWTViewCore viewFromID = mdi.getCoreViewFromID(id);
    if (viewFromID != null) {
      viewFromID.triggerEvent(UISWTViewEvent.TYPE_DATASOURCE_CHANGED, data);
      mdi.showEntryByID(id);
    }

    final String _id = id;
    Utils.execSWTThreadLater(
        0,
        new AERunnable() {

          public void runSupport() {
            if (mdi.showEntryByID(_id)) {
              return;
            }
            UISWTViewEventListener l = null;
            try {
              Constructor<?> constructor = cla.getConstructor(new Class[] {data.getClass()});
              l = (UISWTViewEventListener) constructor.newInstance(new Object[] {data});
            } catch (Exception e) {
            }

            try {
              if (l == null) {
                l = cla.newInstance();
              }
              mdi.createEntryFromEventListener(parentID, l, _id, closeable, data, null);
            } catch (Exception e) {
              Debug.out(e);
            }
            mdi.showEntryByID(_id);
          }
        });
  }
コード例 #5
0
  // TabViews Functions
  public void addTabView(UISWTViewCore view) {
    if (view == null || tabFolder == null) {
      return;
    }

    triggerTabViewDataSourceChanged(view);

    CTabItem item = new CTabItem(tabFolder, SWT.NULL);
    item.setData("IView", view);
    Messages.setLanguageText(item, view.getTitleID());
    view.initialize(tabFolder);
    item.setControl(view.getComposite());
    tabViews.add(view);
  }
コード例 #6
0
  public void triggerTabViewDataSourceChanged(UISWTViewCore view) {
    if (view != null) {
      view.triggerEvent(UISWTViewEvent.TYPE_DATASOURCE_CHANGED, tv.getParentDataSource());

      if (view.useCoreDataSource()) {
        Object[] dataSourcesCore = tv.getSelectedDataSources(true);
        if (dataSourcesCore.length > 0) {
          view.triggerEvent(
              UISWTViewEvent.TYPE_DATASOURCE_CHANGED,
              dataSourcesCore.length == 0 ? tv.getParentDataSource() : dataSourcesCore);
        }
      } else {
        Object[] dataSourcesPlugin = tv.getSelectedDataSources(false);
        if (dataSourcesPlugin.length > 0) {
          view.triggerEvent(
              UISWTViewEvent.TYPE_DATASOURCE_CHANGED,
              dataSourcesPlugin.length == 0
                  ? PluginCoreUtils.convert(tv.getParentDataSource(), false)
                  : dataSourcesPlugin);
        }
      }
    }
  }
コード例 #7
0
  /* (non-Javadoc)
   * @see com.aelitis.azureus.ui.swt.UIFunctionsSWT#closePluginView(org.gudy.azureus2.ui.swt.pluginsimpl.UISWTViewCore)
   */
  public void closePluginView(UISWTViewCore view) {
    try {
      MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
      if (mdi == null) {
        return;
      }
      String id;
      if (view instanceof UISWTViewImpl) {
        id = ((UISWTViewImpl) view).getViewID();
      } else {
        id = view.getClass().getName();
        int i = id.lastIndexOf('.');
        if (i > 0) {
          id = id.substring(i + 1);
        }
      }
      mdi.closeEntry(id);

    } catch (Exception e) {
      Logger.log(new LogEvent(LOGID, "closePluginView", e));
    }
  }
コード例 #8
0
  public void triggerTabViewsDataSourceChanged(boolean sendParent) {
    if (tabViews == null || tabViews.size() == 0) {
      return;
    }

    if (sendParent) {
      for (int i = 0; i < tabViews.size(); i++) {
        UISWTViewCore view = tabViews.get(i);
        if (view != null) {
          view.triggerEvent(UISWTViewEvent.TYPE_DATASOURCE_CHANGED, tv.getParentDataSource());
        }
      }
      return;
    }

    // Set Data Object for all tabs.

    Object[] dataSourcesCore = tv.getSelectedDataSources(true);
    Object[] dataSourcesPlugin = null;

    for (int i = 0; i < tabViews.size(); i++) {
      UISWTViewCore view = tabViews.get(i);
      if (view != null) {
        if (view.useCoreDataSource()) {
          view.triggerEvent(
              UISWTViewEvent.TYPE_DATASOURCE_CHANGED,
              dataSourcesCore.length == 0 ? tv.getParentDataSource() : dataSourcesCore);
        } else {
          if (dataSourcesPlugin == null) {
            dataSourcesPlugin = tv.getSelectedDataSources(false);
          }

          view.triggerEvent(
              UISWTViewEvent.TYPE_DATASOURCE_CHANGED,
              dataSourcesPlugin.length == 0
                  ? PluginCoreUtils.convert(tv.getParentDataSource(), false)
                  : dataSourcesPlugin);
        }
      }
    }
  }
コード例 #9
0
 public void refreshSelectedSubView() {
   UISWTViewCore view = getActiveSubView();
   if (view != null && view.getComposite().isVisible()) {
     view.triggerEvent(UISWTViewEvent.TYPE_REFRESH, null);
   }
 }