com.intellij.openapi.application.ApplicationNamesInfo Java Examples
The following examples show how to use
com.intellij.openapi.application.ApplicationNamesInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WinDockDelegate.java From consulo with Apache License 2.0 | 6 votes |
@Override public void updateRecentProjectsMenu() { if (ApplicationProperties.isInSandbox()) { return; } // we need invoke it in own thread, due we don't want it call inside UI thread, or Write thread (if it separate) myExecutorService.execute(() -> { final AnAction[] recentProjectActions = RecentProjectsManager.getInstance().getRecentProjectsActions(false); RecentTasks.clear(); String name = ApplicationNamesInfo.getInstance().getProductName().toLowerCase(Locale.US); File exePath = new File(ContainerPathManager.get().getAppHomeDirectory(), name + (SystemInfo.is64Bit ? "64" : "") + ".exe"); if (!exePath.exists()) { throw new IllegalArgumentException("Executable is not exists. Path: " + exePath.getPath()); } String launcher = RecentTasks.getShortenPath(exePath.getPath()); Task[] tasks = new Task[recentProjectActions.length]; for (int i = 0; i < recentProjectActions.length; i++) { ReopenProjectAction rpa = (ReopenProjectAction)recentProjectActions[i]; tasks[i] = new Task(launcher, RecentTasks.getShortenPath(rpa.getProjectPath()), rpa.getTemplatePresentation().getText()); } RecentTasks.addTasks(tasks); }); }
Example #2
Source File: HTMLExportFrameMaker.java From consulo with Apache License 2.0 | 6 votes |
public void startInspection(@Nonnull InspectionToolWrapper toolWrapper) { myInspectionToolWrappers.add(toolWrapper); @NonNls StringBuffer buf = new StringBuffer(); buf.append("<HTML><HEAD><TITLE>"); buf.append(ApplicationNamesInfo.getInstance().getFullProductName()); buf.append(InspectionsBundle.message("inspection.export.title")); buf.append("</TITLE></HEAD>"); buf.append("<FRAMESET cols=\"30%,70%\"><FRAMESET rows=\"30%,70%\">"); buf.append("<FRAME src=\""); buf.append(toolWrapper.getFolderName()); buf.append("/index.html\" name=\"inspectionFrame\">"); buf.append("<FRAME src=\"empty.html\" name=\"packageFrame\">"); buf.append("</FRAMESET>"); buf.append("<FRAME src=\"empty.html\" name=\"elementFrame\">"); buf.append("</FRAMESET></BODY></HTML"); HTMLExportUtil.writeFile(myRootFolder, toolWrapper.getFolderName() + "-index.html", buf, myProject); }
Example #3
Source File: TipPanel.java From consulo with Apache License 2.0 | 6 votes |
public void prevTip() { if (myTips.size() == 0) { myBrowser.setText(IdeBundle.message("error.tips.not.found", ApplicationNamesInfo.getInstance().getFullProductName())); return; } final GeneralSettings settings = GeneralSettings.getInstance(); int lastTip = settings.getLastTip(); final TipAndTrickBean tip; lastTip--; if (lastTip <= 0) { tip = myTips.get(myTips.size() - 1); lastTip = myTips.size(); } else { tip = myTips.get(lastTip - 1); } setTip(tip, lastTip, myBrowser, settings); }
Example #4
Source File: TipPanel.java From consulo with Apache License 2.0 | 6 votes |
public void nextTip() { if (myTips.size() == 0) { myBrowser.setText(IdeBundle.message("error.tips.not.found", ApplicationNamesInfo.getInstance().getFullProductName())); return; } GeneralSettings settings = GeneralSettings.getInstance(); int lastTip = settings.getLastTip(); TipAndTrickBean tip; lastTip++; if (lastTip - 1 >= myTips.size()) { tip = myTips.get(0); lastTip = 1; } else { tip = myTips.get(lastTip - 1); } setTip(tip, lastTip, myBrowser, settings); }
Example #5
Source File: IncrementalSyncProjectAction.java From intellij with Apache License 2.0 | 6 votes |
private static void showPopupNotification(Project project) { String message = String.format( "Some relevant files (e.g. BUILD files, .blazeproject file) " + "have changed since the last sync. " + "Please press the 'Sync' button in the toolbar to re-sync your %s project.", ApplicationNamesInfo.getInstance().getFullProductName()); Notification notification = new Notification( NOTIFICATION_GROUP.getDisplayId(), String.format("Changes since last %s sync", Blaze.buildSystemName(project)), message, NotificationType.INFORMATION); notification.setImportant(true); Notifications.Bus.notify(notification, project); }
Example #6
Source File: OptionsAndConfirmations.java From consulo with Apache License 2.0 | 6 votes |
public void init(final Convertor<String, VcsShowConfirmationOption.Value> initOptions) { createSettingFor(VcsConfiguration.StandardOption.ADD); createSettingFor(VcsConfiguration.StandardOption.REMOVE); createSettingFor(VcsConfiguration.StandardOption.CHECKOUT); createSettingFor(VcsConfiguration.StandardOption.UPDATE); createSettingFor(VcsConfiguration.StandardOption.STATUS); createSettingFor(VcsConfiguration.StandardOption.EDIT); myConfirmations.put(VcsConfiguration.StandardConfirmation.ADD.getId(), new VcsShowConfirmationOptionImpl( VcsConfiguration.StandardConfirmation.ADD.getId(), VcsBundle.message("label.text.when.files.created.with.idea", ApplicationNamesInfo.getInstance().getProductName()), VcsBundle.message("radio.after.creation.do.not.add"), VcsBundle.message("radio.after.creation.show.options"), VcsBundle.message("radio.after.creation.add.silently"))); myConfirmations.put(VcsConfiguration.StandardConfirmation.REMOVE.getId(), new VcsShowConfirmationOptionImpl( VcsConfiguration.StandardConfirmation.REMOVE.getId(), VcsBundle.message("label.text.when.files.are.deleted.with.idea", ApplicationNamesInfo.getInstance().getProductName()), VcsBundle.message("radio.after.deletion.do.not.remove"), VcsBundle.message("radio.after.deletion.show.options"), VcsBundle.message("radio.after.deletion.remove.silently"))); restoreReadConfirm(VcsConfiguration.StandardConfirmation.ADD, initOptions); restoreReadConfirm(VcsConfiguration.StandardConfirmation.REMOVE, initOptions); }
Example #7
Source File: VMOptions.java From consulo with Apache License 2.0 | 6 votes |
@Nullable public static File getWriteFile() { String vmOptionsFile = System.getProperty("jb.vmOptionsFile"); if (vmOptionsFile == null) { // launchers should specify a path to an options file used to configure a JVM return null; } vmOptionsFile = new File(vmOptionsFile).getAbsolutePath(); if (!FileUtil.isAncestor(ContainerPathManager.get().getHomePath(), vmOptionsFile, true)) { // a file is located outside the IDE installation - meaning it is safe to overwrite return new File(vmOptionsFile); } File appHomeDirectory = ContainerPathManager.get().getAppHomeDirectory(); String fileName = ApplicationNamesInfo.getInstance().getProductName().toLowerCase(Locale.US); if (SystemInfo.is64Bit && !SystemInfo.isMac) fileName += "64"; if (SystemInfo.isWindows) fileName += ".exe"; fileName += ".vmoptions"; return new File(appHomeDirectory, fileName); }
Example #8
Source File: WindowsDefenderFixAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(@Nonnull AnActionEvent e, @Nonnull Notification notification) { int rc = Messages.showDialog(e.getProject(), DiagnosticBundle .message("virus.scanning.fix.explanation", ApplicationNamesInfo.getInstance().getFullProductName(), WindowsDefenderChecker.getInstance().getConfigurationInstructionsUrl()), DiagnosticBundle.message("virus.scanning.fix.title"), new String[]{DiagnosticBundle.message("virus.scanning.fix.automatically"), DiagnosticBundle.message("virus.scanning.fix.manually"), CommonBundle.getCancelButtonText()}, 0, null); switch (rc) { case Messages.OK: notification.expire(); ApplicationManager.getApplication().executeOnPooledThread(() -> { if (WindowsDefenderChecker.getInstance().runExcludePathsCommand(e.getProject(), myPaths)) { UIUtil.invokeLaterIfNeeded(() -> { Notifications.Bus.notifyAndHide(new Notification("System Health", "", DiagnosticBundle.message("virus.scanning.fix.success.notification"), NotificationType.INFORMATION), e.getProject()); }); } }); break; case Messages.CANCEL: BrowserUtil.browse(WindowsDefenderChecker.getInstance().getConfigurationInstructionsUrl()); break; } }
Example #9
Source File: PluginManagerMain.java From consulo with Apache License 2.0 | 6 votes |
public static void notifyPluginsWereUpdated(final String title, final Project project) { final ApplicationEx app = (ApplicationEx)Application.get(); final boolean restartCapable = app.isRestartCapable(); String message = restartCapable ? IdeBundle.message("message.idea.restart.required", ApplicationNamesInfo.getInstance().getFullProductName()) : IdeBundle.message("message.idea.shutdown.required", ApplicationNamesInfo.getInstance().getFullProductName()); message += "<br><a href="; message += restartCapable ? "\"restart\">Restart now" : "\"shutdown\">Shutdown"; message += "</a>"; new NotificationGroup("Plugins Lifecycle Group", NotificationDisplayType.STICKY_BALLOON, true) .createNotification(title, XmlStringUtil.wrapInHtml(message), NotificationType.INFORMATION, new NotificationListener() { @Override public void hyperlinkUpdate(@Nonnull Notification notification, @Nonnull HyperlinkEvent event) { notification.expire(); if (restartCapable) { app.restart(true); } else { app.exit(true, true); } } }).notify(project); }
Example #10
Source File: ProjectWizardUtil.java From consulo with Apache License 2.0 | 6 votes |
public static boolean createDirectoryIfNotExists(final String promptPrefix, String directoryPath, boolean promptUser) { File dir = new File(directoryPath); if (!dir.exists()) { if (promptUser) { final int answer = Messages.showOkCancelDialog(IdeBundle.message("promot.projectwizard.directory.does.not.exist", promptPrefix, dir.getPath(), ApplicationNamesInfo.getInstance().getFullProductName()), IdeBundle.message("title.directory.does.not.exist"), Messages.getQuestionIcon()); if (answer != 0) { return false; } } try { VfsUtil.createDirectories(dir.getPath()); } catch (IOException e) { Messages.showErrorDialog(IdeBundle.message("error.failed.to.create.directory", dir.getPath()), CommonBundle.getErrorTitle()); return false; } } return true; }
Example #11
Source File: StatusBarManagerTest.java From azure-devops-intellij with MIT License | 6 votes |
@Test public void testProjectOpenedEvent_RiderVsts() { when(applicationNamesInfo.getProductName()).thenReturn(IdeaHelper.RIDER_PRODUCT_NAME); PowerMockito.mockStatic(ApplicationNamesInfo.class); when(ApplicationNamesInfo.getInstance()).thenReturn(applicationNamesInfo); when(VcsHelper.isVstsRepo(project)).thenReturn(true); StatusBarManager.setupStatusBar(); Map<String, Object> map = EventContextHelper.createContext(EventContextHelper.SENDER_PROJECT_OPENED); EventContextHelper.setProject(map, project); ServerEventManager.getInstance().triggerAllEvents(map); verify(statusBar, VerificationModeFactory.times(1)).addWidget(any(BuildWidget.class), Matchers.eq(project)); buildStatusLookupOperation.onLookupStarted(); buildStatusLookupOperation.onLookupResults(new BuildStatusLookupOperation.BuildStatusResults( new ServerContextBuilder().uri("https://test.visualstudio.com/").type(ServerContext.Type.VSO).build(), new ArrayList<BuildStatusLookupOperation.BuildStatusRecord>())); verify(statusBar, VerificationModeFactory.times(1)).updateWidget(anyString()); }
Example #12
Source File: LibNotifyWrapper.java From consulo with Apache License 2.0 | 6 votes |
private LibNotifyWrapper() { myLibNotify = (LibNotify)Native.loadLibrary("libnotify.so.4", LibNotify.class); String appName = ApplicationNamesInfo.getInstance().getProductName(); if (myLibNotify.notify_init(appName) == 0) { throw new IllegalStateException("notify_init failed"); } String icon = AppUIUtil.findIcon(ContainerPathManager.get().getAppHomeDirectory().getPath()); myIcon = icon != null ? icon : "dialog-information"; MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(); connection.subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener() { @Override public void appClosing() { synchronized (myLock) { myDisposed = true; myLibNotify.notify_uninit(); } } }); }
Example #13
Source File: KeyboardInternationalizationNotificationManager.java From consulo with Apache License 2.0 | 6 votes |
public static Notification createNotification(@Nonnull final String groupDisplayId, @Nullable NotificationListener listener) { final String productName = ApplicationNamesInfo.getInstance().getProductName(); Window recentFocusedWindow = TargetAWT.to(WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow()); String text = "<html>We have found out that you are using a non-english keyboard layout. You can <a href='enable'>enable</a> smart layout support for " + KeyboardSettingsExternalizable.getDisplayLanguageNameForComponent(recentFocusedWindow) + " language." + "You can change this option in the settings of " + productName + " <a href='settings'>more...</a></html>"; String title = "Enable smart keyboard internalization for " + productName + "."; return new Notification(groupDisplayId, title, text, NotificationType.INFORMATION, listener); }
Example #14
Source File: StartupUtil.java From consulo with Apache License 2.0 | 6 votes |
private static void logStartupInfo(final Logger log) { LoggerFactory factory = LoggerFactoryInitializer.getFactory(); Runtime.getRuntime().addShutdownHook(new Thread("Shutdown hook - logging") { @Override public void run() { log.info("------------------------------------------------------ IDE SHUTDOWN ------------------------------------------------------"); factory.shutdown(); } }); log.info("------------------------------------------------------ IDE STARTED ------------------------------------------------------"); log.info("Using logger factory: " + factory.getClass().getSimpleName()); 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() + ", " + 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, " ")); } }
Example #15
Source File: CustomizeIDEWizardDialog.java From consulo with Apache License 2.0 | 6 votes |
public CustomizeIDEWizardDialog(MultiMap<String, PluginDescriptor> pluginDescriptors, MultiMap<String, String> predefinedTemplateSets) { super(null); myPluginDescriptors = pluginDescriptors; myPredefinedTemplateSets = predefinedTemplateSets; setTitle("Customize " + ApplicationNamesInfo.getInstance().getProductName()); initSteps(); mySkipButton.addActionListener(this); myBackButton.addActionListener(this); myNextButton.addActionListener(this); myNavigationLabel.setEnabled(false); myFooterLabel.setEnabled(false); init(); initCurrentStep(true); setScalableSize(400, 300); System.setProperty(StartupActionScriptManager.STARTUP_WIZARD_MODE, "true"); }
Example #16
Source File: CommonProxy.java From consulo with Apache License 2.0 | 6 votes |
public static void isInstalledAssertion() { final ProxySelector aDefault = ProxySelector.getDefault(); if (ourInstance != aDefault) { // to report only once if (ourWrong != aDefault || itsTime()) { LOG.error("ProxySelector.setDefault() was changed to [" + aDefault.toString() + "] - other than com.intellij.util.proxy.CommonProxy.ourInstance.\n" + "This will make some " + ApplicationNamesInfo.getInstance().getProductName() + " network calls fail.\n" + "Instead, methods of com.intellij.util.proxy.CommonProxy should be used for proxying."); ourWrong = aDefault; } ProxySelector.setDefault(ourInstance); ourInstance.ensureAuthenticator(); } assertSystemPropertiesSet(); }
Example #17
Source File: CreateDesktopEntryAction.java From consulo with Apache License 2.0 | 6 votes |
private static File prepare() throws IOException { File distributionDirectory = ContainerPathManager.get().getAppHomeDirectory(); String name = ApplicationNamesInfo.getInstance().getFullProductName(); final String iconPath = AppUIUtil.findIcon(distributionDirectory.getPath()); if (iconPath == null) { throw new RuntimeException(ApplicationBundle.message("desktop.entry.icon.missing", distributionDirectory.getPath())); } final File execPath = new File(distributionDirectory, "consulo.sh"); if (!execPath.exists()) { throw new RuntimeException(ApplicationBundle.message("desktop.entry.script.missing", distributionDirectory.getPath())); } final String wmClass = AppUIUtil.getFrameClass(); final String content = ExecUtil.loadTemplate(CreateDesktopEntryAction.class.getClassLoader(), "entry.desktop", ContainerUtil .newHashMap(Arrays.asList("$NAME$", "$SCRIPT$", "$ICON$", "$WM_CLASS$"), Arrays.asList(name, execPath.getPath(), iconPath, wmClass))); final String entryName = wmClass + ".desktop"; final File entryFile = new File(FileUtil.getTempDirectory(), entryName); FileUtil.writeToFile(entryFile, content); entryFile.deleteOnExit(); return entryFile; }
Example #18
Source File: PluginsTableRenderer.java From consulo with Apache License 2.0 | 6 votes |
private static String whyIncompatible(PluginDescriptor descriptor, TableModel model) { if (model instanceof InstalledPluginsTableModel) { InstalledPluginsTableModel installedModel = (InstalledPluginsTableModel)model; Set<PluginId> required = installedModel.getRequiredPlugins(descriptor.getPluginId()); if (required != null && required.size() > 0) { StringBuilder sb = new StringBuilder(); if (!installedModel.isLoaded(descriptor.getPluginId())) { sb.append(IdeBundle.message("plugin.manager.incompatible.not.loaded.tooltip")).append('\n'); } String deps = StringUtil.join(required, id -> { PluginDescriptor plugin = PluginManager.getPlugin(id); return plugin != null ? plugin.getName() : id.getIdString(); }, ", "); sb.append(IdeBundle.message("plugin.manager.incompatible.deps.tooltip", required.size(), deps)); return sb.toString(); } } return IdeBundle.message("plugin.manager.incompatible.tooltip", ApplicationNamesInfo.getInstance().getFullProductName()); }
Example #19
Source File: WindowsDefenderCheckerActivity.java From consulo with Apache License 2.0 | 5 votes |
@Override public void runActivity(@Nonnull UIAccess uiAccess, @Nonnull Project project) { if(!Boolean.getBoolean("consulo.windows.defender.activity")) { return; } if (myApplication.isUnitTestMode()) { return; } WindowsDefenderChecker windowsDefenderChecker = myWindowsDefenderChecker.get(); if (windowsDefenderChecker.isVirusCheckIgnored(project)) { return; } WindowsDefenderChecker.CheckResult checkResult = windowsDefenderChecker.checkWindowsDefender(project); if (checkResult.status == WindowsDefenderChecker.RealtimeScanningStatus.SCANNING_ENABLED && ContainerUtil.any(checkResult.pathStatus, (it) -> !it.getValue())) { List<Path> nonExcludedPaths = checkResult.pathStatus.entrySet().stream().filter(it -> !it.getValue()).map(Map.Entry::getKey).collect(Collectors.toList()); WindowsDefenderNotification notification = new WindowsDefenderNotification( DiagnosticBundle.message("virus.scanning.warn.message", ApplicationNamesInfo.getInstance().getFullProductName(), StringUtil.join(nonExcludedPaths, "<br/>")), nonExcludedPaths); notification.setImportant(true); notification.setCollapseActionsDirection(Notification.CollapseActionsDirection.KEEP_LEFTMOST); windowsDefenderChecker.configureActions(project, notification); myApplication.invokeLater(() -> notification.notify(project)); } }
Example #20
Source File: ReadonlyStatusIsVisibleActivationCheck.java From consulo with Apache License 2.0 | 5 votes |
public static void check(final Project project, final String vcsName) { if (SystemInfo.isUnix && "root".equals(System.getenv("USER"))) { Notifications.Bus.notify(new Notification(vcsName, vcsName + ": can not see read-only status", "You are logged as <b>root</b>, that's why:<br><br>- " + ApplicationNamesInfo.getInstance().getFullProductName() + " can not see read-only status of files.<br>" + "- All files are treated as writeable.<br>- Automatic file checkout on modification is impossible.", NotificationType.WARNING), project); } }
Example #21
Source File: StatisticsSendManager.java From consulo with Apache License 2.0 | 5 votes |
public Notification createNotification(@Nonnull 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); }
Example #22
Source File: StatisticsConfigurationComponent.java From consulo with Apache License 2.0 | 5 votes |
public StatisticsConfigurationComponent() { String product = ApplicationNamesInfo.getInstance().getFullProductName(); String company = ApplicationInfo.getInstance().getCompanyName(); myTitle.setText(StatisticsBundle.message("stats.title", product, company)); myLabel.setText(StatisticsBundle.message("stats.config.details", company)); myLabel.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL)); myAllowToSendUsagesCheckBox.setText(StatisticsBundle.message("stats.config.allow.send.stats.text", company)); myAllowToSendUsagesCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setRadioButtonsEnabled(); } }); }
Example #23
Source File: ErrorReportInformation.java From IntelliJDeodorant with MIT License | 5 votes |
private ErrorReportInformation(GitHubErrorBean error, ApplicationInfoEx appInfo, ApplicationNamesInfo namesInfo) { information.put(ERROR_DESCRIPTION, error.getDescription()); information.put(PLUGIN_NAME, error.getPluginName()); information.put(PLUGIN_VERSION, error.getPluginVersion()); information.put(OS_NAME, SystemInfo.OS_NAME); information.put(JAVA_VERSION, SystemInfo.JAVA_VERSION); information.put(JAVA_VM_VENDOR, SystemInfo.JAVA_VENDOR); information.put(APP_NAME, namesInfo.getProductName()); information.put(APP_FULL_NAME, namesInfo.getFullProductName()); information.put(APP_VERSION_NAME, appInfo.getVersionName()); information.put(IS_EAP, Boolean.toString(appInfo.isEAP())); information.put(APP_BUILD, appInfo.getBuild().asString()); information.put(APP_VERSION, appInfo.getFullVersion()); information.put(PERMANENT_INSTALLATION_ID, PermanentInstallationID.get()); information.put(LAST_ACTION, error.getLastAction()); information.put(ERROR_MESSAGE, error.getMessage()); information.put(ERROR_STACKTRACE, error.getStackTrace()); information.put(ERROR_HASH, error.getExceptionHash()); for (Attachment attachment : error.getAttachments()) { information.put(ATTACHMENT_NAME, attachment.getName()); information.put(ATTACHMENT_VALUE, attachment.getEncodedBytes()); } }
Example #24
Source File: FileTemplateManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@NonNls @Nonnull private String getDefaultClassTemplateText(@Nonnull @NonNls String templateName) { return IdeBundle.message("template.default.class.comment", ApplicationNamesInfo.getInstance().getFullProductName()) + "package $PACKAGE_NAME$;\n" + "public " + internalTemplateToSubject(templateName) + " $NAME$ { }"; }
Example #25
Source File: FileTemplateManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void fillDefaultVariables(@Nonnull Map<String, Object> map) { Calendar calendar = Calendar.getInstance(); Date date = myTestDate == null ? calendar.getTime() : myTestDate; SimpleDateFormat sdfMonthNameShort = new SimpleDateFormat("MMM"); SimpleDateFormat sdfMonthNameFull = new SimpleDateFormat("MMMM"); SimpleDateFormat sdfDayNameShort = new SimpleDateFormat("EEE"); SimpleDateFormat sdfDayNameFull = new SimpleDateFormat("EEEE"); SimpleDateFormat sdfYearFull = new SimpleDateFormat("yyyy"); map.put("DATE", DateFormatUtil.formatDate(date)); map.put("TIME", DateFormatUtil.formatTime(date)); map.put("YEAR", sdfYearFull.format(date)); map.put("MONTH", getCalendarValue(calendar, Calendar.MONTH)); map.put("MONTH_NAME_SHORT", sdfMonthNameShort.format(date)); map.put("MONTH_NAME_FULL", sdfMonthNameFull.format(date)); map.put("DAY", getCalendarValue(calendar, Calendar.DAY_OF_MONTH)); map.put("DAY_NAME_SHORT", sdfDayNameShort.format(date)); map.put("DAY_NAME_FULL", sdfDayNameFull.format(date)); map.put("HOUR", getCalendarValue(calendar, Calendar.HOUR_OF_DAY)); map.put("MINUTE", getCalendarValue(calendar, Calendar.MINUTE)); map.put("SECOND", getCalendarValue(calendar, Calendar.SECOND)); map.put("USER", SystemProperties.getUserName()); map.put("PRODUCT_NAME", ApplicationNamesInfo.getInstance().getFullProductName()); map.put("DS", "$"); // Dollar sign, strongly needed for PHP, JS, etc. See WI-8979 map.put(PROJECT_NAME_VARIABLE, myProject.getName()); }
Example #26
Source File: OpenFileAction.java From consulo with Apache License 2.0 | 5 votes |
public static void openFile(final VirtualFile virtualFile, final Project project) { FileEditorProviderManager editorProviderManager = FileEditorProviderManager.getInstance(); if (editorProviderManager.getProviders(project, virtualFile).length == 0) { Messages.showMessageDialog(project, IdeBundle.message("error.files.of.this.type.cannot.be.opened", ApplicationNamesInfo.getInstance().getProductName()), IdeBundle.message("title.cannot.open.file"), Messages.getErrorIcon()); return; } NonProjectFileWritingAccessProvider.allowWriting(virtualFile); OpenFileDescriptor descriptor = new OpenFileDescriptor(project, virtualFile); FileEditorManager.getInstance(project).openTextEditor(descriptor, true); }
Example #27
Source File: StartupUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private synchronized static ActivationResult lockSystemFolders(BiFunction<String, String, ImportantFolderLocker> lockFactory, String[] args) { if (ourFolderLocker != null) { throw new AssertionError(); } ourFolderLocker = lockFactory.apply(ContainerPathManager.get().getConfigPath(), ContainerPathManager.get().getSystemPath()); ImportantFolderLocker.ActivateStatus status; try { status = ourFolderLocker.lock(args); } catch (Exception e) { showMessage("Cannot Lock System Folders", e); return ActivationResult.FAILED; } if (status == ImportantFolderLocker.ActivateStatus.NO_INSTANCE) { ShutDownTracker.getInstance().registerShutdownTask(() -> { //noinspection SynchronizeOnThis synchronized (StartupUtil.class) { ourFolderLocker.dispose(); ourFolderLocker = null; } }); return ActivationResult.STARTED; } else if (status == ImportantFolderLocker.ActivateStatus.ACTIVATED) { //noinspection UseOfSystemOutOrSystemErr System.out.println("Already running"); return ActivationResult.ACTIVATED; } else if (status == ImportantFolderLocker.ActivateStatus.CANNOT_ACTIVATE) { String message = "Only one instance of " + ApplicationNamesInfo.getInstance().getFullProductName() + " can be run at a time."; showMessage("Too Many Instances", message, true, false); } return ActivationResult.FAILED; }
Example #28
Source File: FontEditorPreview.java From consulo with Apache License 2.0 | 5 votes |
public static String getIDEDemoText() { return ApplicationNamesInfo.getInstance().getFullProductName() + " is a full-featured IDE\n" + "with a high level of usability and outstanding\n" + "advanced code editing and refactoring support.\n" + "\n" + "abcdefghijklmnopqrstuvwxyz 0123456789 (){}[]\n" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ +-*/= .,;:!? #&$%@|^\n" + // Create empty lines in order to make the gutter wide enough to display two-digits line numbers (other previews use long text // and we don't want different gutter widths on color pages switching). "\n" + "\n" + "\n"; }
Example #29
Source File: PluginManager.java From consulo with Apache License 2.0 | 5 votes |
public static void handleComponentError(@Nonnull Throwable t, @Nullable Class componentClass, @Nullable ComponentConfig config) { if (t instanceof StartupAbortedException) { throw (StartupAbortedException)t; } PluginId pluginId = null; if (config != null) { pluginId = config.getPluginId(); } if (pluginId == null || CORE_PLUGIN.equals(pluginId)) { pluginId = componentClass == null ? null : consulo.container.plugin.PluginManager.getPluginId(componentClass); } if (pluginId == null || CORE_PLUGIN.equals(pluginId)) { if (t instanceof PluginExtensionInitializationException) { pluginId = ((PluginExtensionInitializationException)t).getPluginId(); } } if (pluginId != null && !isSystemPlugin(pluginId)) { getLogger().warn(t); if (!ApplicationProperties.isInSandbox()) { consulo.container.plugin.PluginManager.disablePlugin(pluginId.getIdString()); } StringWriter message = new StringWriter(); message.append("Plugin '").append(pluginId.getIdString()).append("' failed to initialize and will be disabled. "); message.append(" Please restart ").append(ApplicationNamesInfo.getInstance().getFullProductName()).append('.'); message.append("\n\n"); t.printStackTrace(new PrintWriter(message)); StartupUtil.showMessage("Plugin Error", message.toString(), false, false); throw new StartupAbortedException(t).exitCode(ExitCodes.PLUGIN_ERROR).logError(false); } else { throw new StartupAbortedException("Fatal error initializing '" + (componentClass == null ? null : componentClass.getName()) + "'", t); } }
Example #30
Source File: DetectedRootsChooserDialog.java From consulo with Apache License 2.0 | 5 votes |
private void init(List<SuggestedChildRootInfo> suggestedRoots) { myDescription = "<html><body>" + ApplicationNamesInfo.getInstance().getFullProductName() + " just scanned files and detected the following " + StringUtil.pluralize("root", suggestedRoots.size()) + ".<br>" + "Select items in the tree below or press Cancel to cancel operation.</body></html>"; myTreeTable = createTreeTable(suggestedRoots); myPane = ScrollPaneFactory.createScrollPane(myTreeTable); setTitle("Detected Roots"); init(); }