当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationInfo.getInstance方法代码示例

本文整理汇总了Java中com.intellij.openapi.application.ApplicationInfo.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationInfo.getInstance方法的具体用法?Java ApplicationInfo.getInstance怎么用?Java ApplicationInfo.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.application.ApplicationInfo的用法示例。


在下文中一共展示了ApplicationInfo.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addAgent

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
private void addAgent(com.samebug.clients.common.tracking.RawEvent e) {
    final Map<String, String> agent = new HashMap<String, String>();
    final LookAndFeel laf = UIManager.getLookAndFeel();
    final ApplicationInfo appInfo = ApplicationInfo.getInstance();
    final IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(IdeaSamebugPlugin.ID));
    final String pluginVersion = plugin == null ? null : plugin.getVersion();
    final String instanceId = config.instanceId;

    agent.put("type", "ide-plugin");
    agent.put("ideCodeName", appInfo.getBuild().getProductCode());
    if (laf != null) agent.put("lookAndFeel", laf.getName());
    if (pluginVersion != null) agent.put("pluginVersion", pluginVersion);
    if (instanceId != null) agent.put("instanceId", instanceId);
    agent.put("isRetina", Boolean.toString(UIUtil.isRetina()));
    agent.put("ideBuild", appInfo.getApiVersion());
    e.withField("agent", agent);
}
 
开发者ID:samebug,项目名称:samebug-idea-plugin,代码行数:18,代码来源:IdeaTrackingService.java

示例2: ProjectNameStep

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
public ProjectNameStep(WizardContext wizardContext) {
  myWizardContext = wizardContext;
  myNamePathComponent = new NamePathComponent(IdeBundle.message("label.project.name"), IdeBundle.message("label.component.file.location",
                                                                                                         StringUtil.capitalize(myWizardContext.getPresentationName())), 'a', 'l',
                                              IdeBundle.message("title.select.project.file.directory", myWizardContext.getPresentationName()),
                                              IdeBundle.message("description.select.project.file.directory", myWizardContext.getPresentationName()));
  myPanel = new JPanel(new GridBagLayout());
  myPanel.setBorder(BorderFactory.createEtchedBorder());

  ApplicationInfo info = ApplicationInfo.getInstance();
  String appName = info.getVersionName();
  myPanel.add(new JLabel(IdeBundle.message("label.please.enter.project.name", appName, wizardContext.getPresentationName())),
              new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 10, 8, 10), 0, 0));

  myPanel.add(myNamePathComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 10, 8, 10), 0, 0));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ProjectNameStep.java

示例3: render

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
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);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AboutPopup.java

示例4: processClose

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
private void processClose() {
  if (Registry.getInstance().isRestartNeeded()) {
    final ApplicationEx app = (ApplicationEx) ApplicationManager.getApplication();
    final ApplicationInfo info = ApplicationInfo.getInstance();

    final int r = Messages.showOkCancelDialog(myContent, "You need to restart " + info.getVersionName() + " for the changes to take effect", "Restart Required",
                                              app.isRestartCapable() ? "Restart Now" : "Shutdown Now",
                                              app.isRestartCapable() ? "Restart Later": "Shutdown Later"
        , Messages.getQuestionIcon());


    if (r == Messages.OK) {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          app.restart(true);
        }
      }, ModalityState.NON_MODAL);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:RegistryUi.java

示例5: doCheckForUpdates

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
@NotNull
public static CheckForUpdateResult doCheckForUpdates(final UpdateSettings settings) {
  ApplicationInfo appInfo = ApplicationInfo.getInstance();
  BuildNumber currentBuild = appInfo.getBuild();
  int majorVersion = Integer.parseInt(appInfo.getMajorVersion());
  final UpdatesXmlLoader loader = new UpdatesXmlLoader(getUpdateUrl());
  final UpdatesInfo info;
  try {
    info = loader.loadUpdatesInfo();
    if (info == null) {
      return new CheckForUpdateResult(UpdateStrategy.State.NOTHING_LOADED);
    }
  }
  catch (ConnectionException e) {
    return new CheckForUpdateResult(UpdateStrategy.State.CONNECTION_ERROR, e);
  }

  UpdateStrategy strategy = new UpdateStrategy(majorVersion, currentBuild, info, settings);
  return strategy.checkForUpdates();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:UpdateChecker.java

示例6: render

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
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);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:AboutDialog.java

示例7: processClose

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
private void processClose() {
  if (Registry.getInstance().isRestartNeeded()) {
    final ApplicationEx app = (ApplicationEx) ApplicationManager.getApplication();
    final ApplicationInfo info = ApplicationInfo.getInstance();

    final int r = Messages.showOkCancelDialog(myContent, "You need to restart " + info.getVersionName() + " for the changes to take effect", "Restart Required",
            (app.isRestartCapable() ? "Restart Now" : "Shutdown Now"), (app.isRestartCapable() ? "Restart Later": "Shutdown Later")
        , Messages.getQuestionIcon());


    if (r == 0) {
      LaterInvocator.invokeLater(new Runnable() {
        @Override
        public void run() {
            app.restart(true);
        }
      }, ModalityState.NON_MODAL);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:RegistryUi.java

示例8: processClose

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
private void processClose() {
  if (Registry.getInstance().isRestartNeeded()) {
    final ApplicationEx app = (ApplicationEx) ApplicationManager.getApplication();
    final ApplicationInfo info = ApplicationInfo.getInstance();

    final int r = Messages.showOkCancelDialog(myContent, "You need to restart " + info.getVersionName() + " for the changes to take effect", "Restart Required",
            (app.isRestartCapable() ? "Restart Now" : "Shutdown Now"), (app.isRestartCapable() ? "Restart Later": "Shutdown Later")
        , Messages.getQuestionIcon());


    if (r == 0) {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
            app.restart(true);
        }
      }, ModalityState.NON_MODAL);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:RegistryUi.java

示例9: getVersion

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
@NotNull
private static String getVersion(@NotNull IdeaPluginDescriptor plugin) {
  if (!plugin.isBundled()) return ObjectUtils.assertNotNull(plugin.getVersion());

  ApplicationInfo appInfo = ApplicationInfo.getInstance();
  BuildNumber build = appInfo.getBuild();
  if (!build.isSnapshot()) return build.asStringWithAllDetails();

  // There is no good way to decide whether to update resources or not when switching to a different development build.
  return build.getProductCode() + "-" + build.getBaselineVersion() + "-" + appInfo.getBuildDate().getTimeInMillis();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ResourceVersions.java

示例10: initializeProperties

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
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());
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:30,代码来源:TelemetryContextInitializer.java

示例11: IdeaIDEBridge

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
public IdeaIDEBridge() {
  final ApplicationInfo info = ApplicationInfo.getInstance();
  final long major = safeNumberExtraction(info.getMajorVersion());
  final long minor = safeNumberExtraction(info.getMinorVersion());
  final long micro = safeNumberExtraction(IdeaUtils.safeInvokeMethodForResult(info, "0","getMicroVersion",new Class<?>[0],new Object[0]));
  this.ideVersion = new Version("intellij", new long[] { major, minor, micro }, info.getVersionName());
}
 
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:8,代码来源:IdeaIDEBridge.java

示例12: allocateFrame

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
public final IdeFrameImpl allocateFrame(final Project project) {
  LOG.assertTrue(!myProject2Frame.containsKey(project));

  final IdeFrameImpl frame;
  if (myProject2Frame.containsKey(null)) {
    frame = myProject2Frame.get(null);
    myProject2Frame.remove(null);
    myProject2Frame.put(project, frame);
    frame.setProject(project);
  }
  else {
    frame = new IdeFrameImpl((ApplicationInfoEx)ApplicationInfo.getInstance(), ActionManagerEx.getInstanceEx(), UISettings.getInstance(),
                             DataManager.getInstance(), ApplicationManager.getApplication());
    final Rectangle bounds = ProjectFrameBounds.getInstance(project).getBounds();
    if (bounds != null) {
      frame.setBounds(bounds);
    }
    else if (myFrameBounds != null) {
      frame.setBounds(myFrameBounds);
    }
    frame.setProject(project);
    myProject2Frame.put(project, frame);
    frame.setExtendedState(myFrameExtendedState);
    frame.setVisible(true);
  }

  frame.addWindowListener(myActivationListener);

  myEventDispatcher.getMulticaster().frameCreated(frame);

  return frame;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:33,代码来源:WindowManagerImpl.java

示例13: UpdateInfoPanel

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
public UpdateInfoPanel() {
  ApplicationInfo appInfo = ApplicationInfo.getInstance();
  myBuildNumber.setText(appInfo.getBuild().asStringWithoutProductCode() + ")");
  final String version = appInfo.getFullVersion();

  myVersionNumber.setText(version);
  myNewBuildNumber.setText(myLatestBuild.getNumber().asStringWithoutProductCode() + ")");
  myNewVersionNumber.setText(myLatestBuild.getVersion());
  myUpdateMessageLabel.setBackground(UIUtil.getLabelBackground());
  myScrollPane.setBackground(UIUtil.getLabelBackground());
  myScrollPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
  if (myLatestBuild.getMessage() != null) {
    StringBuilder builder = new StringBuilder();
    builder.append("<html><head>").append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())).append("</head><body>")
      .append(StringUtil.formatLinks(myLatestBuild.getMessage()))
      .append("</body></html>");
    myUpdateMessageLabel.setText(builder.toString());
    myUpdateMessageLabel.addHyperlinkListener(new BrowserHyperlinkListener());
  }
  else {
    myUpdateMessageLabel.setVisible(false);
  }

  PatchInfo patch = myLatestBuild.findPatchForCurrentBuild();
  if (patch == null) {
    myPatchAvailableLabel.setVisible(false);
    myPatchSizeLabel.setVisible(false);
  }
  else {
    myPatchSizeLabel.setText(patch.getSize() + "MB");
  }

  if (SystemInfo.isMac) {
    myManualCheckLabel.setText("<html><br>To check for new updates manually, use the <b>" +
                               ApplicationNamesInfo.getInstance().getProductName() + " | Check for Updates</b> command.</html>");
  }

  LabelTextReplacingUtil.replaceText(myPanel);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:UpdateInfoDialog.java

示例14: paintChildren

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
@Override
protected void paintChildren(Graphics g) {
  super.paintChildren(g);
  Graphics2D g2 = (Graphics2D)g;
  UIUtil.applyRenderingHints(g);

  Font labelFont = UIUtil.getLabelFont();
  for (int labelSize = 10; labelSize != 6; labelSize -= 1) {
    myLinks.clear();
    g2.setPaint(col);
    myImage.paintIcon(this, g2, 0, 0);

    g2.setColor(col);
    TextRenderer renderer = new TextRenderer(0, 145, 398, 120, g2);
    UIUtil.setupComposite(g2);
    myFont = labelFont.deriveFont(Font.PLAIN, labelSize);
    myBoldFont = labelFont.deriveFont(Font.BOLD, labelSize + 1);
    try {
      renderer.render(30, 0, myLines);
      break;
    }
    catch (TextRenderer.OverflowException ignore) {
    }
  }

  ApplicationInfo appInfo = ApplicationInfo.getInstance();
  Rectangle aboutLogoRect = appInfo.getAboutLogoRect();
  if (aboutLogoRect != null) {
    myLinks.add(new Link(aboutLogoRect, appInfo.getCompanyURL()));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:32,代码来源:AboutDialog.java

示例15: productNameAsUserAgent

import com.intellij.openapi.application.ApplicationInfo; //导入方法依赖的package包/类
@Override
public RequestBuilder productNameAsUserAgent() {
  Application app = ApplicationManager.getApplication();
  if (app != null && !app.isDisposed()) {
    ApplicationInfo info = ApplicationInfo.getInstance();
    return userAgent(info.getVersionName() + '/' + info.getBuild().asString());
  }
  else {
    return userAgent("Consulo");
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:HttpRequests.java


注:本文中的com.intellij.openapi.application.ApplicationInfo.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。