com.intellij.openapi.options.ConfigurationException Java Examples
The following examples show how to use
com.intellij.openapi.options.ConfigurationException.
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: MuleRunnerEditor.java From mule-intellij-plugins with Apache License 2.0 | 6 votes |
/** * This is invoked when the user fills the form and pushes apply/ok * * @param runnerConfiguration runnerConfiguration * @throws ConfigurationException ex */ @Override protected void applyEditorTo(MuleConfiguration runnerConfiguration) throws ConfigurationException { runnerConfiguration.setVmArgs(this.configurationPanel.getVmArgsField().getText()); final Object selectedItem = this.configurationPanel.getMuleHome().getSelectedItem(); runnerConfiguration.setMuleHome(selectedItem instanceof MuleSdk ? ((MuleSdk) selectedItem).getMuleHome() : ""); if (this.configurationPanel.getAlwaysRadioButton().isSelected()) runnerConfiguration.setClearData(CLEAR_DATA_ALWAYS); else if (this.configurationPanel.getNeverRadioButton().isSelected()) runnerConfiguration.setClearData(CLEAR_DATA_NEVER); else runnerConfiguration.setClearData(CLEAR_DATA_PROMPT); Module[] selectedModules = this.configurationPanel.getModulesList().getSelectedModules(runnerConfiguration.getProject()); // final Module selectedModule = this.configurationPanel.getModuleCombo().getSelectedModule(); if (selectedModules != null) { runnerConfiguration.setModules(selectedModules); } }
Example #2
Source File: SubCompositeConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Override public final void apply() throws ConfigurationException { if (root != null) { root.apply(getSettings()); XDebuggerConfigurableProvider.generalApplied(getCategory()); } if (isChildrenMerged()) { for (Configurable child : children) { if (child.isModified()) { child.apply(); } } } }
Example #3
Source File: ProjectSettingsForm.java From EclipseCodeFormatter with Apache License 2.0 | 6 votes |
public void validate() throws ConfigurationException { if (pathToEclipsePreferenceFileJava.isEnabled()) { if (StringUtils.isBlank(pathToEclipsePreferenceFileJava.getText())) { throw new ConfigurationException("Path to Java config file is not valid"); } if (!new File(pathToEclipsePreferenceFileJava.getText()).exists()) { throw new ConfigurationException("Path to Java config file is not valid - the file does not exist"); } } if (pathToImportOrderPreferenceFile.isEnabled()) { if (StringUtils.isBlank(pathToImportOrderPreferenceFile.getText())) { throw new ConfigurationException("Path to Import Order file is not valid"); } if (!new File(pathToImportOrderPreferenceFile.getText()).exists()) { throw new ConfigurationException("Path to Import Order file is not valid - the file does not exist"); } } if (pathToCustomEclipse.isEnabled()) { if (StringUtils.isBlank(pathToCustomEclipse.getText())) { throw new ConfigurationException("Path to custom Eclipse folder is not valid"); } if (!new File(pathToCustomEclipse.getText()).exists()) { throw new ConfigurationException("Path to custom Eclipse folder is not valid - folder does not exist"); } } }
Example #4
Source File: MyConfigurable.java From EclipseCodeFormatter with Apache License 2.0 | 6 votes |
@Override public void apply() throws ConfigurationException { if (form != null) { form.validate(); Settings profile = form.exportDisplayedSettings(); projectSettings.setProfile(profile); if (!profile.isProjectSpecific()) { GlobalSettings.getInstance().updateSettings(profile, project); } if (!project.isDefault()) { if (profile.isProjectSpecific()) { ProjectComponent.getInstance(project).installOrUpdate(profile); } else { ProjectUtils.applyToAllOpenedProjects(profile); } } } }
Example #5
Source File: CSharpCodeGenerationSettingsConfigurable.java From consulo-csharp with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Override public void apply() throws ConfigurationException { mySettings.FIELD_PREFIX = myFieldPrefixField.getText().trim(); mySettings.STATIC_FIELD_PREFIX = myStaticFieldPrefixField.getText().trim(); mySettings.PROPERTY_PREFIX = myPropertyPrefixField.getText().trim(); mySettings.STATIC_PROPERTY_PREFIX = myStaticPropertyPrefixField.getText().trim(); mySettings.FIELD_SUFFIX = myFieldSuffixField.getText().trim(); mySettings.STATIC_FIELD_SUFFIX = myStaticFieldSuffixField.getText().trim(); mySettings.PROPERTY_SUFFIX = myPropertySuffixField.getText().trim(); mySettings.STATIC_PROPERTY_SUFFIX = myStaticPropertySuffixField.getText().trim(); mySettings.USE_LANGUAGE_DATA_TYPES = myUseLanguageKeywordsCheckBox.isSelected(); myCommenterForm.apply(mySettings.getContainer()); }
Example #6
Source File: PluginManagerConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@Override public void apply() throws ConfigurationException { final String applyMessage = myPluginManagerMain.apply(); if (applyMessage != null) { throw new ConfigurationException(applyMessage); } if (myPluginManagerMain.isRequireShutdown()) { final ApplicationEx app = (ApplicationEx)Application.get(); int response = app.isRestartCapable() ? showRestartIDEADialog() : showShutDownIDEADialog(); if (response == Messages.YES) { app.restart(true); } else { myPluginManagerMain.ignoreChanges(); } } }
Example #7
Source File: GraphQLProjectConfigurable.java From js-graphql-intellij-plugin with MIT License | 6 votes |
public void apply() throws ConfigurationException { if (myForm != null) { if (myProject.isDefault()) { myForm.apply(); } else { WriteAction.run(() -> { myForm.apply(); }); ApplicationManager.getApplication().invokeLater(() -> { if (!myProject.isDisposed()) { DaemonCodeAnalyzer.getInstance(myProject).restart(); EditorNotifications.getInstance(myProject).updateAllNotifications(); } }, myProject.getDisposed()); } } }
Example #8
Source File: ProjectSettingsForm.java From EclipseCodeFormatter with Apache License 2.0 | 6 votes |
private void showConfirmationDialogOnProfileChange() { createConfirmation("Profile was modified, save changes?", "Yes", "No", new Runnable() { @Override public void run() { try { apply(); importFrom(getSelectedItem()); } catch (ConfigurationException e) { profiles.setSelectedItem(displayedSettings); SwingUtilities.invokeLater(() -> Messages.showMessageDialog(ProjectSettingsForm.this.rootComponent, e.getMessage(), e.getTitle(), Messages.getErrorIcon())); } } }, new Runnable() { @Override public void run() { importFromInternal(getSelectedItem()); } }, 0).showInCenterOf(profiles); }
Example #9
Source File: MethodConfigurable.java From easy_javadoc with Apache License 2.0 | 6 votes |
@Override public void apply() throws ConfigurationException { TemplateConfig templateConfig = config.getMethodTemplateConfig(); templateConfig.setIsDefault(view.isDefault()); templateConfig.setTemplate(view.getTemplate()); if (templateConfig.getCustomMap() == null) { templateConfig.setCustomMap(new TreeMap<>()); } if (!view.isDefault()) { if (StringUtils.isBlank(view.getTemplate())) { throw new ConfigurationException("使用自定义模板,模板不能为空"); } String temp = StringUtils.strip(view.getTemplate()); if (!temp.startsWith("/**") || !temp.endsWith("*/")) { throw new ConfigurationException("模板格式不正确,正确的javadoc应该以\"/**\"开头,以\"*/\"结束"); } } }
Example #10
Source File: AbstractImportFromExternalSystemControl.java From consulo with Apache License 2.0 | 6 votes |
public void apply() throws ConfigurationException { String linkedProjectPath = myLinkedProjectPathField.getText(); if (StringUtil.isEmpty(linkedProjectPath)) { throw new ConfigurationException(ExternalSystemBundle.message("error.project.undefined")); } else if (myCurrentProject != null) { ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(myExternalSystemId); assert manager != null; AbstractExternalSystemSettings<?, ?,?> settings = manager.getSettingsProvider().fun(myCurrentProject); if (settings.getLinkedProjectSettings(linkedProjectPath) != null) { throw new ConfigurationException(ExternalSystemBundle.message("error.project.already.registered")); } } //noinspection ConstantConditions myProjectSettings.setExternalProjectPath(ExternalSystemApiUtil.normalizePath(linkedProjectPath)); myProjectSettingsControl.validate(myProjectSettings); myProjectSettingsControl.apply(myProjectSettings); if (mySystemSettingsControl != null) { mySystemSettingsControl.validate(mySystemSettings); mySystemSettingsControl.apply(mySystemSettings); } }
Example #11
Source File: RPiJavaModuleBuilder.java From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 | 6 votes |
/** * Used to define the hierachy of the project definition * * @param rootModel * @throws ConfigurationException */ @Override public void setupRootModel(final ModifiableRootModel rootModel) throws ConfigurationException { super.setupRootModel(rootModel); final Project project = rootModel.getProject(); final VirtualFile root = createAndGetContentEntry(); rootModel.addContentEntry(root); if (myJdk != null) { rootModel.setSdk(myJdk); } else { rootModel.inheritSdk(); } createProjectFiles(rootModel, project); }
Example #12
Source File: VcsBackgroundOperationsConfigurationPanel.java From consulo with Apache License 2.0 | 6 votes |
public void apply() throws ConfigurationException { VcsConfiguration settings = VcsConfiguration.getInstance(myProject); settings.PERFORM_COMMIT_IN_BACKGROUND = myCbCommitInBackground.isSelected(); settings.PERFORM_UPDATE_IN_BACKGROUND = myCbUpdateInBackground.isSelected(); settings.PERFORM_CHECKOUT_IN_BACKGROUND = myCbCheckoutInBackground.isSelected(); settings.PERFORM_EDIT_IN_BACKGROUND = myCbEditInBackground.isSelected(); settings.PERFORM_ADD_REMOVE_IN_BACKGROUND = myCbAddRemoveInBackground.isSelected(); settings.PERFORM_ROLLBACK_IN_BACKGROUND = myPerformRevertInBackgroundCheckBox.isSelected(); boolean remoteCacheStateChanged = settings.CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND != myTrackChangedOnServer.isSelected(); if (! myProject.isDefault()) { settings.CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND = myTrackChangedOnServer.isSelected(); settings.CHANGED_ON_SERVER_INTERVAL = ((Number) myChangedOnServerInterval.getValue()).intValue(); myCacheSettingsPanel.apply(); } for (VcsShowOptionsSettingImpl setting : myPromptOptions.keySet()) { setting.setValue(myPromptOptions.get(setting).isSelected()); } // will check if should + was started -> inside RemoteRevisionsCache.getInstance(myProject).updateAutomaticRefreshAlarmState(remoteCacheStateChanged); }
Example #13
Source File: WholeWestSingleConfigurableEditor.java From consulo with Apache License 2.0 | 6 votes |
@Override @RequiredUIAccess protected void doAction(ActionEvent e) { try { if (myConfigurable.isModified()) { myConfigurable.apply(); myChangesWereApplied = true; setCancelButtonText(CommonBundle.getCloseButtonText()); } } catch (ConfigurationException ex) { if (myProject != null) { Messages.showMessageDialog(myProject, ex.getMessage(), ex.getTitle(), Messages.getErrorIcon()); } else { Messages.showMessageDialog(myParentComponent, ex.getMessage(), ex.getTitle(), Messages.getErrorIcon()); } } }
Example #14
Source File: UseExistingBazelWorkspaceOption.java From intellij with Apache License 2.0 | 6 votes |
@Override public WorkspaceTypeData getWorkspaceData() throws ConfigurationException { String directory = getDirectory(); if (directory.isEmpty()) { throw new ConfigurationException("Please select a workspace"); } File workspaceRootFile = new File(directory); if (!workspaceRootFile.exists()) { throw new ConfigurationException("Workspace does not exist"); } if (!isWorkspaceRoot(workspaceRootFile)) { throw new ConfigurationException( "Invalid workspace root: choose a bazel workspace directory " + "(containing a WORKSPACE file)"); } WorkspaceRoot root = new WorkspaceRoot(workspaceRootFile); return WorkspaceTypeData.builder() .setWorkspaceName(workspaceRootFile.getName()) .setWorkspaceRoot(root) .setCanonicalProjectDataLocation(workspaceRootFile) .setFileBrowserRoot(workspaceRootFile) .setWorkspacePathResolver(new WorkspacePathResolverImpl(root)) .setBuildSystem(BuildSystem.Bazel) .build(); }
Example #15
Source File: RemoteServerListConfigurable.java From consulo with Apache License 2.0 | 5 votes |
@Override public void apply() throws ConfigurationException { super.apply(); Set<RemoteServer<?>> servers = new HashSet<RemoteServer<?>>(getServers()); for (NamedConfigurable<RemoteServer<?>> configurable : getConfiguredServers()) { RemoteServer<?> server = configurable.getEditableObject(); server.setName(configurable.getDisplayName()); if (!servers.contains(server)) { myServersManager.addServer(server); } } }
Example #16
Source File: CamelAnnotatorPageTest.java From camel-idea-plugin with Apache License 2.0 | 5 votes |
public void testShouldChangeStateOfRealTimeEndpointValidationCatalogCheckBox() throws ConfigurationException { JBCheckBox checkBox = annotatorPage.getRealTimeEndpointValidationCatalogCheckBox(); assertEquals(true, checkBox.isSelected()); assertEquals(true, annotatorPage.getCamelPreferenceService().isRealTimeEndpointValidation()); checkBox.setSelected(false); annotatorPage.apply(); assertEquals(false, checkBox.isSelected()); assertEquals(false, annotatorPage.getCamelPreferenceService().isRealTimeEndpointValidation()); }
Example #17
Source File: TFSProjectConfigurable.java From azure-devops-intellij with MIT License | 5 votes |
@Override public void apply() throws ConfigurationException { form.apply(); // TODO: move this all to the component apply() method once needed // TFSConfigurationManager.getInstance().setUseIdeaHttpProxy(myComponent.useProxy()); // TFSConfigurationManager.getInstance().setSupportTfsCheckinPolicies(myComponent.supportTfsCheckinPolicies()); // TFSConfigurationManager.getInstance().setSupportStatefulCheckinPolicies(myComponent.supportStatefulCheckinPolicies()); // TFSConfigurationManager.getInstance().setReportNotInstalledCheckinPolicies(myComponent.reportNotInstalledCheckinPolicies()); }
Example #18
Source File: RunDialog.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(final ActionEvent event) { try{ myConfigurable.apply(); } catch(ConfigurationException e){ Messages.showMessageDialog(myProject, e.getMessage(), ExecutionBundle.message("invalid.data.dialog.title"), Messages.getErrorIcon()); } }
Example #19
Source File: BlazeCommandRunConfigurationGenericHandlerIntegrationTest.java From intellij with Apache License 2.0 | 5 votes |
@Test public void testEditorApplyToAndResetFromMatches() throws ConfigurationException { BlazeCommandRunConfigurationSettingsEditor editor = new BlazeCommandRunConfigurationSettingsEditor(configuration); TargetExpression targetExpression = TargetExpression.fromStringSafe("//..."); configuration.setTarget(targetExpression); BlazeCommandRunConfigurationCommonState state = (BlazeCommandRunConfigurationCommonState) configuration.getHandler().getState(); state.getCommandState().setCommand(COMMAND); state.getBlazeFlagsState().setRawFlags(ImmutableList.of("--flag1", "--flag2")); state.getExeFlagsState().setRawFlags(ImmutableList.of("--exeFlag1")); state.getBlazeBinaryState().setBlazeBinary("/usr/bin/blaze"); editor.resetFrom(configuration); BlazeCommandRunConfiguration readConfiguration = type.getFactory().createTemplateConfiguration(getProject()); editor.applyEditorTo(readConfiguration); assertThat(readConfiguration.getTargets()).containsExactly(targetExpression); assertThat(readConfiguration.getHandler()) .isInstanceOf(BlazeCommandGenericRunConfigurationHandler.class); BlazeCommandRunConfigurationCommonState readState = (BlazeCommandRunConfigurationCommonState) readConfiguration.getHandler().getState(); assertThat(readState.getCommandState().getCommand()) .isEqualTo(state.getCommandState().getCommand()); assertThat(readState.getBlazeFlagsState().getRawFlags()) .isEqualTo(state.getBlazeFlagsState().getRawFlags()); assertThat(readState.getExeFlagsState().getRawFlags()) .isEqualTo(state.getExeFlagsState().getRawFlags()); assertThat(readState.getBlazeBinaryState().getBlazeBinary()) .isEqualTo(state.getBlazeBinaryState().getBlazeBinary()); Disposer.dispose(editor); }
Example #20
Source File: BlazeSelectOptionControl.java From intellij with Apache License 2.0 | 5 votes |
void validateAndUpdateModel(BlazeNewProjectBuilder builder) throws ConfigurationException { T option = getSelectedOption(); if (option == null) { throw new ConfigurationException("No option selected."); } option.validateAndUpdateBuilder(builder); }
Example #21
Source File: SimpleConfigurableByProperties.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override protected void apply(@Nonnull SimpleConfigurableByProperties.LayoutWrapper component) throws ConfigurationException { for (Property<?> property : myProperties) { property.apply(); } }
Example #22
Source File: PathMacroListEditor.java From consulo with Apache License 2.0 | 5 votes |
public void commit() throws ConfigurationException { ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { myPathMacroTable.commit(); final Collection<String> ignored = parseIgnoredVariables(); final PathMacros instance = PathMacros.getInstance(); instance.setIgnoredMacroNames(ignored); } }); }
Example #23
Source File: FileEncodingConfigurable.java From consulo with Apache License 2.0 | 5 votes |
@Override public void apply() throws ConfigurationException { String projectCharsetName = getSelectedCharsetName(mySelectedProjectCharset); Map<VirtualFile,Charset> result = myTreeView.getValues(); EncodingProjectManager encodingProjectManager = EncodingProjectManager.getInstance(myProject); encodingProjectManager.setMapping(result); encodingProjectManager.setDefaultCharsetName(projectCharsetName); encodingProjectManager.setDefaultCharsetForPropertiesFiles(null, mySelectedCharsetForPropertiesFiles.get()); encodingProjectManager.setNative2AsciiForPropertiesFiles(null, myTransparentNativeToAsciiCheckBox.isSelected()); Charset ideCharset = mySelectedIdeCharset.get(); EncodingManager.getInstance().setDefaultCharsetName(ideCharset == null ? "" : ideCharset.name()); }
Example #24
Source File: StatisticsConfigurable.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override public void apply() throws ConfigurationException { myUsageStatisticsPersistenceComponent.setPeriod(myConfig.getPeriod()); myUsageStatisticsPersistenceComponent.setAllowed(myConfig.isAllowed()); myStatisticsSendManager.sheduleRunIfStarted(); }
Example #25
Source File: UseAliasListForm.java From idea-php-annotation-plugin with MIT License | 5 votes |
@Override public void apply() throws ConfigurationException { List<UseAliasOption> options = new ArrayList<>(); options.addAll(this.tableView.getListTableModel().getItems()); ApplicationSettings.getInstance().useAliasOptions = options; ApplicationSettings.getInstance().provideDefaults = false; this.changed = false; }
Example #26
Source File: XQueryDataSourcesConfigurableTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Test public void shouldUpdateDataSourceSettingsWithConfigurationFromForm() throws ConfigurationException { given(settingsForm.getCurrentConfigurations()).willReturn(CONFIGURATIONS); configurable.createComponent(); configurable.apply(); verify(settingsForm).getCurrentConfigurations(); verify(dataSourcesSettings).setDataSourceConfigurations(CONFIGURATIONS); }
Example #27
Source File: ArtifactsStructureConfigurable.java From consulo with Apache License 2.0 | 5 votes |
@Override public void apply() throws ConfigurationException { myPackagingEditorContext.saveEditorSettings(); super.apply(); final ModifiableArtifactModel modifiableModel = myPackagingEditorContext.getActualModifiableModel(); if (modifiableModel != null) { WriteAction.run(() -> modifiableModel.commit()); myPackagingEditorContext.resetModifiableModel(); } reset(); // TODO: fix to not reset on apply! }
Example #28
Source File: MongoRunConfigurationEditor.java From nosql4idea with Apache License 2.0 | 5 votes |
@Override protected void applyEditorTo(MongoRunConfiguration configuration) throws ConfigurationException { configuration.setScriptPath(getScriptPath()); configuration.setServerConfiguration(getSelectedConfiguration()); configuration.setDatabase(getSelectedDatabase()); configuration.setShellParameters(getShellParameters()); configuration.setShellWorkingDir(getShellWorkingDir()); }
Example #29
Source File: DebuggerConfigurable.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override public void apply() throws ConfigurationException { if (myRootConfigurable != null) { myRootConfigurable.apply(); } }
Example #30
Source File: BaseLibrariesConfigurable.java From consulo with Apache License 2.0 | 5 votes |
@Override public void checkCanApply() throws ConfigurationException { super.checkCanApply(); for (LibraryConfigurable configurable : getLibraryConfigurables()) { if (configurable.getDisplayName().isEmpty()) { ((LibraryProjectStructureElement)configurable.getProjectStructureElement()).navigate(); throw new ConfigurationException("Library name is not specified"); } } }