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


Java Properties类代码示例

本文整理汇总了Java中org.netbeans.modules.maven.model.pom.Properties的典型用法代码示例。如果您正苦于以下问题:Java Properties类的具体用法?Java Properties怎么用?Java Properties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Properties类属于org.netbeans.modules.maven.model.pom包,在下文中一共展示了Properties类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRemoveIdePropertyOperation

import org.netbeans.modules.maven.model.pom.Properties; //导入依赖的package包/类
private static ModelOperation<POMModel> createRemoveIdePropertyOperation() {
  return new ModelOperation<POMModel>() {
        public @Override void performOperation(POMModel model) {
            Project project = model.getProject();
            Properties properties = project.getProperties();
            if (properties != null) {
                if (properties.getProperty(OLD_PROPERTY) != null) {
                    properties.setProperty(OLD_PROPERTY, null);
                }
                String args = properties.getProperty(MASTER_PROPERTY);
                if (args != null) {
                    String ref = "${" + OLD_PROPERTY + "}"; // NOI18N
                    if (args.contains(ref)) {
                        args = args.replace(ref, "");
                        if (args.trim().length() == 0) {
                            args = null;
                        }
                        properties.setProperty(MASTER_PROPERTY, args);
                    }
                }
            }
        }
  };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:NetBeansRunParamsIDEChecker.java

示例2: performOperation

import org.netbeans.modules.maven.model.pom.Properties; //导入依赖的package包/类
@Override
public void performOperation(POMModel model) {
    String s = PluginPropertyUtils.getPluginProperty(handle.getProject(), Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER, "source", null, null);
    String t = PluginPropertyUtils.getPluginProperty(handle.getProject(), Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER, "source", null, null);
    if (s == null && t == null) {
        Project p = model.getProject();
        if (p != null) {
            Properties prop = p.getProperties();
            if (prop == null) {
                prop = model.getFactory().createProperties();
                p.setProperties(prop);
            }
            prop.setProperty("maven.compiler.source", sourceLevel);
            prop.setProperty("maven.compiler.target", sourceLevel);
        }
    } else {
        ModelUtils.setSourceLevel(model, sourceLevel);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:SourcesPanel.java

示例3: visit

import org.netbeans.modules.maven.model.pom.Properties; //导入依赖的package包/类
@Override
public void visit(Properties target) {
    Properties t = target;
    assert t != null ? t.isInDocumentModel() : true;
    if (t != null) {
        Map<String, String> props = t.getProperties();
        for (Map.Entry<String, String> ent : props.entrySet()) {
            POMCutHolder nd = childs.get(ent.getKey());
            if (nd == null) {
                nd = new SingleFieldCH(parent, ent.getKey());
                childs.put(ent.getKey(), nd);
            }
            fillValues(count, nd, ent.getValue());
        }
    }

    count++;
    
    for (POMCutHolder prop : childs.values()) {
        growToSize(count, prop);
    }


}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:POMModelVisitor.java

示例4: addProperties

import org.netbeans.modules.maven.model.pom.Properties; //导入依赖的package包/类
public void addProperties(String profile, java.util.Properties prop) {
    boolean tx = pomModel.isIntransaction();
    try {
        if (!tx) {
            pomModel.startTransaction();
        }
        org.netbeans.modules.maven.model.pom.Project pomProject = getPOMProject();
        if (profile != null) {
            Profile targetProfile = pomProject.findProfileById(profile);
            if (targetProfile == null) {
                throw new IllegalArgumentException(String.format("Profile[%s] not exist", profile));
            }
            if (targetProfile.getProperties() == null) {
                    targetProfile.setProperties(pomModel.getFactory().createProperties());
                }
            registerProperties(prop, targetProfile.getProperties());
        } else {
            registerProperties(prop, pomProject.getProperties());
        }
    } finally {
        if (!tx) {
            pomModel.endTransaction();
        }
    }
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:26,代码来源:POMManager.java

示例5: registerProperties

import org.netbeans.modules.maven.model.pom.Properties; //导入依赖的package包/类
private Properties registerProperties(java.util.Properties source, Properties target) {
        if (source != null && !source.isEmpty()) {
            if (target == null) {
                target = pomModel.getFactory().createProperties();
            }
            for (String sourceKey : source.stringPropertyNames()) {
                String sourceValue = source.getProperty(sourceKey);
//                String targetValue = target.getProperty(sourceKey);
//                if (targetValue == null) {
                target.setProperty(sourceKey, sourceValue);
//                }
            }
        }
        return target;
    }
 
开发者ID:jeddict,项目名称:jCode,代码行数:16,代码来源:POMManager.java

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

示例7: readOptions

import org.netbeans.modules.maven.model.pom.Properties; //导入依赖的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

示例8: getVaadinVersion

import org.netbeans.modules.maven.model.pom.Properties; //导入依赖的package包/类
public static String getVaadinVersion( POMModel model ) {
    Properties properties = model.getProject().getProperties();
    if (properties != null) {
        return properties.getProperty(VAADIN_PLUGIN_VERSION);
    }
    return null;
}
 
开发者ID:vaadin,项目名称:netbeans-plugin,代码行数:8,代码来源:POMUtils.java

示例9: performOperation

import org.netbeans.modules.maven.model.pom.Properties; //导入依赖的package包/类
@Override
public void performOperation(POMModel model) {
    org.netbeans.modules.maven.model.pom.Project root = model.getProject();
    if (root != null) {
        MavenProject parent = context.getParent();
        if (parent != null) {
            Parent parentpom = model.getFactory().createParent();
            parentpom.setGroupId(parent.getGroupId());
            parentpom.setArtifactId(parent.getArtifactId());
            parentpom.setVersion(parent.getVersion());
            File pfile = FileUtil.normalizeFile(parent.getFile());
            String rel = FileUtilities.relativizeFile(context.getProjectDirectory(), pfile);
            if (rel != null) {
                if ("..".equals(rel) || "../pom.xml".equals(rel)) {
                    
                } else {
                    parentpom.setRelativePath(rel);
                }
            } else {
                parentpom.setRelativePath("");
            }
            root.setPomParent(parentpom);
            
        }
        if (parent == null || !context.getGroupId().equals(parent.getGroupId())) {
            root.setGroupId(context.getGroupId());
        }
        root.setArtifactId(context.getArtifactId());
        if (parent == null || !context.getVersion().equals(parent.getVersion())) {
            root.setVersion(context.getVersion());
        }
        root.setPackaging(packaging);
        
        boolean setEncoding = true;
        if (parent != null) {
            java.util.Properties parentprops = parent.getProperties();
            if (parentprops != null && parentprops.containsKey("project.build.sourceEncoding")) {
                setEncoding = false;
            }
        }
        if (setEncoding) {
            Properties props = root.getProperties();
            if (props == null) {
                props = model.getFactory().createProperties();
                root.setProperties(props);
            }
            props.setProperty("project.build.sourceEncoding", "UTF-8");
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:51,代码来源:CreateProjectBuilder.java

示例10: CheckstylePanel

import org.netbeans.modules.maven.model.pom.Properties; //导入依赖的package包/类
CheckstylePanel(ModelHandle2 hndl, ProjectCustomizer.Category cat) {
    initComponents();
    this.handle = hndl;
    category = cat;
    checkboxUpdater = new CheckBoxUpdater(cbEnable) {
        
        private String modifiedValue;
        
        private ModelOperation<POMModel> operation = new ModelOperation<POMModel>() {
        @Override
            public void performOperation(POMModel model) {
                Properties modprops = model.getProject().getProperties();
                if (modprops == null) {
                    modprops = model.getFactory().createProperties();
                    model.getProject().setProperties(modprops);
                }
                modprops.setProperty(Constants.HINT_CHECKSTYLE_FORMATTING, modifiedValue);
            }
            
        };
        
        @Override
        public Boolean getValue() {
            String val = modifiedValue;
            if (val == null) {
                Properties props = handle.getPOMModel().getProject().getProperties();
                if (props != null) {
                    val = props.getProperty(Constants.HINT_CHECKSTYLE_FORMATTING);
                }
            }
            if (val == null) {
                val = handle.getRawAuxiliaryProperty(Constants.HINT_CHECKSTYLE_FORMATTING, true);
            }
            if (val != null) {
                Boolean ret = Boolean.parseBoolean(val);
                return ret;
            }
            return null;
        }

        @Override
        public boolean getDefaultValue() {
            return Boolean.FALSE;
        }

        @Override
        public void setValue(Boolean value) {
            handle.removePOMModification(operation);
            modifiedValue = null;
            
            String val = value != null ? value.toString() : null;
            boolean hasConfig = handle.getRawAuxiliaryProperty(Constants.HINT_CHECKSTYLE_FORMATTING, true) != null;
            //TODO also try to take the value in pom vs inherited pom value into account.

            if (handle.getProject().getProperties().containsKey(Constants.HINT_CHECKSTYLE_FORMATTING)) {
                modifiedValue = val;
                handle.addPOMModification(operation);
                if (hasConfig) {
                    // in this case clean up the auxiliary config
                    handle.setRawAuxiliaryProperty(Constants.HINT_CHECKSTYLE_FORMATTING, null, true);
                }
                return;
            }
            handle.setRawAuxiliaryProperty(Constants.HINT_CHECKSTYLE_FORMATTING, val, true);
        }
    };

    btnLearnMore.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    btnLearnMore.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                HtmlBrowser.URLDisplayer.getDefault().showURL(new URL("http://maven.apache.org/plugins/maven-checkstyle-plugin"));
            } catch (MalformedURLException ex) {
                Exceptions.printStackTrace(ex);
            }
        }

    });

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:82,代码来源:CheckstylePanel.java

示例11: visit

import org.netbeans.modules.maven.model.pom.Properties; //导入依赖的package包/类
@Override
public void visit(Properties target) {
    visitComponent(target);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:DefaultVisitor.java

示例12: createProperties

import org.netbeans.modules.maven.model.pom.Properties; //导入依赖的package包/类
private Properties createProperties( POMModel model, String version ) {
    Properties properties = model.getFactory().createProperties();
    properties.addExtensibilityElement(createVersion(model, version));
    return properties;
}
 
开发者ID:vaadin,项目名称:netbeans-plugin,代码行数:6,代码来源:VaadinOptionsPanel.java

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


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