Java 类com.intellij.openapi.application.ex.ApplicationInfoEx 实例源码

项目:intellij-ce-playground    文件:WindowManagerImpl.java   
public void showFrame() {
  final IdeFrameImpl frame = new IdeFrameImpl(ApplicationInfoEx.getInstanceEx(),
                                              myActionManager, myDataManager,
                                              ApplicationManager.getApplication());
  myProject2Frame.put(null, frame);

  if (myFrameBounds == null || !ScreenUtil.isVisible(myFrameBounds)) { //avoid situations when IdeFrame is out of all screens
    myFrameBounds = ScreenUtil.getMainScreenBounds();
    int xOff = myFrameBounds.width / 8;
    int yOff = myFrameBounds.height / 8;
    JBInsets.removeFrom(myFrameBounds, new Insets(yOff, xOff, yOff, xOff));
  }

  fixForOracleBug8007219(frame);

  frame.setBounds(myFrameBounds);
  frame.setExtendedState(myFrameExtendedState);
  frame.setVisible(true);

}
项目:intellij-ce-playground    文件:IdeFrameImpl.java   
public static void updateTitle(JFrame frame, final String title, final String fileTitle, final File currentFile) {
  if (myUpdatingTitle) return;

  try {
    myUpdatingTitle = true;

    frame.getRootPane().putClientProperty("Window.documentFile", currentFile);

    final String applicationName = ((ApplicationInfoEx)ApplicationInfo.getInstance()).getFullApplicationName();
    final Builder builder = new Builder();
    if (SystemInfo.isMac) {
      boolean addAppName = StringUtil.isEmpty(title) ||
                           ProjectManager.getInstance().getOpenProjects().length == 0 ||
                           ((ApplicationInfoEx)ApplicationInfo.getInstance()).isEAP() && !applicationName.endsWith("SNAPSHOT");
      builder.append(fileTitle).append(title).append(addAppName ? applicationName : null);
    } else {
      builder.append(title).append(fileTitle).append(applicationName);
    }

    frame.setTitle(builder.sb.toString());
  }
  finally {
    myUpdatingTitle = false;
  }
}
项目:intellij-ce-playground    文件:IdeBackgroundUtil.java   
public static void initFramePainters(@NotNull PaintersHelper painters) {
  PaintersHelper.initWallpaperPainter("idea.wallpaper.ide", painters);

  ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
  String path = UIUtil.isUnderDarcula()? appInfo.getEditorBackgroundImageUrl() : null;
  URL url = path == null ? null : appInfo.getClass().getResource(path);
  Image centerImage = url == null ? null : ImageLoader.loadFromUrl(url);

  if (centerImage != null) {
    painters.addPainter(PaintersHelper.newImagePainter(centerImage, PaintersHelper.FillType.TOP_CENTER, 1.0f, JBUI.insets(10, 0, 0, 0)), null);
  }
  painters.addPainter(new AbstractPainter() {
    EditorEmptyTextPainter p = ServiceManager.getService(EditorEmptyTextPainter.class);

    @Override
    public boolean needsRepaint() {
      return true;
    }

    @Override
    public void executePaint(Component component, Graphics2D g) {
      p.paintEmptyText((JComponent)component, g);
    }
  }, null);

}
项目:intellij-ce-playground    文件:PluginDownloader.java   
@NotNull
private static String getUrl(@NotNull IdeaPluginDescriptor descriptor,
                             @Nullable String host,
                             @Nullable BuildNumber buildNumber) throws URISyntaxException, MalformedURLException {
  if (host != null && descriptor instanceof PluginNode) {
    String url = ((PluginNode)descriptor).getDownloadUrl();
    return new URI(url).isAbsolute() ? url : new URL(new URL(host), url).toExternalForm();
  }
  else {
    Application app = ApplicationManager.getApplication();
    ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();

    String buildNumberAsString = buildNumber != null ? buildNumber.asString() :
                                 app != null ? ApplicationInfo.getInstance().getApiVersion() :
                                 appInfo.getBuild().asString();

    String uuid = app != null ? UpdateChecker.getInstallationUID(PropertiesComponent.getInstance()) : UUID.randomUUID().toString();

    URIBuilder uriBuilder = new URIBuilder(appInfo.getPluginsDownloadUrl());
    uriBuilder.addParameter("action", "download");
    uriBuilder.addParameter("id", descriptor.getPluginId().getIdString());
    uriBuilder.addParameter("build", buildNumberAsString);
    uriBuilder.addParameter("uuid", uuid);
    return uriBuilder.build().toString();
  }
}
项目:intellij-ce-playground    文件:AppUIUtil.java   
@SuppressWarnings({"UnnecessaryFullyQualifiedName", "deprecation"})
private static List<Image> getAppIconImages() {
  ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();
  List<Image> images = ContainerUtil.newArrayListWithCapacity(3);

  if (SystemInfo.isXWindow) {
    String bigIconUrl = appInfo.getBigIconUrl();
    if (bigIconUrl != null) {
      images.add(com.intellij.util.ImageLoader.loadFromResource(bigIconUrl));
    }
  }

  images.add(com.intellij.util.ImageLoader.loadFromResource(appInfo.getIconUrl()));
  images.add(com.intellij.util.ImageLoader.loadFromResource(appInfo.getSmallIconUrl()));

  return images;
}
项目:intellij-ce-playground    文件:IdeaApplication.java   
@Nullable
private Splash showSplash(String[] args) {
  if (StartupUtil.shouldShowSplash(args)) {
    final ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();
    final SplashScreen splashScreen = getSplashScreen();
    if (splashScreen == null) {
      mySplash = new Splash(appInfo);
      mySplash.show();
      return mySplash;
    }
    else {
      updateSplashScreen(appInfo, splashScreen);
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:StartupUtil.java   
static void runStartupWizard() {
  ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();

  String stepsProvider = appInfo.getCustomizeIDEWizardStepsProvider();
  if (stepsProvider != null) {
    CustomizeIDEWizardDialog.showCustomSteps(stepsProvider);
    PluginManagerCore.invalidatePlugins();
    return;
  }

  if (PlatformUtils.isIntelliJ()) {
    new CustomizeIDEWizardDialog().show();
    PluginManagerCore.invalidatePlugins();
    return;
  }

  List<ApplicationInfoEx.PluginChooserPage> pages = appInfo.getPluginChooserPages();
  if (!pages.isEmpty()) {
    StartupWizard startupWizard = new StartupWizard(pages);
    startupWizard.setCancelText("Skip");
    startupWizard.show();
    PluginManagerCore.invalidatePlugins();
  }
}
项目:intellij-ce-playground    文件:RecentProjectsManagerBase.java   
protected static Icon getSmallApplicationIcon() {
  if (ourSmallAppIcon == null) {
    try {
      Icon appIcon = IconLoader.findIcon(ApplicationInfoEx.getInstanceEx().getIconUrl());

      if (appIcon != null) {
        if (appIcon.getIconWidth() == JBUI.scale(16) && appIcon.getIconHeight() == JBUI.scale(16)) {
          ourSmallAppIcon = appIcon;
        } else {
          BufferedImage image = ImageUtil.toBufferedImage(IconUtil.toImage(appIcon));
          image = Scalr.resize(image, Scalr.Method.ULTRA_QUALITY, UIUtil.isRetina() ? 32 : JBUI.scale(16));
          ourSmallAppIcon = toRetinaAwareIcon(image);
        }
      }
    }
    catch (Exception e) {//
    }
    if (ourSmallAppIcon == null) {
      ourSmallAppIcon = EmptyIcon.ICON_16;
    }
  }

  return ourSmallAppIcon;
}
项目:intellij-ce-playground    文件:AboutPopup.java   
public void render(int indentX, int indentY, List<AboutBoxLine> lines) throws OverflowException {
  x = indentX;
  y = indentY;
  ApplicationInfoEx appInfo = (ApplicationInfoEx)ApplicationInfo.getInstance();
  for (AboutBoxLine line : lines) {
    final String s = line.getText();
    setFont(line.isBold() ? myBoldFont : myFont);
    if (line.getUrl() != null) {
      g2.setColor(myLinkColor);
      FontMetrics metrics = g2.getFontMetrics(font);
      myLinks.add(new Link(new Rectangle(x, yBase + y - fontAscent, metrics.stringWidth(s), fontHeight), line.getUrl()));
    }
    else {
      g2.setColor(Registry.is("ide.new.about") ? Gray.x33 : appInfo.getAboutForeground());
    }
    renderString(s, indentX);
    if (!line.isKeepWithNext() && !line.equals(lines.get(lines.size()-1))) {
      lineFeed(indentX, s);
    }
  }
}
项目:tools-idea    文件:IdeFrameImpl.java   
public static void updateTitle(JFrame frame, final String title, final String fileTitle, final File currentFile) {
  if (myUpdatingTitle) return;

  try {
    myUpdatingTitle = true;

    frame.getRootPane().putClientProperty("Window.documentFile", currentFile);

    final String applicationName = ((ApplicationInfoEx)ApplicationInfo.getInstance()).getFullApplicationName();
    final Builder builder = new Builder();
    if (SystemInfo.isMac) {
      builder.append(fileTitle).append(title)
        .append(ProjectManager.getInstance().getOpenProjects().length == 0
                || ((ApplicationInfoEx)ApplicationInfo.getInstance()).isEAP() && !applicationName.endsWith("SNAPSHOT") ? applicationName : null);
    } else {
      builder.append(title).append(fileTitle).append(applicationName);
    }

    frame.setTitle(builder.sb.toString());
  }
  finally {
    myUpdatingTitle = false;
  }
}
项目:tools-idea    文件:AppUIUtil.java   
@SuppressWarnings({"UnnecessaryFullyQualifiedName", "deprecation"})
private static List<Image> getAppIconImages() {
  ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();
  List<Image> images = ContainerUtil.newArrayListWithExpectedSize(3);

  if (SystemInfo.isXWindow) {
    String bigIconUrl = appInfo.getBigIconUrl();
    if (bigIconUrl != null) {
      images.add(com.intellij.util.ImageLoader.loadFromResource(bigIconUrl));
    }
  }

  images.add(com.intellij.util.ImageLoader.loadFromResource(appInfo.getIconUrl()));
  images.add(com.intellij.util.ImageLoader.loadFromResource(appInfo.getSmallIconUrl()));

  return images;
}
项目:tools-idea    文件:IdeaApplication.java   
@Nullable
private Splash showSplash(String[] args) {
  if (StartupUtil.shouldShowSplash(args)) {
    final ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();
    final SplashScreen splashScreen = getSplashScreen();
    if (splashScreen == null) {
      mySplash = new Splash(appInfo);
      mySplash.show();
      return mySplash;
    }
    else {
      updateSplashScreen(appInfo, splashScreen);
    }
  }
  return null;
}
项目:tools-idea    文件:AboutDialog.java   
public void render(int indentX, int indentY, List<AboutBoxLine> lines) throws OverflowException {
  x = indentX;
  y = indentY;
  ApplicationInfoEx appInfo = (ApplicationInfoEx)ApplicationInfo.getInstance();
  for (AboutBoxLine line : lines) {
    final String s = line.getText();
    setFont(line.isBold() ? myBoldFont : myFont);
    if (line.getUrl() != null) {
      g2.setColor(linkCol);
      FontMetrics metrics = g2.getFontMetrics(font);
      myLinks.add(new Link(new Rectangle(x, yBase + y - fontAscent, metrics.stringWidth(s), fontHeight), line.getUrl()));
    }
    else {
      g2.setColor(appInfo.getAboutForeground());
    }
    renderString(s, indentX);
    if (!line.isKeepWithNext() && !line.equals(lines.get(lines.size()-1))) {
      lineFeed(indentX, s);
    }
  }
}
项目:consulo    文件:AboutDialog.java   
public void render(int indentX, int indentY, List<AboutBoxLine> lines) throws OverflowException {
  x = indentX;
  y = indentY;
  ApplicationInfoEx appInfo = (ApplicationInfoEx)ApplicationInfo.getInstance();
  for (AboutBoxLine line : lines) {
    final String s = line.getText();
    setFont(line.isBold() ? myBoldFont : myFont);
    if (line.getUrl() != null) {
      g2.setColor(linkCol);
      FontMetrics metrics = g2.getFontMetrics(font);
      myLinks.add(new Link(new Rectangle(x, yBase + y - fontAscent, metrics.stringWidth(s), fontHeight), line.getUrl()));
    }
    else {
      g2.setColor(appInfo.getAboutForeground());
    }
    renderString(s, indentX);
    if (!line.isKeepWithNext() && !line.equals(lines.get(lines.size()-1))) {
      lineFeed(indentX, s);
    }
  }
}
项目:consulo    文件:DesktopWindowManagerImpl.java   
public void showFrame() {
  final IdeFrameImpl frame = new IdeFrameImpl(ApplicationInfoEx.getInstanceEx(), myActionManager, myDataManager, ApplicationManager.getApplication());
  myProject2Frame.put(null, frame);

  if (myFrameBounds == null || !ScreenUtil.isVisible(myFrameBounds)) { //avoid situations when IdeFrame is out of all screens
    myFrameBounds = ScreenUtil.getMainScreenBounds();
    int xOff = myFrameBounds.width / 8;
    int yOff = myFrameBounds.height / 8;
    JBInsets.removeFrom(myFrameBounds, new Insets(yOff, xOff, yOff, xOff));
  }

  frame.setBounds(myFrameBounds);
  frame.setExtendedState(myFrameExtendedState);
  frame.setVisible(true);

}
项目:intellij-ce-playground    文件:Responses.java   
@Nullable
public static String getServerHeaderValue() {
  if (SERVER_HEADER_VALUE == null) {
    Application app = ApplicationManager.getApplication();
    if (app != null && !app.isDisposed()) {
      SERVER_HEADER_VALUE = ApplicationInfoEx.getInstanceEx().getFullApplicationName();
    }
  }
  return SERVER_HEADER_VALUE;
}
项目:intellij-ce-playground    文件:HelpManagerImpl.java   
public void invokeHelp(@Nullable String id) {
  UsageTrigger.trigger("ide.help." + id);

  if (MacHelpUtil.isApplicable() && MacHelpUtil.invokeHelp(id)) {
    return;
  }

  IdeaHelpBroker broker = myBrokerValue.getValue();

  if (broker == null) {
    ApplicationInfoEx info = ApplicationInfoEx.getInstanceEx();
    String url = info.getWebHelpUrl() + "?";
    if (PlatformUtils.isCLion()) {
      url += "Keyword=" + id;
      url += "&ProductVersion=" + info.getMajorVersion() + "." + info.getMinorVersion();

      if (info.isEAP()) {
        url += "&EAP"; 
      }
    } else {
      url += id;
    }
    BrowserUtil.browse(url);
    return;
  }

  Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
  broker.setActivationWindow(activeWindow);

  if (id != null) {
    try {
      broker.setCurrentID(id);
    }
    catch (BadIDException e) {
      Messages.showErrorDialog(IdeBundle.message("help.topic.not.found.error", id), CommonBundle.getErrorTitle());
      return;
    }
  }
  broker.setDisplayed(true);
}
项目:intellij-ce-playground    文件:NewWelcomeScreen.java   
private static JPanel createHeaderPanel() {
  JPanel header = new JPanel(new BorderLayout());
  JLabel welcome = new JLabel("Welcome to " + ApplicationNamesInfo.getInstance().getFullProductName(),
                              IconLoader.getIcon(ApplicationInfoEx.getInstanceEx().getWelcomeScreenLogoUrl()),
                              SwingConstants.LEFT);
  welcome.setBorder(new EmptyBorder(10, 15, 10, 15));
  welcome.setFont(welcome.getFont().deriveFont((float) 32));
  welcome.setIconTextGap(20);
  welcome.setForeground(WelcomeScreenColors.WELCOME_HEADER_FOREGROUND);
  header.add(welcome);
  header.setBackground(WelcomeScreenColors.WELCOME_HEADER_BACKGROUND);

  header.setBorder(new BottomLineBorder());
  return header;
}
项目:intellij-ce-playground    文件:FlatWelcomeFrame.java   
private JComponent createLogo() {
  NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout());
  ApplicationInfoEx app = ApplicationInfoEx.getInstanceEx();
  JLabel logo = new JLabel(IconLoader.getIcon(app.getWelcomeScreenLogoUrl()));
  logo.setBorder(JBUI.Borders.empty(30,0,10,0));
  logo.setHorizontalAlignment(SwingConstants.CENTER);
  panel.add(logo, BorderLayout.NORTH);
  JLabel appName = new JLabel(ApplicationNamesInfo.getInstance().getFullProductName());
  Font font = getProductFont();
  appName.setForeground(JBColor.foreground());
  appName.setFont(font.deriveFont(JBUI.scale(36f)).deriveFont(Font.PLAIN));
  appName.setHorizontalAlignment(SwingConstants.CENTER);
  String appVersion = "Version " + app.getFullVersion();

  if (app.isEAP() && app.getBuild().getBuildNumber() < Integer.MAX_VALUE) {
    appVersion += " (" + app.getBuild().asString() + ")";
  }

  JLabel version = new JLabel(appVersion);
  version.setFont(getProductFont().deriveFont(JBUI.scale(16f)));
  version.setHorizontalAlignment(SwingConstants.CENTER);
  version.setForeground(Gray._128);

  panel.add(appName);
  panel.add(version, BorderLayout.SOUTH);
  panel.setBorder(JBUI.Borders.emptyBottom(20));
  return panel;
}
项目:intellij-ce-playground    文件:UpdateChecker.java   
private static void prepareUpdateCheckArgs(URIBuilder uriBuilder) {
  addUpdateRequestParameter("build", ApplicationInfo.getInstance().getBuild().asString());
  addUpdateRequestParameter("uid", getInstallationUID(PropertiesComponent.getInstance()));
  addUpdateRequestParameter("os", SystemInfo.OS_NAME + ' ' + SystemInfo.OS_VERSION);
  if (ApplicationInfoEx.getInstanceEx().isEAP()) {
    addUpdateRequestParameter("eap", "");
  }

  for (String name : ourAdditionalRequestOptions.keySet()) {
    String value = ourAdditionalRequestOptions.get(name);
    uriBuilder.addParameter(name, StringUtil.isEmpty(value) ? null : value);
  }
}
项目:intellij-ce-playground    文件:Splash.java   
public Splash(ApplicationInfoEx info) {
  this(info.getSplashImageUrl(), info.getSplashTextColor());
  if (info instanceof ApplicationInfoImpl) {
    final ApplicationInfoImpl appInfo = (ApplicationInfoImpl)info;
    myProgressHeight = appInfo.getProgressHeight();
    myProgressColor = appInfo.getProgressColor();
    myProgressX = appInfo.getProgressX();
    myProgressY = appInfo.getProgressY();
    myProgressTail = appInfo.getProgressTailIcon();
  }
}
项目:intellij-ce-playground    文件:Splash.java   
public static boolean showLicenseeInfo(Graphics g, int x, int y, final int height, final Color textColor) {
  if (ApplicationInfoImpl.getShadowInstance().showLicenseeInfo()) {
    final LicensingFacade provider = LicensingFacade.getInstance();
    if (provider != null) {
      UIUtil.applyRenderingHints(g);
      g.setFont(new Font(UIUtil.ARIAL_FONT_NAME, Font.BOLD, JBUI.scale(Registry.is("ide.new.about") ? 12 : SystemInfo.isUnix ? 10 : 11)));

      g.setColor(textColor);
      final String licensedToMessage = provider.getLicensedToMessage();
      final List<String> licenseRestrictionsMessages = provider.getLicenseRestrictionsMessages();
      int offsetX = JBUI.scale(15);
      if (Registry.is("ide.new.about")) {
        ApplicationInfoEx infoEx = ApplicationInfoEx.getInstanceEx();
        if (infoEx instanceof ApplicationInfoImpl) {
          offsetX = ((ApplicationInfoImpl)infoEx).getProgressX();
        } else {
          return false;
        }
      }
      int offsetY = Registry.is("ide.new.about") ? 85 : 30;
      g.drawString(licensedToMessage, x + offsetX, y + height - JBUI.scale(offsetY));
      if (licenseRestrictionsMessages.size() > 0) {
        g.drawString(licenseRestrictionsMessages.get(0), x + offsetX, y + height - JBUI.scale(offsetY - 16));
      }
    }
    return true;
  }
  return false;
}
项目:intellij-ce-playground    文件:IdeaApplication.java   
private void updateSplashScreen(ApplicationInfoEx appInfo, SplashScreen splashScreen) {
  final Graphics2D graphics = splashScreen.createGraphics();
  final Dimension size = splashScreen.getSize();
  if (Splash.showLicenseeInfo(graphics, 0, 0, size.height, appInfo.getSplashTextColor())) {
    splashScreen.update();
  }
}
项目:intellij-ce-playground    文件:IdeaLogger.java   
private static ApplicationInfoProvider getIdeaInfoProvider() {
  return new ApplicationInfoProvider() {
    @Override
    public String getInfo() {
      final ApplicationInfoEx info = ApplicationInfoImpl.getShadowInstance();
      return info.getFullApplicationName() + "  " + "Build #" + info.getBuild().asStringWithAllDetails();
    }
  };
}
项目:intellij-ce-playground    文件:RecentProjectsManagerBase.java   
public static RecentProjectMetaInfo create() {
  RecentProjectMetaInfo info = new RecentProjectMetaInfo();
  info.build = ApplicationInfoEx.getInstanceEx().getBuild().asString();
  info.productionCode = ApplicationInfoEx.getInstanceEx().getBuild().getProductCode();
  info.eap = ApplicationInfoEx.getInstanceEx().isEAP();
  info.binFolder = PathManager.getBinPath();
  info.projectOpenTimestamp = System.currentTimeMillis();
  info.buildTimestamp = ApplicationInfoEx.getInstanceEx().getBuildDate().getTimeInMillis();
  return info;
}
项目:intellij-ce-playground    文件:SendFeedbackAction.java   
public static void launchBrowser(@Nullable Project project) {
  final ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
  boolean eap = appInfo.isEAP();
  String urlTemplate = eap ? appInfo.getEAPFeedbackUrl() : appInfo.getReleaseFeedbackUrl();
  urlTemplate = urlTemplate
    .replace("$BUILD", eap ? appInfo.getBuild().asStringWithoutProductCode() : appInfo.getBuild().asString())
    .replace("$TIMEZONE", System.getProperty("user.timezone"))
    .replace("$EVAL", isEvaluationLicense() ? "true" : "false")
    .replace("$DESCR", getDescription());
  BrowserUtil.browse(urlTemplate, project);
}
项目:intellij-ce-playground    文件:WhatsNewAction.java   
@Override
public void update(AnActionEvent e) {
  boolean visible = ApplicationInfoEx.getInstanceEx().getWhatsNewUrl() != null;
  e.getPresentation().setVisible(visible);
  if (visible) {
    e.getPresentation()
      .setText(IdeBundle.message("whatsnew.action.custom.text", ApplicationNamesInfo.getInstance().getFullProductName()));
    e.getPresentation().setDescription(
      IdeBundle.message("whatsnew.action.custom.description", ApplicationNamesInfo.getInstance().getFullProductName()));
  }
}
项目:intellij-ce-playground    文件:AvailablePluginsTableModel.java   
public boolean isHostAccepted(String repositoryName) {
  if (repositoryName != null) {
    if (repositoryName.equals(ApplicationInfoEx.getInstanceEx().getBuiltinPluginsUrl()) && myRepository.equals(BUILTIN_REPO)) {
      return true;
    }
    else if (!ALL.equals(myRepository) && !repositoryName.equals(myRepository)) {
      return false;
    }
  }
  else {
    return ALL.equals(myRepository) || JETBRAINS_REPO.equals(myRepository);
  }
  return true;
}
项目:intellij-ce-playground    文件:RepositoryHelper.java   
/**
 * Returns a list of configured plugin hosts.
 * Note that the list always ends with {@code null} element denoting a main plugin repository.
 */
@NotNull
public static List<String> getPluginHosts() {
  List<String> hosts = ContainerUtil.newArrayList(UpdateSettings.getInstance().getPluginHosts());
  ContainerUtil.addIfNotNull(hosts, ApplicationInfoEx.getInstanceEx().getBuiltinPluginsUrl());
  hosts.add(null);  // main plugin repository
  return hosts;
}
项目:intellij-ce-playground    文件:AvailablePluginsManagerMain.java   
@Override
public void update(AnActionEvent e) {
  super.update(e);
  boolean empty = UpdateSettings.getInstance().getPluginHosts().isEmpty();
  e.getPresentation().setVisible(!empty || ApplicationInfoEx.getInstanceEx().getBuiltinPluginsUrl() != null);
  String repository = ((AvailablePluginsTableModel)pluginsModel).getRepository();
  if (repository.length() > LENGTH) {
    repository = repository.substring(0, LENGTH) + "...";
  }
  e.getPresentation().setText("Repository: " + repository);
}
项目:intellij-ce-playground    文件:AvailablePluginsManagerMain.java   
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
  final DefaultActionGroup gr = new DefaultActionGroup();
  gr.add(createFilterByRepositoryAction(AvailablePluginsTableModel.ALL));
  gr.add(createFilterByRepositoryAction(AvailablePluginsTableModel.JETBRAINS_REPO));
  if (ApplicationInfoEx.getInstanceEx().getBuiltinPluginsUrl() != null) {
    gr.add(createFilterByRepositoryAction(AvailablePluginsTableModel.BUILTIN_REPO));
  }

  for (final String host : UpdateSettings.getInstance().getPluginHosts()) {
    gr.add(createFilterByRepositoryAction(host));
  }
  return gr;
}
项目:intellij-ce-playground    文件:IdeErrorsDialog.java   
private static boolean canDisablePlugin(AbstractMessage message) {
  if (message == null) {
    return false;
  }

  PluginId pluginId = findPluginId(message.getThrowable());
  return pluginId != null && !ApplicationInfoEx.getInstanceEx().isEssentialPlugin(pluginId.getIdString());
}
项目:intellij-ce-playground    文件:InspectionApplication.java   
public void startup() {
  if (myProjectPath == null) {
    logError("Project to inspect is not defined");
    printHelp();
  }

  if (myProfileName == null && myProfilePath == null && myStubProfile == null) {
    logError("Profile to inspect with is not defined");
    printHelp();
  }

  final ApplicationEx application = ApplicationManagerEx.getApplicationEx();
  application.runReadAction(new Runnable() {
    @Override
    public void run() {
      try {
        final ApplicationInfoEx applicationInfo = (ApplicationInfoEx)ApplicationInfo.getInstance();
        logMessage(1, InspectionsBundle.message("inspection.application.starting.up", applicationInfo.getFullApplicationName()));
        application.doNotSave();
        logMessageLn(1, InspectionsBundle.message("inspection.done"));

        InspectionApplication.this.run();
      }
      catch (Exception e) {
        LOG.error(e);
      }
      finally {
        if (myErrorCodeRequired) application.exit(true, true);
      }
    }
  });
}
项目:intellij-ce-playground    文件:ShowSplashAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
  final ApplicationInfoEx app = ApplicationInfoImpl.getShadowInstance();
  final Splash splash = new Splash(app.getSplashImageUrl(), app.getSplashTextColor());
  final SplashListener listener = new SplashListener(splash);
  splash.addFocusListener(listener);
  splash.addKeyListener(listener);
  splash.addMouseListener(listener);
  splash.show();
}
项目:vso-intellij    文件:TelemetryContextInitializer.java   
private void initializeProperties(final Map<String, String> properties) {
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_USER_ID, getUserId());

    // Get IntelliJ IDEA version info
    ApplicationInfoEx appInfo = (ApplicationInfoEx) ApplicationInfo.getInstance();
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_MAJOR_VERSION, appInfo.getMajorVersion());
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_MINOR_VERSION, appInfo.getMinorVersion());
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_BUILD_NUMBER, appInfo.getBuild().asString());
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_EXE_NAME, appInfo.getFullApplicationName());

    // Get our plugin version
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_PLUGIN_VERSION, getPluginVersion());

    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_PROCESSOR_ARCHITECTURE, getProcessorArchitecture());
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_LOCALE_NAME, getLocaleName());

    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_OS_MAJOR_VERSION, getPlatformMajorVersion());
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_OS_MINOR_VERSION, getPlatformMinorVersion());
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_OS_NAME, getPlatformName());
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_OS_SHORT_NAME, getPlatformShortName());
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_OS_FULL_NAME, getPlatformFullName());

    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_JAVA_RUNTIME_NAME, getJavaName());
    properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_JAVA_RUNTIME_VERSION, getJavaVersion());

    // TODO do we need this information (Eclipse plugin provides it)
    //properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_FRAMEWORK_NAME, getFrameworkName());
    //properties.put(TfsTelemetryConstants.CONTEXT_PROPERTY_FRAMEWORK_VERSION, getFrameworkVersion());
}
项目:google-cloud-intellij    文件:GoogleFeedbackErrorReporter.java   
@VisibleForTesting
static Map<String, String> buildKeyValuesMap(
    @NotNull ErrorBean error,
    @NotNull ApplicationNamesInfo intelliJAppNameInfo,
    @NotNull ApplicationInfoEx intelliJAppExtendedInfo,
    @NotNull Application application) {
  Map<String, String> params =
      ImmutableMap.<String, String>builder()
          // required parameters
          .put(ERROR_MESSAGE_KEY, nullToNone(error.getMessage()))
          .put(ERROR_STACKTRACE_KEY, nullToNone(error.getStackTrace()))
          // end or required parameters
          .put(ERROR_DESCRIPTION_KEY, nullToNone(error.getDescription()))
          .put(LAST_ACTION_KEY, nullToNone(error.getLastAction()))
          .put(OS_NAME_KEY, SystemProperties.getOsName())
          .put(JAVA_VERSION_KEY, SystemProperties.getJavaVersion())
          .put(JAVA_VM_VENDOR_KEY, SystemProperties.getJavaVmVendor())
          .put(APP_NAME_KEY, intelliJAppNameInfo.getFullProductName())
          .put(APP_CODE_KEY, intelliJAppExtendedInfo.getPackageCode())
          .put(APP_NAME_VERSION_KEY, intelliJAppExtendedInfo.getVersionName())
          .put(APP_EAP_KEY, Boolean.toString(intelliJAppExtendedInfo.isEAP()))
          .put(APP_INTERNAL_KEY, Boolean.toString(application.isInternal()))
          .put(APP_VERSION_MAJOR_KEY, intelliJAppExtendedInfo.getMajorVersion())
          .put(APP_VERSION_MINOR_KEY, intelliJAppExtendedInfo.getMinorVersion())
          .put(PLUGIN_VERSION, error.getPluginVersion())
          .build();

  return params;
}
项目:tools-idea    文件:DelegatingHttpRequestHandler.java   
@Override
protected boolean process(ChannelHandlerContext context, HttpRequest request, QueryStringDecoder urlDecoder) throws IOException, ImageWriteException {
  HttpRequestHandler connectedHandler = (HttpRequestHandler)context.getAttachment();
  if (connectedHandler != null) {
    if (connectedHandler.isSupported(request) && connectedHandler.process(urlDecoder, request, context)) {
      return true;
    }
    // prev cached connectedHandler is not suitable for this request, so, let's find it again
    context.setAttachment(null);
  }

  if (urlDecoder.getPath().equals("/favicon.ico")) {
    Icon icon = IconLoader.findIcon(ApplicationInfoEx.getInstanceEx().getSmallIconUrl());
    if (icon != null) {
      BufferedImage image = UIUtil.createImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
      icon.paintIcon(null, image.getGraphics(), 0, 0);
      byte[] icoBytes = Sanselan.writeImageToBytes(image, ImageFormat.IMAGE_FORMAT_ICO, null);
      Responses.send(icoBytes, FileResponses.createResponse(urlDecoder.getPath()), request, context);
      return true;
    }
  }

  for (HttpRequestHandler handler : BuiltInServerManager.EP_NAME.getExtensions()) {
    try {
      if (handler.isSupported(request) && handler.process(urlDecoder, request, context)) {
        if (context.getAttachment() == null) {
          context.setAttachment(handler);
        }
        return true;
      }
    }
    catch (Throwable e) {
      BuiltInServer.LOG.error(e);
    }
  }
  return false;
}
项目:tools-idea    文件:Responses.java   
@Nullable
public static String getServerHeaderValue() {
  if (SERVER_HEADER_VALUE == null) {
    Application app = ApplicationManager.getApplication();
    if (app != null && !app.isDisposed()) {
      SERVER_HEADER_VALUE = ApplicationInfoEx.getInstanceEx().getFullApplicationName();
    }
  }
  return SERVER_HEADER_VALUE;
}
项目:tools-idea    文件:HelpManagerImpl.java   
public void invokeHelp(@Nullable String id) {

    if (myHelpSet == null) {
      myHelpSet = createHelpSet();
    }

    if (SystemInfo.isJavaVersionAtLeast("1.7.0.40") && Registry.is("ide.help.fxbrowser")) {
      showHelpInFXBrowser(id);
      return;
    }

    if (MacHelpUtil.isApplicable()) {
      if (MacHelpUtil.invokeHelp(id)) return;
    }

    if (myHelpSet == null) {
      BrowserUtil.launchBrowser(ApplicationInfoEx.getInstanceEx().getWebHelpUrl() + "?" + id);
      return;
    }

    if (myBroker == null) {
      myBroker = new IdeaHelpBroker(myHelpSet);
    }

    Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
    myBroker.setActivationWindow(activeWindow);

    if (id != null) {
      try {
        myBroker.setCurrentID(id);
      }
      catch (BadIDException e) {
        Messages.showErrorDialog(IdeBundle.message("help.topic.not.found.error", id), CommonBundle.getErrorTitle());
        return;
      }
    }
    myBroker.setDisplayed(true);
  }
项目:tools-idea    文件:NewWelcomeScreen.java   
private static JPanel createHeaderPanel() {
  JPanel header = new JPanel(new BorderLayout());
  JLabel welcome = new JLabel("Welcome to " + ApplicationNamesInfo.getInstance().getFullProductName(),
                              IconLoader.getIcon(ApplicationInfoEx.getInstanceEx().getWelcomeScreenLogoUrl()), 
                              SwingConstants.LEFT);
  welcome.setBorder(new EmptyBorder(10, 15, 10, 15));
  welcome.setFont(welcome.getFont().deriveFont((float) 32));
  welcome.setIconTextGap(20);
  welcome.setForeground(WelcomeScreenColors.WELCOME_HEADER_FOREGROUND);
  header.add(welcome);
  header.setBackground(WelcomeScreenColors.WELCOME_HEADER_BACKGROUND);

  header.setBorder(new BottomLineBorder());
  return header;
}