Example usage for com.intellij.openapi.options ConfigurationException ConfigurationException

List of usage examples for com.intellij.openapi.options ConfigurationException ConfigurationException

Introduction

In this page you can find the example usage for com.intellij.openapi.options ConfigurationException ConfigurationException.

Prototype

public ConfigurationException(String message, String title) 

Source Link

Usage

From source file:com.android.tools.idea.gradle.project.GradleProjectImporter.java

License:Apache License

@NotNull
private static ConfigurationException handleImportFailure(@NotNull String errorMessage,
        @Nullable String errorDetails) {
    if (errorDetails != null) {
        LOG.warn(errorDetails);//  www.java  2  s.  c  o  m
    }
    String reason = "Failed to import Gradle project: " + errorMessage;
    return new ConfigurationException(ExternalSystemBundle.message("error.resolve.with.reason", reason),
            ExternalSystemBundle.message("error.resolve.generic"));
}

From source file:com.goide.refactor.GoIntroduceVariableDialog.java

License:Apache License

@Override
protected void canRun() throws ConfigurationException {
    if (!areButtonsValid()) {
        throw new ConfigurationException(RefactoringBundle.message("refactoring.introduce.name.error"),
                getName());/*w ww. jav  a  2s . c o  m*/
    }
}

From source file:com.intellij.ide.highlighter.custom.impl.CustomFileTypeEditor.java

License:Apache License

public void applyEditorTo(AbstractFileType type) throws ConfigurationException {
    if (myFileTypeName.getText().trim().length() == 0) {
        throw new ConfigurationException(IdeBundle.message("error.name.cannot.be.empty"),
                CommonBundle.getErrorTitle());
    } else if (myFileTypeDescr.getText().trim().length() == 0) {
        myFileTypeDescr.setText(myFileTypeName.getText());
    }//from   w  w w .jav a  2s.  com
    type.setName(myFileTypeName.getText());
    type.setDescription(myFileTypeDescr.getText());
    type.setSyntaxTable(getSyntaxTable());
}

From source file:com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable.java

License:Apache License

@Override
protected void checkApply(Set<MyNode> rootNodes, String prefix, String title) throws ConfigurationException {
    super.checkApply(rootNodes, prefix, title);
    final Set<String> predefinedScopes = new HashSet<String>();
    for (CustomScopesProvider scopesProvider : myProject
            .getExtensions(CustomScopesProvider.CUSTOM_SCOPES_PROVIDER)) {
        for (NamedScope namedScope : scopesProvider.getCustomScopes()) {
            predefinedScopes.add(namedScope.getName());
        }//w w w.ja  v a  2  s .c o m
    }
    for (MyNode rootNode : rootNodes) {
        for (int i = 0; i < rootNode.getChildCount(); i++) {
            final MyNode node = (MyNode) rootNode.getChildAt(i);
            final NamedConfigurable scopeConfigurable = node.getConfigurable();
            final String name = scopeConfigurable.getDisplayName();
            if (predefinedScopes.contains(name)) {
                selectNodeInTree(node);
                throw new ConfigurationException("Scope name equals to predefined one",
                        ProjectBundle.message("rename.scope.title"));
            }
        }
    }
}

From source file:com.intellij.projectImport.SelectImportedProjectsStep.java

License:Apache License

public boolean validate() throws ConfigurationException {
    getContext().setList(fileChooser.getMarkedElements());
    if (fileChooser.getMarkedElements().size() == 0) {
        throw new ConfigurationException("Nothing found to import", "Unable to proceed");
    }//from www.j  a v  a2 s  .c o  m
    return true;
}

From source file:com.liferay.ide.idea.ui.modules.LiferayModuleFragmentWizardStep.java

License:Open Source License

@Override
public boolean validate() throws ConfigurationException {
    String validationTitle = "Validation Error";

    if (CoreUtil.isNullOrEmpty(getSelectedJsps())) {
        throw new ConfigurationException("At least select one jsp to override", validationTitle);
    }/*from  ww w.j  a  v a 2 s  .c o m*/

    return true;
}

From source file:com.liferay.ide.idea.ui.modules.LiferayModuleWizardStep.java

License:Open Source License

@Override
public boolean validate() throws ConfigurationException {
    String validationTitle = "Validation Error";

    if (CoreUtil.isNullOrEmpty(getSelectedType())) {
        throw new ConfigurationException("Please click one of the items to select a template", validationTitle);
    }/*from   ww  w . j ava2  s  .  c om*/

    Project workspaceProject = ProjectManager.getInstance().getOpenProjects()[0];

    String packageNameValue = getPackageName();
    String classNameValue = getClassName();

    if (!CoreUtil.isNullOrEmpty(packageNameValue)
            && !PsiDirectoryFactory.getInstance(workspaceProject).isValidPackageName(packageNameValue)) {

        throw new ConfigurationException(packageNameValue + " is not a valid package name", validationTitle);
    }

    if (!CoreUtil.isNullOrEmpty(classNameValue)
            && !PsiNameHelper.getInstance(workspaceProject).isQualifiedName(classNameValue)) {

        throw new ConfigurationException(classNameValue + " is not a valid java class name", validationTitle);
    }

    return true;
}

From source file:com.mediaworx.intellij.opencmsplugin.configuration.OpenCmsPluginConfigurationComponent.java

License:Open Source License

/**
 * Applies the modifications made to the project level configuration.
 * @throws ConfigurationException required by the interface but never thrown
 *//*from  ww  w .ja  va 2  s.  co  m*/
public void apply() throws ConfigurationException {
    if (form != null) {
        boolean pluginActivationWasModified = form
                .isPluginActivationModified(configurationData.isOpenCmsPluginEnabled());

        // Get data from editor to component
        form.getData(configurationData);

        final OpenCmsPlugin plugin = project.getComponent(OpenCmsPlugin.class);

        if (!plugin.checkWebappRootConfiguration(false)) {
            throw new ConfigurationException(
                    "The Webapp Root or OpenCms configuration folder was not found. Please check the OpenCms Webapp Root in the OpenCms Plugin settings.",
                    "Configuration error!");
        }

        if (plugin.getOpenCmsModules() != null && plugin.getOpenCmsModules().getAllModules().size() > 0) {
            plugin.refreshOpenCmsModules();
        }

        VfsAdapter vfsAdapter = plugin.getVfsAdapter();

        if (vfsAdapter != null) {
            vfsAdapter.setUser(configurationData.getUsername());
            vfsAdapter.setPassword(configurationData.getPassword());
        }

        if (configurationData.isPluginConnectorEnabled()) {
            if (plugin.getPluginConnector() != null) {
                plugin.getPluginConnector().setConnectorUrl(configurationData.getConnectorUrl());
                plugin.getPluginConnector().setUser(configurationData.getUsername());
                plugin.getPluginConnector().setPassword(configurationData.getPassword());
                plugin.getPluginConnector()
                        .setUseMetaDateVariables(configurationData.isUseMetaDateVariablesEnabled());
                plugin.getPluginConnector()
                        .setUseMetaIdVariables(configurationData.isUseMetaIdVariablesEnabled());
            } else {
                plugin.setPluginConnector(new OpenCmsPluginConnector(configurationData.getConnectorUrl(),
                        configurationData.getUsername(), configurationData.getPassword(),
                        configurationData.isUseMetaDateVariablesEnabled(),
                        configurationData.isUseMetaIdVariablesEnabled()));
            }
        } else {
            plugin.setPluginConnector(null);
        }

        if (configurationData.isPluginConnectorServiceEnabled()
                && StringUtils.isNotBlank(configurationData.getConnectorServiceUrl())) {
            IDEConnectorClient connectorClient = plugin.getConnectorClient();
            if (connectorClient != null) {
                connectorClient.getConfiguration()
                        .setConnectorServiceBaseUrl(configurationData.getConnectorServiceUrl());
            }
        } else {
            plugin.setConnectorClient(null);
        }

        if (pluginActivationWasModified) {
            if (configurationData.isOpenCmsPluginEnabled()) {
                plugin.enable();
            } else {
                plugin.disable();
            }
        }
    }
}

From source file:com.microsoft.intellij.ui.azureroles.AzureRolePanel.java

License:Open Source License

/**
 * Modify listener for role name textbox.
 *///from w w w  .  j ava  2  s .co  m
private void roleNameModifyListener() throws ConfigurationException {
    //        if (isValidinstances) {
    //            setValid(true);
    //        } else {
    //            setValid(false);
    //        }
    String roleName = txtRoleName.getText();
    try {
        boolean isValidRoleName;
        if (roleName.equalsIgnoreCase(windowsAzureRole.getName())) {
            isValidRoleName = true;
        } else {
            isValidRoleName = waProjManager.isAvailableRoleName(roleName);
        }
        /*
        * If text box is empty then do not show error
        * as user may be giving input.
        * Just disable OK button.
        */
        /*if (txtRoleName.getText().isEmpty()) {
        setValid(false);
        } else */
        if (isValidRoleName) {
            windowsAzureRole.setName(txtRoleName.getText().trim());
        } else {
            throw new ConfigurationException(message("dlgInvldRoleName2"), message("dlgInvldRoleName1"));
        }
    } catch (WindowsAzureInvalidProjectOperationException e) {
        PluginUtil.displayErrorDialogAndLog(message("adRolErrTitle"),
                message("adRolErrMsgBox1") + message("adRolErrMsgBox2"), e);
    }
}

From source file:com.microsoft.intellij.ui.azureroles.CachingPanel.java

License:Open Source License

@Override
public void apply() throws ConfigurationException {
    boolean okToProceed = false;
    // Check caching is enabled
    if (cacheCheck.isSelected()) {
        /* Check cache memory size
         * is set to valid value or not//from w  w w . j ava 2  s.  co  m
         */
        if (isCachPerValid) {
            okToProceed = true;
        } else {
            PluginUtil.displayErrorDialog(message("cachPerErrTtl"), message("cachPerErrMsg"));
        }
    } else {
        okToProceed = true;
    }
    if (okToProceed) {
        try {
            waProjManager.save();
            setModified(false);
            LocalFileSystem.getInstance().findFileByPath(PluginUtil.getModulePath(module)).refresh(true, true);
        } catch (WindowsAzureInvalidProjectOperationException e) {
            AzurePlugin.log(message("adRolErrMsgBox1") + message("adRolErrMsgBox2", e));
            throw new ConfigurationException(message("adRolErrMsgBox1") + message("adRolErrMsgBox2"),
                    message("adRolErrTitle"));
        }
    }
}