use of org.erlide.core.builder.CompilerOption.PathsOption in project erlide_eclipse by erlang.
the class CompilerOptions method store.
public void store() throws BackingStoreException {
for (final CompilerOption option : ALL_OPTIONS) {
final Object value = options.get(option);
if (option instanceof BooleanOption) {
final Boolean val = (Boolean) value;
helper.putString(option.getName(), val.toString());
} else if (option instanceof PathsOption) {
if (value != null) {
@SuppressWarnings("unchecked") final Iterable<String> avalue = (Iterable<String>) value;
helper.putString(option.getName(), PathsOption.toString(avalue));
} else {
helper.remove(option.getName());
}
} else if (option instanceof ModuleOption) {
if (value != null) {
final String avalue = (String) value;
helper.putString(option.getName(), avalue);
} else {
helper.remove(option.getName());
}
} else if (option instanceof RawOption) {
if (value != null) {
final String avalue = (String) value;
helper.putString(option.getName(), avalue);
} else {
helper.remove(option.getName());
}
} else {
if (value != null) {
@SuppressWarnings("unchecked") final Collection<Pair<String, String>> val = (Collection<Pair<String, String>>) value;
helper.putString(option.getName(), val.toString());
} else {
helper.remove(option.getName());
}
}
}
helper.flush();
}
use of org.erlide.core.builder.CompilerOption.PathsOption in project erlide_eclipse by erlang.
the class CompilerOptions method export.
@SuppressWarnings("unchecked")
public OtpErlangList export() {
final List<OtpErlangObject> result = new ArrayList<>();
for (final CompilerOption option : ALL_OPTIONS) {
final Object optionValue = options.get(option);
if (optionValue != null) {
if (option instanceof BooleanOption) {
final OtpErlangObject val = ((BooleanOption) option).toTerm((Boolean) optionValue);
if (val != null) {
result.add(val);
}
} else if (option instanceof PathsOption) {
final Iterable<String> value = (Iterable<String>) optionValue;
final OtpErlangList val = (OtpErlangList) ((PathsOption) option).toTerm(value);
for (final OtpErlangObject inc : val.elements()) {
result.add(inc);
}
} else if (option instanceof ModuleOption) {
final String value = (String) optionValue;
final OtpErlangObject val = ((ModuleOption) option).toTerm(value);
result.add(val);
} else if (option instanceof RawOption) {
final String value = (String) optionValue;
final OtpErlangList val = (OtpErlangList) ((RawOption) option).toTerm(value);
for (final OtpErlangObject item : val.elements()) {
result.add(item);
}
} else {
try {
final OtpErlangList val = ((DefineOption) option).toTerm((List<Pair<String, String>>) optionValue);
if (val != null) {
result.addAll(Lists.newArrayList(val.elements()));
}
} catch (final OtpParserException e) {
ErlLogger.warn(e);
}
}
}
}
final OtpErlangList list = OtpErlang.mkList(result);
return list;
}
Aggregations