本文整理汇总了Java中org.netbeans.modules.maven.model.pom.Properties.getExtensibilityElements方法的典型用法代码示例。如果您正苦于以下问题:Java Properties.getExtensibilityElements方法的具体用法?Java Properties.getExtensibilityElements怎么用?Java Properties.getExtensibilityElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.modules.maven.model.pom.Properties
的用法示例。
在下文中一共展示了Properties.getExtensibilityElements方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performOperation
import org.netbeans.modules.maven.model.pom.Properties; //导入方法依赖的package包/类
@Override
public void performOperation( POMModel model ) {
Properties properties = model.getProject().getProperties();
if (properties == null) {
model.getProject().setProperties(
createProperties(model, myVersion));
}
else {
List<POMExtensibilityElement> props =
properties.getExtensibilityElements();
boolean versionSet = false;
for (POMExtensibilityElement prop : props) {
if (prop.getQName().getLocalPart()
.equals(POMUtils.VAADIN_PLUGIN_VERSION))
{
String newVersion = myVersion;
if (newVersion.equals(prop.getElementText())) {
return;
}
prop.setElementText(newVersion);
versionSet = true;
break;
}
}
if (!versionSet) {
properties.addExtensibilityElement(createVersion(model,
myVersion));
}
}
}
示例2: performOperation
import org.netbeans.modules.maven.model.pom.Properties; //导入方法依赖的package包/类
@Override
public void performOperation( POMModel model ) {
Properties properties = model.getProject().getProperties();
boolean needProperties = properties == null;
if (needProperties) {
properties = model.getFactory().createProperties();
}
List<POMExtensibilityElement> props =
properties.getExtensibilityElements();
Map<String, POMExtensibilityElement> values = new HashMap<>();
for (POMExtensibilityElement param : props) {
values.put(param.getQName().getLocalPart(), param);
}
String version =
(String) myVaadinVersion.getModel().getSelectedItem();
if (version != null) {
POMExtensibilityElement versionElement =
values.get(POMUtils.VAADIN_PLUGIN_VERSION);
if (versionElement == null) {
versionElement =
POMUtils.createElement(model,
POMUtils.VAADIN_PLUGIN_VERSION,
version.toString());
properties.addExtensibilityElement(versionElement);
}
else {
String oldValue = POMUtils.getValue(versionElement);
if (oldValue == null
|| !oldValue.equals(version.toString()))
{
versionElement.setElementText(version.toString());
}
}
}
POMUtils.setTextField(IMPLEMENTATION_TITLE, values, myImplTitle,
properties);
POMUtils.setTextField(IMPLEMENTATION_VERSION, values,
myImplVersion, properties);
POMUtils.setTextField(IMPLEMENTATION_VENDOR, values, myImplVendor,
properties);
if (needProperties) {
model.getProject().setProperties(properties);
}
POMExtensibilityElement widgetsets = POMUtils.getWidgetsets(model);
if (widgetsets == null) {
POMUtils.createWidgetset(model, myWidgetset.getText().trim());
}
else {
POMUtils.setWidgetset(widgetsets, myWidgetset.getText().trim());
}
}