Skip to content

Commit

Permalink
If Drupal path isn't configured, error for run configuration should l…
Browse files Browse the repository at this point in the history
…ink to settings form. (#7)
  • Loading branch information
mglaman committed Jun 6, 2016
1 parent 1abc365 commit c200291
Showing 1 changed file with 13 additions and 1 deletion.
Expand Up @@ -8,12 +8,15 @@
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Property;
import com.jetbrains.php.config.PhpProjectConfigurable;
import com.jetbrains.php.config.PhpProjectConfigurationFacade;
import com.jetbrains.php.config.commandLine.PhpCommandSettings;
import com.jetbrains.php.config.interpreters.PhpInterpreter;
import com.jetbrains.php.drupal.DrupalVersion;
import com.jetbrains.php.drupal.settings.DrupalConfigurable;
import com.jetbrains.php.drupal.settings.DrupalDataService;
import com.jetbrains.php.run.*;
import com.jetbrains.php.ui.PhpUiUtil;
import com.jetbrains.php.util.PhpConfigurationUtil;
import com.jetbrains.php.util.pathmapper.PhpPathMapper;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -76,7 +79,7 @@ public void checkConfiguration() throws RuntimeConfigurationException {

if (PhpRunUtil.findDirectory(drupalRoot) == null) {
// @todo Can we link to a shortcut to configure Drupal?s
throw new RuntimeConfigurationException("Invalid Drupal directory configured for this project.");
throw new RuntimeConfigurationError("Invalid Drupal directory configured for this project.", createDrupalFix(getProject()));
}

PhpRunUtil.checkPhpInterpreter(getProject());
Expand All @@ -85,6 +88,15 @@ public void checkConfiguration() throws RuntimeConfigurationException {
PhpRunUtil.checkCommandLineSettings(settings.getCommandLineSettings());
}

@NotNull
public static Runnable createDrupalFix(@NotNull final Project project) {
return new Runnable() {
public void run() {
PhpUiUtil.editConfigurable(project, new DrupalConfigurable(project));
}
};
}

public void fillCommandSettings(@NotNull Map<String, String> env, @NotNull PhpCommandSettings command) throws ExecutionException {
DrupalRunConfiguration.Settings settings = this.getSettings();

Expand Down

0 comments on commit c200291

Please sign in to comment.