コード例 #1
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);
          }
        });
  }
コード例 #2
0
 /* (non-Javadoc)
  * @see com.aelitis.azureus.ui.swt.UIFunctionsSWT#openPluginView(org.gudy.azureus2.ui.swt.pluginsimpl.UISWTViewCore, java.lang.String)
  */
 public void openPluginView(UISWTViewCore view, String name) {
   try {
     MultipleDocumentInterfaceSWT mdi = getMDISWT();
     if (mdi == null) {
       return;
     }
     if (mdi.createEntryFromView(
             MultipleDocumentInterface.SIDEBAR_HEADER_PLUGINS, view, name, null, true, true, true)
         != null) {
       return;
     }
   } catch (Exception e) {
     Logger.log(new LogEvent(LOGID, "openPluginView", e));
   }
 }
コード例 #3
0
  // @see com.aelitis.azureus.ui.swt.UIFunctionsSWT#openPluginView(java.lang.String,
  // java.lang.String, org.gudy.azureus2.ui.swt.plugins.UISWTViewEventListener, java.lang.Object,
  // boolean)
  public void openPluginView(
      String sParentID,
      String sViewID,
      UISWTViewEventListener l,
      Object dataSource,
      boolean bSetFocus) {
    try {
      MultipleDocumentInterfaceSWT mdi = getMDISWT();

      if (mdi != null) {

        String sidebarParentID = null;

        if (UISWTInstance.VIEW_MYTORRENTS.equals(sParentID)) {
          sidebarParentID = SideBar.SIDEBAR_HEADER_TRANSFERS;
        } else if (UISWTInstance.VIEW_MAIN.equals(sParentID)) {
          sidebarParentID = MultipleDocumentInterface.SIDEBAR_HEADER_PLUGINS;
        } else {
          System.err.println("Can't find parent " + sParentID + " for " + sViewID);
        }

        MdiEntry entry =
            mdi.createEntryFromEventListener(sidebarParentID, l, sViewID, true, dataSource, null);
        if (bSetFocus) {
          mdi.showEntryByID(sViewID);
        } else if (entry instanceof BaseMdiEntry) {
          // Some plugins (CVS Updater) want their view's composite initialized
          // on OpenPluginView, otherwise they won't do logic users expect
          // (like check for new snapshots).  So, enforce loading entry.
          ((BaseMdiEntry) entry).build();
        }
      }
    } catch (Exception e) {
      Logger.log(new LogEvent(LOGID, "openPluginView", e));
    }
  }