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


Java Parameters类代码示例

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


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

示例1: SourceLevelSelector

import org.openide.util.Parameters; //导入依赖的package包/类
SourceLevelSelector(
        @NonNull final PropertyEvaluator eval,
        @NonNull final String sourceLevelPropName,
        @NonNull final List<? extends Supplier<? extends ClassPath>> cpFactories) {
    Parameters.notNull("eval", eval);   //NOI18N
    Parameters.notNull("sourceLevelPropName", sourceLevelPropName); //NOI18N
    Parameters.notNull("cpFactories", cpFactories); //NOI18N
    if (cpFactories.size() != 2) {
        throw new IllegalArgumentException("Invalid classpaths: " + cpFactories);  //NOI18N
    }
    for (Supplier<?> f : cpFactories) {
        if (f == null) {
            throw new NullPointerException("Classpaths contain null: " + cpFactories);  //NOI18N
        }
    }
    this.eval = eval;
    this.sourceLevelPropName = sourceLevelPropName;
    this.cpfs = cpFactories;
    this.listeners = new PropertyChangeSupport(this);
    this.cps = new ClassPath[2];
    this.eval.addPropertyChangeListener(WeakListeners.propertyChange(this, this.eval));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:ClassPathProviderImpl.java

示例2: getWhiteListViolations

import org.openide.util.Parameters; //导入依赖的package包/类
/**
 * Utility method to check the given {@link CompilationUnitTree} for white list violations.
 * @param unit the {@link CompilationUnitTree} to be analyzed
 * @param whitelist the {@link WhiteList} to use to check the violations
 * @param trees the {@link Trees} service
 * @param cancel the cancel request. If the {@link Callable} returns true the check is canceled
 * and null is returned.
 * @return a {@link Map} of {@link Tree}s with attached white list violations or null when the
 * scan was canceled.
 */
@CheckForNull
public static Map<? extends Tree, ? extends WhiteListQuery.Result> getWhiteListViolations(
        @NonNull final CompilationUnitTree unit,
        @NonNull final WhiteListQuery.WhiteList whitelist,
        @NonNull final Trees trees,
        @NullAllowed final Callable<Boolean> cancel) {
    Parameters.notNull("tree", unit);           //NOI18N
    Parameters.notNull("whitelist", whitelist); //NOI18N
    Parameters.notNull("trees", trees);         //NOI18N
    final Map<Tree,WhiteListQuery.Result> result = new HashMap<Tree, Result>();
    final WhiteListScanner scanner = new WhiteListScanner(trees, whitelist, cancel);
    try {
        scanner.scan(unit, result);
        return result;
    } catch (WhiteListScanner.Cancel ce) {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:WhiteListSupport.java

示例3: getProfile

import org.openide.util.Parameters; //导入依赖的package包/类
/**
 * Return a {@link SourceLevelQuery.Profile} for an item obtained from the ComboBoxModel created by
 * the {@link PlatformUiSupport#createProfileComboBoxModel} method.
 * This method can return <code>null</code> if the profile is broken.
 * @param profileKey an item obtained from {@link ComboBoxModel} created by
 *                    {@link PlatformUiSupport#createProfileComboBoxModel}.
 * @return {@link SourceLevelQuery.Profile} or <code>null</code> in case when profile is broken.
 * @throws IllegalArgumentException if the input parameter is not an object created by profile combobox model.
 * @since 1.57
 */
@CheckForNull
public static SourceLevelQuery.Profile getProfile(@NonNull final Object profileKey) {
    Parameters.notNull("profileKey", profileKey);   //NOI18N
    if (profileKey instanceof Union2) {
        final Union2 u2 = (Union2)profileKey;
        if (u2.hasFirst()) {
            final Object profile = u2.first();
            if (profile instanceof SourceLevelQuery.Profile) {
                return (SourceLevelQuery.Profile) profile;
            } else {
                throw new IllegalArgumentException(profile.getClass().getName());
            }
        } else {
            return null;
        }
    } else {
        throw  new IllegalArgumentException(profileKey.getClass().getName());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:PlatformUiSupport.java

示例4: FilterNode

import org.openide.util.Parameters; //导入依赖的package包/类
/** Constructs new filter node with a provided children and lookup.
 * The lookup is used to implement {@link FilterNode#getCookie} calls that just call
 * <code>lookup.lookup(clazz)</code>. If this constructor is used,
 * the code shall not override {@link FilterNode#getCookie} method, but do all
 * its state manipulation in the lookup. Look at {@link Node#Node}
 * constructor for best practices usage of this constructor.
 *
 * @param original the node we delegate to
 * @param children the children to use for the filter node or <code>null</code> if
 *    default children should be provided
 * @param lookup lookup to use. Do not pass <CODE>orginal.getLookup()</CODE> into this parameter.
 *        In such case use the {@link #FilterNode(Node, Children)} constructor.
 *
 * @since 4.4
 */
public FilterNode(Node original, org.openide.nodes.Children children, Lookup lookup) {
    super(
        (children == null) ? (original.isLeaf() ? org.openide.nodes.Children.LEAF : new Children(original)) : children,
        lookup
    );

    Parameters.notNull("original", original);

    this.childrenProvided = children != null;
    this.lookupProvided = lookup != null && !(lookup instanceof FilterLookup);
    this.original = original;
    init();

    Lookup lkp = internalLookup(false);

    if (lkp instanceof FilterLookup) {
        ((FilterLookup) lkp).ownNode(this);
    } else {
        if (lkp == null) {
            // rely on default NodeLookup around getCookie. 
            getNodeListener();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:FilterNode.java

示例5: createSimpleScriptAction

import org.openide.util.Parameters; //导入依赖的package包/类
/**
 * Creates a simple {@link ScriptAction} for given command performing given targets.
 * The action just calls the given targets in project's build file.
 * The action does not support Compile On Save.
 * @param command the action command
 * @param requiresValidJavaPlatform if true the action is not executed when the project has invalid platform
 * @param javaModelSensitive if true the action requires java model
 * @param scanSensitive if true the action needs to wait for scan finish
 * @param enabledInCoS if true the action is enabled in compile on save mode
 * @param targets the targets to execute
 * @return the newly created {@link ScriptAction}
 * @since 1.109
 */
@NonNull
public ScriptAction createSimpleScriptAction(
        @NonNull final String command,
        final boolean requiresValidJavaPlatform,
        final boolean javaModelSensitive,
        final boolean scanSensitive,
        final boolean enabledInCoS,
        @NonNull final String... targets) {
    Parameters.notNull("targets", targets); //NOI18N
    return createSimpleScriptAction(
            command,
            requiresValidJavaPlatform,
            javaModelSensitive,
            scanSensitive,
            enabledInCoS,
            (ctx) -> true,
            () -> targets);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:JavaActionProvider.java

示例6: removeFromPath

import org.openide.util.Parameters; //导入依赖的package包/类
/**
 * Removes the path entry from path.
 * @param path to remove the netry from
 * @param toRemove the entry to be rmeoved from the path
 * @return new path with removed entry
 */
@NonNull
public static String removeFromPath(@NonNull final String path, @NonNull final String toRemove) {
    Parameters.notNull("path", path);   //NOI18N
    Parameters.notNull("toRemove", toRemove); //NOI18N
    final StringBuilder sb = new StringBuilder();
    for (String entry : PropertyUtils.tokenizePath(path)) {
        if (toRemove.equals(entry)) {
            continue;
        }
        sb.append(entry);
        sb.append(':'); //NOI18N
    }
    return sb.length() == 0 ?
        sb.toString() :
        sb.substring(0, sb.length()-1);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:JFXProjectUtils.java

示例7: ProjectOperationsBuilder

import org.openide.util.Parameters; //导入依赖的package包/类
private ProjectOperationsBuilder(
    @NonNull final Project project,
    @NonNull final PropertyEvaluator eval,
    @NonNull final UpdateHelper helper,
    @NonNull final ReferenceHelper refHelper,
    @NonNull final SourceRoots sources,
    @NonNull final SourceRoots tests) {
    Parameters.notNull("project", project); //NOI18N
    Parameters.notNull("eval", eval);   //NOI18N
    Parameters.notNull("helper", helper);   //NOI18N
    Parameters.notNull("refHelper", refHelper); //NOI18N
    Parameters.notNull("sources", sources); //NOI18N
    Parameters.notNull("tests", tests); //NOI18N
    this.project = project;
    this.eval = eval;
    this.helper = helper;
    this.refHelper = refHelper;
    this.sources = sources;
    this.tests = tests;
    this.additionalMetadataFiles = new ArrayList<>();
    this.additionalDataFiles = new ArrayList<>();
    this.cleanTargets = new ArrayList<>();            
    this.privateProps = new HashSet<>();
    this.updatedProps = new HashMap<>();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ProjectOperations.java

示例8: init

import org.openide.util.Parameters; //导入依赖的package包/类
private void init() {
    errorLabel.setText(" "); // NOI18N
    GroupLayout containerPanelLayout = new GroupLayout(containerPanel);
    containerPanel.setLayout(containerPanelLayout);
    GroupLayout.ParallelGroup horizontalGroup = containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
    GroupLayout.SequentialGroup verticalGroup = containerPanelLayout.createSequentialGroup();
    containerPanelLayout.setHorizontalGroup(horizontalGroup);
    containerPanelLayout.setVerticalGroup(
        containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(verticalGroup)
    );
    for (CssPreprocessorUIImplementation.Options options : allOptions) {
        JComponent component = options.getComponent();
        Parameters.notNull("component", component); // NOI18N
        horizontalGroup.addComponent(component, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);
        verticalGroup.addComponent(component, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:CssPrepOptionsPanel.java

示例9: isCompileOnSaveSupported

import org.openide.util.Parameters; //导入依赖的package包/类
public static boolean isCompileOnSaveSupported(final J2SEModularProject project) {
    Parameters.notNull("project", project);
    final Map<String,String> props = project.evaluator().getProperties();
    if (props == null) {
        LOG.warning("PropertyEvaluator mapping could not be computed (e.g. due to a circular definition)");  //NOI18N
    }
    else {
        for (Entry<String, String> e : props.entrySet()) {
            if (e.getKey().startsWith(ProjectProperties.COMPILE_ON_SAVE_UNSUPPORTED_PREFIX)) {
                if (e.getValue() != null && Boolean.valueOf(e.getValue())) {
                    return false;
                }
            }
        }                    
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:J2SEModularProjectUtil.java

示例10: setBreadcrumbs

import org.openide.util.Parameters; //导入依赖的package包/类
@Deprecated
public static void setBreadcrumbs(@NonNull Document doc, @NonNull final Node root, @NonNull final Node selected) {
    Parameters.notNull("doc", doc);
    Parameters.notNull("root", root);
    Parameters.notNull("selected", selected);
    
    final ExplorerManager manager = HolderImpl.get(doc).getManager();

    Children.MUTEX.writeAccess(new Action<Void>() {
        @Override public Void run() {
            manager.setRootContext(root);
            manager.setExploredContext(selected);
            return null;
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BreadcrumbsController.java

示例11: DataSource

import org.openide.util.Parameters; //导入依赖的package包/类
DataSource(
    @NonNull final String propName,
    @NonNull final JLabel label,
    @NonNull final JComboBox<?> configCombo,
    @NonNull final Map<String,Map<String,String>> configs) {
    Parameters.notNull("propName", propName);   //NOI18N
    Parameters.notNull("label", label);         //NOI18N
    Parameters.notNull("configCombo", configCombo); //NOI18N
    Parameters.notNull("configs", configs); //NOI18N
    this.propName = propName;
    this.label = label;
    this.configCombo = configCombo;
    this.configs = configs;
    basefont = label.getFont();
    boldfont = basefont.deriveFont(Font.BOLD);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:CustomizerRun.java

示例12: getContext

import org.openide.util.Parameters; //导入依赖的package包/类
/**
 * Returns the context for given {@link FileObject} indexing.
 * @param file the {@link FileObject} to get indexing context for
 * @return the context represented by {@link Lookup}
 */
@NonNull
public static Lookup getContext(@NonNull FileObject file) {
    Parameters.notNull("file", file);   //NOI18N
    for (ContextProvider cp : getImpls()) {
        final Lookup res = cp.findContext(file);
        if (res != null) {
            return res;
        }
    }
    throw new IllegalStateException("Missing DefaultContextProvider");  //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ContextProvider.java

示例13: getSpringScope

import org.openide.util.Parameters; //导入依赖的package包/类
/**
 * Finds the Spring scope that contains (or could contain) a given file.
 *
 * @param  fo a file; never null.
 * @return the Spring scope or null.
 */
public static SpringScope getSpringScope(FileObject fo) {
    Parameters.notNull("fo", fo);
    Project project = FileOwnerQuery.getOwner(fo);
    if (project == null) {
        return null;
    }
    ProjectSpringScopeProvider provider = project.getLookup().lookup(ProjectSpringScopeProvider.class);
    if (provider == null) {
        return null;
    }
    return provider.getSpringScope();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:SpringScope.java

示例14: getArchiveFile

import org.openide.util.Parameters; //导入依赖的package包/类
/**
 * Returns a FileObject representing an archive file containing the
 * FileObject given by the parameter.
 * <strong>Remember</strong> that any path within the archive is discarded
 * so you may need to check for non-root entries.
 * @param fo a file in an archive filesystem
 * @return the file corresponding to the archive itself,
 *         or null if <code>fo</code> is not an archive entry
 * @since 4.48
 */
public static FileObject getArchiveFile(FileObject fo) {
    Parameters.notNull("fo", fo);   //NOI18N
    for (ArchiveRootProvider provider : getArchiveRootProviders()) {
        if (provider.isArchiveArtifact(fo)) {
            final FileObject file = provider.getArchiveFile(fo);
            if (file != null) {
                return file;
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:FileUtil.java

示例15: runDeferred

import org.openide.util.Parameters; //导入依赖的package包/类
private void runDeferred(@NonNull final Runnable r) {
    Parameters.notNull("r", r); //NOI18N
    ProjectManager.mutex().postReadRequest(new Runnable() {
        @Override
        public void run() {
            ProjectManager.mutex().postWriteRequest(r);
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:J2SEDeployGeneratedFilesInterceptor.java


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