本文整理汇总了Java中org.openide.modules.Dependency.TYPE_NEEDS属性的典型用法代码示例。如果您正苦于以下问题:Java Dependency.TYPE_NEEDS属性的具体用法?Java Dependency.TYPE_NEEDS怎么用?Java Dependency.TYPE_NEEDS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.openide.modules.Dependency
的用法示例。
在下文中一共展示了Dependency.TYPE_NEEDS属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
@Override
public String toString () {
StringBuilder buf = new StringBuilder(100);
buf.append ("Key[");
if (type == Dependency.TYPE_MODULE) {
buf.append("module "); // NOI18N
} else if (type == Dependency.TYPE_PACKAGE) {
buf.append("package "); // NOI18N
} else if (type == Dependency.TYPE_REQUIRES) {
buf.append("requires "); // NOI18N
} else if (type == Dependency.TYPE_NEEDS) {
buf.append("needs "); // NOI18N
} else if (type == Dependency.TYPE_RECOMMENDS) {
buf.append("recommends "); // NOI18N
}
buf.append(name);
buf.append (']');
return buf.toString();
}
示例2: clearProblemCache
private void clearProblemCache(Map<Module,Set<Union2<Dependency,InvalidException>>> mP) {
Iterator<Map.Entry<Module,Set<Union2<Dependency,InvalidException>>>> it = mP.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Module,Set<Union2<Dependency,InvalidException>>> entry = it.next();
Module m = entry.getKey();
if (! m.isEnabled()) {
Set<Union2<Dependency,InvalidException>> s = entry.getValue();
if (s != null) {
boolean clear = false;
for (Union2<Dependency,InvalidException> problem : s) {
if (problem.hasSecond()) {
// Hard problem, skip this one.
continue;
}
Dependency dep = problem.first();
if (dep.getType() != Dependency.TYPE_MODULE &&
dep.getType() != Dependency.TYPE_REQUIRES &&
dep.getType() != Dependency.TYPE_NEEDS &&
dep.getType() != Dependency.TYPE_RECOMMENDS
) {
// Also a hard problem.
continue;
}
// Some soft problems found, i.e. module deps. Clear them all.
// #76917: Even clear any hard problems.
clear = true;
break;
}
if (clear || s.isEmpty()) { // leave alone only if all hard problems
it.remove();
firer.change(new ChangeFirer.Change(m, Module.PROP_PROBLEMS, null, null));
}
}
// if we never computed anything, make no change now
}
// enabled modules are definitely OK, no change there
}
}
示例3: addToDisableList
private void addToDisableList(Set<Module> willDisable, Module m) {
if (willDisable.contains(m)) {
// E.g. if original set had A then B, B depends on A.
return;
}
willDisable.add(m);
// Find any modules depending on this one which are currently enabled.
// (And not already here.)
// If there are any, add them.
for (Module other : modules) {
if (other.isFixed() || ! other.isEnabled() || willDisable.contains(other)) {
continue;
}
Dependency[] depenencies = other.getDependenciesArray();
for (int i = 0; i < depenencies.length; i++) {
Dependency dep = depenencies[i];
if (dep.getType() == Dependency.TYPE_MODULE) {
if (Util.parseCodeName(dep.getName())[0].equals(m.getCodeNameBase())) {
// Need to disable this one too.
addToDisableList(willDisable, other);
// No need to scan the rest of its dependencies.
break;
}
} else if (
dep.getType() == Dependency.TYPE_REQUIRES ||
dep.getType() == Dependency.TYPE_NEEDS
) {
if (m.provides(dep.getName())) {
// Careful. There may be some third module still enabled which
// provides this same token too.
boolean foundOne = false;
for (Module third: getEnabledModules()) {
if (third.isEnabled() &&
!willDisable.contains(third) &&
third.provides(dep.getName())) {
foundOne = true;
break;
}
}
if (!foundOne) {
// Nope, we were the only/last one to provide it.
addToDisableList(willDisable, other);
break;
}
}
}
// else some other kind of dependency, we do not care
}
}
}
示例4: searchForUnusedAutoloads
private boolean searchForUnusedAutoloads(Set<Module> willDisable, Set<Module> stillEnabled) {
// Check for any autoloads in stillEnabled which are not used by anything else
// in stillEnabled. For each such, remove it from stillEnabled and add
// to willDisable. If any were found, return true.
boolean found = false;
Iterator<Module> it = stillEnabled.iterator();
FIND_AUTOLOADS:
while (it.hasNext()) {
Module m = it.next();
if (m.isAutoload()) {
for (Module other: stillEnabled) {
Dependency[] dependencies = other.getDependenciesArray();
for (int i = 0; i < dependencies.length; i++) {
Dependency dep = dependencies[i];
if (dep.getType() == Dependency.TYPE_MODULE) {
if (Util.parseCodeName(dep.getName())[0].equals(m.getCodeNameBase())) {
// Still used, skip it.
continue FIND_AUTOLOADS;
}
} else if (
dep.getType() == Dependency.TYPE_REQUIRES ||
dep.getType() == Dependency.TYPE_NEEDS ||
dep.getType() == Dependency.TYPE_RECOMMENDS
) {
// Here we play it safe and leave autoloads on if they provide
// something used by some module - even if technically it would
// be possible to turn off the autoload because there is another
// enabled module providing the same thing. Leave it on anyway.
if (m.provides(dep.getName())) {
continue FIND_AUTOLOADS;
}
}
// else some other type
}
}
// Nobody uses it!
found = true;
it.remove();
willDisable.add(m);
}
}
return found;
}
示例5: findBrokenDependencies
public static Set<Dependency> findBrokenDependencies (Set<Dependency> deps, Collection<ModuleInfo> modules) {
Set<Dependency> res = new HashSet<Dependency> ();
for (Dependency dep : deps) {
err.log(Level.FINE, "Dependency[" + dep.getType () + "]: " + dep);
switch (dep.getType ()) {
case (Dependency.TYPE_REQUIRES) :
case (Dependency.TYPE_NEEDS) :
if (findModuleMatchesDependencyRequires (dep, modules).isEmpty ()) {
// bad, report missing module
res.add (dep);
} else {
// ok
}
break;
case (Dependency.TYPE_RECOMMENDS) :
break;
case (Dependency.TYPE_MODULE) :
if (matchDependencyModule (dep, modules) != null) {
// ok
} else {
// bad, report missing module
res.add (dep);
}
break;
case (Dependency.TYPE_JAVA) :
if (! matchDependencyJava (dep)) {
err.log(Level.FINE, "The Java platform version " + dep +
" or higher was requested but only " + Dependency.JAVA_SPEC + " is running.");
res.add (dep);
}
break;
case (Dependency.TYPE_PACKAGE) :
if (! matchPackageDependency (dep)) {
err.log(Level.FINE, "The package " + dep +
" was requested but it is not in current ClassPath.");
res.add (dep);
}
break;
default:
//assert false : "Unknown type of Dependency, was " + dep.getType ();
err.log(Level.FINE, "Uncovered Dependency " + dep);
}
}
return res;
}