本文整理汇总了Java中org.netbeans.modules.maven.model.pom.POMExtensibilityElement类的典型用法代码示例。如果您正苦于以下问题:Java POMExtensibilityElement类的具体用法?Java POMExtensibilityElement怎么用?Java POMExtensibilityElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
POMExtensibilityElement类属于org.netbeans.modules.maven.model.pom包,在下文中一共展示了POMExtensibilityElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOrCreateChild
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
/**
* Returns child element of given parent, specified by its local name.
* Creates such child in case it doesn't exist.
*
* @param parent parent element
* @param localQName local name of the child
* @param pomModel whole pom model
* @return existing or newly created child
*/
public static POMExtensibilityElement getOrCreateChild (POMComponent parent, String localQName, POMModel pomModel) {
POMExtensibilityElement result = null;
for (POMExtensibilityElement el : parent.getExtensibilityElements()) {
if (localQName.equals(el.getQName().getLocalPart())) {
result = el;
break;
}
}
if (result == null) {
result = pomModel.getFactory().
createPOMExtensibilityElement(new QName(localQName));
parent.addExtensibilityElement(result);
}
return result;
}
示例2: setSimpleParameter
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
@Override
public void setSimpleParameter(String parameter, String value) {
List<POMExtensibilityElement> list = getConfigurationElements();
for (POMExtensibilityElement e : list) {
if (parameter.equals(e.getQName().getLocalPart())) {
if (value == null) {
removeChild(e.getQName().getLocalPart(), e);
} else {
e.setElementText(value);
}
return;
}
}
if (value != null) {
POMExtensibilityElement el = getModel().getFactory().createPOMExtensibilityElement(POMQName.createQName(parameter));
el.setElementText(value);
addExtensibilityElement(el);
}
}
示例3: createContextPath
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
private POMExtensibilityElement createContextPath( String name,
POMModel model )
{
QName qname =
POMQName.createQName(CONTEXT_PATH, model.getPOMQNames()
.isNSAware());
POMExtensibilityElement contextPath =
model.getFactory().createPOMExtensibilityElement(qname);
String cPath = "/";
try {
cPath += URLEncoder.encode(name, UTF_8);
}
catch (UnsupportedEncodingException ignore) {
}
contextPath.setElementText(cPath);
return contextPath;
}
示例4: createWidgetset
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
public static void createWidgetset( POMModel model, String widgetset ) {
POMExtensibilityElement manifest = getManifestEntries(model);
if (manifest == null) {
Plugin plugin = getJarPlugin(model);
if (plugin != null) {
Configuration configuration = plugin.getConfiguration();
if (configuration == null) {
configuration = model.getFactory().createConfiguration();
createArchive(configuration, widgetset);
plugin.setConfiguration(configuration);
}
else {
createWidgetset(configuration, widgetset);
}
}
}
else {
createWidgetset(manifest, widgetset);
}
}
示例5: setBooleanVaue
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
public static void setBooleanVaue( String optionName,
Map<String, POMExtensibilityElement> values, JCheckBox checkBox,
Configuration configuration )
{
POMExtensibilityElement element = values.get(optionName);
boolean isEnabled = checkBox.isSelected();
if (element == null) {
if (isEnabled) {
configuration.addExtensibilityElement(POMUtils.createElement(
configuration.getModel(), optionName,
Boolean.TRUE.toString()));
}
}
else {
String value = getValue(element);
if (!value.equals(Boolean.toString(isEnabled))) {
element.setElementText(Boolean.toString(isEnabled));
}
}
}
示例6: performOperation
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
@Override
public void performOperation(POMModel model) {
Configuration config = config(model);
if (modifiedValue != null) {
config.setSimpleParameter(property, modifiedValue != null ? Boolean.toString(modifiedValue) : Boolean.toString(getDefaultValue()));
} else {
//TODO for this case config(model) method which creates the configuration element is wrong..
POMExtensibilityElement e = ModelUtils.getOrCreateChild(config, property, config.getModel());
config.removeExtensibilityElement(e);
}
}
示例7: visit
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
@Override
public void visit(POMExtensibilityElement target) {
POMExtensibilityElement t = target;
assert t != null ? t.isInDocumentModel() : true;
if (t != null) {
doVisit(t.getAnyElements());
}
count++;
for (POMCutHolder prop : childs.values()) {
growToSize(count, prop);
}
}
示例8: getSimpleParameter
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
@Override
public String getSimpleParameter(String parameter) {
List<POMExtensibilityElement> list = getConfigurationElements();
for (POMExtensibilityElement e : list) {
if (parameter.equals(e.getQName().getLocalPart())) {
return e.getElementText();
}
}
return null;
}
示例9: getChildElementText
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
/**
* overrides the parent method as that one cannot be rollbacked.
* see testModelWrite() test.
* @param qname
* @return
*/
@Override
public String getChildElementText(QName qname) {
List<POMExtensibilityElement> els = getChildren(POMExtensibilityElement.class);
for (POMExtensibilityElement el : els) {
if (el.getQName().equals(qname)) {
return el.getElementText();
}
}
return null;
}
示例10: findChildElementPosition
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
@Override
public int findChildElementPosition(QName qname) {
List<POMExtensibilityElement> els = getChildren(POMExtensibilityElement.class);
for (POMExtensibilityElement el : els) {
if (el.getQName().equals(qname)) {
return el.findPosition();
}
}
return -1;
}
示例11: PropFix
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
private PropFix(String oldValue, int offset, int endOffset, POMExtensibilityElement el, POMModel model, String key) {
mdl = model;
this.old = oldValue;
start = offset;
end = endOffset;
this.key = key;
element = el;
}
示例12: getPomTargets
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
private List<String> getPomTargets( POMExtensibilityElement scanTargets ) {
List<POMExtensibilityElement> targets = scanTargets
.getExtensibilityElements();
List<String> result = new ArrayList<>(targets.size());
for (POMExtensibilityElement target : targets) {
if (target.getQName().getLocalPart().equals(SCAN_TARGET)) {
result.add(target.getElementText().trim());
}
}
return result;
}
示例13: performOperation
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的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));
}
}
}
示例14: createVersion
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
private POMExtensibilityElement createVersion( POMModel model,
String value )
{
QName qname =
POMQName.createQName(POMUtils.VAADIN_PLUGIN_VERSION, model
.getPOMQNames().isNSAware());
POMExtensibilityElement version =
model.getFactory().createPOMExtensibilityElement(qname);
version.setElementText(value);
return version;
}
示例15: readOptions
import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入依赖的package包/类
private void readOptions( Lookup context ) {
Project project = context.lookup(Project.class);
NbMavenProject mvnProject =
project.getLookup().lookup(NbMavenProject.class);
MavenProject mavenProject = mvnProject.getMavenProject();
File file = mavenProject.getFile();
FileObject pom = FileUtil.toFileObject(FileUtil.normalizeFile(file));
final String[] version = new String[1];
final String[] title = new String[1];
final String[] vendor = new String[1];
final String[] widgetset = new String[1];
ModelOperation<POMModel> operation = new ModelOperation<POMModel>() {
@Override
public void performOperation( POMModel model ) {
Properties properties = model.getProject().getProperties();
if (properties != null) {
version[0] = properties.getProperty(IMPLEMENTATION_VERSION);
title[0] = properties.getProperty(IMPLEMENTATION_TITLE);
vendor[0] = properties.getProperty(IMPLEMENTATION_VENDOR);
}
POMExtensibilityElement widgetsets =
POMUtils.getWidgetsets(model);
if (widgetsets != null) {
widgetset[0] = widgetsets.getElementText();
if (widgetset[0] != null) {
widgetset[0] = widgetset[0].trim();
}
}
}
};
Utilities.performPOMModelOperations(pom,
Collections.singletonList(operation));
myImplTitle.setText(title[0]);
myImplVersion.setText(version[0]);
myImplVendor.setText(vendor[0]);
myWidgetset.setText(widgetset[0]);
}