Search in sources :

Example 66 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-community by JetBrains.

the class PluginModuleBuildConfEditor method apply.

@Override
public void apply() throws ConfigurationException {
    if (myUseUserManifest.isSelected() && !new File(myManifest.getText()).exists()) {
        throw new ConfigurationException(DevKitBundle.message("error.file.not.found.message", myManifest.getText()));
    }
    final File plugin = new File(myBuildProperties.getPluginXmlPath());
    final String newPluginPath = myPluginXML.getText() + File.separator + META_INF + File.separator + PLUGIN_XML;
    if (plugin.exists() && !plugin.getPath().equals(newPluginPath)) {
        Project project = myModule.getProject();
        // later because we're in a write action and can't show a dialog
        ApplicationManager.getApplication().invokeLater(() -> askToDeleteOldPlugin(plugin, project), project.getDisposed());
    }
    myBuildProperties.setPluginXmlPathAndCreateDescriptorIfDoesntExist(newPluginPath);
    myBuildProperties.setManifestPath(myManifest.getText());
    myBuildProperties.setUseUserManifest(myUseUserManifest.isSelected());
}
Also used : Project(com.intellij.openapi.project.Project) ConfigurationException(com.intellij.openapi.options.ConfigurationException) File(java.io.File)

Example 67 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-community by JetBrains.

the class ScopeConfigurable method apply.

@Override
public void apply() throws ConfigurationException {
    try {
        myPanel.apply();
        final PackageSet packageSet = myPanel.getCurrentScope();
        myScope = new NamedScope(myScope.getName(), packageSet);
        myPackageSet = packageSet != null ? packageSet.getText() : null;
        myShareScope = mySharedCheckbox.isSelected();
    } catch (ConfigurationException e) {
    //was canceled - didn't change anything
    }
}
Also used : NamedScope(com.intellij.psi.search.scope.packageSet.NamedScope) ConfigurationException(com.intellij.openapi.options.ConfigurationException) PackageSet(com.intellij.psi.search.scope.packageSet.PackageSet)

Example 68 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-community by JetBrains.

the class PluginManagerConfigurable method apply.

@Override
public void apply() throws ConfigurationException {
    final String applyMessage = myPluginManagerMain.apply();
    if (applyMessage != null) {
        throw new ConfigurationException(applyMessage);
    }
    boolean prev = myShutdownRequired;
    myShutdownRequired |= myPluginManagerMain.isRequireShutdown();
    myPluginManagerMain.ignoreChanges();
    if (prev)
        return;
    Disposable d = UIUtil.uiParents(myPluginManagerMain.getMainPanel(), false).filter(Disposable.class).first();
    if (d == null)
        return;
    Disposer.register(d, new Disposable() {

        @Override
        public void dispose() {
            ApplicationManager.getApplication().invokeLater(() -> showShutdownDialogIfNeeded(), ApplicationManager.getApplication().getDisposed());
        }
    });
}
Also used : Disposable(com.intellij.openapi.Disposable) ConfigurationException(com.intellij.openapi.options.ConfigurationException)

Example 69 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-community by JetBrains.

the class ReplaceConstructorWithBuilderDialog method canRun.

@Override
protected void canRun() throws ConfigurationException {
    final PsiNameHelper nameHelper = PsiNameHelper.getInstance(myProject);
    for (ParameterData parameterData : myParametersMap.values()) {
        if (!nameHelper.isIdentifier(parameterData.getFieldName()))
            throw new ConfigurationException("\'" + parameterData.getFieldName() + "\' is not a valid field name");
        if (!nameHelper.isIdentifier(parameterData.getSetterName()))
            throw new ConfigurationException("\'" + parameterData.getSetterName() + "\' is not a valid setter name");
    }
    if (myCreateBuilderClassRadioButton.isSelected()) {
        final String className = myNewClassName.getText().trim();
        if (className.length() == 0 || !nameHelper.isQualifiedName(className))
            throw new ConfigurationException("\'" + className + "\' is invalid builder class name");
        final String packageName = myPackageTextField.getText().trim();
        if (packageName.length() > 0 && !nameHelper.isQualifiedName(packageName))
            throw new ConfigurationException("\'" + packageName + "\' is invalid builder package name");
    } else {
        final String qualifiedName = myExistentClassTF.getText().trim();
        if (qualifiedName.length() == 0 || !nameHelper.isQualifiedName(qualifiedName))
            throw new ConfigurationException("\'" + qualifiedName + "\' is invalid builder qualified class name");
    }
}
Also used : ConfigurationException(com.intellij.openapi.options.ConfigurationException)

Example 70 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-community by JetBrains.

the class BaseRCSettingsConfigurable method isModified.

@Override
public boolean isModified() {
    try {
        RunnerAndConfigurationSettings original = getSettings();
        RunnerAndConfigurationSettings snapshot = getEditor().getSnapshot();
        final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(original.getConfiguration().getProject());
        if (runManager.findExistingConfigurationId(original) == null)
            return true;
        if (!super.isModified())
            return false;
        if (!original.isTemplate() && runManager.findExistingConfigurationId(original) == null) {
            return true;
        }
        if (isSnapshotSpecificallyModified(runManager, original, snapshot)) {
            return true;
        }
        if (!runManager.getBeforeRunTasks(original.getConfiguration()).equals(runManager.getBeforeRunTasks(snapshot.getConfiguration()))) {
            return true;
        }
        if (original instanceof JDOMExternalizable && snapshot instanceof JDOMExternalizable) {
            applySnapshotToComparison(original, snapshot);
            Element originalElement = new Element("config");
            Element snapshotElement = new Element("config");
            ((JDOMExternalizable) original).writeExternal(originalElement);
            ((JDOMExternalizable) snapshot).writeExternal(snapshotElement);
            patchElementsIfNeed(originalElement, snapshotElement);
            boolean result = !JDOMUtil.areElementsEqual(originalElement, snapshotElement, true);
            if (!result) {
                super.setModified(false);
            }
            return result;
        }
    } catch (ConfigurationException e) {
    //ignore
    }
    return super.isModified();
}
Also used : ConfigurationException(com.intellij.openapi.options.ConfigurationException) JDOMExternalizable(com.intellij.openapi.util.JDOMExternalizable) Element(org.jdom.Element) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings)

Aggregations

ConfigurationException (com.intellij.openapi.options.ConfigurationException)102 File (java.io.File)25 VirtualFile (com.intellij.openapi.vfs.VirtualFile)24 Project (com.intellij.openapi.project.Project)22 Module (com.intellij.openapi.module.Module)18 IOException (java.io.IOException)14 NotNull (org.jetbrains.annotations.NotNull)11 Nullable (org.jetbrains.annotations.Nullable)8 FlexProjectConfigurationEditor (com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor)7 Sdk (com.intellij.openapi.projectRoots.Sdk)7 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)6 Disposable (com.intellij.openapi.Disposable)4 LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)4 Pair (com.intellij.openapi.util.Pair)4 GradleProjectImporter (com.android.tools.idea.gradle.project.importing.GradleProjectImporter)3 ExecutionException (com.intellij.execution.ExecutionException)3 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)3 ModuleWizardStep (com.intellij.ide.util.projectWizard.ModuleWizardStep)3 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)3 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)3