本文整理汇总了Java中com.intellij.openapi.application.ApplicationInfo类的典型用法代码示例。如果您正苦于以下问题:Java ApplicationInfo类的具体用法?Java ApplicationInfo怎么用?Java ApplicationInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationInfo类属于com.intellij.openapi.application包,在下文中一共展示了ApplicationInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: log
import com.intellij.openapi.application.ApplicationInfo; //导入依赖的package包/类
private void log(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo) {
IdeaLoggingEvent ideaEvent = events[0];
if (ideaEvent.getThrowable() == null) {
return;
}
LinkedHashMap<String, Object> customData = new LinkedHashMap<>();
customData.put(TAG_PLATFORM_VERSION, ApplicationInfo.getInstance().getBuild().asString());
customData.put(TAG_OS, SystemInfo.OS_NAME);
customData.put(TAG_OS_VERSION, SystemInfo.OS_VERSION);
customData.put(TAG_OS_ARCH, SystemInfo.OS_ARCH);
customData.put(TAG_JAVA_VERSION, SystemInfo.JAVA_VERSION);
customData.put(TAG_JAVA_RUNTIME_VERSION, SystemInfo.JAVA_RUNTIME_VERSION);
if (additionalInfo != null) {
customData.put(EXTRA_ADDITIONAL_INFO, additionalInfo);
}
if (events.length > 1) {
customData.put(EXTRA_MORE_EVENTS,
Stream.of(events).map(Object::toString).collect(Collectors.joining("\n")));
}
rollbar.codeVersion(getPluginVersion()).log(ideaEvent.getThrowable(), customData);
}
示例2: 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);
}
示例3: 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));
}
示例4: update
import com.intellij.openapi.application.ApplicationInfo; //导入依赖的package包/类
public void update(AnActionEvent event){
Presentation presentation = event.getPresentation();
if (!ApplicationInfo.contextHelpAvailable()) {
presentation.setVisible(false);
return;
}
if (ActionPlaces.isMainMenuOrActionSearch(event.getPlace())) {
DataContext dataContext = event.getDataContext();
presentation.setEnabled(getHelpId(dataContext) != null);
}
else {
presentation.setIcon(AllIcons.Actions.Help);
presentation.setText(CommonBundle.getHelpButtonText());
}
}
示例5: createHelpSet
import com.intellij.openapi.application.ApplicationInfo; //导入依赖的package包/类
@Nullable
private static HelpSet createHelpSet() {
String urlToHelp = ApplicationInfo.getInstance().getHelpURL() + "/" + HELP_HS;
HelpSet mainHelpSet = loadHelpSet(urlToHelp);
if (mainHelpSet == null) return null;
// merge plugins help sets
IdeaPluginDescriptor[] pluginDescriptors = PluginManagerCore.getPlugins();
for (IdeaPluginDescriptor pluginDescriptor : pluginDescriptors) {
HelpSetPath[] sets = pluginDescriptor.getHelpSets();
for (HelpSetPath hsPath : sets) {
String url = "jar:file:///" + pluginDescriptor.getPath().getAbsolutePath() + "/help/" + hsPath.getFile() + "!";
if (!hsPath.getPath().startsWith("/")) {
url += "/";
}
url += hsPath.getPath();
HelpSet pluginHelpSet = loadHelpSet(url);
if (pluginHelpSet != null) {
mainHelpSet.add(pluginHelpSet);
}
}
}
return mainHelpSet;
}
示例6: updateTitle
import com.intellij.openapi.application.ApplicationInfo; //导入依赖的package包/类
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;
}
}
示例7: getUrl
import com.intellij.openapi.application.ApplicationInfo; //导入依赖的package包/类
@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();
}
}
示例8: scheduleOnStartCheck
import com.intellij.openapi.application.ApplicationInfo; //导入依赖的package包/类
private void scheduleOnStartCheck(@NotNull Application app) {
if (!mySettings.isCheckNeeded()) {
return;
}
app.getMessageBus().connect(app).subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() {
@Override
public void appFrameCreated(String[] commandLineArgs, @NotNull Ref<Boolean> willOpenProject) {
String currentBuild = ApplicationInfo.getInstance().getBuild().asString();
long timeToNextCheck = mySettings.getLastTimeChecked() + CHECK_INTERVAL - System.currentTimeMillis();
if (StringUtil.compareVersionNumbers(mySettings.getLasBuildChecked(), currentBuild) < 0 || timeToNextCheck <= 0) {
myCheckRunnable.run();
}
else {
queueNextCheck(timeToNextCheck);
}
}
});
}
示例9: createNotification
import com.intellij.openapi.application.ApplicationInfo; //导入依赖的package包/类
@Override
public Notification createNotification(@NotNull final String groupDisplayId, @Nullable NotificationListener listener) {
final String fullProductName = ApplicationNamesInfo.getInstance().getFullProductName();
final String companyName = ApplicationInfo.getInstance().getCompanyName();
String text =
"<html>Please click <a href='allow'>I agree</a> if you want to help make " + fullProductName +
" better or <a href='decline'>I don't agree</a> otherwise. <a href='settings'>more...</a></html>";
String title = "Help improve " + fullProductName + " by sending anonymous usage statistics to " + companyName;
return new Notification(groupDisplayId, title,
text,
NotificationType.INFORMATION,
listener);
}
示例10: startLogging
import com.intellij.openapi.application.ApplicationInfo; //导入依赖的package包/类
private static void startLogging(final Logger log) {
Runtime.getRuntime().addShutdownHook(new Thread("Shutdown hook - logging") {
@Override
public void run() {
log.info("------------------------------------------------------ IDE SHUTDOWN ------------------------------------------------------");
}
});
log.info("------------------------------------------------------ IDE STARTED ------------------------------------------------------");
ApplicationInfo appInfo = ApplicationInfoImpl.getShadowInstance();
ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
String buildDate = new SimpleDateFormat("dd MMM yyyy HH:ss", Locale.US).format(appInfo.getBuildDate().getTime());
log.info("IDE: " + namesInfo.getFullProductName() + " (build #" + appInfo.getBuild().asStringWithAllDetails() + ", " + buildDate + ")");
log.info("OS: " + SystemInfoRt.OS_NAME + " (" + SystemInfoRt.OS_VERSION + ", " + SystemInfo.OS_ARCH + ")");
log.info("JRE: " + System.getProperty("java.runtime.version", "-") + " (" + System.getProperty("java.vendor", "-") + ")");
log.info("JVM: " + System.getProperty("java.vm.version", "-") + " (" + System.getProperty("java.vm.name", "-") + ")");
List<String> arguments = ManagementFactory.getRuntimeMXBean().getInputArguments();
if (arguments != null) {
log.info("JVM Args: " + StringUtil.join(arguments, " "));
}
}
示例11: 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);
}
}
}
示例12: 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);
}
}
}
示例13: handshake
import com.intellij.openapi.application.ApplicationInfo; //导入依赖的package包/类
private void handshake() throws PyDebuggerException {
String remoteVersion = myDebugger.handshake();
String currentBuild = ApplicationInfo.getInstance().getBuild().asStringWithoutProductCode();
if ("@@[email protected]@".equals(remoteVersion)) {
remoteVersion = currentBuild;
}
else if (remoteVersion.startsWith("PY-")) {
remoteVersion = remoteVersion.substring(3);
}
else {
remoteVersion = null;
}
printToConsole("Connected to pydev debugger (build " + remoteVersion + ")\n", ConsoleViewContentType.SYSTEM_OUTPUT);
if (remoteVersion != null) {
if (!remoteVersion.equals(currentBuild)) {
printToConsole("Warning: wrong debugger version. Use pycharm-debugger.egg from PyCharm installation folder.\n",
ConsoleViewContentType.ERROR_OUTPUT);
}
}
}
示例14: checkExpiredPreviewBuild
import com.intellij.openapi.application.ApplicationInfo; //导入依赖的package包/类
private static void checkExpiredPreviewBuild(@NotNull Project project) {
if (project.isDisposed() || ourCheckedExpiration) {
return;
}
String fullVersion = ApplicationInfo.getInstance().getFullVersion();
if (fullVersion.contains("Preview") || fullVersion.contains("Beta") || fullVersion.contains("RC")) {
// Expire preview builds two months after their build date (which is going to be roughly six weeks after release; by
// then will definitely have updated the build
Calendar expirationDate = (Calendar)ApplicationInfo.getInstance().getBuildDate().clone();
expirationDate.add(Calendar.MONTH, 2);
Calendar now = Calendar.getInstance();
if (now.after(expirationDate)) {
OpenUrlHyperlink hyperlink = new OpenUrlHyperlink("http://tools.android.com/download/studio/", "Show Available Versions");
String message = String.format("This preview build (%1$s) is old; please update to a newer preview or a stable version",
fullVersion);
AndroidGradleNotification.getInstance(project).showBalloon("Old Preview Build", message, INFORMATION, hyperlink);
// If we show an expiration message, don't also show a second balloon regarding available SDKs
ourNewSdkVersionToolsInfoAlreadyShown = true;
}
}
ourCheckedExpiration = true;
}
示例15: createNotification
import com.intellij.openapi.application.ApplicationInfo; //导入依赖的package包/类
@NonNull
@Override
public Notification createNotification(@NotNull final String groupDisplayId,
@Nullable NotificationListener listener) {
final String fullProductName = ApplicationNamesInfo.getInstance().getFullProductName();
final String companyName = ApplicationInfo.getInstance().getCompanyName();
String text =
"<html>Please click <a href='allow'>I agree</a> if you want to help make " + fullProductName +
" better or <a href='decline'>I don't agree</a> otherwise. <a href='settings'>more...</a></html>";
String title = "Help improve " + fullProductName + " by sending usage statistics to " + companyName;
return new Notification(groupDisplayId, title,
text,
NotificationType.INFORMATION,
listener);
}