@Nullable public static IdeFrameDecorator decorate(@NotNull IdeFrameImpl frame) { if (SystemInfo.isMac) { return new MacMainFrameDecorator(frame, PlatformUtils.isAppCode()); } else if (SystemInfo.isWindows) { return new WinMainFrameDecorator(frame); } else if (SystemInfo.isXWindow) { if (X11UiUtil.isFullScreenSupported()) { return new EWMHFrameDecorator(frame); } } return null; }
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(); } }
@Override protected JComponent createSouthPanel() { final JPanel buttonPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets.right = 5; gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 0; gbc.gridy = 0; if (!PlatformUtils.isCLion()) { buttonPanel.add(mySkipButton, gbc); gbc.gridx++; } buttonPanel.add(myBackButton, gbc); gbc.gridx++; gbc.weightx = 1; buttonPanel.add(Box.createHorizontalGlue(), gbc); gbc.gridx++; gbc.weightx = 0; buttonPanel.add(myNextButton, gbc); buttonPanel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0)); myButtonWrapper.add(buttonPanel, BUTTONS); myButtonWrapper.add(new JLabel(), NO_BUTTONS); myButtonWrapperLayout.show(myButtonWrapper, BUTTONS); return myButtonWrapper; }
public FindSettingsImpl() { recentFileMasks.add("*.properties"); recentFileMasks.add("*.html"); recentFileMasks.add("*.jsp"); recentFileMasks.add("*.xml"); recentFileMasks.add("*.java"); recentFileMasks.add("*.js"); recentFileMasks.add("*.as"); recentFileMasks.add("*.css"); recentFileMasks.add("*.mxml"); if (PlatformUtils.isPyCharm()) { recentFileMasks.add("*.py"); } else if (PlatformUtils.isRubyMine()) { recentFileMasks.add("*.rb"); } else if (PlatformUtils.isPhpStorm()) { recentFileMasks.add("*.php"); } }
@Nullable private String getPluginResourcesRootName(VirtualFile resourcesDir) throws IOException { PluginId ownerPluginId = getOwner(resourcesDir); if (ownerPluginId == null) return null; if (PluginManagerCore.CORE_PLUGIN_ID.equals(ownerPluginId.getIdString())) { return PlatformUtils.getPlatformPrefix(); } IdeaPluginDescriptor plugin = PluginManager.getPlugin(ownerPluginId); if (plugin != null) { return plugin.getName(); } return null; }
@Override public void visitPyFile(PyFile node) { super.visitPyFile(node); if (PlatformUtils.isPyCharm()) { final Module module = ModuleUtilCore.findModuleForPsiElement(node); if (module != null) { final Sdk sdk = PythonSdkType.findPythonSdk(module); if (sdk == null) { registerProblem(node, "No Python interpreter configured for the project", new ConfigureInterpreterFix()); } else if (PythonSdkType.isInvalid(sdk)) { registerProblem(node, "Invalid Python interpreter selected for the project", new ConfigureInterpreterFix()); } } } }
private static void addLibrariesFromModule(Module module, Collection<String> list) { final OrderEntry[] entries = ModuleRootManager.getInstance(module).getOrderEntries(); for (OrderEntry entry : entries) { if (entry instanceof LibraryOrderEntry) { final String name = ((LibraryOrderEntry)entry).getLibraryName(); if (name != null && name.endsWith(LibraryContributingFacet.PYTHON_FACET_LIBRARY_NAME_SUFFIX)) { // skip libraries from Python facet continue; } for (VirtualFile root : ((LibraryOrderEntry)entry).getRootFiles(OrderRootType.CLASSES)) { final Library library = ((LibraryOrderEntry)entry).getLibrary(); if (!PlatformUtils.isPyCharm()) { addToPythonPath(root, list); } else if (library instanceof LibraryImpl) { final PersistentLibraryKind<?> kind = ((LibraryImpl)library).getKind(); if (kind == PythonLibraryType.getInstance().getKind()) { addToPythonPath(root, list); } } } } } }
@Override public boolean validateProjectView( @Nullable Project project, BlazeContext context, ProjectViewSet projectViewSet, WorkspaceLanguageSettings workspaceLanguageSettings) { boolean typescriptActive = workspaceLanguageSettings.isLanguageActive(LanguageClass.TYPESCRIPT); if (typescriptActive && !PlatformUtils.isIdeaUltimate()) { IssueOutput.error("IntelliJ Ultimate needed for Typescript support.").submit(context); return false; } // Must have either both typescript and ts_config_rules or neither if (typescriptActive ^ !getTsConfigTargets(projectViewSet).isEmpty()) { invalidProjectViewError(context, Blaze.getBuildSystemProvider(project)); return false; } return true; }
@Test public void testJavascriptLanguageAvailableForUltimateEdition() { TestUtils.setPlatformPrefix(testDisposable, PlatformUtils.IDEA_PREFIX); ProjectViewSet projectViewSet = ProjectViewSet.builder() .add( ProjectView.builder() .add( ScalarSection.builder(WorkspaceTypeSection.KEY) .set(WorkspaceType.JAVASCRIPT)) .add( ListSection.builder(AdditionalLanguagesSection.KEY) .add(LanguageClass.JAVASCRIPT)) .build()) .build(); WorkspaceLanguageSettings workspaceLanguageSettings = LanguageSupport.createWorkspaceLanguageSettings(projectViewSet); errorCollector.assertNoIssues(); assertThat(workspaceLanguageSettings) .isEqualTo( new WorkspaceLanguageSettings( WorkspaceType.JAVASCRIPT, ImmutableSet.of(LanguageClass.JAVASCRIPT, LanguageClass.GENERIC))); }
@Test public void testJavascriptWorkspaceTypeUnavailableForCommunityEdition() { TestUtils.setPlatformPrefix(testDisposable, PlatformUtils.IDEA_CE_PREFIX); ProjectViewSet projectViewSet = ProjectViewSet.builder() .add( ProjectView.builder() .add( ScalarSection.builder(WorkspaceTypeSection.KEY) .set(WorkspaceType.JAVASCRIPT)) .build()) .build(); WorkspaceLanguageSettings workspaceLanguageSettings = LanguageSupport.createWorkspaceLanguageSettings(projectViewSet); LanguageSupport.validateLanguageSettings(context, workspaceLanguageSettings); errorCollector.assertIssues("Workspace type 'javascript' is not supported by this plugin"); }
@Test public void testTypescriptLanguageAvailableInUltimateEdition() { TestUtils.setPlatformPrefix(testDisposable, PlatformUtils.IDEA_PREFIX); ProjectViewSet projectViewSet = ProjectViewSet.builder() .add( ProjectView.builder() .add(ScalarSection.builder(WorkspaceTypeSection.KEY).set(WorkspaceType.JAVA)) .add( ListSection.builder(AdditionalLanguagesSection.KEY) .add(LanguageClass.TYPESCRIPT)) .build()) .build(); WorkspaceLanguageSettings workspaceLanguageSettings = LanguageSupport.createWorkspaceLanguageSettings(projectViewSet); errorCollector.assertNoIssues(); assertThat(workspaceLanguageSettings) .isEqualTo( new WorkspaceLanguageSettings( WorkspaceType.JAVA, ImmutableSet.of( LanguageClass.TYPESCRIPT, LanguageClass.GENERIC, LanguageClass.JAVA))); }
@Test public void testTypescriptNotLanguageAvailableInCommunityEdition() { TestUtils.setPlatformPrefix(testDisposable, PlatformUtils.IDEA_CE_PREFIX); ProjectViewSet projectViewSet = ProjectViewSet.builder() .add( ProjectView.builder() .add(ScalarSection.builder(WorkspaceTypeSection.KEY).set(WorkspaceType.JAVA)) .add( ListSection.builder(AdditionalLanguagesSection.KEY) .add(LanguageClass.TYPESCRIPT)) .build()) .build(); WorkspaceLanguageSettings workspaceLanguageSettings = LanguageSupport.createWorkspaceLanguageSettings(projectViewSet); LanguageSupport.validateLanguageSettings(context, workspaceLanguageSettings); errorCollector.assertIssues("Language 'typescript' is not supported by this plugin"); }
@Test public void testUsefulErrorMessageInCommunityEdition() { TestUtils.setPlatformPrefix(getTestRootDisposable(), PlatformUtils.IDEA_CE_PREFIX); setProjectView( "directories:", " common/jslayout", "targets:", " //common/jslayout/...:all", "workspace_type: javascript"); workspace.createDirectory(new WorkspacePath("common/jslayout")); BlazeSyncParams syncParams = new BlazeSyncParams.Builder("Full Sync", BlazeSyncParams.SyncMode.FULL) .addProjectViewTargets(true) .build(); runBlazeSync(syncParams); errorCollector.assertIssues("IntelliJ Ultimate needed for Javascript support."); }
/** * Constructs a usage tracker configured with analytics and plugin name configured from its * environment. */ public GoogleUsageTracker() { analyticsId = UsageTrackerManager.getInstance().getAnalyticsProperty(); AccountPluginInfoService pluginInfo = ServiceManager.getService(AccountPluginInfoService.class); externalPluginName = pluginInfo.getExternalPluginName(); userAgent = pluginInfo.getUserAgent(); String intellijPlatformName = PlatformUtils.getPlatformPrefix(); String intellijPlatformVersion = ApplicationInfo.getInstance().getStrictVersion(); String cloudToolsPluginVersion = pluginInfo.getPluginVersion(); Map<String, String> systemMetadataMap = ImmutableMap.of( PLATFORM_NAME_KEY, METADATA_ESCAPER.escape(intellijPlatformName), PLATFORM_VERSION_KEY, METADATA_ESCAPER.escape(intellijPlatformVersion), JDK_VERSION_KEY, METADATA_ESCAPER.escape(JDK_VERSION_VALUE), OPERATING_SYSTEM_KEY, METADATA_ESCAPER.escape(OPERATING_SYSTEM_VALUE), PLUGIN_VERSION_KEY, METADATA_ESCAPER.escape(cloudToolsPluginVersion)); systemMetadataKeyValues = METADATA_JOINER.join(systemMetadataMap); }
@Nullable private Icon getIcon(VirtualFile file, Project project) { final String path = file.getPath(); final long stamp = file.getModificationStamp(); Pair<Long, Icon> iconInfo = iconsCache.get(path); if (iconInfo == null || iconInfo.getFirst() < stamp) { try { final Icon icon = createOrFindBetterIcon(file, PlatformUtils.isIdeaProject(project)); iconInfo = new Pair<Long, Icon>(stamp, hasProperSize(icon) ? icon : null); iconsCache.put(file.getPath(), iconInfo); } catch (Exception e) {// iconInfo = null; iconsCache.remove(path); } } return iconInfo == null ? null : iconInfo.getSecond(); }
/** * Called from PluginManager via reflection. */ protected static void start(final String[] args) { System.setProperty(PlatformUtilsCore.PLATFORM_PREFIX_KEY, PlatformUtils.getPlatformPrefix(PlatformUtils.COMMUNITY_PREFIX)); StartupUtil.prepareAndStart(args, new StartupUtil.AppStarter() { @Override public void start(boolean newConfigFolder) { final IdeaApplication app = new IdeaApplication(args); //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { PluginManager.installExceptionHandler(); app.run(); } }); } }); }
public FindSettingsImpl() { RECENT_FILE_MASKS.add("*.properties"); RECENT_FILE_MASKS.add("*.html"); RECENT_FILE_MASKS.add("*.jsp"); RECENT_FILE_MASKS.add("*.xml"); RECENT_FILE_MASKS.add("*.java"); RECENT_FILE_MASKS.add("*.js"); RECENT_FILE_MASKS.add("*.as"); RECENT_FILE_MASKS.add("*.css"); RECENT_FILE_MASKS.add("*.mxml"); if (PlatformUtils.isPyCharm()) { RECENT_FILE_MASKS.add("*.py"); } else if (PlatformUtils.isRubyMine()) { RECENT_FILE_MASKS.add("*.rb"); } else if (PlatformUtils.isPhpStorm()) { RECENT_FILE_MASKS.add("*.php"); } }
@BeforeMethod protected void setUp(final Method testMethod) throws Exception { System.setProperty(PlatformUtils.PLATFORM_PREFIX_KEY, "PlatformLangXml"); myProjectDirFixture = IdeaTestFixtureFactory.getFixtureFactory().createTempDirTestFixture(); myProjectDirFixture.setUp(); myProjectDir = new File(myProjectDirFixture.getTempDirPath()); UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { try { initProject(myProjectDir, testMethod.getName()); initRepositories(); activateVCS(GitVcs.NAME); } catch (Exception e) { throw new RuntimeException("Exception initializing the test", e); } } }); myVcs = GitVcs.getInstance(myProject); assertNotNull(myVcs); myTraceClient = true; doActionSilently(VcsConfiguration.StandardConfirmation.ADD); doActionSilently(VcsConfiguration.StandardConfirmation.REMOVE); }
public boolean isAnyMissing() { if (!notEnabledPlugins.isEmpty()) { return true; } if (PlatformUtils.isIdeaUltimate()) { return !notInstalledPlugins.isEmpty(); } for (PluginId pluginId : notInstalledPlugins) { if (!ULTIMATE_EDITION_ONLY.contains(pluginId.getIdString())) { return true; } } return false; }
@Override public void update(AnActionEvent e) { if (ApplicationManager.getApplication().getExtensions(EduIntelliJProjectTemplate.EP_NAME).length < 1) { e.getPresentation().setEnabledAndVisible(false); } if (!PlatformUtils.isJetBrainsProduct()) { e.getPresentation().setEnabledAndVisible(false); } }
public static void showNotificationByMessageId(final Project project, @NotNull String messageId) { NotificationListener listener = null; if (PlatformUtils.isPhpStorm()) { listener = new NotificationListener() { public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { ShowSettingsUtil.getInstance().showSettingsDialog(project, "Directories"); notification.expire(); } }; } showNotificationByMessageId(project, messageId, listener); }
public static void showNotificationByMessageId(Project project, @NotNull String messageId, @Nullable NotificationListener listener) { String settingsPointer = "actions.detect.namespace.roots.manually.edit.idea"; if (PlatformUtils.isPhpStorm()) { settingsPointer = "actions.detect.namespace.roots.manually.edit"; } showNotification( project, MessageBundle.message(messageId, MessageBundle.message(settingsPointer)), listener ); }
public JPanel build(Map<SettingKey, Boolean> settingsMap) { if (!PlatformUtils.isIntelliJ()) { return getFallbackGUI(); } this.autoQueryCheckBox.setSelected(settingsMap.get(SettingKey.AUTO_QUERY)); this.runtimeErrorCheckBox.setSelected(settingsMap.get(SettingKey.RUNTIME_ERROR)); this.compileErrorCheckbox.setSelected(settingsMap.get(SettingKey.COMPILE_ERROR)); this.difficultyCheckBox.setSelected(settingsMap.get(SettingKey.DIFFICULTY)); this.loggingCheckBox.setSelected(settingsMap.get(SettingKey.LOGGING)); if(!settingsMap.get(SettingKey.AUTO_QUERY)) { this.runtimeErrorCheckBox.setEnabled(false); this.compileErrorCheckbox.setEnabled(false); this.difficultyCheckBox.setEnabled(false); } autoQueryCheckBox.addChangeListener(e -> { if (((JCheckBox)e.getSource()).isSelected()) { this.runtimeErrorCheckBox.setEnabled(true); this.compileErrorCheckbox.setEnabled(true); this.difficultyCheckBox.setEnabled(true); } else { this.runtimeErrorCheckBox.setEnabled(false); this.compileErrorCheckbox.setEnabled(false); this.difficultyCheckBox.setEnabled(false); } }); return content; }
static String getProductNameWithArticle() { final ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance(); // example: "to create an IntelliJ IDEA project" (full product name is ok); // "to create a JetBrains Astella project" (better use not full product name: "to create an Astella project") final String productName = PlatformUtils.isIdeaUltimate() ? namesInfo.getFullProductName() : namesInfo.getProductName(); final String article = StringUtil.isVowel(Character.toLowerCase(productName.charAt(0))) ? "an " : "a "; return article + productName; }
/** * Called from PluginManager via reflection. */ protected static void start(final String[] args) { System.setProperty(PlatformUtils.PLATFORM_PREFIX_KEY, PlatformUtils.getPlatformPrefix(PlatformUtils.IDEA_CE_PREFIX)); StartupUtil.prepareAndStart(args, new StartupUtil.AppStarter() { @Override public void start(final boolean newConfigFolder) { //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { PluginManager.installExceptionHandler(); if (newConfigFolder && !Boolean.getBoolean(ConfigImportHelper.CONFIG_IMPORTED_IN_CURRENT_SESSION_KEY)) { StartupUtil.runStartupWizard(); } final IdeaApplication app = new IdeaApplication(args); //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { app.run(); } }); } }); } }); }
public static String getComponentName() { final String prefix = System.getProperty(PlatformUtils.PLATFORM_PREFIX_KEY); if (prefix != null) { return prefix + COMPONENT_NAME; } return COMPONENT_NAME; }
private void tweakPlatformDefaults() { // TODO[anton] consider making all IDEs use the same settings if (PlatformUtils.isAppCode()) { SCROLL_TAB_LAYOUT_IN_EDITOR = true; ACTIVATE_RIGHT_EDITOR_ON_CLOSE = true; SHOW_ICONS_IN_MENUS = false; } }
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); }
static List<String> hasBundledPluginToInstall(Collection<Plugin> plugins) { if (PlatformUtils.isIdeaUltimate()) return null; final List<String> bundled = new ArrayList<String>(); for (Plugin plugin : plugins) { if (plugin.myBundled && PluginManager.getPlugin(PluginId.getId(plugin.myPluginId)) == null) { bundled.add(plugin.myPluginName != null ? plugin.myPluginName : plugin.myPluginId); } } return bundled.isEmpty() ? null : bundled; }
public static String getFrameClass() { String name = ApplicationNamesInfo.getInstance().getProductName().toLowerCase(Locale.US); String wmClass = VENDOR_PREFIX + StringUtil.replaceChar(name, ' ', '-'); if ("true".equals(System.getProperty("idea.debug.mode"))) { wmClass += "-debug"; } return PlatformUtils.isCommunityEdition() ? wmClass + "-ce" : wmClass; }
private static String getProductPrefix() { String prefix = null; if (PlatformUtils.isIdeaCommunity()) { prefix = "IC"; } else if (PlatformUtils.isIdeaUltimate()) { prefix = "IU"; } return prefix; }
@Override public void update(AnActionEvent event) { final Presentation presentation = event.getPresentation(); final Project project = event.getData(CommonDataKeys.PROJECT); presentation.setEnabled(project != null); presentation.setVisible(ActionPlaces.isMainMenuOrActionSearch(event.getPlace()) && !PlatformUtils.isCidr()); }
private static boolean isPrimaryModule(Module[] modules) { if (!ProjectAttachProcessor.canAttachToProject()) { return !PlatformUtils.isIntelliJ(); } for (Module module : modules) { final File moduleFile = new File(module.getModuleFilePath()); @SuppressWarnings("ConstantConditions") File projectFile = new File(module.getProject().getProjectFilePath()); if (moduleFile.getParent().equals(projectFile.getParent()) && moduleFile.getParentFile().getName().equals(Project.DIRECTORY_STORE_FOLDER)) { return true; } } return false; }
public void setupToolWindow(ToolWindowEx window) { final CollapseAllAction collapseAction = new CollapseAllAction(myTree); collapseAction.getTemplatePresentation().setIcon(AllIcons.General.CollapseAll); collapseAction.getTemplatePresentation().setHoveredIcon(AllIcons.General.CollapseAllHover); window.setTitleActions(collapseAction); final DefaultActionGroup group = new DefaultActionGroup(); final ProjectViewDirectoryHelper helper = ProjectViewDirectoryHelper.getInstance(myProject); if (helper.supportsFlattenPackages()) { group.add(new FavoritesFlattenPackagesAction(myProject, myBuilder)); } if (helper.supportsHideEmptyMiddlePackages()) { group.add(new FavoritesCompactEmptyMiddlePackagesAction(myProject, myBuilder)); } if (helper.supportsFlattenPackages()) { group.addAction(new FavoritesAbbreviatePackageNamesAction(myProject, myBuilder)); } if (!PlatformUtils.isCidr()) { group.add(new FavoritesShowMembersAction(myProject, myBuilder)); } final FavoritesAutoscrollFromSourceHandler handler = new FavoritesAutoscrollFromSourceHandler(myProject, myBuilder); handler.install(); group.add(handler.createToggleAction()); group.add(new FavoritesAutoScrollToSourceAction(myProject, myAutoScrollToSourceHandler, myBuilder)); window.setAdditionalGearActions(group); }
public boolean isEnabled(@NotNull PsiElement anchor) { if (myIsEnabled == null) { final boolean isPyCharm = PlatformUtils.isPyCharm(); if (PySkeletonRefresher.isGeneratingSkeletons()) { myIsEnabled = false; } else if (isPyCharm) { myIsEnabled = PythonSdkType.getSdk(anchor) != null || PyUtil.isInScratchFile(anchor); } else { myIsEnabled = true; } } return myIsEnabled; }
void setupDialog(Project project, final List<Sdk> allSdks) { myProject = project; final GridBagLayout layout = new GridBagLayout(); myMainPanel = new JPanel(layout); myName = new JTextField(); myDestination = new TextFieldWithBrowseButton(); myMakeAvailableToAllProjectsCheckbox = new JBCheckBox(PyBundle.message("sdk.create.venv.dialog.make.available.to.all.projects")); if (project == null || project.isDefault() || !PlatformUtils.isPyCharm()) { myMakeAvailableToAllProjectsCheckbox.setSelected(true); myMakeAvailableToAllProjectsCheckbox.setVisible(false); } layoutPanel(allSdks); init(); setOKActionEnabled(false); registerValidators(new FacetValidatorsManager() { public void registerValidator(FacetEditorValidator validator, JComponent... componentsToWatch) { } public void validate() { checkValid(); } }); myMainPanel.setPreferredSize(new Dimension(300, 50)); checkValid(); setInitialDestination(); addUpdater(myName); new LocationNameFieldsBinding(project, myDestination, myName, myInitialPath, PyBundle.message("sdk.create.venv.dialog.select.venv.location")); }
private void checkSdk() throws RuntimeConfigurationError { if (PlatformUtils.isPyCharm()) { final String path = getInterpreterPath(); if (path == null) { throw new RuntimeConfigurationError("Please select a valid Python interpreter"); } } else { if (!myUseModuleSdk) { if (StringUtil.isEmptyOrSpaces(getSdkHome())) { final Sdk projectSdk = ProjectRootManager.getInstance(getProject()).getProjectSdk(); if (projectSdk == null || !(projectSdk.getSdkType() instanceof PythonSdkType)) { throw new RuntimeConfigurationError(PyBundle.message("runcfg.unittest.no_sdk")); } } else if (!PythonSdkType.getInstance().isValidSdkHome(getSdkHome())) { throw new RuntimeConfigurationError(PyBundle.message("runcfg.unittest.no_valid_sdk")); } } else { Sdk sdk = PythonSdkType.findPythonSdk(getModule()); if (sdk == null) { throw new RuntimeConfigurationError(PyBundle.message("runcfg.unittest.no_module_sdk")); } } } }
@NotNull @Override protected Configurable createModuleConfigurable(Module module) { if (PlatformUtils.isPyCharmCommunity()) return new PlatformContentEntriesConfigurable(module, JavaSourceRootType.SOURCE); return new PyContentEntriesModuleConfigurable(module); }
@Override public CommonCodeStyleSettings getDefaultCommonSettings() { CommonCodeStyleSettings xmlSettings = new CommonCodeStyleSettings(getLanguage()); CommonCodeStyleSettings.IndentOptions indentOptions = xmlSettings.initIndentOptions(); xmlSettings.setForceArrangeMenuAvailable(true); // HACK [yole] if (PlatformUtils.isRubyMine()) { indentOptions.INDENT_SIZE = 2; } return xmlSettings; }