use of com.intellij.javascript.nodejs.util.NodePackage in project intellij-plugins by JetBrains.
the class TsLintView method setState.
@Override
protected void setState(@NotNull TsLintState state) {
myNodeModuleConfigurationView.getNodeInterpreterField().setInterpreterRef(state.getInterpreterRef());
myNodeModuleConfigurationView.getPackageField().setSelected(new NodePackage(state.getPackagePath()));
myConfigFileView.setCustomConfigFileUsed(state.isCustomConfigFileUsed());
myConfigFileView.setCustomConfigFilePath(StringUtil.notNullize(state.getCustomConfigFilePath()));
if (!StringUtil.isEmptyOrSpaces(state.getRulesDirectory())) {
myRules.setText(state.getRulesDirectory());
}
myAllowJs.setSelected(state.isAllowJs());
resizeOnSeparateDialog();
}
use of com.intellij.javascript.nodejs.util.NodePackage in project intellij-plugins by JetBrains.
the class KarmaRunConfiguration method readExternal.
@Override
public void readExternal(Element element) throws InvalidDataException {
super.readExternal(element);
myRunSettings = KarmaRunSettingsSerializationUtil.readXml(element);
NodePackage karmaPackage = myRunSettings.getKarmaPackage();
if ("true".equals(element.getAttributeValue("default")) && karmaPackage != null && karmaPackage.isEmptyPath()) {
myRunSettings = myRunSettings.toBuilder().setKarmaPackage(null).build();
}
}
use of com.intellij.javascript.nodejs.util.NodePackage in project intellij-plugins by JetBrains.
the class KarmaRunSettingsSerializationUtil method readXml.
public static KarmaRunSettings readXml(@NotNull Element element) {
KarmaRunSettings.Builder builder = new KarmaRunSettings.Builder();
builder.setConfigPath(JDOMExternalizerUtil.getFirstChildValueAttribute(element, CONFIG_FILE));
builder.setBrowsers(JDOMExternalizerUtil.getFirstChildValueAttribute(element, BROWSERS));
String karmaPackageDir = JDOMExternalizerUtil.getFirstChildValueAttribute(element, KARMA_PACKAGE_DIR);
if (karmaPackageDir != null) {
builder.setKarmaPackage(new NodePackage(karmaPackageDir));
}
String interpreterRefName = JDOMExternalizerUtil.getFirstChildValueAttribute(element, NODE_INTERPRETER);
builder.setInterpreterRef(NodeJsInterpreterRef.create(interpreterRefName));
EnvironmentVariablesData envData = EnvironmentVariablesData.readExternal(element);
builder.setEnvData(envData);
KarmaScopeKind scopeKind = readScopeKind(element);
builder.setScopeKind(scopeKind);
if (scopeKind == KarmaScopeKind.TEST_FILE) {
builder.setTestFilePath(JDOMExternalizerUtil.getFirstChildValueAttribute(element, TEST_FILE_PATH));
} else if (scopeKind == KarmaScopeKind.SUITE || scopeKind == KarmaScopeKind.TEST) {
builder.setTestNames(readTestNames(element));
}
return builder.build();
}
use of com.intellij.javascript.nodejs.util.NodePackage in project intellij-plugins by JetBrains.
the class KarmaRunConfiguration method setRunSettings.
public void setRunSettings(@NotNull KarmaRunSettings runSettings) {
NodePackage newKarmaPackage = runSettings.getKarmaPackage();
NodePackage oldKarmaPackage = myRunSettings.getKarmaPackage();
if (newKarmaPackage == null || newKarmaPackage.equals(oldKarmaPackage)) {
myRunSettings = runSettings;
return;
}
Project project = getProject();
if (!KarmaUtil.isPathUnderContentRoots(project, newKarmaPackage)) {
KarmaProjectSettings.setKarmaPackage(project, newKarmaPackage);
newKarmaPackage = new NodePackage("");
}
if (newKarmaPackage.isEmptyPath() && isTemplate()) {
newKarmaPackage = null;
}
myRunSettings = runSettings.toBuilder().setKarmaPackage(newKarmaPackage).build();
}
use of com.intellij.javascript.nodejs.util.NodePackage in project intellij-plugins by JetBrains.
the class KarmaRunConfiguration method getOrInitKarmaPackage.
@NotNull
private NodePackage getOrInitKarmaPackage() {
NodePackage pkg = myRunSettings.getKarmaPackage();
if (pkg == null) {
Project project = getProject();
NodeJsLocalInterpreter interpreter = NodeJsLocalInterpreter.tryCast(myRunSettings.getInterpreterRef().resolve(project));
pkg = NodePackage.findPreferredPackage(project, KarmaUtil.NODE_PACKAGE_NAME, interpreter);
if (!pkg.isEmptyPath() && !KarmaUtil.isPathUnderContentRoots(project, pkg)) {
NodePackage projectKarmaPackage = KarmaProjectSettings.getKarmaPackage(project);
if (projectKarmaPackage.isEmptyPath()) {
KarmaProjectSettings.setKarmaPackage(project, pkg);
}
pkg = new NodePackage("");
}
myRunSettings = myRunSettings.toBuilder().setKarmaPackage(pkg).build();
}
return pkg;
}
Aggregations