当前位置: 首页>>代码示例>>Java>>正文


Java POMExtensibilityElement.getElementText方法代码示例

本文整理汇总了Java中org.netbeans.modules.maven.model.pom.POMExtensibilityElement.getElementText方法的典型用法代码示例。如果您正苦于以下问题:Java POMExtensibilityElement.getElementText方法的具体用法?Java POMExtensibilityElement.getElementText怎么用?Java POMExtensibilityElement.getElementText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.modules.maven.model.pom.POMExtensibilityElement的用法示例。


在下文中一共展示了POMExtensibilityElement.getElementText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ConfigurationImpl.java

示例2: 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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:POMComponentImpl.java

示例3: 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]);
}
 
开发者ID:vaadin,项目名称:netbeans-plugin,代码行数:41,代码来源:AddOnOptionsPanel.java

示例4: getErrorsForDocument

import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入方法依赖的package包/类
@Override
public List<ErrorDescription> getErrorsForDocument(POMModel model, Project prj,
        int selectionStart, int selectionEnd, int caretPosition) {
    List<ErrorDescription> err = new ArrayList<ErrorDescription>();
    if (prj == null) {
        return err;
    }
    DocumentComponent comp1 = model.findComponent(selectionStart);
    DocumentComponent comp2 = model.findComponent(selectionEnd);
    if (comp1 == null || comp2 == null) { //#157213
        return err;
    }
    if (comp1 == comp2 && comp1 instanceof POMExtensibilityElement) {
        POMExtensibilityElement el = (POMExtensibilityElement) comp1;
        int startPos = el.findPosition();
        startPos = startPos + el.getQName().getLocalPart().length() + 2; //2 is brackets
        String text = el.getElementText();
        int endPos = startPos + text.length();
        if (selectionStart >= startPos && selectionEnd <= endPos) {
            //we are in actual text now..
            //TODO also skip when inside expression as well..
            int offset = selectionStart - startPos;
            int endOffset = selectionEnd - startPos;
            String s = text.substring(offset, endOffset);
            if (s.length() > 0) {
                List<Fix> fixes = new ArrayList<Fix>();
                String elementName = el.getQName().getLocalPart();
                Map<String, String> props = loadAllProperties(prj, model, el, selectionStart);
                for (Map.Entry<String, String> ent : props.entrySet()) {
                    if (s.equals(ent.getValue()) && !elementName.equals(ent.getKey())) { //do not want to complete the cycle
                        fixes.add(new PropFix(text, offset, endOffset, el, model, ent.getKey()));
                    }
                }
                fixes.add(new PropFix(text, offset, endOffset, el, model));
                try {
                    Line line = NbEditorUtilities.getLine(model.getBaseDocument(), selectionEnd, false);
                    err.add(ErrorDescriptionFactory.createErrorDescription(
                            Severity.HINT,
                            TIT_TurnToPropertyHint(),
                            fixes,
                            model.getBaseDocument(), line.getLineNumber() + 1));
                } catch (IndexOutOfBoundsException iiob) {
                    //#214527
                    LOG.log(Level.FINE, "document changed", iiob);
                }
                
            }
        }
    }
    return err;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:52,代码来源:TurnToPropertyHint.java

示例5: performOperation

import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入方法依赖的package包/类
@Override
public void performOperation( POMModel model ) {
    Plugin vaadinPlugin = POMUtils.getVaadinPlugin(model);
    if (vaadinPlugin == null) {
        return;
    }

    Configuration configuration = vaadinPlugin.getConfiguration();
    if (configuration == null) {
        return;
    }
    List<POMExtensibilityElement> params = configuration
            .getExtensibilityElements();
    for (POMExtensibilityElement param : params) {
        QName qName = param.getQName();
        String name = qName.getLocalPart();
        String value = param.getElementText() == null ? "" : param
                .getElementText().trim();
        switch (name) {
            case WEBAPP_DIRECTORY:
                webApp = value;
                break;
            case PERSISTENT_UNIT_CACHEDIR:
                persistentUnitDir = value;
                break;
            case OPTIMIZATION_LEVEL:
                try {
                    optimization = Integer.parseInt(value);
                }
                catch (NumberFormatException e) {
                    optimization = -1;
                }
                break;
            case COMPILE_REPORT:
                compileReport = Boolean.parseBoolean(value);
                break;
            case STRICT:
                strict = Boolean.parseBoolean(value);
                break;
            case FORCE:
                force = Boolean.parseBoolean(value);
                break;
            case SKIP:
                skip = Boolean.parseBoolean(value);
                break;
            case VALIDATE_ONLY:
                validate = Boolean.parseBoolean(value);
                break;
            case TREE_LOGGER:
                treeLogger = Boolean.parseBoolean(value);
                break;
            case PERSISTENT_UNIT_CACHE:
                usePersistentUnitCache = Boolean.parseBoolean(value);
                break;
        }
    }
}
 
开发者ID:vaadin,项目名称:netbeans-plugin,代码行数:58,代码来源:AdvancedGwtOptionsPanel.java

示例6: performOperation

import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入方法依赖的package包/类
@Override
public void performOperation( POMModel model ) {
    Plugin vaadinPlugin = POMUtils.getVaadinPlugin(model);
    if (vaadinPlugin == null) {
        return;
    }

    Configuration configuration = vaadinPlugin.getConfiguration();
    if (configuration == null) {
        return;
    }
    List<POMExtensibilityElement> params = configuration
            .getExtensibilityElements();
    for (POMExtensibilityElement param : params) {
        QName qName = param.getQName();
        String name = qName.getLocalPart();
        String value = param.getElementText() == null ? "" : param
                .getElementText().trim();
        switch (name) {
            case JVM_ARGS:
                jvmArgs = value;
                break;
            case STYLE:
                style = JSStyle.forString(value);
                break;
            case LOG_LEVEL:
                logLevel = GwtLogLevel.forString(value);
                break;
            case LOCAL_WORKERS:
                try {
                    threads = Integer.parseInt(value);
                }
                catch (NumberFormatException ignore) {
                }
                break;
            case DRAFT:
                draft = Boolean.parseBoolean(value);
                break;
        }
    }
}
 
开发者ID:vaadin,项目名称:netbeans-plugin,代码行数:42,代码来源:GwtCompilerOptionsPanel.java

示例7: setRunTarget

import org.netbeans.modules.maven.model.pom.POMExtensibilityElement; //导入方法依赖的package包/类
private void setRunTarget( String name, POMModel model ) {
    Plugin plugin = getVaadinPlugin(model);
    if (plugin == null) {
        return;
    }
    Configuration configuration = plugin.getConfiguration();
    if (configuration == null) {
        configuration = model.getFactory().createConfiguration();
        configuration.addExtensibilityElement(createRunTarget(name, model));
        plugin.setConfiguration(configuration);
    }
    else {
        List<POMExtensibilityElement> children =
                configuration.getExtensibilityElements();
        for (POMExtensibilityElement child : children) {
            if (RUN_TARGET.equals(child.getQName().getLocalPart())) {
                String target = child.getElementText();
                URI uri;
                try {
                    uri = new URI(target);
                    URL url = uri.toURL();
                    String file = url.getFile();
                    if (file != null) {
                        if (file.length() == 0) {
                            target = target + '/' + name;
                        }
                        else if (file.length() == 1
                                && file.charAt(0) == '/')
                        {
                            target += name;
                        }
                        child.setElementText(target);
                    }
                }
                catch (URISyntaxException | MalformedURLException e) {
                    LOG.log(Level.INFO, null, e);
                }
                return;
            }
        }
        configuration.addExtensibilityElement(createRunTarget(name, model));
    }
}
 
开发者ID:vaadin,项目名称:netbeans-plugin,代码行数:44,代码来源:VaadinProjectWizardIterator.java


注:本文中的org.netbeans.modules.maven.model.pom.POMExtensibilityElement.getElementText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。