Java 类org.eclipse.ui.internal.ide.AboutInfo 实例源码

项目:gama    文件:GamaActionBarAdvisor.java   
/**
 * Creates the feature-dependent actions for the menu bar.
 */
private void makeFeatureDependentActions(final IWorkbenchWindow window) {
    final AboutInfo[] infos = null;

    final IPreferenceStore prefs = IDEWorkbenchPlugin.getDefault().getPreferenceStore();

    // Optimization: avoid obtaining the about infos if the platform state is
    // unchanged from last time. See bug 75130 for details.
    final String stateKey = "platformState"; //$NON-NLS-1$
    final String prevState = prefs.getString(stateKey);
    final String currentState = String.valueOf(Platform.getStateStamp());
    final boolean sameState = currentState.equals(prevState);
    if ( !sameState ) {
        prefs.putValue(stateKey, currentState);
    }
}
项目:limpet    文件:ApplicationWorkbenchAdvisor.java   
public String getInitialWindowPerspectiveId()
{
  int index = PlatformUI.getWorkbench().getWorkbenchWindowCount() - 1;

  String perspectiveId = null;
  AboutInfo[] welcomeInfos = getWelcomePerspectiveInfos();
  if (index >= 0 && welcomeInfos != null && index < welcomeInfos.length)
  {
    perspectiveId = welcomeInfos[index].getWelcomePerspectiveId();
  }
  if (perspectiveId == null)
  {
    perspectiveId = Perspective.ID;
  }
  return perspectiveId;
}
项目:limpet    文件:ApplicationWorkbenchAdvisor.java   
/**
 * Returns the map of versioned feature ids -> info object for all installed features. The format
 * of the versioned feature id (the key of the map) is featureId + ":" + versionId.
 * 
 * @return map of versioned feature ids -> info object (key type: <code>String</code>, value type:
 *         <code>AboutInfo</code>)
 * @since 3.0
 */
private Map<String, AboutInfo> computeBundleGroupMap()
{
  // use tree map to get predicable order
  Map<String, AboutInfo> ids = new TreeMap<String, AboutInfo>();

  IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
  for (int i = 0; i < providers.length; ++i)
  {
    IBundleGroup[] groups = providers[i].getBundleGroups();
    for (int j = 0; j < groups.length; ++j)
    {
      IBundleGroup group = groups[j];
      AboutInfo info = new AboutInfo(group);

      String version = info.getVersionId();
      version = version == null ? "0.0.0" //$NON-NLS-1$
          : new Version(version).toString();
      String versionedFeature = group.getIdentifier() + ":" + version; //$NON-NLS-1$

      ids.put(versionedFeature, info);
    }
  }

  return ids;
}
项目:limpet    文件:ApplicationWorkbenchAdvisor.java   
/**
 * Updates the old features setting and returns a map of new features.
 */
private Map<String, AboutInfo> createNewBundleGroupsMap()
{
  // retrieve list of installed bundle groups from last session
  IDialogSettings settings =
      IDEWorkbenchPlugin.getDefault().getDialogSettings();
  String[] previousFeaturesArray = settings.getArray(INSTALLED_FEATURES);

  // get a map of currently installed bundle groups and store it for next
  // session
  Map<String, AboutInfo> bundleGroups = computeBundleGroupMap();
  String[] currentFeaturesArray = new String[bundleGroups.size()];
  bundleGroups.keySet().toArray(currentFeaturesArray);
  settings.put(INSTALLED_FEATURES, currentFeaturesArray);

  // remove the previously known from the current set
  if (previousFeaturesArray != null)
  {
    for (int i = 0; i < previousFeaturesArray.length; ++i)
    {
      bundleGroups.remove(previousFeaturesArray[i]);
    }
  }

  return bundleGroups;
}
项目:limpet    文件:ApplicationWorkbenchAdvisor.java   
/**
 * @return the welcome perspective infos, or <code>null</code> if none or if they should be
 *         ignored due to the new intro being present
 */
public AboutInfo[] getWelcomePerspectiveInfos()
{
  // support old welcome perspectives if intro plugin is not present
  if (welcomePerspectiveInfos == null && !hasIntro())
  {
    Map<String, AboutInfo> m = getNewlyAddedBundleGroups();
    List<AboutInfo> list = new ArrayList<AboutInfo>(m.size());
    for (Iterator<AboutInfo> i = m.values().iterator(); i.hasNext();)
    {
      AboutInfo info = (AboutInfo) i.next();
      if (info != null && info.getWelcomePerspectiveId() != null
          && info.getWelcomePageURL() != null)
      {
        list.add(info);
      }
    }
    welcomePerspectiveInfos = new AboutInfo[list.size()];
    list.toArray(welcomePerspectiveInfos);
  }
  return welcomePerspectiveInfos;
}
项目:http4e    文件:HdJavaEditorInput.java   
/**
 * WelcomeEditorInput constructor comment.
 */
public HdJavaEditorInput(AboutInfo info) {
    super();
    if (info == null) {
        throw new IllegalArgumentException();
    }
    aboutInfo = info;
}
项目:PDFReporter-Studio    文件:ApplicationActionBarAdvisor.java   
/**
 * Returns whether any of the given infos have a welcome page.
 * 
 * @param infos
 *            the infos
 * @return <code>true</code> if a welcome page was found, <code>false</code>
 *         if not
 */
private boolean hasWelcomePage(AboutInfo[] infos) {
    for (int i = 0; i < infos.length; i++) {
        if (infos[i].getWelcomePageURL() != null) {
            return true;
        }
    }
    return false;
}
项目:PDFReporter-Studio    文件:ApplicationActionBarAdvisor.java   
/**
 * Returns whether any of the given infos have tips and tricks.
 * 
 * @param infos
 *            the infos
 * @return <code>true</code> if tips and tricks were found,
 *         <code>false</code> if not
 */
private boolean hasTipsAndTricks(AboutInfo[] infos) {
    for (int i = 0; i < infos.length; i++) {
        if (infos[i].getTipsAndTricksHref() != null) {
            return true;
        }
    }
    return false;
}
项目:limpet    文件:ApplicationWorkbenchAdvisor.java   
/**
 * Returns the ordered map of versioned feature ids -> AboutInfo that are new for this session.
 * 
 * @return ordered map of versioned feature ids (key type: <code>String</code>) -> infos (value
 *         type: <code>AboutInfo</code>).
 */
public Map<String, AboutInfo> getNewlyAddedBundleGroups()
{
  if (newlyAddedBundleGroups == null)
  {
    newlyAddedBundleGroups = createNewBundleGroupsMap();
  }
  return newlyAddedBundleGroups;
}
项目:limpet    文件:ApplicationActionBarAdvisor.java   
/**
 * Returns whether any of the given infos have a welcome page.
 * 
 * @param infos
 *          the infos
 * @return <code>true</code> if a welcome page was found, <code>false</code> if not
 */
private boolean hasWelcomePage(AboutInfo[] infos)
{
  for (int i = 0; i < infos.length; i++)
  {
    if (infos[i].getWelcomePageURL() != null)
    {
      return true;
    }
  }
  return false;
}
项目:limpet    文件:ApplicationActionBarAdvisor.java   
/**
 * Returns whether any of the given infos have tips and tricks.
 * 
 * @param infos
 *          the infos
 * @return <code>true</code> if tips and tricks were found, <code>false</code> if not
 */
private boolean hasTipsAndTricks(AboutInfo[] infos)
{
  for (int i = 0; i < infos.length; i++)
  {
    if (infos[i].getTipsAndTricksHref() != null)
    {
      return true;
    }
  }
  return false;
}
项目:http4e    文件:HdJavaEditorInput.java   
public AboutInfo getAboutInfo() {
    return aboutInfo;
}
项目:gama    文件:ApplicationWorkbenchAdvisor.java   
@Override
public Map<String, AboutInfo> getNewlyAddedBundleGroups() {
    // TODO Auto-generated method stub
    return super.getNewlyAddedBundleGroups();
}
项目:limpet    文件:ApplicationWorkbenchWindowAdvisor.java   
public void postWindowRestore() throws WorkbenchException
{
  IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
  IWorkbenchWindow window = configurer.getWindow();

  int index = getWorkbench().getWorkbenchWindowCount() - 1;

  AboutInfo[] welcomePerspectiveInfos =
      wbAdvisor.getWelcomePerspectiveInfos();
  if (index >= 0 && welcomePerspectiveInfos != null
      && index < welcomePerspectiveInfos.length)
  {
    // find a page that exist in the window
    IWorkbenchPage page = window.getActivePage();
    if (page == null)
    {
      IWorkbenchPage[] pages = window.getPages();
      if (pages != null && pages.length > 0)
      {
        page = pages[0];
      }
    }

    // if the window does not contain a page, create one
    String perspectiveId =
        welcomePerspectiveInfos[index].getWelcomePerspectiveId();
    if (page == null)
    {
      IAdaptable root = wbAdvisor.getDefaultPageInput();
      page = window.openPage(perspectiveId, root);
    }
    else
    {
      IPerspectiveRegistry reg = getWorkbench().getPerspectiveRegistry();
      IPerspectiveDescriptor desc = reg.findPerspectiveWithId(perspectiveId);
      if (desc != null)
      {
        page.setPerspective(desc);
      }
    }

    // set the active page and open the welcome editor
    window.setActivePage(page);
    page.openEditor(new WelcomeEditorInput(welcomePerspectiveInfos[index]),
        WELCOME_EDITOR_ID, true);
  }
  cleanUpEditorArea();
}
项目:limpet    文件:ApplicationWorkbenchWindowAdvisor.java   
private void openWelcomeEditors(IWorkbenchWindow window)
{
  if (IDEWorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(
      IDEInternalPreferences.WELCOME_DIALOG))
  {
    // show the welcome page for the product the first time the
    // workbench opens
    IProduct product = Platform.getProduct();
    if (product == null)
    {
      return;
    }

    AboutInfo productInfo = new AboutInfo(product);
    URL url = productInfo.getWelcomePageURL();
    if (url == null)
    {
      return;
    }

    IDEWorkbenchPlugin.getDefault().getPreferenceStore().setValue(
        IDEInternalPreferences.WELCOME_DIALOG, false);
    openWelcomeEditor(window, new WelcomeEditorInput(productInfo), null);
  }
  else
  {
    // Show the welcome page for any newly installed features
    List<AboutInfo> welcomeFeatures = new ArrayList<AboutInfo>();
    for (Iterator<Entry<String, AboutInfo>> it =
        wbAdvisor.getNewlyAddedBundleGroups().entrySet().iterator(); it
        .hasNext();)
    {
      Entry<String, AboutInfo> entry = it.next();
      AboutInfo info = (AboutInfo) entry.getValue();

      if (info != null && info.getWelcomePageURL() != null)
      {
        welcomeFeatures.add(info);
        // activate the feature plug-in so it can run some install
        // code
        String pi = info.getBrandingBundleId();
        if (pi != null)
        {
          // Start the bundle if there is one
          Bundle bundle = Platform.getBundle(pi);
          if (bundle != null)
          {
            try
            {
              bundle.start(Bundle.START_TRANSIENT);
            }
            catch (BundleException exception)
            {
              StatusManager.getManager().handle(
                  new Status(IStatus.ERROR, IDEApplication.PLUGIN_ID,
                      "Failed to load feature", exception)); //$NON-NLS-1$
            }
          }
        }
      }
    }

    int wCount = getWorkbench().getWorkbenchWindowCount();
    for (int i = 0; i < welcomeFeatures.size(); i++)
    {
      AboutInfo newInfo = (AboutInfo) welcomeFeatures.get(i);
      String id = newInfo.getWelcomePerspectiveId();
      // Other editors were already opened in postWindowRestore(..)
      if (id == null || i >= wCount)
      {
        openWelcomeEditor(window, new WelcomeEditorInput(newInfo), id);
      }
    }
  }
}